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

Commit d3848cb

Browse files
committedDec 18, 2021
Auto merge of rust-lang#92064 - matthiaskrgr:rollup-tgj2pai, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#91858 (pass -Wl,-z,origin to set DF_ORIGIN when using rpath) - rust-lang#91923 (Remove `in_band_lifetimes` from `rustc_query_impl`) - rust-lang#91925 (Remove `in_band_lifetimes` from `rustc_privacy`) - rust-lang#91977 (Clean up search code and unify function returned values) - rust-lang#92018 (Fix typo in "new region bound" suggestion) - rust-lang#92022 (Eliminate duplicate codes of expected_found_bool) - rust-lang#92032 (hir: Do not introduce dummy type names for `extern` blocks in def paths) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents d3f3004 + 5e8f934 commit d3848cb

File tree

33 files changed

+183
-192
lines changed

33 files changed

+183
-192
lines changed
 

‎compiler/rustc_codegen_ssa/src/back/rpath.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ pub fn get_rpath_flags(config: &mut RPathConfig<'_>) -> Vec<String> {
2323
let rpaths = get_rpaths(config);
2424
let mut flags = rpaths_to_flags(&rpaths);
2525

26-
// Use DT_RUNPATH instead of DT_RPATH if available
2726
if config.linker_is_gnu {
27+
// Use DT_RUNPATH instead of DT_RPATH if available
2828
flags.push("-Wl,--enable-new-dtags".to_owned());
29+
30+
// Set DF_ORIGIN for substitute $ORIGIN
31+
flags.push("-Wl,-z,origin".to_owned());
2932
}
3033

3134
flags

‎compiler/rustc_hir/src/definitions.rs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ pub enum DefPathData {
267267
// Different kinds of items and item-like things:
268268
/// An impl.
269269
Impl,
270+
/// An `extern` block.
271+
ForeignMod,
270272
/// Something in the type namespace.
271273
TypeNs(Symbol),
272274
/// Something in the value namespace.
@@ -469,7 +471,9 @@ impl DefPathData {
469471
match *self {
470472
TypeNs(name) | ValueNs(name) | MacroNs(name) | LifetimeNs(name) => Some(name),
471473

472-
Impl | CrateRoot | Misc | ClosureExpr | Ctor | AnonConst | ImplTrait => None,
474+
Impl | ForeignMod | CrateRoot | Misc | ClosureExpr | Ctor | AnonConst | ImplTrait => {
475+
None
476+
}
473477
}
474478
}
475479

@@ -482,6 +486,7 @@ impl DefPathData {
482486
// Note that this does not show up in user print-outs.
483487
CrateRoot => DefPathDataName::Anon { namespace: kw::Crate },
484488
Impl => DefPathDataName::Anon { namespace: kw::Impl },
489+
ForeignMod => DefPathDataName::Anon { namespace: kw::Extern },
485490
Misc => DefPathDataName::Anon { namespace: sym::misc },
486491
ClosureExpr => DefPathDataName::Anon { namespace: sym::closure },
487492
Ctor => DefPathDataName::Anon { namespace: sym::constructor },

‎compiler/rustc_infer/src/infer/combine.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use crate::traits::{Obligation, PredicateObligations};
3737
use rustc_data_structures::sso::SsoHashMap;
3838
use rustc_hir::def_id::DefId;
3939
use rustc_middle::traits::ObligationCause;
40-
use rustc_middle::ty::error::TypeError;
40+
use rustc_middle::ty::error::{ExpectedFound, TypeError};
4141
use rustc_middle::ty::relate::{self, Relate, RelateResult, TypeRelation};
4242
use rustc_middle::ty::subst::SubstsRef;
4343
use rustc_middle::ty::{self, InferConst, ToPredicate, Ty, TyCtxt, TypeFoldable};
@@ -790,23 +790,23 @@ pub fn const_unification_error<'tcx>(
790790
a_is_expected: bool,
791791
(a, b): (&'tcx ty::Const<'tcx>, &'tcx ty::Const<'tcx>),
792792
) -> TypeError<'tcx> {
793-
TypeError::ConstMismatch(ty::relate::expected_found_bool(a_is_expected, a, b))
793+
TypeError::ConstMismatch(ExpectedFound::new(a_is_expected, a, b))
794794
}
795795

796796
fn int_unification_error<'tcx>(
797797
a_is_expected: bool,
798798
v: (ty::IntVarValue, ty::IntVarValue),
799799
) -> TypeError<'tcx> {
800800
let (a, b) = v;
801-
TypeError::IntMismatch(ty::relate::expected_found_bool(a_is_expected, a, b))
801+
TypeError::IntMismatch(ExpectedFound::new(a_is_expected, a, b))
802802
}
803803

804804
fn float_unification_error<'tcx>(
805805
a_is_expected: bool,
806806
v: (ty::FloatVarValue, ty::FloatVarValue),
807807
) -> TypeError<'tcx> {
808808
let (ty::FloatVarValue(a), ty::FloatVarValue(b)) = v;
809-
TypeError::FloatMismatch(ty::relate::expected_found_bool(a_is_expected, a, b))
809+
TypeError::FloatMismatch(ExpectedFound::new(a_is_expected, a, b))
810810
}
811811

