Skip to content

Commit 2144c94

Browse files
authored
Rollup merge of rust-lang#139848 - nnethercote:kw-Empty-5, r=compiler-errors
Reduce kw::Empty usage, part 5 Another step towards rust-lang#137978. r? `@davidtwco`
2 parents 8bb01ff + c12b4aa commit 2144c94

File tree

5 files changed

+5
-13
lines changed

5 files changed

+5
-13
lines changed

Diff for: compiler/rustc_ast_lowering/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
17651765
ident: Ident,
17661766
is_anon_in_path: IsAnonInPath,
17671767
) -> &'hir hir::Lifetime {
1768-
debug_assert_ne!(ident.name, kw::Empty);
17691768
let res = self.resolver.get_lifetime_res(id).unwrap_or(LifetimeRes::Error);
17701769
let res = match res {
17711770
LifetimeRes::Param { param, .. } => hir::LifetimeName::Param(param),

Diff for: compiler/rustc_hir_typeck/src/expr.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -1600,11 +1600,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
16001600
Ok(method)
16011601
}
16021602
Err(error) => {
1603-
if segment.ident.name == kw::Empty {
1604-
span_bug!(rcvr.span, "empty method name")
1605-
} else {
1606-
Err(self.report_method_error(expr.hir_id, rcvr_t, error, expected, false))
1607-
}
1603+
Err(self.report_method_error(expr.hir_id, rcvr_t, error, expected, false))
16081604
}
16091605
};
16101606

@@ -2941,9 +2937,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
29412937
return Ty::new_error(self.tcx(), guar);
29422938
}
29432939

2944-
let guar = if field.name == kw::Empty {
2945-
self.dcx().span_bug(field.span, "field name with no name")
2946-
} else if self.method_exists_for_diagnostic(
2940+
let guar = if self.method_exists_for_diagnostic(
29472941
field,
29482942
base_ty,
29492943
expr.hir_id,

Diff for: compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ use rustc_middle::ty::{
2727
};
2828
use rustc_middle::{bug, span_bug};
2929
use rustc_session::lint;
30+
use rustc_span::Span;
3031
use rustc_span::def_id::LocalDefId;
3132
use rustc_span::hygiene::DesugaringKind;
32-
use rustc_span::{Span, kw};
3333
use rustc_trait_selection::error_reporting::infer::need_type_info::TypeAnnotationNeeded;
3434
use rustc_trait_selection::traits::{
3535
self, NormalizeExt, ObligationCauseCode, StructurallyNormalizeExt,
@@ -833,7 +833,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
833833

834834
let trait_missing_method =
835835
matches!(error, method::MethodError::NoMatch(_)) && ty.normalized.is_trait();
836-
assert_ne!(item_name.name, kw::Empty);
837836
self.report_method_error(
838837
hir_id,
839838
ty.normalized,

Diff for: compiler/rustc_resolve/src/imports.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
10121012
// HACK(eddyb) `lint_if_path_starts_with_module` needs at least
10131013
// 2 segments, so the `resolve_path` above won't trigger it.
10141014
let mut full_path = import.module_path.clone();
1015-
full_path.push(Segment::from_ident(Ident::empty()));
1015+
full_path.push(Segment::from_ident(Ident::dummy()));
10161016
self.lint_if_path_starts_with_module(Some(finalize), &full_path, None);
10171017
}
10181018

Diff for: compiler/rustc_symbol_mangling/src/v0.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
776776
self.push_disambiguator(
777777
disambiguated_field.disambiguator as u64,
778778
);
779-
self.push_ident(field_name.unwrap_or(kw::Empty).as_str());
779+
self.push_ident(field_name.unwrap().as_str());
780780

781781
field.print(self)?;
782782
}

0 commit comments

Comments
 (0)