Skip to content

Commit e37ff7e

Browse files
committed
Auto merge of #106256 - matthiaskrgr:rollup-g1ovcqq, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #106208 (Make trait/impl `where` clause mismatch on region error a bit more actionable) - #106216 (Powershell: Use `WaitForExit` instead of `-Wait`) - #106217 (rustdoc: remove unnecessary `.tooltip::after { text-align: center }`) - #106218 (Migrate css var scraped examples) - #106221 (Rename `Rptr` to `Ref` in AST and HIR) - #106223 (On unsized locals with explicit types suggest `&`) - #106225 (Remove CraftSpider from review rotation) - #106229 (update Miri) - #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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 6 additions & 6 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 4 deletions
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();

0 commit comments

Comments
 (0)