812812
struct ConstInferUnifier<'cx, 'tcx> {

‎compiler/rustc_infer/src/infer/error_reporting/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ pub fn unexpected_hidden_region_diagnostic(
275275
fn_returns,
276276
hidden_region.to_string(),
277277
None,
278-
format!("captures {}", hidden_region),
278+
format!("captures `{}`", hidden_region),
279279
None,
280280
)
281281
}

‎compiler/rustc_lint/src/context.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,8 +1030,8 @@ impl<'tcx> LateContext<'tcx> {
10301030
) -> Result<Self::Path, Self::Error> {
10311031
let mut path = print_prefix(self)?;
10321032

1033-
// Skip `::{{constructor}}` on tuple/unit structs.
1034-
if let DefPathData::Ctor = disambiguated_data.data {
1033+
// Skip `::{{extern}}` blocks and `::{{constructor}}` on tuple/unit structs.
1034+
if let DefPathData::ForeignMod | DefPathData::Ctor = disambiguated_data.data {
10351035
return Ok(path);
10361036
}
10371037

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

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,30 +1740,26 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
17401740
) -> Result<Self::Path, Self::Error> {
17411741
self = print_prefix(self)?;
17421742

1743-
// Skip `::{{constructor}}` on tuple/unit structs.
1744-
if let DefPathData::Ctor = disambiguated_data.data {
1743+
// Skip `::{{extern}}` blocks and `::{{constructor}}` on tuple/unit structs.
1744+
if let DefPathData::ForeignMod | DefPathData::Ctor = disambiguated_data.data {
17451745
return Ok(self);
17461746
}
17471747

1748-
// FIXME(eddyb) `name` should never be empty, but it
1749-
// currently is for `extern { ... }` "foreign modules".
17501748
let name = disambiguated_data.data.name();
1751-
if name != DefPathDataName::Named(kw::Empty) {
1752-
if !self.empty_path {
1753-
write!(self, "::")?;
1754-
}
1749+
if !self.empty_path {
1750+
write!(self, "::")?;
1751+
}
17551752

1756-
if let DefPathDataName::Named(name) = name {
1757-
if Ident::with_dummy_span(name).is_raw_guess() {
1758-
write!(self, "r#")?;
1759-
}
1753+
if let DefPathDataName::Named(name) = name {
1754+
if Ident::with_dummy_span(name).is_raw_guess() {
1755+
write!(self, "r#")?;
17601756
}
1757+
}
17611758

1762-
let verbose = self.tcx.sess.verbose();
1763-
disambiguated_data.fmt_maybe_verbose(&mut self, verbose)?;
1759+
let verbose = self.tcx.sess.verbose();
1760+
disambiguated_data.fmt_maybe_verbose(&mut self, verbose)?;
17641761

1765-
self.empty_path = false;
1766-
}
1762+
self.empty_path = false;
17671763

17681764
Ok(self)
17691765
}

‎compiler/rustc_middle/src/ty/relate.rs‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -836,13 +836,5 @@ pub fn expected_found<R, T>(relation: &mut R, a: T, b: T) -> ExpectedFound<T>
836836
where
837837
R: TypeRelation<'tcx>,
838838
{
839-
expected_found_bool(relation.a_is_expected(), a, b)
840-
}
841-
842-
pub fn expected_found_bool<T>(a_is_expected: bool, a: T, b: T) -> ExpectedFound<T> {
843-
if a_is_expected {
844-
ExpectedFound { expected: a, found: b }
845-
} else {
846-
ExpectedFound { expected: b, found: a }
847-
}
839+
ExpectedFound::new(relation.a_is_expected(), a, b)
848840
}

‎compiler/rustc_privacy/src/lib.rs‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2-
#![feature(in_band_lifetimes)]
32
#![feature(nll)]
43
#![feature(control_flow_enum)]
54
#![feature(try_blocks)]
@@ -310,7 +309,7 @@ struct PubRestrictedVisitor<'tcx> {
310309
has_pub_restricted: bool,
311310
}
312311

313-
impl Visitor<'tcx> for PubRestrictedVisitor<'tcx> {
312+
impl<'tcx> Visitor<'tcx> for PubRestrictedVisitor<'tcx> {
314313
type Map = Map<'tcx>;
315314

316315
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
@@ -432,7 +431,7 @@ struct ReachEverythingInTheInterfaceVisitor<'a, 'tcx> {
432431
ev: &'a mut EmbargoVisitor<'tcx>,
433432
}
434433

435-
impl EmbargoVisitor<'tcx> {
434+
impl<'tcx> EmbargoVisitor<'tcx> {
436435
fn get(&self, def_id: LocalDefId) -> Option<AccessLevel> {
437436
self.access_levels.map.get(&def_id).copied()
438437
}
@@ -674,7 +673,7 @@ impl EmbargoVisitor<'tcx> {
674673
}
675674
}
676675

677-
impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
676+
impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> {
678677
type Map = Map<'tcx>;
679678

680679
/// We want to visit items in the context of their containing
@@ -944,7 +943,7 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
944943
}
945944
}
946945

947-
impl ReachEverythingInTheInterfaceVisitor<'_, 'tcx> {
946+
impl ReachEverythingInTheInterfaceVisitor<'_, '_> {
948947
fn generics(&mut self) -> &mut Self {
949948
for param in &self.ev.tcx.generics_of(self.item_def_id).params {
950949
match param.kind {
@@ -983,7 +982,7 @@ impl ReachEverythingInTheInterfaceVisitor<'_, 'tcx> {
983982
}
984983
}
985984

986-
impl DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx> {
985+
impl<'tcx> DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx> {
987986
fn tcx(&self) -> TyCtxt<'tcx> {
988987
self.ev.tcx
989988
}
@@ -1413,7 +1412,7 @@ impl<'tcx> Visitor<'tcx> for TypePrivacyVisitor<'tcx> {
14131412
}
14141413
}
14151414

1416-
impl DefIdVisitor<'tcx> for TypePrivacyVisitor<'tcx> {
1415+
impl<'tcx> DefIdVisitor<'tcx> for TypePrivacyVisitor<'tcx> {
14171416
fn tcx(&self) -> TyCtxt<'tcx> {
14181417
self.tcx
14191418
}
@@ -1800,7 +1799,7 @@ struct SearchInterfaceForPrivateItemsVisitor<'tcx> {
18001799
in_assoc_ty: bool,
18011800
}
18021801

1803-
impl SearchInterfaceForPrivateItemsVisitor<'tcx> {
1802+
impl SearchInterfaceForPrivateItemsVisitor<'_> {
18041803
fn generics(&mut self) -> &mut Self {
18051804
for param in &self.tcx.generics_of(self.item_def_id).params {
18061805
match param.kind {
@@ -1921,7 +1920,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'tcx> {
19211920
}
19221921
}
19231922

1924-
impl DefIdVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'tcx> {
1923+
impl<'tcx> DefIdVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'tcx> {
19251924
fn tcx(&self) -> TyCtxt<'tcx> {
19261925
self.tcx
19271926
}

‎compiler/rustc_query_impl/src/keys.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl Key for (DefId, DefId) {
151151
}
152152
}
153153

154-
impl Key for (ty::Instance<'tcx>, LocalDefId) {
154+
impl<'tcx> Key for (ty::Instance<'tcx>, LocalDefId) {
155155
#[inline(always)]
156156
fn query_crate_is_local(&self) -> bool {
157157
true

‎compiler/rustc_query_impl/src/lib.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
44
#![feature(crate_visibility_modifier)]
5-
#![feature(in_band_lifetimes)]
65
#![feature(nll)]
76
#![feature(min_specialization)]
87
#![feature(once_cell)]

‎compiler/rustc_query_impl/src/on_disk_cache.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl<'sess> rustc_middle::ty::OnDiskCache<'sess> for OnDiskCache<'sess> {
212212
/// Cache promotions require invoking queries, which needs to read the serialized data.
213213
/// In order to serialize the new on-disk cache, the former on-disk cache file needs to be
214214
/// deleted, hence we won't be able to refer to its memmapped data.
215-
fn drop_serialized_data(&self, tcx: TyCtxt<'tcx>) {
215+
fn drop_serialized_data(&self, tcx: TyCtxt<'_>) {
216216
// Load everything into memory so we can write it out to the on-disk
217217
// cache. The vast majority of cacheable query results should already
218218
// be in memory, so this should be a cheap operation.

‎compiler/rustc_query_impl/src/plumbing.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl<'tcx> std::ops::Deref for QueryCtxt<'tcx> {
3131
}
3232
}
3333

34-
impl HasDepContext for QueryCtxt<'tcx> {
34+
impl<'tcx> HasDepContext for QueryCtxt<'tcx> {
3535
type DepKind = rustc_middle::dep_graph::DepKind;
3636
type DepContext = TyCtxt<'tcx>;
3737

@@ -41,7 +41,7 @@ impl HasDepContext for QueryCtxt<'tcx> {
4141
}
4242
}
4343

44-
impl QueryContext for QueryCtxt<'tcx> {
44+
impl QueryContext for QueryCtxt<'_> {
4545
fn current_query_job(&self) -> Option<QueryJobId<Self::DepKind>> {
4646
tls::with_related_context(**self, |icx| icx.query)
4747
}
@@ -130,7 +130,7 @@ impl<'tcx> QueryCtxt<'tcx> {
130130

131131
pub(super) fn encode_query_results(
132132
self,
133-
encoder: &mut on_disk_cache::CacheEncoder<'a, 'tcx, opaque::FileEncoder>,
133+
encoder: &mut on_disk_cache::CacheEncoder<'_, 'tcx, opaque::FileEncoder>,
134134
query_result_index: &mut on_disk_cache::EncodedDepNodeIndex,
135135
) -> opaque::FileEncodeResult {
136136
macro_rules! encode_queries {
@@ -511,7 +511,7 @@ macro_rules! define_queries_struct {
511511
}
512512
}
513513

514-
impl QueryEngine<'tcx> for Queries<'tcx> {
514+
impl<'tcx> QueryEngine<'tcx> for Queries<'tcx> {
515515
fn as_any(&'tcx self) -> &'tcx dyn std::any::Any {
516516
let this = unsafe { std::mem::transmute::<&Queries<'_>, &Queries<'_>>(self) };
517517
this as _

‎compiler/rustc_query_impl/src/profiling_support.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ fn alloc_self_profile_query_strings_for_query_cache<'tcx, C>(
295295
/// If we are recording only summary data, the ids will point to
296296
/// just the query names. If we are recording query keys too, we
297297
/// allocate the corresponding strings here.
298-
pub fn alloc_self_profile_query_strings(tcx: TyCtxt<'tcx>) {
298+
pub fn alloc_self_profile_query_strings(tcx: TyCtxt<'_>) {
299299
if !tcx.prof.enabled() {
300300
return;
301301
}

‎compiler/rustc_resolve/src/def_collector.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ impl<'a, 'b> visit::Visitor<'a> for DefCollector<'a, 'b> {
9292
// information we encapsulate into, the better
9393
let def_data = match &i.kind {
9494
ItemKind::Impl { .. } => DefPathData::Impl,
95+
ItemKind::ForeignMod(..) => DefPathData::ForeignMod,
9596
ItemKind::Mod(..)
9697
| ItemKind::Trait(..)
9798
| ItemKind::TraitAlias(..)
9899
| ItemKind::Enum(..)
99100
| ItemKind::Struct(..)
100101
| ItemKind::Union(..)
101102
| ItemKind::ExternCrate(..)
102-
| ItemKind::ForeignMod(..)
103103
| ItemKind::TyAlias(..) => DefPathData::TypeNs(i.ident.name),
104104
ItemKind::Static(..) | ItemKind::Const(..) | ItemKind::Fn(..) => {
105105
DefPathData::ValueNs(i.ident.name)

‎compiler/rustc_symbol_mangling/src/legacy.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
311311
) -> Result<Self::Path, Self::Error> {
312312
self = print_prefix(self)?;
313313

314-
// Skip `::{{constructor}}` on tuple/unit structs.
315-
if let DefPathData::Ctor = disambiguated_data.data {
314+
// Skip `::{{extern}}` blocks and `::{{constructor}}` on tuple/unit structs.
315+
if let DefPathData::ForeignMod | DefPathData::Ctor = disambiguated_data.data {
316316
return Ok(self);
317317
}
318318

‎compiler/rustc_symbol_mangling/src/v0.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,10 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
771771
disambiguated_data: &DisambiguatedDefPathData,
772772
) -> Result<Self::Path, Self::Error> {
773773
let ns = match disambiguated_data.data {
774+
// FIXME: It shouldn't be necessary to add anything for extern block segments,
775+
// but we add 't' for backward compatibility.
776+
DefPathData::ForeignMod => 't',
777+
774778
// Uppercase categories are more stable than lowercase ones.
775779
DefPathData::TypeNs(_) => 't',
776780
DefPathData::ValueNs(_) => 'v',

‎compiler/rustc_typeck/src/check/expr.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ use rustc_infer::infer;
3636
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
3737
use rustc_infer::infer::InferOk;
3838
use rustc_middle::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase};
39+
use rustc_middle::ty::error::ExpectedFound;
3940
use rustc_middle::ty::error::TypeError::{FieldMisMatch, Sorts};
40-
use rustc_middle::ty::relate::expected_found_bool;
4141
use rustc_middle::ty::subst::SubstsRef;
4242
use rustc_middle::ty::{self, AdtKind, Ty, TypeFoldable};
4343
use rustc_session::parse::feature_err;
@@ -1493,7 +1493,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
14931493
&self.misc(base_expr.span),
14941494
adt_ty,
14951495
base_ty,
1496-
Sorts(expected_found_bool(true, adt_ty, base_ty)),
1496+
Sorts(ExpectedFound::new(true, adt_ty, base_ty)),
14971497
)
14981498
.emit();
14991499
}

‎src/bootstrap/builder.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,7 @@ impl<'a> Builder<'a> {
11761176
rustflags.arg("-Zosx-rpath-install-name");
11771177
Some("-Wl,-rpath,@loader_path/../lib")
11781178
} else if !target.contains("windows") {
1179+
rustflags.arg("-Clink-args=-Wl,-z,origin");
11791180
Some("-Wl,-rpath,$ORIGIN/../lib")
11801181
} else {
11811182
None

‎src/librustdoc/clean/inline.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use rustc_data_structures::fx::FxHashSet;
88
use rustc_hir as hir;
99
use rustc_hir::def::{DefKind, Res};
1010
use rustc_hir::def_id::DefId;
11+
use rustc_hir::definitions::DefPathData;
1112
use rustc_hir::Mutability;
1213
use rustc_metadata::creader::{CStore, LoadedMacro};
1314
use rustc_middle::ty::{self, TyCtxt};
@@ -165,9 +166,8 @@ crate fn record_extern_fqn(cx: &mut DocContext<'_>, did: DefId, kind: ItemType)
165166
let crate_name = cx.tcx.crate_name(did.krate).to_string();
166167

167168
let relative = cx.tcx.def_path(did).data.into_iter().filter_map(|elem| {
168-
// extern blocks have an empty name
169-
let s = elem.data.to_string();
170-
if !s.is_empty() { Some(s) } else { None }
169+
// Filter out extern blocks
170+
(elem.data != DefPathData::ForeignMod).then(|| elem.data.to_string())
171171
});
172172
let fqn = if let ItemType::Macro = kind {
173173
// Check to see if it is a macro 2.0 or built-in macro

‎src/librustdoc/html/static/js/search.js‎

Lines changed: 102 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,13 @@ window.initSearch = function(rawSearchIndex) {
176176
var ar = [];
177177
for (var entry in results) {
178178
if (hasOwnPropertyRustdoc(results, entry)) {
179-
ar.push(results[entry]);
179+
var result = results[entry];
180+
result.word = searchWords[result.id];
181+
result.item = searchIndex[result.id] || {};
182+
ar.push(result);
180183
}
181184
}
182185
results = ar;
183-
var i, len, result;
184-
for (i = 0, len = results.length; i < len; ++i) {
185-
result = results[i];
186-
result.word = searchWords[result.id];
187-
result.item = searchIndex[result.id] || {};
188-
}
189186
// if there are no results then return to default and fail
190187
if (results.length === 0) {
191188
return [];
@@ -258,7 +255,7 @@ window.initSearch = function(rawSearchIndex) {
258255
return 0;
259256
});
260257

261-
for (i = 0, len = results.length; i < len; ++i) {
258+
for (var i = 0, len = results.length; i < len; ++i) {
262259
result = results[i];
263260

264261
// this validation does not make sense when searching by types
@@ -344,7 +341,17 @@ window.initSearch = function(rawSearchIndex) {
344341
return MAX_LEV_DISTANCE + 1;
345342
}
346343

347-
// Check for type name and type generics (if any).
344+
/**
345+
* This function checks if the object (`obj`) matches the given type (`val`) and its
346+
* generics (if any).
347+
*
348+
* @param {Object} obj
349+
* @param {string} val
350+
* @param {boolean} literalSearch
351+
*
352+
* @return {integer} - Returns a Levenshtein distance to the best match. If there is
353+
* no match, returns `MAX_LEV_DISTANCE + 1`.
354+
*/
348355
function checkType(obj, val, literalSearch) {
349356
var lev_distance = MAX_LEV_DISTANCE + 1;
350357
var tmp_lev = MAX_LEV_DISTANCE + 1;
@@ -363,24 +370,23 @@ window.initSearch = function(rawSearchIndex) {
363370
elems[obj[GENERICS_DATA][x][NAME]] += 1;
364371
}
365372

366-
var allFound = true;
367373
len = val.generics.length;
368374
for (x = 0; x < len; ++x) {
369375
firstGeneric = val.generics[x];
370376
if (elems[firstGeneric]) {
371377
elems[firstGeneric] -= 1;
372378
} else {
373-
allFound = false;
374-
break;
379+
// Something wasn't found and this is a literal search so
380+
// abort and return a "failing" distance.
381+
return MAX_LEV_DISTANCE + 1;
375382
}
376383
}
377-
if (allFound) {
378-
return true;
379-
}
384+
// Everything was found, success!
385+
return 0;
380386
}
381-
return false;
387+
return MAX_LEV_DISTANCE + 1;
382388
}
383-
return true;
389+
return 0;
384390
} else {
385391
// If the type has generics but don't match, then it won't return at this point.
386392
// Otherwise, `checkGenerics` will return 0 and it'll return.
@@ -392,14 +398,15 @@ window.initSearch = function(rawSearchIndex) {
392398
}
393399
}
394400
} else if (literalSearch) {
401+
var found = false;
395402
if ((!val.generics || val.generics.length === 0) &&
396403
obj.length > GENERICS_DATA && obj[GENERICS_DATA].length > 0) {
397-
return obj[GENERICS_DATA].some(
404+
found = obj[GENERICS_DATA].some(
398405
function(gen) {
399406
return gen[NAME] === val.name;
400407
});
401408
}
402-
return false;
409+
return found ? 0 : MAX_LEV_DISTANCE + 1;
403410
}
404411
lev_distance = Math.min(levenshtein(obj[NAME], val.name), lev_distance);
405412
if (lev_distance <= MAX_LEV_DISTANCE) {
@@ -430,6 +437,17 @@ window.initSearch = function(rawSearchIndex) {
430437
return Math.min(lev_distance, tmp_lev) + 1;
431438
}
432439

440+
/**
441+
* This function checks if the object (`obj`) has an argument with the given type (`val`).
442+
*
443+
* @param {Object} obj
444+
* @param {string} val
445+
* @param {boolean} literalSearch
446+
* @param {integer} typeFilter
447+
*
448+
* @return {integer} - Returns a Levenshtein distance to the best match. If there is no
449+
* match, returns `MAX_LEV_DISTANCE + 1`.
450+
*/
433451
function findArg(obj, val, literalSearch, typeFilter) {
434452
var lev_distance = MAX_LEV_DISTANCE + 1;
435453

@@ -441,19 +459,15 @@ window.initSearch = function(rawSearchIndex) {
441459
continue;
442460
}
443461
tmp = checkType(tmp, val, literalSearch);
444-
if (literalSearch) {
445-
if (tmp) {
446-
return true;
447-
}
462+
if (tmp === 0) {
463+
return 0;
464+
} else if (literalSearch) {
448465
continue;
449466
}
450467
lev_distance = Math.min(tmp, lev_distance);
451-
if (lev_distance === 0) {
452-
return 0;
453-
}
454468
}
455469
}
456-
return literalSearch ? false : lev_distance;
470+
return literalSearch ? MAX_LEV_DISTANCE + 1 : lev_distance;
457471
}
458472

459473
function checkReturned(obj, val, literalSearch, typeFilter) {
@@ -470,19 +484,15 @@ window.initSearch = function(rawSearchIndex) {
470484
continue;
471485
}
472486
tmp = checkType(tmp, val, literalSearch);
473-
if (literalSearch) {
474-
if (tmp) {
475-
return true;
476-
}
487+
if (tmp === 0) {
488+
return 0;
489+
} else if (literalSearch) {
477490
continue;
478491
}
479492
lev_distance = Math.min(tmp, lev_distance);
480-
if (lev_distance === 0) {
481-
return 0;
482-
}
483493
}
484494
}
485-
return literalSearch ? false : lev_distance;
495+
return literalSearch ? MAX_LEV_DISTANCE + 1 : lev_distance;
486496
}
487497

488498
function checkPath(contains, lastElem, ty) {
@@ -612,6 +622,44 @@ window.initSearch = function(rawSearchIndex) {
612622
onEach(crateAliases, pushFunc);
613623
}
614624

625+
/**
626+
* This function adds the given result into the provided `res` map if it matches the
627+
* following condition:
628+
*
629+
* * If it is a "literal search" (`isExact`), then `lev` must be 0.
630+
* * If it is not a "literal search", `lev` must be <= `MAX_LEV_DISTANCE`.
631+
*
632+
* The `res` map contains information which will be used to sort the search results:
633+
*
634+
* * `fullId` is a `string`` used as the key of the object we use for the `res` map.
635+
* * `id` is the index in both `searchWords` and `searchIndex` arrays for this element.
636+
* * `index` is an `integer`` used to sort by the position of the word in the item's name.
637+
* * `lev` is the main metric used to sort the search results.
638+
*
639+
* @param {boolean} isExact
640+
* @param {Object} res
641+
* @param {string} fullId
642+
* @param {integer} id
643+
* @param {integer} index
644+
* @param {integer} lev
645+
*/
646+
function addIntoResults(isExact, res, fullId, id, index, lev) {
647+
if (lev === 0 || (!isExact && lev <= MAX_LEV_DISTANCE)) {
648+
if (res[fullId] !== undefined) {
649+
var result = res[fullId];
650+
if (result.dontValidate || result.lev <= lev) {
651+
return;
652+
}
653+
}
654+
res[fullId] = {
655+
id: id,
656+
index: index,
657+
dontValidate: isExact,
658+
lev: lev,
659+
};
660+
}
661+
}
662+
615663
// quoted values mean literal search
616664
var nSearchWords = searchWords.length;
617665
var i, it;
@@ -634,28 +682,11 @@ window.initSearch = function(rawSearchIndex) {
634682
fullId = ty.id;
635683

636684
if (searchWords[i] === val.name
637-
&& typePassesFilter(typeFilter, searchIndex[i].ty)
638-
&& results[fullId] === undefined) {
639-
results[fullId] = {
640-
id: i,
641-
index: -1,
642-
dontValidate: true,
643-
};
644-
}
645-
if (in_args && results_in_args[fullId] === undefined) {
646-
results_in_args[fullId] = {
647-
id: i,
648-
index: -1,
649-
dontValidate: true,
650-
};
651-
}
652-
if (returned && results_returned[fullId] === undefined) {
653-
results_returned[fullId] = {
654-
id: i,
655-
index: -1,
656-
dontValidate: true,
657-
};
685+
&& typePassesFilter(typeFilter, searchIndex[i].ty)) {
686+
addIntoResults(true, results, fullId, i, -1, 0);
658687
}
688+
addIntoResults(true, results_in_args, fullId, i, -1, in_args);
689+
addIntoResults(true, results_returned, fullId, i, -1, returned);
659690
}
660691
query.inputs = [val];
661692
query.output = val;
@@ -684,39 +715,27 @@ window.initSearch = function(rawSearchIndex) {
684715
fullId = ty.id;
685716

686717
returned = checkReturned(ty, output, true, NO_TYPE_FILTER);
687-
if (output.name === "*" || returned) {
718+
if (output.name === "*" || returned === 0) {
688719
in_args = false;
689720
var is_module = false;
690721

691722
if (input === "*") {
692723
is_module = true;
693724
} else {
694-
var allFound = true;
695-
for (it = 0, len = inputs.length; allFound && it < len; it++) {
696-
allFound = checkType(type, inputs[it], true);
725+
var firstNonZeroDistance = 0;
726+
for (it = 0, len = inputs.length; it < len; it++) {
727+
var distance = checkType(type, inputs[it], true);
728+
if (distance > 0) {
729+
firstNonZeroDistance = distance;
730+
break;
731+
}
697732
}
698-
in_args = allFound;
699-
}
700-
if (in_args) {
701-
results_in_args[fullId] = {
702-
id: i,
703-
index: -1,
704-
dontValidate: true,
705-
};
706-
}
707-
if (returned) {
708-
results_returned[fullId] = {
709-
id: i,
710-
index: -1,
711-
dontValidate: true,
712-
};
733+
in_args = firstNonZeroDistance;
713734
}
735+
addIntoResults(true, results_in_args, fullId, i, -1, in_args);
736+
addIntoResults(true, results_returned, fullId, i, -1, returned);
714737
if (is_module) {
715-
results[fullId] = {
716-
id: i,
717-
index: -1,
718-
dontValidate: true,
719-
};
738+
addIntoResults(true, results, fullId, i, -1, 0);
720739
}
721740
}
722741
}
@@ -788,41 +807,14 @@ window.initSearch = function(rawSearchIndex) {
788807
lev = 0;
789808
}
790809
}
791-
if (in_args <= MAX_LEV_DISTANCE) {
792-
if (results_in_args[fullId] === undefined) {
793-
results_in_args[fullId] = {
794-
id: j,
795-
index: index,
796-
lev: in_args,
797-
};
798-
}
799-
results_in_args[fullId].lev =
800-
Math.min(results_in_args[fullId].lev, in_args);
801-
}
802-
if (returned <= MAX_LEV_DISTANCE) {
803-
if (results_returned[fullId] === undefined) {
804-
results_returned[fullId] = {
805-
id: j,
806-
index: index,
807-
lev: returned,
808-
};
809-
}
810-
results_returned[fullId].lev =
811-
Math.min(results_returned[fullId].lev, returned);
812-
}
810+
addIntoResults(false, results_in_args, fullId, j, index, in_args);
811+
addIntoResults(false, results_returned, fullId, j, index, returned);
813812
if (typePassesFilter(typeFilter, ty.ty) &&
814813
(index !== -1 || lev <= MAX_LEV_DISTANCE)) {
815814
if (index !== -1 && paths.length < 2) {
816815
lev = 0;
817816
}
818-
if (results[fullId] === undefined) {
819-
results[fullId] = {
820-
id: j,
821-
index: index,
822-
lev: lev,
823-
};
824-
}
825-
results[fullId].lev = Math.min(results[fullId].lev, lev);
817+
addIntoResults(false, results, fullId, j, index, lev);
826818
}
827819
}
828820
}

‎src/librustdoc/visit_ast.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
55
use rustc_hir as hir;
66
use rustc_hir::def::{DefKind, Res};
77
use rustc_hir::def_id::DefId;
8+
use rustc_hir::definitions::DefPathData;
89
use rustc_hir::Node;
910
use rustc_hir::CRATE_HIR_ID;
1011
use rustc_middle::middle::privacy::AccessLevel;
@@ -45,9 +46,8 @@ impl Module<'hir> {
4546
fn def_id_to_path(tcx: TyCtxt<'_>, did: DefId) -> Vec<String> {
4647
let crate_name = tcx.crate_name(did.krate).to_string();
4748
let relative = tcx.def_path(did).data.into_iter().filter_map(|elem| {
48-
// extern blocks have an empty name
49-
let s = elem.data.to_string();
50-
if !s.is_empty() { Some(s) } else { None }
49+
// Filter out extern blocks
50+
(elem.data != DefPathData::ForeignMod).then(|| elem.data.to_string())
5151
});
5252
std::iter::once(crate_name).chain(relative).collect()
5353
}

‎src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<
2121
| |
2222
| hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here
2323
|
24-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
24+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
2525
|
2626
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
2727
| ++++

‎src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<
1616
| |
1717
| hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here
1818
|
19-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
19+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
2020
|
2121
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
2222
| ++++

‎src/test/ui/impl-trait/hidden-lifetimes.stderr‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a {
66
| |
77
| hidden type `&'a mut &'b T` captures the lifetime `'b` as defined here
88
|
9-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
9+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
1010
|
1111
LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a + 'b {
1212
| ++++
@@ -19,7 +19,7 @@ LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl S
1919
| |
2020
| hidden type `Rc<RefCell<&'b T>>` captures the lifetime `'b` as defined here
2121
|
22-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
22+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
2323
|
2424
LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a + 'b {
2525
| ++++

‎src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.stderr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> im
66
| |
77
| hidden type `Ordinary<'b>` captures the lifetime `'b` as defined here
88
|
9-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
9+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
1010
|
1111
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e> + 'b
1212
| ++++

‎src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.stderr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a,
66
| |
77
| hidden type `Ordinary<'b>` captures the lifetime `'b` as defined here
88
|
9-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
9+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
1010
|
1111
LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b> + 'b
1212
| ++++

‎src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn elided(x: &i32) -> impl Copy { x }
66
| |
77
| hidden type `&i32` captures the anonymous lifetime defined here
88
|
9-
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
9+
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
1010
|
1111
LL | fn elided(x: &i32) -> impl Copy + '_ { x }
1212
| ++++
@@ -19,7 +19,7 @@ LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
1919
| |
2020
| hidden type `&'a i32` captures the lifetime `'a` as defined here
2121
|
22-
help: to declare that the `impl Trait` captures 'a, you can add an explicit `'a` lifetime bound
22+
help: to declare that the `impl Trait` captures `'a`, you can add an explicit `'a` lifetime bound
2323
|
2424
LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
2525
| ++++
@@ -74,7 +74,7 @@ LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32
7474
| |
7575
| hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:35:5: 35:31]` captures the lifetime `'b` as defined here
7676
|
77-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
77+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
7878
|
7979
LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) + 'b {
8080
| ++++

‎src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn elided(x: &i32) -> impl Copy { x }
66
| |
77
| hidden type `&i32` captures the anonymous lifetime defined here
88
|
9-
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
9+
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
1010
|
1111
LL | fn elided(x: &i32) -> impl Copy + '_ { x }
1212
| ++++
@@ -19,7 +19,7 @@ LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
1919
| |
2020
| hidden type `&'a i32` captures the lifetime `'a` as defined here
2121
|
22-
help: to declare that the `impl Trait` captures 'a, you can add an explicit `'a` lifetime bound
22+
help: to declare that the `impl Trait` captures `'a`, you can add an explicit `'a` lifetime bound
2323
|
2424
LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
2525
| ++++
@@ -119,7 +119,7 @@ LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32
119119
| |
120120
| hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:35:5: 35:31]` captures the lifetime `'b` as defined here
121121
|
122-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
122+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
123123
|
124124
LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) + 'b {
125125
| ++++

‎src/test/ui/impl-trait/region-escape-via-bound.stderr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL |
77
LL | where 'x: 'y
88
| -- hidden type `Cell<&'x u32>` captures the lifetime `'x` as defined here
99
|
10-
help: to declare that the `impl Trait` captures 'x, you can add an explicit `'x` lifetime bound
10+
help: to declare that the `impl Trait` captures `'x`, you can add an explicit `'x` lifetime bound
1111
|
1212
LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y> + 'x
1313
| ++++

‎src/test/ui/impl-trait/static-return-lifetime-infered.stderr‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
66
| |
77
| hidden type `Map<std::slice::Iter<'_, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:9:27: 9:34]>` captures the anonymous lifetime defined here
88
|
9-
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
9+
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
1010
|
1111
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
1212
| ++++
@@ -19,7 +19,7 @@ LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
1919
| |
2020
| hidden type `Map<std::slice::Iter<'_, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:9:27: 9:34]>` captures the anonymous lifetime defined here
2121
|
22-
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
22+
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
2323
|
2424
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
2525
| ++++
@@ -32,7 +32,7 @@ LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
3232
| |
3333
| hidden type `Map<std::slice::Iter<'a, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:14:27: 14:34]>` captures the lifetime `'a` as defined here
3434
|
35-
help: to declare that the `impl Trait` captures 'a, you can add an explicit `'a` lifetime bound
35+
help: to declare that the `impl Trait` captures `'a`, you can add an explicit `'a` lifetime bound
3636
|
3737
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
3838
| ++++
@@ -45,7 +45,7 @@ LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
4545
| |
4646
| hidden type `Map<std::slice::Iter<'a, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:14:27: 14:34]>` captures the lifetime `'a` as defined here
4747
|
48-
help: to declare that the `impl Trait` captures 'a, you can add an explicit `'a` lifetime bound
48+
help: to declare that the `impl Trait` captures `'a`, you can add an explicit `'a` lifetime bound
4949
|
5050
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
5151
| ++++

‎src/test/ui/nll/ty-outlives/impl-trait-captures.stderr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> {
66
| |
77
| hidden type `&ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0)) T` captures the anonymous lifetime defined here
88
|
9-
help: to declare that the `impl Trait` captures ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0)), you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0))` lifetime bound
9+
help: to declare that the `impl Trait` captures `ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0))`, you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0))` lifetime bound
1010
|
1111
LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0)) {
1212
| ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

‎src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | async fn f(self: Pin<&Self>) -> impl Clone { self }
66
| |
77
| hidden type `Pin<&Foo>` captures the lifetime `'_` as defined here
88
|
9-
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
9+
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
1010
|
1111
LL | async fn f(self: Pin<&Self>) -> impl Clone + '_ { self }
1212
| ++++

‎src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn f(self: Pin<&Self>) -> impl Clone { self }
66
| |
77
| hidden type `Pin<&Foo>` captures the anonymous lifetime defined here
88
|
9-
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
9+
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
1010
|
1111
LL | fn f(self: Pin<&Self>) -> impl Clone + '_ { self }
1212
| ++++

0 commit comments

Comments
 (0)
This repository has been archived.