Skip to content

Commit 2fbd0ec

Browse files
Ty::new_ref and Ty::new_ptr stop using TypeAndMut
1 parent 5ac67dd commit 2fbd0ec

File tree

23 files changed

+68
-125
lines changed

23 files changed

+68
-125
lines changed

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -572,20 +572,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
572572

573573
mir::Rvalue::Ref(_, bk, place) => {
574574
let mk_ref = move |tcx: TyCtxt<'tcx>, ty: Ty<'tcx>| {
575-
Ty::new_ref(
576-
tcx,
577-
tcx.lifetimes.re_erased,
578-
ty::TypeAndMut { ty, mutbl: bk.to_mutbl_lossy() },
579-
)
575+
Ty::new_ref(tcx, tcx.lifetimes.re_erased, ty, bk.to_mutbl_lossy())
580576
};
581577
self.codegen_place_to_pointer(bx, place, mk_ref)
582578
}
583579

584580
mir::Rvalue::CopyForDeref(place) => self.codegen_operand(bx, &Operand::Copy(place)),
585581
mir::Rvalue::AddressOf(mutability, place) => {
586-
let mk_ptr = move |tcx: TyCtxt<'tcx>, ty: Ty<'tcx>| {
587-
Ty::new_ptr(tcx, ty::TypeAndMut { ty, mutbl: mutability })
588-
};
582+
let mk_ptr =
583+
move |tcx: TyCtxt<'tcx>, ty: Ty<'tcx>| Ty::new_ptr(tcx, ty, mutability);
589584
self.codegen_place_to_pointer(bx, place, mk_ptr)
590585
}
591586

compiler/rustc_hir_analysis/src/astconv/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,14 +2239,12 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
22392239
self.ty_from_delegation(*sig_id, *idx, ast_ty.span)
22402240
}
22412241
hir::TyKind::Slice(ty) => Ty::new_slice(tcx, self.ast_ty_to_ty(ty)),
2242-
hir::TyKind::Ptr(mt) => {
2243-
Ty::new_ptr(tcx, ty::TypeAndMut { ty: self.ast_ty_to_ty(mt.ty), mutbl: mt.mutbl })
2244-
}
2242+
hir::TyKind::Ptr(mt) => Ty::new_ptr(tcx, self.ast_ty_to_ty(mt.ty), mt.mutbl),
22452243
hir::TyKind::Ref(region, mt) => {
22462244
let r = self.ast_region_to_region(region, None);
22472245
debug!(?r);
22482246
let t = self.ast_ty_to_ty_inner(mt.ty, true, false);
2249-
Ty::new_ref(tcx, r, ty::TypeAndMut { ty: t, mutbl: mt.mutbl })
2247+
Ty::new_ref(tcx, r, t, mt.mutbl)
22502248
}
22512249
hir::TyKind::Never => tcx.types.never,
22522250
hir::TyKind::Tup(fields) => {

compiler/rustc_hir_analysis/src/check/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ pub fn check_intrinsic_type(
191191
ty::BoundRegion { var: ty::BoundVar::from_u32(2), kind: ty::BrEnv },
192192
);
193193
let va_list_ty = tcx.type_of(did).instantiate(tcx, &[region.into()]);
194-
(Ty::new_ref(tcx, env_region, ty::TypeAndMut { ty: va_list_ty, mutbl }), va_list_ty)
194+
(Ty::new_ref(tcx, env_region, va_list_ty, mutbl), va_list_ty)
195195
})
196196
};
197197

compiler/rustc_hir_typeck/src/cast.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
334334
if let ty::Ref(reg, cast_ty, mutbl) = *self.cast_ty.kind() {
335335
if let ty::RawPtr(TypeAndMut { ty: expr_ty, .. }) = *self.expr_ty.kind()
336336
&& fcx.can_coerce(
337-
Ty::new_ref(
338-
fcx.tcx,
339-
fcx.tcx.lifetimes.re_erased,
340-
TypeAndMut { ty: expr_ty, mutbl },
341-
),
337+
Ty::new_ref(fcx.tcx, fcx.tcx.lifetimes.re_erased, expr_ty, mutbl),
342338
self.cast_ty,
343339
)
344340
{
@@ -354,19 +350,15 @@ impl<'a, 'tcx> CastCheck<'tcx> {
354350
if !sugg_mutref
355351
&& sugg == None
356352
&& fcx.can_coerce(
357-
Ty::new_ref(fcx.tcx, reg, TypeAndMut { ty: self.expr_ty, mutbl }),
353+
Ty::new_ref(fcx.tcx, reg, self.expr_ty, mutbl),
358354
self.cast_ty,
359355
)
360356
{
361357
sugg = Some((format!("&{}", mutbl.prefix_str()), false));
362358
}
363359
} else if let ty::RawPtr(TypeAndMut { mutbl, .. }) = *self.cast_ty.kind()
364360
&& fcx.can_coerce(
365-
Ty::new_ref(
366-
fcx.tcx,
367-
fcx.tcx.lifetimes.re_erased,
368-
TypeAndMut { ty: self.expr_ty, mutbl },
369-
),
361+
Ty::new_ref(fcx.tcx, fcx.tcx.lifetimes.re_erased, self.expr_ty, mutbl),
370362
self.cast_ty,
371363
)
372364
{
@@ -861,7 +853,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
861853
// from a region pointer to a vector.
862854

863855
// Coerce to a raw pointer so that we generate AddressOf in MIR.
864-
let array_ptr_type = Ty::new_ptr(fcx.tcx, m_expr);
856+
let array_ptr_type = Ty::new_ptr(fcx.tcx, m_expr.ty, m_expr.mutbl);
865857
fcx.coerce(self.expr, self.expr_ty, array_ptr_type, AllowTwoPhase::No, None)
866858
.unwrap_or_else(|_| {
867859
bug!(

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use rustc_middle::ty::adjustment::{
5555
use rustc_middle::ty::error::TypeError;
5656
use rustc_middle::ty::relate::RelateResult;
5757
use rustc_middle::ty::visit::TypeVisitableExt;
58-
use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt, TypeAndMut};
58+
use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt};
5959
use rustc_session::parse::feature_err;
6060
use rustc_span::symbol::sym;
6161
use rustc_span::DesugaringKind;
@@ -440,10 +440,8 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
440440
let derefd_ty_a = Ty::new_ref(
441441
self.tcx,
442442
r,
443-
TypeAndMut {
444-
ty: referent_ty,
445-
mutbl: mutbl_b, // [1] above
446-
},
443+
referent_ty,
444+
mutbl_b, // [1] above
447445
);
448446
match self.unify(derefd_ty_a, b) {
449447
Ok(ok) => {
@@ -558,11 +556,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
558556
Adjustment { kind: Adjust::Deref(None), target: ty_a },
559557
Adjustment {
560558
kind: Adjust::Borrow(AutoBorrow::Ref(r_borrow, mutbl)),
561-
target: Ty::new_ref(
562-
self.tcx,
563-
r_borrow,
564-
ty::TypeAndMut { mutbl: mutbl_b, ty: ty_a },
565-
),
559+
target: Ty::new_ref(self.tcx, r_borrow, ty_a, mutbl_b),
566560
},
567561
))
568562
}
@@ -573,7 +567,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
573567
Adjustment { kind: Adjust::Deref(None), target: ty_a },
574568
Adjustment {
575569
kind: Adjust::Borrow(AutoBorrow::RawPtr(mt_b)),
576-
target: Ty::new_ptr(self.tcx, ty::TypeAndMut { mutbl: mt_b, ty: ty_a }),
570+
target: Ty::new_ptr(self.tcx, ty_a, mt_b),
577571
},
578572
))
579573
}
@@ -990,7 +984,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
990984
coerce_mutbls(mt_a.mutbl, mutbl_b)?;
991985

992986
// Check that the types which they point at are compatible.
993-
let a_unsafe = Ty::new_ptr(self.tcx, ty::TypeAndMut { mutbl: mutbl_b, ty: mt_a.ty });
987+
let a_unsafe = Ty::new_ptr(self.tcx, mt_a.ty, mutbl_b);
994988
// Although references and unsafe ptrs have the same
995989
// representation, we still register an Adjust::DerefRef so that
996990
// regionck knows that the region for `a` must be valid here.

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
442442
let ty =
443443
self.check_expr_with_expectation_and_needs(oprnd, hint, Needs::maybe_mut_place(mutbl));
444444

