mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Handle box with allocator
In 1.49.0, the definition of Box was modified to support an optional
Allocator[1]. Adapt the parsing of the `box` keyword to supply the
expected number of parameters to the constructor.
[1] f288cd2e17
This commit is contained in:
parent
fde4a860ae
commit
be0691b02b
2 changed files with 28 additions and 1 deletions
|
@ -491,7 +491,10 @@ impl<'a> InferenceContext<'a> {
|
|||
Expr::Box { expr } => {
|
||||
let inner_ty = self.infer_expr_inner(*expr, &Expectation::none());
|
||||
if let Some(box_) = self.resolve_boxed_box() {
|
||||
Ty::apply_one(TypeCtor::Adt(box_), inner_ty)
|
||||
let mut sb = Substs::build_for_type_ctor(self.db, TypeCtor::Adt(box_));
|
||||
sb = sb.push(inner_ty);
|
||||
sb = sb.fill(repeat_with(|| self.table.new_type_var()));
|
||||
Ty::apply(TypeCtor::Adt(box_), sb.build())
|
||||
} else {
|
||||
Ty::Unknown
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue