Is there a way to go from a
BuiltinType to an
hir::Type in the IDE crates? I can't seem to find any
I wonder if there should be a way? Maybe whiever thing gave you BuiltinType should have handed
Type in the first place?
Seems easier if ther's only one type
So it'd be
hm no... it might make sense to have a
hmm, how does
Type currently represent builtin types? they have no defining crate, but
Type requires one
Yeah, I feel it should be
the krate doesn't need to be the defining one I think, rather the one where the type currently 'lives'
something can be either
i32 is structy) or a dedicated BuildInType with a
I'm pretty sure the current
Type isn't the ideal abstraction, but I'm not sure how to do it better :grimacing:
"where the type currently 'lives'"? so the crate from which the type is used?
assuming this is about the completion issue, it should be the crate and trait environment from the place where we're completing
i.e. you'd use
Type::new_with_resolver to create it with the resolver from there
the other code paths seem to use the defining crate
the other code paths are "give me the type in the environment of its definition"
hmm, only for obtaining the initial
and then the current crate is passed later
it probably doesn't really matter much what you use in this case
although, we do need the crate to find impls, so it does matter somewhat
not terribly happy with this but it seems to work https://github.com/rust-analyzer/rust-analyzer/pull/7644