Pass ImplTraitContext as &, there's no need for that to be &mut
This commit is contained in:
parent
669f2d4550
commit
861055094c
6 changed files with 84 additions and 107 deletions
|
@ -66,7 +66,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
seg,
|
||||
ParamMode::Optional,
|
||||
ParenthesizedGenericArgs::Err,
|
||||
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
|
||||
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
|
||||
));
|
||||
let receiver = self.lower_expr(receiver);
|
||||
let args =
|
||||
|
@ -89,14 +89,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
}
|
||||
ExprKind::Cast(ref expr, ref ty) => {
|
||||
let expr = self.lower_expr(expr);
|
||||
let ty = self
|
||||
.lower_ty(ty, &mut ImplTraitContext::Disallowed(ImplTraitPosition::Type));
|
||||
let ty =
|
||||
self.lower_ty(ty, &ImplTraitContext::Disallowed(ImplTraitPosition::Type));
|
||||
hir::ExprKind::Cast(expr, ty)
|
||||
}
|
||||
ExprKind::Type(ref expr, ref ty) => {
|
||||
let expr = self.lower_expr(expr);
|
||||
let ty = self
|
||||
.lower_ty(ty, &mut ImplTraitContext::Disallowed(ImplTraitPosition::Type));
|
||||
let ty =
|
||||
self.lower_ty(ty, &ImplTraitContext::Disallowed(ImplTraitPosition::Type));
|
||||
hir::ExprKind::Type(expr, ty)
|
||||
}
|
||||
ExprKind::AddrOf(k, m, ref ohs) => {
|
||||
|
@ -225,7 +225,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
qself,
|
||||
path,
|
||||
ParamMode::Optional,
|
||||
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
|
||||
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
|
||||
);
|
||||
hir::ExprKind::Path(qpath)
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
&se.qself,
|
||||
&se.path,
|
||||
ParamMode::Optional,
|
||||
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
|
||||
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
|
||||
)),
|
||||
self.arena
|
||||
.alloc_from_iter(se.fields.iter().map(|x| self.lower_expr_field(x))),
|
||||
|
@ -556,14 +556,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
async_gen_kind: hir::AsyncGeneratorKind,
|
||||
body: impl FnOnce(&mut Self) -> hir::Expr<'hir>,
|
||||
) -> hir::ExprKind<'hir> {
|
||||
let output =
|
||||
match ret_ty {
|
||||
Some(ty) => hir::FnRetTy::Return(self.lower_ty(
|
||||
&ty,
|
||||
&mut ImplTraitContext::Disallowed(ImplTraitPosition::AsyncBlock),
|
||||
)),
|
||||
None => hir::FnRetTy::DefaultReturn(self.lower_span(span)),
|
||||
};
|
||||
let output = match ret_ty {
|
||||
Some(ty) => hir::FnRetTy::Return(
|
||||
self.lower_ty(&ty, &ImplTraitContext::Disallowed(ImplTraitPosition::AsyncBlock)),
|
||||
),
|
||||
None => hir::FnRetTy::DefaultReturn(self.lower_span(span)),
|
||||
};
|
||||
|
||||
// Resume argument type. We let the compiler infer this to simplify the lowering. It is
|
||||
// fully constrained by `future::from_generator`.
|
||||
|
@ -1131,7 +1129,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
qself,
|
||||
path,
|
||||
ParamMode::Optional,
|
||||
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
|
||||
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
|
||||
);
|
||||
// Destructure like a tuple struct.
|
||||
let tuple_struct_pat = hir::PatKind::TupleStruct(
|
||||
|
@ -1150,7 +1148,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
qself,
|
||||
path,
|
||||
ParamMode::Optional,
|
||||
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
|
||||
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
|
||||
);
|
||||
// Destructure like a unit struct.
|
||||
let unit_struct_pat = hir::PatKind::Path(qpath);
|
||||
|
@ -1174,7 +1172,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
&se.qself,
|
||||
&se.path,
|
||||
ParamMode::Optional,
|
||||
&mut ImplTraitContext::Disallowed(ImplTraitPosition::Path),
|
||||
&ImplTraitContext::Disallowed(ImplTraitPosition::Path),
|
||||
);
|
||||
let fields_omitted = match &se.rest {
|
||||
StructRest::Base(e) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue