Skip to content

Commit e37ff7e

Browse files
committed
Auto merge of rust-lang#106256 - matthiaskrgr:rollup-g1ovcqq, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#106208 (Make trait/impl `where` clause mismatch on region error a bit more actionable) - rust-lang#106216 (Powershell: Use `WaitForExit` instead of `-Wait`) - rust-lang#106217 (rustdoc: remove unnecessary `.tooltip::after { text-align: center }`) - rust-lang#106218 (Migrate css var scraped examples) - rust-lang#106221 (Rename `Rptr` to `Ref` in AST and HIR) - rust-lang#106223 (On unsized locals with explicit types suggest `&`) - rust-lang#106225 (Remove CraftSpider from review rotation) - rust-lang#106229 (update Miri) - rust-lang#106242 (Detect diff markers in the parser) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 29d76cc + 031a214 commit e37ff7e

File tree

129 files changed

+1174
-412
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+1174
-412
lines changed

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -3295,9 +3295,9 @@ dependencies = [
32953295

32963296
[[package]]
32973297
name = "rustc-build-sysroot"
3298-
version = "0.4.0"
3298+
version = "0.4.1"
32993299
source = "registry+https://github.com/rust-lang/crates.io-index"
3300-
checksum = "20c4b4625eeb148cccf82d5e9b90ad7fab3b11a0204cf75cc7fa04981a0fdffd"
3300+
checksum = "d65b1271cdac365b71b59570ea35d945dea2dd2cc47eba3d33b4bd1e0190ac6d"
33013301
dependencies = [
33023302
"anyhow",
33033303
"rustc_version",

compiler/rustc_ast/src/ast.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ impl Pat {
572572
PatKind::MacCall(mac) => TyKind::MacCall(mac.clone()),
573573
// `&mut? P` can be reinterpreted as `&mut? T` where `T` is `P` reparsed as a type.
574574
PatKind::Ref(pat, mutbl) => {
575-
pat.to_ty().map(|ty| TyKind::Rptr(None, MutTy { ty, mutbl: *mutbl }))?
575+
pat.to_ty().map(|ty| TyKind::Ref(None, MutTy { ty, mutbl: *mutbl }))?
576576
}
577577
// A slice/array pattern `[P]` can be reparsed as `[T]`, an unsized array,
578578
// when `P` can be reparsed as a type `T`.
@@ -1193,7 +1193,7 @@ impl Expr {
11931193
ExprKind::Paren(expr) => expr.to_ty().map(TyKind::Paren)?,
11941194

11951195
ExprKind::AddrOf(BorrowKind::Ref, mutbl, expr) => {
1196-
expr.to_ty().map(|ty| TyKind::Rptr(None, MutTy { ty, mutbl: *mutbl }))?
1196+
expr.to_ty().map(|ty| TyKind::Ref(None, MutTy { ty, mutbl: *mutbl }))?
11971197
}
11981198

11991199
ExprKind::Repeat(expr, expr_len) => {
@@ -2031,7 +2031,7 @@ impl Clone for Ty {
20312031
impl Ty {
20322032
pub fn peel_refs(&self) -> &Self {
20332033
let mut final_ty = self;
2034-
while let TyKind::Rptr(_, MutTy { ty, .. }) = &final_ty.kind {
2034+
while let TyKind::Ref(_, MutTy { ty, .. }) = &final_ty.kind {
20352035
final_ty = ty;
20362036
}
20372037
final_ty
@@ -2058,7 +2058,7 @@ pub enum TyKind {
20582058
/// A raw pointer (`*const T` or `*mut T`).
20592059
Ptr(MutTy),
20602060
/// A reference (`&'a T` or `&'a mut T`).
2061-
Rptr(Option<Lifetime>, MutTy),
2061+
Ref(Option<Lifetime>, MutTy),
20622062
/// A bare function (e.g., `fn(usize) -> bool`).
20632063
BareFn(P<BareFnTy>),
20642064
/// The never type (`!`).
@@ -2286,7 +2286,7 @@ impl Param {
22862286
if ident.name == kw::SelfLower {
22872287
return match self.ty.kind {
22882288
TyKind::ImplicitSelf => Some(respan(self.pat.span, SelfKind::Value(mutbl))),
2289-
TyKind::Rptr(lt, MutTy { ref ty, mutbl }) if ty.kind.is_implicit_self() => {
2289+
TyKind::Ref(lt, MutTy { ref ty, mutbl }) if ty.kind.is_implicit_self() => {
22902290
Some(respan(self.pat.span, SelfKind::Region(lt, mutbl)))
22912291
}
22922292
_ => Some(respan(
@@ -2319,7 +2319,7 @@ impl Param {
23192319
Mutability::Not,
23202320
P(Ty {
23212321
id: DUMMY_NODE_ID,
2322-
kind: TyKind::Rptr(lt, MutTy { ty: infer_ty, mutbl }),
2322+
kind: TyKind::Ref(lt, MutTy { ty: infer_ty, mutbl }),
23232323
span,
23242324
tokens: None,
23252325
}),

compiler/rustc_ast/src/mut_visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ pub fn noop_visit_ty<T: MutVisitor>(ty: &mut P<Ty>, vis: &mut T) {
459459
TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err | TyKind::Never | TyKind::CVarArgs => {}
460460
TyKind::Slice(ty) => vis.visit_ty(ty),
461461
TyKind::Ptr(mt) => vis.visit_mt(mt),
462-
TyKind::Rptr(lt, mt) => {
462+
TyKind::Ref(lt, mt) => {
463463
visit_opt(lt, |lt| noop_visit_lifetime(lt, vis));
464464
vis.visit_mt(mt);
465465
}

compiler/rustc_ast/src/visit.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl<'a> FnKind<'a> {
9292
#[derive(Copy, Clone, Debug)]
9393
pub enum LifetimeCtxt {
9494
/// Appears in a reference type.
95-
Rptr,
95+
Ref,
9696
/// Appears as a bound on a type or another lifetime.
9797
Bound,
9898
/// Appears as a generic argument.
@@ -396,8 +396,8 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) {
396396
match &typ.kind {
397397
TyKind::Slice(ty) | TyKind::Paren(ty) => visitor.visit_ty(ty),
398398
TyKind::Ptr(mutable_type) => visitor.visit_ty(&mutable_type.ty),
399-
TyKind::Rptr(opt_lifetime, mutable_type) => {
400-
walk_list!(visitor, visit_lifetime, opt_lifetime, LifetimeCtxt::Rptr);
399+
TyKind::Ref(opt_lifetime, mutable_type) => {
400+
walk_list!(visitor, visit_lifetime, opt_lifetime, LifetimeCtxt::Ref);
401401
visitor.visit_ty(&mutable_type.ty)
402402
}
403403
TyKind::Tup(tuple_element_types) => {

compiler/rustc_ast_lowering/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12381238
TyKind::Err => hir::TyKind::Err,
12391239
TyKind::Slice(ty) => hir::TyKind::Slice(self.lower_ty(ty, itctx)),
12401240
TyKind::Ptr(mt) => hir::TyKind::Ptr(self.lower_mt(mt, itctx)),
1241-
TyKind::Rptr(region, mt) => {
1241+
TyKind::Ref(region, mt) => {
12421242
let region = region.unwrap_or_else(|| {
12431243
let id = if let Some(LifetimeRes::ElidedAnchor { start, end }) =
12441244
self.resolver.get_lifetime_res(t.id)
@@ -1252,7 +1252,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12521252
Lifetime { ident: Ident::new(kw::UnderscoreLifetime, span), id }
12531253
});
12541254
let lifetime = self.lower_lifetime(&region);
1255-
hir::TyKind::Rptr(lifetime, self.lower_mt(mt, itctx))
1255+
hir::TyKind::Ref(lifetime, self.lower_mt(mt, itctx))
12561256
}
12571257
TyKind::BareFn(f) => {
12581258
let generic_params = self.lower_lifetime_binder(t.id, &f.generic_params);
@@ -1771,7 +1771,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
17711771
// Given we are only considering `ImplicitSelf` types, we needn't consider
17721772
// the case where we have a mutable pattern to a reference as that would
17731773
// no longer be an `ImplicitSelf`.
1774-
TyKind::Rptr(_, mt) if mt.ty.kind.is_implicit_self() => match mt.mutbl {
1774+
TyKind::Ref(_, mt) if mt.ty.kind.is_implicit_self() => match mt.mutbl {
17751775
hir::Mutability::Not => hir::ImplicitSelfKind::ImmRef,
17761776
hir::Mutability::Mut => hir::ImplicitSelfKind::MutRef,
17771777
},

compiler/rustc_ast_lowering/src/lifetime_collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<'ast> Visitor<'ast> for LifetimeCollectVisitor<'ast> {
8383
visit::walk_ty(self, t);
8484
self.current_binders.pop();
8585
}
86-
TyKind::Rptr(None, _) => {
86+
TyKind::Ref(None, _) => {
8787
self.record_elided_anchor(t.id, t.span);
8888
visit::walk_ty(self, t);
8989
}

compiler/rustc_ast_pretty/src/pprust/state.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ impl<'a> State<'a> {
10251025
self.word("*");
10261026
self.print_mt(mt, true);
10271027
}
1028-
ast::TyKind::Rptr(lifetime, mt) => {
1028+
ast::TyKind::Ref(lifetime, mt) => {
10291029
self.word("&");
10301030
self.print_opt_lifetime(lifetime);
10311031
self.print_mt(mt, false);

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2681,7 +2681,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
26812681
// Need to use the `rustc_middle::ty` types to compare against the
26822682
// `return_region`. Then use the `rustc_hir` type to get only
26832683
// the lifetime span.
2684-
if let hir::TyKind::Rptr(lifetime, _) = &fn_decl.inputs[index].kind {
2684+
if let hir::TyKind::Ref(lifetime, _) = &fn_decl.inputs[index].kind {
26852685
// With access to the lifetime, we can get
26862686
// the span of it.
26872687
arguments.push((*argument, lifetime.ident.span));
@@ -2702,7 +2702,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
27022702
let return_ty = sig.output().skip_binder();
27032703
let mut return_span = fn_decl.output.span();
27042704
if let hir::FnRetTy::Return(ty) = &fn_decl.output {
2705-
if let hir::TyKind::Rptr(lifetime, _) = ty.kind {
2705+
if let hir::TyKind::Ref(lifetime, _) = ty.kind {
27062706
return_span = lifetime.ident.span;
27072707
}
27082708
}

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ fn get_mut_span_in_struct_field<'tcx>(
12091209
// Now we're dealing with the actual struct that we're going to suggest a change to,
12101210
// we can expect a field that is an immutable reference to a type.
12111211
&& let hir::Node::Field(field) = node
1212-
&& let hir::TyKind::Rptr(lt, hir::MutTy { mutbl: hir::Mutability::Not, ty }) = field.ty.kind
1212+
&& let hir::TyKind::Ref(lt, hir::MutTy { mutbl: hir::Mutability::Not, ty }) = field.ty.kind
12131213
{
12141214
return Some(lt.ident.span.between(ty.span));
12151215
}

compiler/rustc_borrowck/src/diagnostics/region_name.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
493493
//
494494
// &
495495
// - let's call the lifetime of this reference `'1`
496-
(
497-
ty::Ref(region, referent_ty, _),
498-
hir::TyKind::Rptr(_lifetime, referent_hir_ty),
499-
) => {
496+
(ty::Ref(region, referent_ty, _), hir::TyKind::Ref(_lifetime, referent_hir_ty)) => {
500497
if region.to_region_vid() == needle_fr {
501498
// Just grab the first character, the `&`.
502499
let source_map = self.infcx.tcx.sess.source_map();

compiler/rustc_builtin_macros/src/deriving/debug.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
117117
// `let names: &'static _ = &["field1", "field2"];`
118118
let names_let = if is_struct {
119119
let lt_static = Some(cx.lifetime_static(span));
120-
let ty_static_ref =
121-
cx.ty_rptr(span, cx.ty_infer(span), lt_static, ast::Mutability::Not);
120+
let ty_static_ref = cx.ty_ref(span, cx.ty_infer(span), lt_static, ast::Mutability::Not);
122121
Some(cx.stmt_let_ty(
123122
span,
124123
false,
@@ -138,13 +137,13 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
138137
);
139138
let ty_slice = cx.ty(
140139
span,
141-
ast::TyKind::Slice(cx.ty_rptr(span, ty_dyn_debug, None, ast::Mutability::Not)),
140+
ast::TyKind::Slice(cx.ty_ref(span, ty_dyn_debug, None, ast::Mutability::Not)),
142141
);
143142
let values_let = cx.stmt_let_ty(
144143
span,
145144
false,
146145
Ident::new(sym::values, span),
147-
Some(cx.ty_rptr(span, ty_slice, None, ast::Mutability::Not)),
146+
Some(cx.ty_ref(span, ty_slice, None, ast::Mutability::Not)),
148147
cx.expr_array_ref(span, value_exprs),
149148
);
150149

compiler/rustc_builtin_macros/src/deriving/generic/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl Ty {
9797
match self {
9898
Ref(ty, mutbl) => {
9999
let raw_ty = ty.to_ty(cx, span, self_ty, self_generics);
100-
cx.ty_rptr(span, raw_ty, None, *mutbl)
100+
cx.ty_ref(span, raw_ty, None, *mutbl)
101101
}
102102
Path(p) => p.to_ty(cx, span, self_ty, self_generics),
103103
Self_ => cx.ty_path(self.to_path(cx, span, self_ty, self_generics)),

compiler/rustc_builtin_macros/src/env.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn expand_option_env<'cx>(
3030
sp,
3131
true,
3232
cx.std_path(&[sym::option, sym::Option, sym::None]),
33-
vec![GenericArg::Type(cx.ty_rptr(
33+
vec![GenericArg::Type(cx.ty_ref(
3434
sp,
3535
cx.ty_ident(sp, Ident::new(sym::str, sp)),
3636
Some(lt),

compiler/rustc_builtin_macros/src/proc_macro_harness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
349349
.item_static(
350350
span,
351351
Ident::new(sym::_DECLS, span),
352-
cx.ty_rptr(
352+
cx.ty_ref(
353353
span,
354354
cx.ty(
355355
span,

compiler/rustc_expand/src/build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ impl<'a> ExtCtxt<'a> {
8787
self.anon_const(span, ast::ExprKind::Path(None, self.path_ident(span, ident)))
8888
}
8989

90-
pub fn ty_rptr(
90+
pub fn ty_ref(
9191
&self,
9292
span: Span,
9393
ty: P<ast::Ty>,
9494
lifetime: Option<ast::Lifetime>,
9595
mutbl: ast::Mutability,
9696
) -> P<ast::Ty> {
97-
self.ty(span, ast::TyKind::Rptr(lifetime, self.ty_mt(ty, mutbl)))
97+
self.ty(span, ast::TyKind::Ref(lifetime, self.ty_mt(ty, mutbl)))
9898
}
9999

100100
pub fn ty_ptr(&self, span: Span, ty: P<ast::Ty>, mutbl: ast::Mutability) -> P<ast::Ty> {

compiler/rustc_hir/src/hir.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2431,7 +2431,7 @@ impl<'hir> Ty<'hir> {
24312431

24322432
pub fn peel_refs(&self) -> &Self {
24332433
let mut final_ty = self;
2434-
while let TyKind::Rptr(_, MutTy { ty, .. }) = &final_ty.kind {
2434+
while let TyKind::Ref(_, MutTy { ty, .. }) = &final_ty.kind {
24352435
final_ty = ty;
24362436
}
24372437
final_ty
@@ -2588,7 +2588,7 @@ pub enum TyKind<'hir> {
25882588
/// A raw pointer (i.e., `*const T` or `*mut T`).
25892589
Ptr(MutTy<'hir>),
25902590
/// A reference (i.e., `&'a T` or `&'a mut T`).
2591-
Rptr(&'hir Lifetime, MutTy<'hir>),
2591+
Ref(&'hir Lifetime, MutTy<'hir>),
25922592
/// A bare function (e.g., `fn(usize) -> bool`).
25932593
BareFn(&'hir BareFnTy<'hir>),
25942594
/// The never type (`!`).

compiler/rustc_hir/src/intravisit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) {
809809
match typ.kind {
810810
TyKind::Slice(ref ty) => visitor.visit_ty(ty),
811811
TyKind::Ptr(ref mutable_type) => visitor.visit_ty(mutable_type.ty),
812-
TyKind::Rptr(ref lifetime, ref mutable_type) => {
812+
TyKind::Ref(ref lifetime, ref mutable_type) => {
813813
visitor.visit_lifetime(lifetime);
814814
visitor.visit_ty(mutable_type.ty)
815815
}

compiler/rustc_hir_analysis/src/astconv/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2657,7 +2657,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
26572657
hir::TyKind::Ptr(ref mt) => {
26582658
tcx.mk_ptr(ty::TypeAndMut { ty: self.ast_ty_to_ty(mt.ty), mutbl: mt.mutbl })
26592659
}
2660-
hir::TyKind::Rptr(ref region, ref mt) => {
2660+
hir::TyKind::Ref(ref region, ref mt) => {
26612661
let r = self.ast_region_to_region(region, None);
26622662
debug!(?r);
26632663
let t = self.ast_ty_to_ty_inner(mt.ty, true, false);

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ fn check_trait_item(tcx: TyCtxt<'_>, trait_item: &hir::TraitItem<'_>) {
291291
// Do some rudimentary sanity checking to avoid an ICE later (issue #83471).
292292
if let Some(hir::FnSig { decl, span, .. }) = method_sig {
293293
if let [self_ty, _] = decl.inputs {
294-
if !matches!(self_ty.kind, hir::TyKind::Rptr(_, _)) {
294+
if !matches!(self_ty.kind, hir::TyKind::Ref(_, _)) {
295295
tcx.sess
296296
.struct_span_err(
297297
self_ty.span,

compiler/rustc_hir_analysis/src/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ fn is_suggestable_infer_ty(ty: &hir::Ty<'_>) -> bool {
10631063
is_suggestable_infer_ty(ty) || matches!(length, hir::ArrayLen::Infer(_, _))
10641064
}
10651065
Tup(tys) => tys.iter().any(is_suggestable_infer_ty),
1066-
Ptr(mut_ty) | Rptr(_, mut_ty) => is_suggestable_infer_ty(mut_ty.ty),
1066+
Ptr(mut_ty) | Ref(_, mut_ty) => is_suggestable_infer_ty(mut_ty.ty),
10671067
OpaqueDef(_, generic_args, _) => are_suggestable_generic_args(generic_args),
10681068
Path(hir::QPath::TypeRelative(ty, segment)) => {
10691069
is_suggestable_infer_ty(ty) || are_suggestable_generic_args(segment.args().args)

compiler/rustc_hir_analysis/src/collect/lifetimes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
617617
LifetimeName::Error => {}
618618
}
619619
}
620-
hir::TyKind::Rptr(ref lifetime_ref, ref mt) => {
620+
hir::TyKind::Ref(ref lifetime_ref, ref mt) => {
621621
self.visit_lifetime(lifetime_ref);
622622
let scope = Scope::ObjectLifetimeDefault {
623623
lifetime: self.map.defs.get(&lifetime_ref.hir_id).cloned(),

compiler/rustc_hir_pretty/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ impl<'a> State<'a> {
307307
self.word("*");
308308
self.print_mt(mt, true);
309309
}
310-
hir::TyKind::Rptr(ref lifetime, ref mt) => {
310+
hir::TyKind::Ref(ref lifetime, ref mt) => {
311311
self.word("&");
312312
self.print_opt_lifetime(lifetime);
313313
self.print_mt(mt, false);

compiler/rustc_hir_typeck/src/pat.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
19211921
) -> Ty<'tcx> {
19221922
let tcx = self.tcx;
19231923
let expected = self.shallow_resolve(expected);
1924-
let (rptr_ty, inner_ty) = if self.check_dereferenceable(pat.span, expected, inner) {
1924+
let (ref_ty, inner_ty) = if self.check_dereferenceable(pat.span, expected, inner) {
19251925
// `demand::subtype` would be good enough, but using `eqtype` turns
19261926
// out to be equally general. See (note_1) for details.
19271927

@@ -1936,25 +1936,25 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
19361936
kind: TypeVariableOriginKind::TypeInference,
19371937
span: inner.span,
19381938
});
1939-
let rptr_ty = self.new_ref_ty(pat.span, mutbl, inner_ty);
1940-
debug!("check_pat_ref: demanding {:?} = {:?}", expected, rptr_ty);
1941-
let err = self.demand_eqtype_pat_diag(pat.span, expected, rptr_ty, ti);
1939+
let ref_ty = self.new_ref_ty(pat.span, mutbl, inner_ty);
1940+
debug!("check_pat_ref: demanding {:?} = {:?}", expected, ref_ty);
1941+
let err = self.demand_eqtype_pat_diag(pat.span, expected, ref_ty, ti);
19421942

19431943
// Look for a case like `fn foo(&foo: u32)` and suggest
19441944
// `fn foo(foo: &u32)`
19451945
if let Some(mut err) = err {
19461946
self.borrow_pat_suggestion(&mut err, pat);
19471947
err.emit();
19481948
}
1949-
(rptr_ty, inner_ty)
1949+
(ref_ty, inner_ty)
19501950
}
19511951
}
19521952
} else {
19531953
let err = tcx.ty_error();
19541954
(err, err)
19551955
};
19561956
self.check_pat(inner, inner_ty, def_bm, ti);
1957-
rptr_ty
1957+
ref_ty
19581958
}
19591959

19601960
/// Create a reference type with a fresh region variable.

compiler/rustc_infer/src/errors/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ impl AddToDiagnostic for AddLifetimeParamsSuggestion<'_> {
369369
{
370370
let mut mk_suggestion = || {
371371
let (
372-
hir::Ty { kind: hir::TyKind::Rptr(lifetime_sub, _), .. },
373-
hir::Ty { kind: hir::TyKind::Rptr(lifetime_sup, _), .. },
372+
hir::Ty { kind: hir::TyKind::Ref(lifetime_sub, _), .. },
373+
hir::Ty { kind: hir::TyKind::Ref(lifetime_sup, _), .. },
374374
) = (self.ty_sub, self.ty_sup) else {
375375
return false;
376376
};

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
9696
}
9797
}
9898

99-
hir::TyKind::Rptr(ref lifetime, _) => {
100-
// the lifetime of the TyRptr
99+
hir::TyKind::Ref(ref lifetime, _) => {
100+
// the lifetime of the Ref
101101
let hir_id = lifetime.hir_id;
102102
match (self.tcx.named_region(hir_id), self.bound_region) {
103103
// Find the index of the named region that was part of the

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<'tcx> Visitor<'tcx> for TypeParamSpanVisitor<'tcx> {
147147

148148
fn visit_ty(&mut self, arg: &'tcx hir::Ty<'tcx>) {
149149
match arg.kind {
150-
hir::TyKind::Rptr(_, ref mut_ty) => {
150+
hir::TyKind::Ref(_, ref mut_ty) => {
151151
// We don't want to suggest looking into borrowing `&T` or `&Self`.
152152
hir::intravisit::walk_ty(self, mut_ty.ty);
153153
return;

0 commit comments

Comments
 (0)