mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
hir_ty: use default type generic for box expressions
This commit is contained in:
parent
23d7dbfa5e
commit
2cdd1ff1b5
2 changed files with 61 additions and 0 deletions
|
@ -488,6 +488,12 @@ impl<'a> InferenceContext<'a> {
|
|||
if let Some(box_) = self.resolve_boxed_box() {
|
||||
let mut sb = Substs::builder(generics(self.db.upcast(), box_.into()).len());
|
||||
sb = sb.push(inner_ty);
|
||||
match self.db.generic_defaults(box_.into()).as_ref() {
|
||||
[_, alloc_ty, ..] if !alloc_ty.value.is_unknown() => {
|
||||
sb = sb.push(alloc_ty.value.clone());
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
sb = sb.fill(repeat_with(|| self.table.new_type_var()));
|
||||
Ty::Adt(box_, sb.build())
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue