Rollup merge of #139848 - nnethercote:kw-Empty-5, r=compiler-errors
Reduce kw::Empty usage, part 5 Another step towards https://github.com/rust-lang/rust/issues/137978. r? `@davidtwco`
This commit is contained in:
commit
2144c940ce
5 changed files with 5 additions and 13 deletions
|
@ -1765,7 +1765,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||||
ident: Ident,
|
ident: Ident,
|
||||||
is_anon_in_path: IsAnonInPath,
|
is_anon_in_path: IsAnonInPath,
|
||||||
) -> &'hir hir::Lifetime {
|
) -> &'hir hir::Lifetime {
|
||||||
debug_assert_ne!(ident.name, kw::Empty);
|
|
||||||
let res = self.resolver.get_lifetime_res(id).unwrap_or(LifetimeRes::Error);
|
let res = self.resolver.get_lifetime_res(id).unwrap_or(LifetimeRes::Error);
|
||||||
let res = match res {
|
let res = match res {
|
||||||
LifetimeRes::Param { param, .. } => hir::LifetimeName::Param(param),
|
LifetimeRes::Param { param, .. } => hir::LifetimeName::Param(param),
|
||||||
|
|
|
@ -1600,11 +1600,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
Ok(method)
|
Ok(method)
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
if segment.ident.name == kw::Empty {
|
Err(self.report_method_error(expr.hir_id, rcvr_t, error, expected, false))
|
||||||
span_bug!(rcvr.span, "empty method name")
|
|
||||||
} else {
|
|
||||||
Err(self.report_method_error(expr.hir_id, rcvr_t, error, expected, false))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2941,9 +2937,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
return Ty::new_error(self.tcx(), guar);
|
return Ty::new_error(self.tcx(), guar);
|
||||||
}
|
}
|
||||||
|
|
||||||
let guar = if field.name == kw::Empty {
|
let guar = if self.method_exists_for_diagnostic(
|
||||||
self.dcx().span_bug(field.span, "field name with no name")
|
|
||||||
} else if self.method_exists_for_diagnostic(
|
|
||||||
field,
|
field,
|
||||||
base_ty,
|
base_ty,
|
||||||
expr.hir_id,
|
expr.hir_id,
|
||||||
|
|
|
@ -27,9 +27,9 @@ use rustc_middle::ty::{
|
||||||
};
|
};
|
||||||
use rustc_middle::{bug, span_bug};
|
use rustc_middle::{bug, span_bug};
|
||||||
use rustc_session::lint;
|
use rustc_session::lint;
|
||||||
|
use rustc_span::Span;
|
||||||
use rustc_span::def_id::LocalDefId;
|
use rustc_span::def_id::LocalDefId;
|
||||||
use rustc_span::hygiene::DesugaringKind;
|
use rustc_span::hygiene::DesugaringKind;
|
||||||
use rustc_span::{Span, kw};
|
|
||||||
use rustc_trait_selection::error_reporting::infer::need_type_info::TypeAnnotationNeeded;
|
use rustc_trait_selection::error_reporting::infer::need_type_info::TypeAnnotationNeeded;
|
||||||
use rustc_trait_selection::traits::{
|
use rustc_trait_selection::traits::{
|
||||||
self, NormalizeExt, ObligationCauseCode, StructurallyNormalizeExt,
|
self, NormalizeExt, ObligationCauseCode, StructurallyNormalizeExt,
|
||||||
|
@ -833,7 +833,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
let trait_missing_method =
|
let trait_missing_method =
|
||||||
matches!(error, method::MethodError::NoMatch(_)) && ty.normalized.is_trait();
|
matches!(error, method::MethodError::NoMatch(_)) && ty.normalized.is_trait();
|
||||||
assert_ne!(item_name.name, kw::Empty);
|
|
||||||
self.report_method_error(
|
self.report_method_error(
|
||||||
hir_id,
|
hir_id,
|
||||||
ty.normalized,
|
ty.normalized,
|
||||||
|
|
|
@ -1012,7 +1012,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
||||||
// HACK(eddyb) `lint_if_path_starts_with_module` needs at least
|
// HACK(eddyb) `lint_if_path_starts_with_module` needs at least
|
||||||
// 2 segments, so the `resolve_path` above won't trigger it.
|
// 2 segments, so the `resolve_path` above won't trigger it.
|
||||||
let mut full_path = import.module_path.clone();
|
let mut full_path = import.module_path.clone();
|
||||||
full_path.push(Segment::from_ident(Ident::empty()));
|
full_path.push(Segment::from_ident(Ident::dummy()));
|
||||||
self.lint_if_path_starts_with_module(Some(finalize), &full_path, None);
|
self.lint_if_path_starts_with_module(Some(finalize), &full_path, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -776,7 +776,7 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
|
||||||
self.push_disambiguator(
|
self.push_disambiguator(
|
||||||
disambiguated_field.disambiguator as u64,
|
disambiguated_field.disambiguator as u64,
|
||||||
);
|
);
|
||||||
self.push_ident(field_name.unwrap_or(kw::Empty).as_str());
|
self.push_ident(field_name.unwrap().as_str());
|
||||||
|
|
||||||
field.print(self)?;
|
field.print(self)?;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue