Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 5dab47d

Browse files
committed
Auto merge of rust-lang#90000 - matthiaskrgr:rollup-vj7wwur, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#89950 (bootstrap: tweak verbosity settings) - rust-lang#89965 (Fix ICE with `let...else` and `ref mut`) - rust-lang#89974 (Nicer error message if the user attempts to do let...else if) - rust-lang#89987 (Check implementing type for `#[doc(hidden)]`) - rust-lang#89989 (rustdoc: Add static size assertion for `clean::Type`) - rust-lang#89990 (rustc_span: `Ident::invalid` -> `Ident::empty`) - rust-lang#89993 (Remove dead code from `compiletest::json`) - rust-lang#89996 (Bump backtrace) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5e02151 + 2724b00 commit 5dab47d

File tree

34 files changed

+146
-54
lines changed

34 files changed

+146
-54
lines changed

compiler/rustc_ast/src/attr/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl NestedMetaItem {
6262
self.meta_item().and_then(|meta_item| meta_item.ident())
6363
}
6464
pub fn name_or_empty(&self) -> Symbol {
65-
self.ident().unwrap_or_else(Ident::invalid).name
65+
self.ident().unwrap_or_else(Ident::empty).name
6666
}
6767

6868
/// Gets the string value if `self` is a `MetaItem` and the `MetaItem` is a
@@ -131,7 +131,7 @@ impl Attribute {
131131
}
132132
}
133133
pub fn name_or_empty(&self) -> Symbol {
134-
self.ident().unwrap_or_else(Ident::invalid).name
134+
self.ident().unwrap_or_else(Ident::empty).name
135135
}
136136

137137
pub fn value_str(&self) -> Option<Symbol> {
@@ -166,7 +166,7 @@ impl MetaItem {
166166
if self.path.segments.len() == 1 { Some(self.path.segments[0].ident) } else { None }
167167
}
168168
pub fn name_or_empty(&self) -> Symbol {
169-
self.ident().unwrap_or_else(Ident::invalid).name
169+
self.ident().unwrap_or_else(Ident::empty).name
170170
}
171171

172172
// Example:

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ pub fn noop_visit_crate<T: MutVisitor>(krate: &mut Crate, vis: &mut T) {
10601060
let item_vis =
10611061
Visibility { kind: VisibilityKind::Public, span: span.shrink_to_lo(), tokens: None };
10621062
let item = P(Item {
1063-
ident: Ident::invalid(),
1063+
ident: Ident::empty(),
10641064
attrs,
10651065
id: DUMMY_NODE_ID,
10661066
vis: item_vis,

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
14351435
trace!("registering opaque type with id {:#?}", opaque_ty_id);
14361436
let opaque_ty_item = hir::Item {
14371437
def_id: opaque_ty_id,
1438-
ident: Ident::invalid(),
1438+
ident: Ident::empty(),
14391439
kind: opaque_ty_item_kind,
14401440
vis: respan(self.lower_span(span.shrink_to_lo()), hir::VisibilityKind::Inherited),
14411441
span: self.lower_span(opaque_ty_span),

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
4545
let item_msg;
4646
let reason;
4747
let mut opt_source = None;
48-
let access_place_desc = self.describe_place(access_place.as_ref());
48+
let access_place_desc = self.describe_any_place(access_place.as_ref());
4949
debug!("report_mutability_error: access_place_desc={:?}", access_place_desc);
5050

5151
match the_place_err {
5252
PlaceRef { local, projection: [] } => {
53-
item_msg = format!("`{}`", access_place_desc.unwrap());
53+
item_msg = access_place_desc;
5454
if access_place.as_local().is_some() {
5555
reason = ", as it is not declared as mutable".to_string();
5656
} else {
@@ -83,7 +83,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
8383
// If we deref an immutable ref then the suggestion here doesn't help.
8484
return;
8585
} else {
86-
item_msg = format!("`{}`", access_place_desc.unwrap());
86+
item_msg = access_place_desc;
8787
if self.is_upvar_field_projection(access_place.as_ref()).is_some() {
8888
reason = ", as it is not declared as mutable".to_string();
8989
} else {
@@ -96,17 +96,17 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
9696
PlaceRef { local, projection: [ProjectionElem::Deref] }
9797
if self.body.local_decls[local].is_ref_for_guard() =>
9898
{
99-
item_msg = format!("`{}`", access_place_desc.unwrap());
99+
item_msg = access_place_desc;
100100
reason = ", as it is immutable for the pattern guard".to_string();
101101
}
102102
PlaceRef { local, projection: [ProjectionElem::Deref] }
103103
if self.body.local_decls[local].is_ref_to_static() =>
104104
{
105105
if access_place.projection.len() == 1 {
106-
item_msg = format!("immutable static item `{}`", access_place_desc.unwrap());
106+
item_msg = format!("immutable static item {}", access_place_desc);
107107
reason = String::new();
108108
} else {
109-
item_msg = format!("`{}`", access_place_desc.unwrap());
109+
item_msg = access_place_desc;
110110
let local_info = &self.body.local_decls[local].local_info;
111111
if let Some(box LocalInfo::StaticRef { def_id, .. }) = *local_info {
112112
let static_name = &self.infcx.tcx.item_name(def_id);
@@ -121,7 +121,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
121121
&& proj_base.is_empty()
122122
&& !self.upvars.is_empty()
123123
{
124-
item_msg = format!("`{}`", access_place_desc.unwrap());
124+
item_msg = access_place_desc;
125125
debug_assert!(
126126
self.body.local_decls[ty::CAPTURE_STRUCT_LOCAL].ty.is_region_ptr()
127127
);
@@ -147,7 +147,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
147147
});
148148
let pointer_type = source.describe_for_immutable_place(self.infcx.tcx);
149149
opt_source = Some(source);
150-
if let Some(desc) = access_place_desc {
150+
if let Some(desc) = self.describe_place(access_place.as_ref()) {
151151
item_msg = format!("`{}`", desc);
152152
reason = match error_access {
153153
AccessKind::Mutate => format!(", which is behind {}", pointer_type),

compiler/rustc_builtin_macros/src/asm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ pub fn expand_global_asm<'cx>(
812812
Ok(args) => {
813813
if let Some(inline_asm) = expand_preparsed_asm(ecx, args) {
814814
MacEager::items(smallvec![P(ast::Item {
815-
ident: Ident::invalid(),
815+
ident: Ident::empty(),
816816
attrs: Vec::new(),
817817
id: ast::DUMMY_NODE_ID,
818818
kind: ast::ItemKind::GlobalAsm(inline_asm),

compiler/rustc_builtin_macros/src/derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl MultiItemModifier for Expander {
8585
fn dummy_annotatable() -> Annotatable {
8686
Annotatable::GenericParam(ast::GenericParam {
8787
id: ast::DUMMY_NODE_ID,
88-
ident: Ident::invalid(),
88+
ident: Ident::empty(),
8989
attrs: Default::default(),
9090
bounds: Default::default(),
9191
is_placeholder: false,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ impl<'a> TraitDef<'a> {
724724

725725
cx.item(
726726
self.span,
727-
Ident::invalid(),
727+
Ident::empty(),
728728
a,
729729
ast::ItemKind::Impl(Box::new(ast::ImplKind {
730730
unsafety,

compiler/rustc_builtin_macros/src/deriving/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ fn inject_impl_of_structural_trait(
178178

179179
let newitem = cx.item(
180180
span,
181-
Ident::invalid(),
181+
Ident::empty(),
182182
attrs,
183183
ItemKind::Impl(Box::new(ImplKind {
184184
unsafety: ast::Unsafe::No,

compiler/rustc_builtin_macros/src/standard_library_imports.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub fn inject(
7777

7878
let use_item = cx.item(
7979
span,
80-
Ident::invalid(),
80+
Ident::empty(),
8181
vec![cx.attribute(cx.meta_word(span, sym::prelude_import))],
8282
ast::ItemKind::Use(ast::UseTree {
8383
prefix: cx.path(span, import_path),

compiler/rustc_expand/src/expand.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
383383
Unsafe::No,
384384
ModKind::Loaded(krate.items, Inline::Yes, krate.span)
385385
),
386-
ident: Ident::invalid(),
386+
ident: Ident::empty(),
387387
id: ast::DUMMY_NODE_ID,
388388
vis: ast::Visibility {
389389
span: krate.span.shrink_to_lo(),
@@ -1426,7 +1426,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
14261426
_ => unreachable!(),
14271427
})
14281428
}
1429-
ast::ItemKind::Mod(_, ref mut mod_kind) if ident != Ident::invalid() => {
1429+
ast::ItemKind::Mod(_, ref mut mod_kind) if ident != Ident::empty() => {
14301430
let (file_path, dir_path, dir_ownership) = match mod_kind {
14311431
ModKind::Loaded(_, inline, _) => {
14321432
// Inline `mod foo { ... }`, but we still need to push directories.
@@ -1508,7 +1508,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
15081508
_ => {
15091509
item.attrs = attrs;
15101510
// The crate root is special - don't assign an ID to it.
1511-
if !(matches!(item.kind, ast::ItemKind::Mod(..)) && ident == Ident::invalid()) {
1511+
if !(matches!(item.kind, ast::ItemKind::Mod(..)) && ident == Ident::empty()) {
15121512
assign_id!(self, &mut item.id, || noop_flat_map_item(item, self))
15131513
} else {
15141514
noop_flat_map_item(item, self)

0 commit comments

Comments
 (0)