Skip to content

Commit b758149

Browse files
committed
Auto merge of #124055 - matthiaskrgr:rollup-waq2e68, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #122813 (Qualifier tweaking) - #122883 (refactor clippy in bootstrap) - #123997 (Delay span bug when `Self` kw resolves to `DefKind::{Mod,Trait}`) - #124045 (Reinstate nnethercote to the review rotation.) - #124051 (Fix empty-set symbol in comments) - #124052 (Make the comments for `ReturnDest` variants doc comments) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 803e33a + 854303b commit b758149

File tree

76 files changed

+810
-509
lines changed

Some content is hidden

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

76 files changed

+810
-509
lines changed

compiler/rustc_ast/src/token.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub enum Delimiter {
5151
Brace,
5252
/// `[ ... ]`
5353
Bracket,
54-
/// `Ø ... Ø`
54+
/// ` ... `
5555
/// An invisible delimiter, that may, for example, appear around tokens coming from a
5656
/// "macro variable" `$var`. It is important to preserve operator priorities in cases like
5757
/// `$var * 3` where `$var` is `1 + 2`.

compiler/rustc_ast_lowering/src/expr.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use rustc_ast::*;
1414
use rustc_data_structures::stack::ensure_sufficient_stack;
1515
use rustc_hir as hir;
1616
use rustc_hir::def::{DefKind, Res};
17+
use rustc_hir::HirId;
1718
use rustc_middle::span_bug;
1819
use rustc_session::errors::report_lit_error;
1920
use rustc_span::source_map::{respan, Spanned};
@@ -701,8 +702,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
701702
pub(super) fn maybe_forward_track_caller(
702703
&mut self,
703704
span: Span,
704-
outer_hir_id: hir::HirId,
705-
inner_hir_id: hir::HirId,
705+
outer_hir_id: HirId,
706+
inner_hir_id: HirId,
706707
) {
707708
if self.tcx.features().async_fn_track_caller
708709
&& let Some(attrs) = self.attrs.get(&outer_hir_id.local_id)
@@ -1048,7 +1049,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10481049
binder: &ClosureBinder,
10491050
capture_clause: CaptureBy,
10501051
closure_id: NodeId,
1051-
closure_hir_id: hir::HirId,
1052+
closure_hir_id: HirId,
10521053
coroutine_kind: CoroutineKind,
10531054
decl: &FnDecl,
10541055
body: &Expr,
@@ -2036,7 +2037,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
20362037
&mut self,
20372038
sp: Span,
20382039
ident: Ident,
2039-
binding: hir::HirId,
2040+
binding: HirId,
20402041
) -> &'hir hir::Expr<'hir> {
20412042
self.arena.alloc(self.expr_ident_mut(sp, ident, binding))
20422043
}
@@ -2045,7 +2046,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
20452046
&mut self,
20462047
span: Span,
20472048
ident: Ident,
2048-
binding: hir::HirId,
2049+
binding: HirId,
20492050
) -> hir::Expr<'hir> {
20502051
let hir_id = self.next_id();
20512052
let res = Res::Local(binding);

compiler/rustc_ast_lowering/src/lib.rs

+15-22
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use rustc_hir as hir;
5757
use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
5858
use rustc_hir::def_id::{LocalDefId, LocalDefIdMap, CRATE_DEF_ID, LOCAL_CRATE};
5959
use rustc_hir::{
60-
ConstArg, GenericArg, ItemLocalMap, MissingLifetimeKind, ParamName, TraitCandidate,
60+
ConstArg, GenericArg, HirId, ItemLocalMap, MissingLifetimeKind, ParamName, TraitCandidate,
6161
};
6262
use rustc_index::{Idx, IndexSlice, IndexVec};
6363
use rustc_macros::extension;
@@ -108,7 +108,7 @@ struct LoweringContext<'a, 'hir> {
108108

109109
/// When inside an `async` context, this is the `HirId` of the
110110
/// `task_context` local bound to the resume argument of the coroutine.
111-
task_context: Option<hir::HirId>,
111+
task_context: Option<HirId>,
112112

113113
/// Used to get the current `fn`'s def span to point to when using `await`
114114
/// outside of an `async fn`.
@@ -662,18 +662,16 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
662662
/// `HirIdValidator` later on, which makes sure that all `NodeId`s got mapped
663663
/// properly. Calling the method twice with the same `NodeId` is fine though.
664664
#[instrument(level = "debug", skip(self), ret)]
665-
fn lower_node_id(&mut self, ast_node_id: NodeId) -> hir::HirId {
665+
fn lower_node_id(&mut self, ast_node_id: NodeId) -> HirId {
666666
assert_ne!(ast_node_id, DUMMY_NODE_ID);
667667

668668
match self.node_id_to_local_id.entry(ast_node_id) {
669-
Entry::Occupied(o) => {
670-
hir::HirId { owner: self.current_hir_id_owner, local_id: *o.get() }
671-
}
669+
Entry::Occupied(o) => HirId { owner: self.current_hir_id_owner, local_id: *o.get() },
672670
Entry::Vacant(v) => {
673671
// Generate a new `HirId`.
674672
let owner = self.current_hir_id_owner;
675673
let local_id = self.item_local_id_counter;
676-
let hir_id = hir::HirId { owner, local_id };
674+
let hir_id = HirId { owner, local_id };
677675

678676
v.insert(local_id);
679677
self.item_local_id_counter.increment_by(1);
@@ -694,20 +692,20 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
694692

695693
/// Generate a new `HirId` without a backing `NodeId`.
696694
#[instrument(level = "debug", skip(self), ret)]
697-
fn next_id(&mut self) -> hir::HirId {
695+
fn next_id(&mut self) -> HirId {
698696
let owner = self.current_hir_id_owner;
699697
let local_id = self.item_local_id_counter;
700698
assert_ne!(local_id, hir::ItemLocalId::ZERO);
701699
self.item_local_id_counter.increment_by(1);
702-
hir::HirId { owner, local_id }
700+
HirId { owner, local_id }
703701
}
704702

705703
#[instrument(level = "trace", skip(self))]
706704
fn lower_res(&mut self, res: Res<NodeId>) -> Res {
707705
let res: Result<Res, ()> = res.apply_id(|id| {
708706
let owner = self.current_hir_id_owner;
709707
let local_id = self.node_id_to_local_id.get(&id).copied().ok_or(())?;
710-
Ok(hir::HirId { owner, local_id })
708+
Ok(HirId { owner, local_id })
711709
});
712710
trace!(?res);
713711

@@ -890,7 +888,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
890888
ret
891889
}
892890

893-
fn lower_attrs(&mut self, id: hir::HirId, attrs: &[Attribute]) -> Option<&'hir [Attribute]> {
891+
fn lower_attrs(&mut self, id: HirId, attrs: &[Attribute]) -> Option<&'hir [Attribute]> {
894892
if attrs.is_empty() {
895893
None
896894
} else {
@@ -922,7 +920,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
922920
Attribute { kind, id: attr.id, style: attr.style, span: self.lower_span(attr.span) }
923921
}
924922

925-
fn alias_attrs(&mut self, id: hir::HirId, target_id: hir::HirId) {
923+
fn alias_attrs(&mut self, id: HirId, target_id: HirId) {
926924
debug_assert_eq!(id.owner, self.current_hir_id_owner);
927925
debug_assert_eq!(target_id.owner, self.current_hir_id_owner);
928926
if let Some(&a) = self.attrs.get(&target_id.local_id) {
@@ -2479,11 +2477,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24792477
self.pat(span, hir::PatKind::Struct(qpath, fields, false))
24802478
}
24812479

2482-
fn pat_ident(&mut self, span: Span, ident: Ident) -> (&'hir hir::Pat<'hir>, hir::HirId) {
2480+
fn pat_ident(&mut self, span: Span, ident: Ident) -> (&'hir hir::Pat<'hir>, HirId) {
24832481
self.pat_ident_binding_mode(span, ident, hir::BindingAnnotation::NONE)
24842482
}
24852483

2486-
fn pat_ident_mut(&mut self, span: Span, ident: Ident) -> (hir::Pat<'hir>, hir::HirId) {
2484+
fn pat_ident_mut(&mut self, span: Span, ident: Ident) -> (hir::Pat<'hir>, HirId) {
24872485
self.pat_ident_binding_mode_mut(span, ident, hir::BindingAnnotation::NONE)
24882486
}
24892487

@@ -2492,7 +2490,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24922490
span: Span,
24932491
ident: Ident,
24942492
bm: hir::BindingAnnotation,
2495-
) -> (&'hir hir::Pat<'hir>, hir::HirId) {
2493+
) -> (&'hir hir::Pat<'hir>, HirId) {
24962494
let (pat, hir_id) = self.pat_ident_binding_mode_mut(span, ident, bm);
24972495
(self.arena.alloc(pat), hir_id)
24982496
}
@@ -2502,7 +2500,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
25022500
span: Span,
25032501
ident: Ident,
25042502
bm: hir::BindingAnnotation,
2505-
) -> (hir::Pat<'hir>, hir::HirId) {
2503+
) -> (hir::Pat<'hir>, HirId) {
25062504
let hir_id = self.next_id();
25072505

25082506
(
@@ -2534,12 +2532,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
25342532
}
25352533
}
25362534

2537-
fn ty_path(
2538-
&mut self,
2539-
mut hir_id: hir::HirId,
2540-
span: Span,
2541-
qpath: hir::QPath<'hir>,
2542-
) -> hir::Ty<'hir> {
2535+
fn ty_path(&mut self, mut hir_id: HirId, span: Span, qpath: hir::QPath<'hir>) -> hir::Ty<'hir> {
25432536
let kind = match qpath {
25442537
hir::QPath::Resolved(None, path) => {
25452538
// Turn trait object paths into `TyKind::TraitObject` instead.

compiler/rustc_ast_pretty/src/pprust/tests.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use super::*;
33
use rustc_ast as ast;
44
use rustc_span::create_default_session_globals_then;
55
use rustc_span::symbol::Ident;
6+
use rustc_span::DUMMY_SP;
67
use thin_vec::ThinVec;
78

89
fn fun_to_string(
@@ -28,10 +29,7 @@ fn test_fun_to_string() {
2829
create_default_session_globals_then(|| {
2930
let abba_ident = Ident::from_str("abba");
3031

31-
let decl = ast::FnDecl {
32-
inputs: ThinVec::new(),
33-
output: ast::FnRetTy::Default(rustc_span::DUMMY_SP),
34-
};
32+
let decl = ast::FnDecl { inputs: ThinVec::new(), output: ast::FnRetTy::Default(DUMMY_SP) };
3533
let generics = ast::Generics::default();
3634
assert_eq!(
3735
fun_to_string(&decl, ast::FnHeader::default(), abba_ident, &generics),
@@ -48,15 +46,15 @@ fn test_variant_to_string() {
4846
let var = ast::Variant {
4947
ident,
5048
vis: ast::Visibility {
51-
span: rustc_span::DUMMY_SP,
49+
span: DUMMY_SP,
5250
kind: ast::VisibilityKind::Inherited,
5351
tokens: None,
5452
},
5553
attrs: ast::AttrVec::new(),
5654
id: ast::DUMMY_NODE_ID,
5755
data: ast::VariantData::Unit(ast::DUMMY_NODE_ID),
5856
disr_expr: None,
59-
span: rustc_span::DUMMY_SP,
57+
span: DUMMY_SP,
6058
is_placeholder: false,
6159
};
6260

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ use rustc_ast::{self as ast, Expr, GenericArg, GenericParamKind, Generics, SelfK
88
use rustc_expand::base::ExtCtxt;
99
use rustc_span::source_map::respan;
1010
use rustc_span::symbol::{kw, Ident, Symbol};
11-
use rustc_span::Span;
12-
use rustc_span::DUMMY_SP;
11+
use rustc_span::{Span, DUMMY_SP};
1312
use thin_vec::ThinVec;
1413

1514
/// A path, e.g., `::std::option::Option::<i32>` (global). Has support

compiler/rustc_codegen_ssa/src/mir/block.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1861,12 +1861,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
18611861
}
18621862

18631863
enum ReturnDest<'tcx, V> {
1864-
// Do nothing; the return value is indirect or ignored.
1864+
/// Do nothing; the return value is indirect or ignored.
18651865
Nothing,
1866-
// Store the return value to the pointer.
1866+
/// Store the return value to the pointer.
18671867
Store(PlaceRef<'tcx, V>),
1868-
// Store an indirect return value to an operand local place.
1868+
/// Store an indirect return value to an operand local place.
18691869
IndirectOperand(PlaceRef<'tcx, V>, mir::Local),
1870-
// Store a direct return value to an operand local place.
1870+
/// Store a direct return value to an operand local place.
18711871
DirectOperand(mir::Local),
18721872
}

compiler/rustc_const_eval/src/transform/check_consts/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl<'ck, 'mir, 'tcx> TypeVisitor<TyCtxt<'tcx>> for LocalReturnTyVisitor<'ck, 'm
168168
match t.kind() {
169169
ty::FnPtr(_) => {}
170170
ty::Ref(_, _, hir::Mutability::Mut) => {
171-
self.checker.check_op(ops::ty::MutRef(self.kind));
171+
self.checker.check_op(ops::mut_ref::MutRef(self.kind));
172172
t.super_visit_with(self)
173173
}
174174
_ => t.super_visit_with(self),

compiler/rustc_const_eval/src/transform/check_consts/ops.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ use rustc_infer::infer::TyCtxtInferExt;
99
use rustc_infer::traits::{ImplSource, Obligation, ObligationCause};
1010
use rustc_middle::mir::{self, CallSource};
1111
use rustc_middle::ty::print::with_no_trimmed_paths;
12-
use rustc_middle::ty::TraitRef;
13-
use rustc_middle::ty::{suggest_constraining_type_param, Adt, Closure, FnDef, FnPtr, Param, Ty};
14-
use rustc_middle::ty::{GenericArgKind, GenericArgsRef};
12+
use rustc_middle::ty::{
13+
self, suggest_constraining_type_param, Closure, FnDef, FnPtr, GenericArgKind, GenericArgsRef,
14+
Param, TraitRef, Ty,
15+
};
1516
use rustc_middle::util::{call_kind, CallDesugaringKind, CallKind};
1617
use rustc_session::parse::feature_err;
1718
use rustc_span::symbol::sym;
@@ -123,7 +124,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
123124
);
124125
}
125126
}
126-
Adt(..) => {
127+
ty::Adt(..) => {
127128
let obligation =
128129
Obligation::new(tcx, ObligationCause::dummy(), param_env, trait_ref);
129130

@@ -620,7 +621,7 @@ impl<'tcx> NonConstOp<'tcx> for ThreadLocalAccess {
620621
}
621622

622623
/// Types that cannot appear in the signature or locals of a `const fn`.
623-
pub mod ty {
624+
pub mod mut_ref {
624625
use super::*;
625626

626627
#[derive(Debug)]

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub(super) fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredic
3737
// from the trait itself that *shouldn't* be shown as the source of
3838
// an obligation and instead be skipped. Otherwise we'd use
3939
// `tcx.def_span(def_id);`
40-
let span = rustc_span::DUMMY_SP;
40+
let span = DUMMY_SP;
4141

4242
result.predicates =
4343
tcx.arena.alloc_from_iter(result.predicates.iter().copied().chain(std::iter::once((

compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

+8-12
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_hir as hir;
1313
use rustc_hir::def::{DefKind, Res};
1414
use rustc_hir::def_id::LocalDefId;
1515
use rustc_hir::intravisit::{self, Visitor};
16-
use rustc_hir::{GenericArg, GenericParam, GenericParamKind, HirIdMap, LifetimeName, Node};
16+
use rustc_hir::{GenericArg, GenericParam, GenericParamKind, HirId, HirIdMap, LifetimeName, Node};
1717
use rustc_macros::extension;
1818
use rustc_middle::bug;
1919
use rustc_middle::hir::nested_filter;
@@ -107,7 +107,7 @@ enum Scope<'a> {
107107
/// queried later. However, if we enter an elision scope, we have to
108108
/// later append the elided bound vars to the list and need to know what
109109
/// to append to.
110-
hir_id: hir::HirId,
110+
hir_id: HirId,
111111

112112
s: ScopeRef<'a>,
113113

@@ -825,7 +825,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
825825
}
826826
}
827827

828-
fn visit_path(&mut self, path: &hir::Path<'tcx>, hir_id: hir::HirId) {
828+
fn visit_path(&mut self, path: &hir::Path<'tcx>, hir_id: HirId) {
829829
for (i, segment) in path.segments.iter().enumerate() {
830830
let depth = path.segments.len() - i - 1;
831831
if let Some(args) = segment.args {
@@ -1027,7 +1027,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
10271027
}
10281028
}
10291029

1030-
fn record_late_bound_vars(&mut self, hir_id: hir::HirId, binder: Vec<ty::BoundVariableKind>) {
1030+
fn record_late_bound_vars(&mut self, hir_id: HirId, binder: Vec<ty::BoundVariableKind>) {
10311031
if let Some(old) = self.map.late_bound_vars.insert(hir_id, binder) {
10321032
bug!(
10331033
"overwrote bound vars for {hir_id:?}:\nold={old:?}\nnew={:?}",
@@ -1054,12 +1054,8 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
10541054
/// already in scope (for a fn item, that will be 0, but for a method it might not be). Late
10551055
/// bound lifetimes are resolved by name and associated with a binder ID (`binder_id`), so the
10561056
/// ordering is not important there.
1057-
fn visit_early_late<F>(
1058-
&mut self,
1059-
hir_id: hir::HirId,
1060-
generics: &'tcx hir::Generics<'tcx>,
1061-
walk: F,
1062-
) where
1057+
fn visit_early_late<F>(&mut self, hir_id: HirId, generics: &'tcx hir::Generics<'tcx>, walk: F)
1058+
where
10631059
F: for<'b, 'c> FnOnce(&'b mut BoundVarContext<'c, 'tcx>),
10641060
{
10651061
let mut named_late_bound_vars = 0;
@@ -1106,7 +1102,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
11061102
self.with(scope, walk);
11071103
}
11081104

1109-
fn visit_early<F>(&mut self, hir_id: hir::HirId, generics: &'tcx hir::Generics<'tcx>, walk: F)
1105+
fn visit_early<F>(&mut self, hir_id: HirId, generics: &'tcx hir::Generics<'tcx>, walk: F)
11101106
where
11111107
F: for<'b, 'c> FnOnce(&'b mut BoundVarContext<'c, 'tcx>),
11121108
{
@@ -1332,7 +1328,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
13321328
);
13331329
}
13341330

1335-
fn resolve_type_ref(&mut self, param_def_id: LocalDefId, hir_id: hir::HirId) {
1331+
fn resolve_type_ref(&mut self, param_def_id: LocalDefId, hir_id: HirId) {
13361332
// Walk up the scope chain, tracking the number of fn scopes
13371333
// that we pass through, until we find a lifetime with the
13381334
// given name or we run out of scopes.

0 commit comments

Comments
 (0)