445-
let tm = ty::TypeAndMut { ty, mutbl };
446445
match kind {
447-
_ if tm.ty.references_error() => Ty::new_misc_error(self.tcx),
446+
_ if ty.references_error() => Ty::new_misc_error(self.tcx),
448447
hir::BorrowKind::Raw => {
449448
self.check_named_place_expr(oprnd);
450-
Ty::new_ptr(self.tcx, tm)
449+
Ty::new_ptr(self.tcx, ty, mutbl)
451450
}
452451
hir::BorrowKind::Ref => {
453452
// Note: at this point, we cannot say what the best lifetime
@@ -465,7 +464,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
465464
// whose address was taken can actually be made to live as long
466465
// as it needs to live.
467466
let region = self.next_region_var(infer::AddrOfRegion(expr.span));
468-
Ty::new_ref(self.tcx, region, tm)
467+
Ty::new_ref(self.tcx, region, ty, mutbl)
469468
}
470469
}
471470
}
@@ -3225,7 +3224,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
32253224
self.demand_coerce(expr, ty, fnptr_ty, None, AllowTwoPhase::No);
32263225
}
32273226
ty::Ref(_, base_ty, mutbl) => {
3228-
let ptr_ty = Ty::new_ptr(self.tcx, ty::TypeAndMut { ty: base_ty, mutbl });
3227+
let ptr_ty = Ty::new_ptr(self.tcx, base_ty, mutbl);
32293228
self.demand_coerce(expr, ty, ptr_ty, None, AllowTwoPhase::No);
32303229
}
32313230
_ => {}

