Skip to content

Commit 69c5275

Browse files
Fix elided lifetimes in rustdoc
1 parent 62da2e1 commit 69c5275

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
289289

290290
debug!("give_region_a_name: error_region = {:?}", error_region);
291291
match error_region.kind() {
292-
ty::ReEarlyParam(ebr) => ebr.has_name().then(|| {
292+
ty::ReEarlyParam(ebr) => ebr.is_named().then(|| {
293293
let def_id = tcx.generics_of(self.mir_def_id()).region_param(ebr, tcx).def_id;
294294
let span = tcx.hir_span_if_local(def_id).unwrap_or(DUMMY_SP);
295295
RegionName { name: ebr.name, source: RegionNameSource::NamedEarlyParamRegion(span) }
@@ -895,7 +895,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
895895
let ty::ReEarlyParam(region) = self.to_error_region(fr)?.kind() else {
896896
return None;
897897
};
898-
if region.has_name() {
898+
if region.is_named() {
899899
return None;
900900
};
901901

@@ -930,7 +930,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
930930
let ty::ReEarlyParam(region) = self.to_error_region(fr)?.kind() else {
931931
return None;
932932
};
933-
if region.has_name() {
933+
if region.is_named() {
934934
return None;
935935
};
936936

compiler/rustc_hir_analysis/src/coherence/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ fn infringing_fields_error<'tcx>(
655655
.or_default()
656656
.push(origin.span());
657657
if let ty::RegionKind::ReEarlyParam(ebr) = b.kind()
658-
&& ebr.has_name()
658+
&& ebr.is_named()
659659
{
660660
bounds.push((b.to_string(), a.to_string(), None));
661661
}

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ impl<'tcx> rustc_type_ir::Flags for Ty<'tcx> {
474474
impl EarlyParamRegion {
475475
/// Does this early bound region have a name? Early bound regions normally
476476
/// always have names except when using anonymous lifetimes (`'_`).
477-
pub fn has_name(&self) -> bool {
477+
pub fn is_named(&self) -> bool {
478478
self.name != kw::UnderscoreLifetime
479479
}
480480
}

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2546,7 +2546,7 @@ impl<'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx> {
25462546
let identify_regions = self.tcx.sess.opts.unstable_opts.identify_regions;
25472547

25482548
match region.kind() {
2549-
ty::ReEarlyParam(ref data) => data.has_name(),
2549+
ty::ReEarlyParam(ref data) => data.is_named(),
25502550

25512551
ty::ReLateParam(ty::LateParamRegion { kind, .. }) => kind.is_named(self.tcx),
25522552
ty::ReBound(_, ty::BoundRegion { kind: br, .. })

compiler/rustc_middle/src/ty/region.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl<'tcx> Region<'tcx> {
165165

166166
pub fn get_name(self, tcx: TyCtxt<'tcx>) -> Option<Symbol> {
167167
match self.kind() {
168-
ty::ReEarlyParam(ebr) => Some(ebr.name),
168+
ty::ReEarlyParam(ebr) => ebr.is_named().then_some(ebr.name),
169169
ty::ReBound(_, br) => br.kind.get_name(tcx),
170170
ty::ReLateParam(fr) => fr.kind.get_name(tcx),
171171
ty::ReStatic => Some(kw::StaticLifetime),
@@ -184,7 +184,7 @@ impl<'tcx> Region<'tcx> {
184184
/// Is this region named by the user?
185185
pub fn has_name(self, tcx: TyCtxt<'tcx>) -> bool {
186186
match self.kind() {
187-
ty::ReEarlyParam(ebr) => ebr.has_name(),
187+
ty::ReEarlyParam(ebr) => ebr.is_named(),
188188
ty::ReBound(_, br) => br.kind.is_named(tcx),
189189
ty::ReLateParam(fr) => fr.kind.is_named(tcx),
190190
ty::ReStatic => true,

compiler/rustc_trait_selection/src/error_reporting/infer/region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ fn msg_span_from_named_region<'tcx>(
10901090
ty::ReEarlyParam(br) => {
10911091
let param_def_id = tcx.generics_of(generic_param_scope).region_param(br, tcx).def_id;
10921092
let span = tcx.def_span(param_def_id);
1093-
let text = if br.has_name() {
1093+
let text = if br.is_named() {
10941094
format!("the lifetime `{}` as defined here", br.name)
10951095
} else {
10961096
"the anonymous lifetime as defined here".to_string()

compiler/rustc_trait_selection/src/errors/note_and_explain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'a> DescriptionCtx<'a> {
3232
} else {
3333
tcx.def_span(scope)
3434
};
35-
if br.has_name() {
35+
if br.is_named() {
3636
(Some(span), "as_defined", br.name.to_string())
3737
} else {
3838
(Some(span), "as_defined_anon", String::new())

0 commit comments

Comments
 (0)