compiler/rustc_hir_typeck/src/mem_categorization.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
268268
adjustment::Adjust::Deref(overloaded) => {
269269
// Equivalent to *expr or something similar.
270270
let base = if let Some(deref) = overloaded {
271-
let ref_ty = Ty::new_ref(
272-
self.tcx(),
273-
deref.region,
274-
ty::TypeAndMut { ty: target, mutbl: deref.mutbl },
275-
);
271+
let ref_ty = Ty::new_ref(self.tcx(), deref.region, target, deref.mutbl);
276272
self.cat_rvalue(expr.hir_id, ref_ty)
277273
} else {
278274
previous()?
@@ -479,7 +475,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
479475
let ty::Ref(region, _, mutbl) = *base_ty.kind() else {
480476
span_bug!(expr.span, "cat_overloaded_place: base is not a reference");
481477
};
482-
let ref_ty = Ty::new_ref(self.tcx(), region, ty::TypeAndMut { ty: place_ty, mutbl });
478+
let ref_ty = Ty::new_ref(self.tcx(), region, place_ty, mutbl);
483479

484480
let base = self.cat_rvalue(expr.hir_id, ref_ty);
485481
self.cat_deref(expr, base)

compiler/rustc_hir_typeck/src/method/confirm.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
188188
// Type we're wrapping in a reference, used later for unsizing
189189
let base_ty = target;
190190

191-
target = Ty::new_ref(self.tcx, region, ty::TypeAndMut { mutbl, ty: target });
191+
target = Ty::new_ref(self.tcx, region, target, mutbl);
192192

193193
// Method call receivers are the primary use case
194194
// for two-phase borrows.
@@ -208,11 +208,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
208208
base_ty
209209
)
210210
};
211-
target = Ty::new_ref(
212-
self.tcx,
213-
region,
214-
ty::TypeAndMut { mutbl: mutbl.into(), ty: unsized_ty },
215-
);
211+
target = Ty::new_ref(self.tcx, region, unsized_ty, mutbl.into());
216212
adjustments.push(Adjustment {
217213
kind: Adjust::Pointer(PointerCoercion::Unsize),
218214
target,

compiler/rustc_hir_typeck/src/method/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
200200
if let Some(span) = result.illegal_sized_bound {
201201
let mut needs_mut = false;
202202
if let ty::Ref(region, t_type, mutability) = self_ty.kind() {
203-
let trait_type = Ty::new_ref(
204-
self.tcx,
205-
*region,
206-
ty::TypeAndMut { ty: *t_type, mutbl: mutability.invert() },
207-
);
203+
let trait_type = Ty::new_ref(self.tcx, *region, *t_type, mutability.invert());
208204
// We probe again to see if there might be a borrow mutability discrepancy.
209205
match self.lookup_probe(
210206
segment.ident,

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
12131213
// In general, during probing we erase regions.
12141214
let region = tcx.lifetimes.re_erased;
12151215

1216-
let autoref_ty = Ty::new_ref(tcx, region, ty::TypeAndMut { ty: self_ty, mutbl });
1216+
let autoref_ty = Ty::new_ref(tcx, region, self_ty, mutbl);
12171217
self.pick_method(autoref_ty, unstable_candidates).map(|r| {
12181218
r.map(|mut pick| {
12191219
pick.autoderefs = step.autoderefs;

compiler/rustc_hir_typeck/src/method/suggest.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
304304
}
305305
if let ty::Ref(region, t_type, mutability) = rcvr_ty.kind() {
306306
if needs_mut {
307-
let trait_type = Ty::new_ref(
308-
self.tcx,
309-
*region,
310-
ty::TypeAndMut { ty: *t_type, mutbl: mutability.invert() },
311-
);
307+
let trait_type =
308+
Ty::new_ref(self.tcx, *region, *t_type, mutability.invert());
312309
let msg = format!("you need `{trait_type}` instead of `{rcvr_ty}`");
313310
let mut kind = &self_expr.kind;
314311
while let hir::ExprKind::AddrOf(_, _, expr)

compiler/rustc_hir_typeck/src/op.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
508508
suggest_deref_binop(&mut err, *lhs_deref_ty);
509509
} else {
510510
let lhs_inv_mutbl = mutbl.invert();
511-
let lhs_inv_mutbl_ty = Ty::new_ref(
512-
self.tcx,
513-
*region,
514-
ty::TypeAndMut { ty: *lhs_deref_ty, mutbl: lhs_inv_mutbl },
515-
);
511+
let lhs_inv_mutbl_ty =
512+
Ty::new_ref(self.tcx, *region, *lhs_deref_ty, lhs_inv_mutbl);
516513

517514
suggest_different_borrow(
518515
&mut err,
@@ -524,11 +521,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
524521

525522
if let Ref(region, rhs_deref_ty, mutbl) = rhs_ty.kind() {
526523
let rhs_inv_mutbl = mutbl.invert();
527-
let rhs_inv_mutbl_ty = Ty::new_ref(
528-
self.tcx,
529-
*region,
530-
ty::TypeAndMut { ty: *rhs_deref_ty, mutbl: rhs_inv_mutbl },
531-
);
524+
let rhs_inv_mutbl_ty =
525+
Ty::new_ref(self.tcx, *region, *rhs_deref_ty, rhs_inv_mutbl);
532526

533527
suggest_different_borrow(
534528
&mut err,

compiler/rustc_hir_typeck/src/pat.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,8 +2057,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
20572057
/// Create a reference type with a fresh region variable.
20582058
fn new_ref_ty(&self, span: Span, mutbl: hir::Mutability, ty: Ty<'tcx>) -> Ty<'tcx> {
20592059
let region = self.next_region_var(infer::PatternRegion(span));
2060-
let mt = ty::TypeAndMut { ty, mutbl };
2061-
Ty::new_ref(self.tcx, region, mt)
2060+
Ty::new_ref(self.tcx, region, ty, mutbl)
20622061
}
20632062

20642063
fn try_resolve_slice_ty_to_array_ty(

compiler/rustc_hir_typeck/src/place_op.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
162162
if let ty::Ref(region, _, hir::Mutability::Not) = method.sig.inputs()[0].kind() {
163163
adjustments.push(Adjustment {
164164
kind: Adjust::Borrow(AutoBorrow::Ref(*region, AutoBorrowMutability::Not)),
165-
target: Ty::new_ref(
166-
self.tcx,
167-
*region,
168-
ty::TypeAndMut { mutbl: hir::Mutability::Not, ty: adjusted_ty },
169-
),
165+
target: Ty::new_imm_ref(self.tcx, *region, adjusted_ty),
170166
});
171167
} else {
172168
span_bug!(expr.span, "input to index is not a ref?");
@@ -400,11 +396,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
400396
allow_two_phase_borrow: AllowTwoPhase::No,
401397
};
402398
adjustment.kind = Adjust::Borrow(AutoBorrow::Ref(*region, mutbl));
403-
adjustment.target = Ty::new_ref(
404-
self.tcx,
405-
*region,
406-
ty::TypeAndMut { ty: source, mutbl: mutbl.into() },
407-
);
399+
adjustment.target = Ty::new_ref(self.tcx, *region, source, mutbl.into());
408400
}
409401
source = adjustment.target;
410402
}

compiler/rustc_hir_typeck/src/upvar.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,11 +1780,9 @@ fn apply_capture_kind_on_capture_ty<'tcx>(
17801780
) -> Ty<'tcx> {
17811781
match capture_kind {
17821782
ty::UpvarCapture::ByValue => ty,
1783-
ty::UpvarCapture::ByRef(kind) => Ty::new_ref(
1784-
tcx,
1785-
region.unwrap(),
1786-
ty::TypeAndMut { ty: ty, mutbl: kind.to_mutbl_lossy() },
1787-
),
1783+
ty::UpvarCapture::ByRef(kind) => {
1784+
Ty::new_ref(tcx, region.unwrap(), ty, kind.to_mutbl_lossy())
1785+
}
17881786
}
17891787
}
17901788

compiler/rustc_lint/src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,10 +1046,10 @@ fn get_nullable_type<'tcx>(
10461046
}
10471047
ty::Int(ty) => Ty::new_int(tcx, ty),
10481048
ty::Uint(ty) => Ty::new_uint(tcx, ty),
1049-
ty::RawPtr(ty_mut) => Ty::new_ptr(tcx, ty_mut),
1049+
ty::RawPtr(ty_mut) => Ty::new_ptr(tcx, ty_mut.ty, ty_mut.mutbl),
10501050
// As these types are always non-null, the nullable equivalent of
10511051
// `Option<T>` of these types are their raw pointer counterparts.
1052-
ty::Ref(_region, ty, mutbl) => Ty::new_ptr(tcx, ty::TypeAndMut { ty, mutbl }),
1052+
ty::Ref(_region, ty, mutbl) => Ty::new_ptr(tcx, ty, mutbl),
10531053
// There is no nullable equivalent for Rust's function pointers,
10541054
// you must use an `Option<fn(..) -> _>` to represent it.
10551055
ty::FnPtr(..) => ty,

compiler/rustc_middle/src/mir/tcx.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,11 @@ impl<'tcx> Rvalue<'tcx> {
170170
Rvalue::ThreadLocalRef(did) => tcx.thread_local_ptr_ty(did),
171171
Rvalue::Ref(reg, bk, ref place) => {
172172
let place_ty = place.ty(local_decls, tcx).ty;
173-
Ty::new_ref(tcx, reg, ty::TypeAndMut { ty: place_ty, mutbl: bk.to_mutbl_lossy() })
173+
Ty::new_ref(tcx, reg, place_ty, bk.to_mutbl_lossy())
174174
}
175175
Rvalue::AddressOf(mutability, ref place) => {
176176
let place_ty = place.ty(local_decls, tcx).ty;
177-
Ty::new_ptr(tcx, ty::TypeAndMut { ty: place_ty, mutbl: mutability })
177+
Ty::new_ptr(tcx, place_ty, mutability)
178178
}
179179
Rvalue::Len(..) => tcx.types.usize,
180180
Rvalue::Cast(.., ty) => ty,

compiler/rustc_middle/src/ty/relate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ pub fn structurally_relate_tys<'tcx, R: TypeRelation<'tcx>>(
460460

461461
let ty = relation.relate_with_variance(variance, info, a_ty, b_ty)?;
462462

463-
Ok(Ty::new_ptr(tcx, ty::TypeAndMut { mutbl: a_mutbl, ty }))
463+
Ok(Ty::new_ptr(tcx, ty, a_mutbl))
464464
}
465465

466466
(&ty::Ref(a_r, a_ty, a_mutbl), &ty::Ref(b_r, b_ty, b_mutbl)) => {
@@ -478,7 +478,7 @@ pub fn structurally_relate_tys<'tcx, R: TypeRelation<'tcx>>(
478478
let r = relation.relate(a_r, b_r)?;
479479
let ty = relation.relate_with_variance(variance, info, a_ty, b_ty)?;
480480

481-
Ok(Ty::new_ref(tcx, r, ty::TypeAndMut { mutbl: a_mutbl, ty }))
481+
Ok(Ty::new_ref(tcx, r, ty, a_mutbl))
482482
}
483483

484484
(&ty::Array(a_t, sz_a), &ty::Array(b_t, sz_b)) => {

0 commit comments

Comments
 (0)