From 07d6454a0fe1f34096a5c20d3f59d8c20e8a0823 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Sun, 22 Aug 2021 20:08:48 -0700 Subject: [PATCH 01/13] Remove `Type::ResolvedPath.is_generic` It can be computed on-demand. --- src/librustdoc/clean/auto_trait.rs | 15 ++-------- src/librustdoc/clean/mod.rs | 13 ++++----- src/librustdoc/clean/types.rs | 20 ++++++++----- src/librustdoc/clean/utils.rs | 24 ++++++--------- src/librustdoc/html/format.rs | 37 +++++++++--------------- src/librustdoc/html/render/print_item.rs | 18 ++++++------ src/librustdoc/json/conversions.rs | 2 +- 7 files changed, 52 insertions(+), 77 deletions(-) diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index 11adb56490b32..83a4a4157b22c 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -354,7 +354,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { let (poly_trait, output) = (data.0.as_ref().unwrap().clone(), data.1.as_ref().cloned().map(Box::new)); let new_ty = match poly_trait.trait_ { - Type::ResolvedPath { ref path, ref did, ref is_generic } => { + Type::ResolvedPath { ref path, ref did } => { let mut new_path = path.clone(); let last_segment = new_path.segments.pop().expect("segments were empty"); @@ -389,11 +389,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { .segments .push(PathSegment { name: last_segment.name, args: new_params }); - Type::ResolvedPath { - path: new_path, - did: *did, - is_generic: *is_generic, - } + Type::ResolvedPath { path: new_path, did: *did } } _ => panic!("Unexpected data: {:?}, {:?}", ty, data), }; @@ -563,11 +559,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { Type::QPath { name: left_name, ref self_type, ref trait_, .. } => { let ty = &*self_type; match **trait_ { - Type::ResolvedPath { - path: ref trait_path, - ref did, - ref is_generic, - } => { + Type::ResolvedPath { path: ref trait_path, ref did } => { let mut new_trait_path = trait_path.clone(); if self.is_fn_ty(trait_) && left_name == sym::Output { @@ -612,7 +604,6 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { trait_: Type::ResolvedPath { path: new_trait_path, did: *did, - is_generic: *is_generic, }, generic_params: Vec::new(), }, diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index e281bbc59c255..a63fea595be00 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -168,7 +168,7 @@ impl Clean for (ty::TraitRef<'_>, &[TypeBinding]) { debug!("ty::TraitRef\n subst: {:?}\n", trait_ref.substs); - ResolvedPath { path, did: trait_ref.def_id, is_generic: false } + ResolvedPath { path, did: trait_ref.def_id } } } @@ -1442,12 +1442,12 @@ impl<'tcx> Clean for Ty<'tcx> { }; inline::record_extern_fqn(cx, did, kind); let path = external_path(cx, did, false, vec![], substs); - ResolvedPath { path, did, is_generic: false } + ResolvedPath { path, did } } ty::Foreign(did) => { inline::record_extern_fqn(cx, did, ItemType::ForeignType); let path = external_path(cx, did, false, vec![], InternalSubsts::empty()); - ResolvedPath { path, did, is_generic: false } + ResolvedPath { path, did } } ty::Dynamic(ref obj, ref reg) => { // HACK: pick the first `did` as the `did` of the trait object. Someone @@ -1473,7 +1473,7 @@ impl<'tcx> Clean for Ty<'tcx> { let path = external_path(cx, did, false, vec![], empty); inline::record_extern_fqn(cx, did, ItemType::Trait); let bound = PolyTrait { - trait_: ResolvedPath { path, did, is_generic: false }, + trait_: ResolvedPath { path, did }, generic_params: Vec::new(), }; bounds.push(bound); @@ -1490,10 +1490,7 @@ impl<'tcx> Clean for Ty<'tcx> { let path = external_path(cx, did, false, bindings, substs); bounds.insert( 0, - PolyTrait { - trait_: ResolvedPath { path, did, is_generic: false }, - generic_params: Vec::new(), - }, + PolyTrait { trait_: ResolvedPath { path, did }, generic_params: Vec::new() }, ); DynTrait(bounds, lifetime) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index b3c320555f9e5..3033af333df69 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1114,10 +1114,7 @@ impl GenericBound { let path = external_path(cx, did, false, vec![], empty); inline::record_extern_fqn(cx, did, ItemType::Trait); GenericBound::TraitBound( - PolyTrait { - trait_: ResolvedPath { path, did, is_generic: false }, - generic_params: Vec::new(), - }, + PolyTrait { trait_: ResolvedPath { path, did }, generic_params: Vec::new() }, hir::TraitBoundModifier::Maybe, ) } @@ -1384,8 +1381,6 @@ crate enum Type { ResolvedPath { path: Path, did: DefId, - /// `true` if is a `T::Name` path for associated types. - is_generic: bool, }, /// `dyn for<'a> Trait<'a> + Send + 'static` DynTrait(Vec, Option), @@ -1504,8 +1499,8 @@ impl Type { } crate fn is_generic(&self) -> bool { - match *self { - ResolvedPath { is_generic, .. } => is_generic, + match self { + ResolvedPath { path, .. } => path.is_generic(), _ => false, } } @@ -1994,6 +1989,15 @@ impl Path { String::from(if self.global { "::" } else { "" }) + &self.segments.iter().map(|s| s.name.to_string()).collect::>().join("::") } + + crate fn is_generic(&self) -> bool { + match self.res { + Res::SelfTy(..) if self.segments.len() != 1 => true, + Res::Def(DefKind::TyParam, _) if self.segments.len() != 1 => true, + Res::Def(DefKind::AssocTy, _) => true, + _ => false, + } + } } #[derive(Clone, PartialEq, Eq, Debug, Hash)] diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index b0021d1234cd6..33d460d587a51 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -159,9 +159,7 @@ pub(super) fn external_path( crate fn strip_type(ty: Type) -> Type { match ty { - Type::ResolvedPath { path, did, is_generic } => { - Type::ResolvedPath { path: strip_path(&path), did, is_generic } - } + Type::ResolvedPath { path, did } => Type::ResolvedPath { path: strip_path(&path), did }, Type::DynTrait(mut bounds, lt) => { let first = bounds.remove(0); let stripped_trait = strip_type(first.trait_); @@ -404,19 +402,15 @@ crate fn print_const_expr(tcx: TyCtxt<'_>, body: hir::BodyId) -> String { crate fn resolve_type(cx: &mut DocContext<'_>, path: Path) -> Type { debug!("resolve_type({:?})", path); - let is_generic = match path.res { - Res::PrimTy(p) => return Primitive(PrimitiveType::from(p)), - Res::SelfTy(..) if path.segments.len() == 1 => { - return Generic(kw::SelfUpper); - } - Res::Def(DefKind::TyParam, _) if path.segments.len() == 1 => { - return Generic(path.segments[0].name); + match path.res { + Res::PrimTy(p) => Primitive(PrimitiveType::from(p)), + Res::SelfTy(..) if path.segments.len() == 1 => Generic(kw::SelfUpper), + Res::Def(DefKind::TyParam, _) if path.segments.len() == 1 => Generic(path.segments[0].name), + _ => { + let did = register_res(cx, path.res); + ResolvedPath { path, did } } - Res::SelfTy(..) | Res::Def(DefKind::TyParam | DefKind::AssocTy, _) => true, - _ => false, - }; - let did = register_res(cx, path.res); - ResolvedPath { path, did, is_generic } + } } crate fn get_auto_trait_and_blanket_impls( diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 2fde0017dc80c..722d91ca69b77 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -752,9 +752,9 @@ fn fmt_type<'cx>( match *t { clean::Generic(name) => write!(f, "{}", name), - clean::ResolvedPath { did, ref path, is_generic } => { + clean::ResolvedPath { did, ref path } => { // Paths like `T::Output` and `Self::Output` should be rendered with all segments. - resolved_path(f, did, path, is_generic, use_absolute, cx) + resolved_path(f, did, path, path.is_generic(), use_absolute, cx) } clean::DynTrait(ref bounds, ref lt) => { f.write_str("dyn ")?; @@ -825,28 +825,17 @@ fn fmt_type<'cx>( hir::Mutability::Mut => "mut", hir::Mutability::Not => "const", }; - match **t { - clean::Generic(_) | clean::ResolvedPath { is_generic: true, .. } => { - if f.alternate() { - primitive_link( - f, - clean::PrimitiveType::RawPointer, - &format!("*{} {:#}", m, t.print(cx)), - cx, - ) - } else { - primitive_link( - f, - clean::PrimitiveType::RawPointer, - &format!("*{} {}", m, t.print(cx)), - cx, - ) - } - } - _ => { - primitive_link(f, clean::PrimitiveType::RawPointer, &format!("*{} ", m), cx)?; - fmt::Display::fmt(&t.print(cx), f) - } + + if matches!(**t, clean::Generic(_)) || t.is_generic() { + let text = if f.alternate() { + format!("*{} {:#}", m, t.print(cx)) + } else { + format!("*{} {}", m, t.print(cx)) + }; + primitive_link(f, clean::PrimitiveType::RawPointer, &text, cx) + } else { + primitive_link(f, clean::PrimitiveType::RawPointer, &format!("*{} ", m), cx)?; + fmt::Display::fmt(&t.print(cx), f) } } clean::BorrowedRef { lifetime: ref l, mutability, type_: ref ty } => { diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 52505f2d63471..90fed020119b0 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -712,11 +712,10 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra let mut implementor_dups: FxHashMap = FxHashMap::default(); for implementor in implementors { match implementor.inner_impl().for_ { - clean::ResolvedPath { ref path, did, is_generic: false, .. } + clean::ResolvedPath { ref path, did, .. } | clean::BorrowedRef { - type_: box clean::ResolvedPath { ref path, did, is_generic: false, .. }, - .. - } => { + type_: box clean::ResolvedPath { ref path, did, .. }, .. + } if !path.is_generic() => { let &mut (prev_did, ref mut has_duplicates) = implementor_dups.entry(path.last()).or_insert((did, false)); if prev_did != did { @@ -1410,11 +1409,12 @@ fn render_implementor( // If there's already another implementor that has the same abridged name, use the // full path, for example in `std::iter::ExactSizeIterator` let use_absolute = match implementor.inner_impl().for_ { - clean::ResolvedPath { ref path, is_generic: false, .. } - | clean::BorrowedRef { - type_: box clean::ResolvedPath { ref path, is_generic: false, .. }, - .. - } => implementor_dups[&path.last()].1, + clean::ResolvedPath { ref path, .. } + | clean::BorrowedRef { type_: box clean::ResolvedPath { ref path, .. }, .. } + if !path.is_generic() => + { + implementor_dups[&path.last()].1 + } _ => false, }; render_impl( diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index f8ea7a499b234..fda9070305797 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -387,7 +387,7 @@ impl FromWithTcx for Type { fn from_tcx(ty: clean::Type, tcx: TyCtxt<'_>) -> Self { use clean::Type::*; match ty { - ResolvedPath { path, did, is_generic: _ } => Type::ResolvedPath { + ResolvedPath { path, did } => Type::ResolvedPath { name: path.whole_name(), id: from_item_id(did.into()), args: path.segments.last().map(|args| Box::new(args.clone().args.into_tcx(tcx))), From 1085dc2148594bc259f9629b7ca4aa9489c8c10d Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Mon, 30 Aug 2021 20:53:57 -0700 Subject: [PATCH 02/13] Rename `is_generic()` to `is_assoc_ty()` The new name is more accurate than the previous one. --- src/librustdoc/clean/types.rs | 6 +++--- src/librustdoc/html/format.rs | 4 ++-- src/librustdoc/html/render/print_item.rs | 4 ++-- src/librustdoc/passes/stripper.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 3033af333df69..0139c4e879a70 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1498,9 +1498,9 @@ impl Type { } } - crate fn is_generic(&self) -> bool { + crate fn is_assoc_ty(&self) -> bool { match self { - ResolvedPath { path, .. } => path.is_generic(), + ResolvedPath { path, .. } => path.is_assoc_ty(), _ => false, } } @@ -1990,7 +1990,7 @@ impl Path { + &self.segments.iter().map(|s| s.name.to_string()).collect::>().join("::") } - crate fn is_generic(&self) -> bool { + crate fn is_assoc_ty(&self) -> bool { match self.res { Res::SelfTy(..) if self.segments.len() != 1 => true, Res::Def(DefKind::TyParam, _) if self.segments.len() != 1 => true, diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 722d91ca69b77..d11781581a8df 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -754,7 +754,7 @@ fn fmt_type<'cx>( clean::Generic(name) => write!(f, "{}", name), clean::ResolvedPath { did, ref path } => { // Paths like `T::Output` and `Self::Output` should be rendered with all segments. - resolved_path(f, did, path, path.is_generic(), use_absolute, cx) + resolved_path(f, did, path, path.is_assoc_ty(), use_absolute, cx) } clean::DynTrait(ref bounds, ref lt) => { f.write_str("dyn ")?; @@ -826,7 +826,7 @@ fn fmt_type<'cx>( hir::Mutability::Not => "const", }; - if matches!(**t, clean::Generic(_)) || t.is_generic() { + if matches!(**t, clean::Generic(_)) || t.is_assoc_ty() { let text = if f.alternate() { format!("*{} {:#}", m, t.print(cx)) } else { diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 90fed020119b0..1906a7bc3f31f 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -715,7 +715,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra clean::ResolvedPath { ref path, did, .. } | clean::BorrowedRef { type_: box clean::ResolvedPath { ref path, did, .. }, .. - } if !path.is_generic() => { + } if !path.is_assoc_ty() => { let &mut (prev_did, ref mut has_duplicates) = implementor_dups.entry(path.last()).or_insert((did, false)); if prev_did != did { @@ -1411,7 +1411,7 @@ fn render_implementor( let use_absolute = match implementor.inner_impl().for_ { clean::ResolvedPath { ref path, .. } | clean::BorrowedRef { type_: box clean::ResolvedPath { ref path, .. }, .. } - if !path.is_generic() => + if !path.is_assoc_ty() => { implementor_dups[&path.last()].1 } diff --git a/src/librustdoc/passes/stripper.rs b/src/librustdoc/passes/stripper.rs index a93880453ba27..90300dbd16b13 100644 --- a/src/librustdoc/passes/stripper.rs +++ b/src/librustdoc/passes/stripper.rs @@ -128,7 +128,7 @@ impl<'a> DocFolder for ImplStripper<'a> { return None; } if let Some(did) = imp.for_.def_id() { - if did.is_local() && !imp.for_.is_generic() && !self.retained.contains(&did.into()) + if did.is_local() && !imp.for_.is_assoc_ty() && !self.retained.contains(&did.into()) { debug!("ImplStripper: impl item for stripped type; removing"); return None; From 52ab3e8e76afde6c6b5059816f641e49ef008c30 Mon Sep 17 00:00:00 2001 From: est31 Date: Thu, 16 Sep 2021 13:20:36 +0200 Subject: [PATCH 03/13] Add intra-doc-links to LinkedList rustdoc --- library/alloc/src/collections/linked_list.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/alloc/src/collections/linked_list.rs b/library/alloc/src/collections/linked_list.rs index 9d45c5082db43..a3729617aeb23 100644 --- a/library/alloc/src/collections/linked_list.rs +++ b/library/alloc/src/collections/linked_list.rs @@ -38,9 +38,12 @@ mod tests; /// let list = LinkedList::from([1, 2, 3]); /// ``` /// -/// NOTE: It is almost always better to use `Vec` or `VecDeque` because +/// NOTE: It is almost always better to use [`Vec`] or [`VecDeque`] because /// array-based containers are generally faster, /// more memory efficient, and make better use of CPU cache. +/// +/// [`Vec`]: crate::vec::Vec +/// [`VecDeque`]: super::vec_deque::VecDeque #[stable(feature = "rust1", since = "1.0.0")] #[cfg_attr(not(test), rustc_diagnostic_item = "LinkedList")] pub struct LinkedList { From a8a829deb491db3b87bbe715eece7a7dd5cd288c Mon Sep 17 00:00:00 2001 From: est31 Date: Thu, 16 Sep 2021 13:35:54 +0200 Subject: [PATCH 04/13] Add intra-doc-links to BinaryHeap rustdoc --- library/alloc/src/collections/binary_heap.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/library/alloc/src/collections/binary_heap.rs b/library/alloc/src/collections/binary_heap.rs index 28e4f8bba05c8..ca289502379ab 100644 --- a/library/alloc/src/collections/binary_heap.rs +++ b/library/alloc/src/collections/binary_heap.rs @@ -159,9 +159,9 @@ use super::SpecExtend; /// This will be a max-heap. /// /// It is a logic error for an item to be modified in such a way that the -/// item's ordering relative to any other item, as determined by the `Ord` +/// item's ordering relative to any other item, as determined by the [`Ord`] /// trait, changes while it is in the heap. This is normally only possible -/// through `Cell`, `RefCell`, global state, I/O, or unsafe code. The +/// through [`Cell`], [`RefCell`], global state, I/O, or unsafe code. The /// behavior resulting from such a logic error is not specified, but will /// not result in undefined behavior. This could include panics, incorrect /// results, aborts, memory leaks, and non-termination. @@ -219,7 +219,7 @@ use super::SpecExtend; /// /// ## Min-heap /// -/// Either `std::cmp::Reverse` or a custom `Ord` implementation can be used to +/// Either [`core::cmp::Reverse`] or a custom [`Ord`] implementation can be used to /// make `BinaryHeap` a min-heap. This makes `heap.pop()` return the smallest /// value instead of the greatest one. /// @@ -250,6 +250,10 @@ use super::SpecExtend; /// The value for `push` is an expected cost; the method documentation gives a /// more detailed analysis. /// +/// [`core::cmp::Reverse`]: core::cmp::Reverse +/// [`Ord`]: core::cmp::Ord +/// [`Cell`]: core::cell::Cell +/// [`RefCell`]: core::cell::RefCell /// [push]: BinaryHeap::push /// [pop]: BinaryHeap::pop /// [peek]: BinaryHeap::peek From 372711906b95f3008bca52869a5bd923767062d0 Mon Sep 17 00:00:00 2001 From: est31 Date: Thu, 16 Sep 2021 13:54:05 +0200 Subject: [PATCH 05/13] Add IntoIterator intra doc link to various collections --- library/alloc/src/collections/binary_heap.rs | 3 ++- library/alloc/src/collections/btree/map.rs | 3 ++- library/alloc/src/collections/btree/set.rs | 3 ++- library/alloc/src/collections/linked_list.rs | 3 ++- library/alloc/src/collections/vec_deque/into_iter.rs | 3 ++- library/std/src/collections/hash/map.rs | 3 ++- library/std/src/collections/hash/set.rs | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/library/alloc/src/collections/binary_heap.rs b/library/alloc/src/collections/binary_heap.rs index ca289502379ab..313553872249c 100644 --- a/library/alloc/src/collections/binary_heap.rs +++ b/library/alloc/src/collections/binary_heap.rs @@ -1259,9 +1259,10 @@ impl FusedIterator for Iter<'_, T> {} /// An owning iterator over the elements of a `BinaryHeap`. /// /// This `struct` is created by [`BinaryHeap::into_iter()`] -/// (provided by the `IntoIterator` trait). See its documentation for more. +/// (provided by the [`IntoIterator`] trait). See its documentation for more. /// /// [`into_iter`]: BinaryHeap::into_iter +/// [`IntoIterator`]: core::iter::IntoIterator #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone)] pub struct IntoIter { diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs index 501a604e7f76d..2a7e1ef351bc6 100644 --- a/library/alloc/src/collections/btree/map.rs +++ b/library/alloc/src/collections/btree/map.rs @@ -326,9 +326,10 @@ impl fmt::Debug for IterMut<'_, K, V> { /// An owning iterator over the entries of a `BTreeMap`. /// /// This `struct` is created by the [`into_iter`] method on [`BTreeMap`] -/// (provided by the `IntoIterator` trait). See its documentation for more. +/// (provided by the [`IntoIterator`] trait). See its documentation for more. /// /// [`into_iter`]: IntoIterator::into_iter +/// [`IntoIterator`]: core::iter::IntoIterator #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter { range: LazyLeafRange, diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs index c664e201aec54..16150ceeb62c1 100644 --- a/library/alloc/src/collections/btree/set.rs +++ b/library/alloc/src/collections/btree/set.rs @@ -107,9 +107,10 @@ impl fmt::Debug for Iter<'_, T> { /// An owning iterator over the items of a `BTreeSet`. /// /// This `struct` is created by the [`into_iter`] method on [`BTreeSet`] -/// (provided by the `IntoIterator` trait). See its documentation for more. +/// (provided by the [`IntoIterator`] trait). See its documentation for more. /// /// [`into_iter`]: BTreeSet#method.into_iter +/// [`IntoIterator`]: core::iter::IntoIterator #[stable(feature = "rust1", since = "1.0.0")] #[derive(Debug)] pub struct IntoIter { diff --git a/library/alloc/src/collections/linked_list.rs b/library/alloc/src/collections/linked_list.rs index a3729617aeb23..b483a09192568 100644 --- a/library/alloc/src/collections/linked_list.rs +++ b/library/alloc/src/collections/linked_list.rs @@ -124,9 +124,10 @@ impl fmt::Debug for IterMut<'_, T> { /// An owning iterator over the elements of a `LinkedList`. /// /// This `struct` is created by the [`into_iter`] method on [`LinkedList`] -/// (provided by the `IntoIterator` trait). See its documentation for more. +/// (provided by the [`IntoIterator`] trait). See its documentation for more. /// /// [`into_iter`]: LinkedList::into_iter +/// [`IntoIterator`]: core::iter::IntoIterator #[derive(Clone)] #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter { diff --git a/library/alloc/src/collections/vec_deque/into_iter.rs b/library/alloc/src/collections/vec_deque/into_iter.rs index 5f13c3bf30387..946d3aa8064d6 100644 --- a/library/alloc/src/collections/vec_deque/into_iter.rs +++ b/library/alloc/src/collections/vec_deque/into_iter.rs @@ -8,9 +8,10 @@ use super::VecDeque; /// An owning iterator over the elements of a `VecDeque`. /// /// This `struct` is created by the [`into_iter`] method on [`VecDeque`] -/// (provided by the `IntoIterator` trait). See its documentation for more. +/// (provided by the [`IntoIterator`] trait). See its documentation for more. /// /// [`into_iter`]: VecDeque::into_iter +/// [`IntoIterator`]: core::iter::IntoIterator #[derive(Clone)] #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter< diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs index 36077a42b48ac..862f411ebe058 100644 --- a/library/std/src/collections/hash/map.rs +++ b/library/std/src/collections/hash/map.rs @@ -1257,9 +1257,10 @@ impl<'a, K, V> IterMut<'a, K, V> { /// An owning iterator over the entries of a `HashMap`. /// /// This `struct` is created by the [`into_iter`] method on [`HashMap`] -/// (provided by the `IntoIterator` trait). See its documentation for more. +/// (provided by the [`IntoIterator`] trait). See its documentation for more. /// /// [`into_iter`]: IntoIterator::into_iter +/// [`IntoIterator`]: crate::iter::IntoIterator /// /// # Example /// diff --git a/library/std/src/collections/hash/set.rs b/library/std/src/collections/hash/set.rs index 3b61acd122e2e..941981e3b00f1 100644 --- a/library/std/src/collections/hash/set.rs +++ b/library/std/src/collections/hash/set.rs @@ -1237,9 +1237,10 @@ pub struct Iter<'a, K: 'a> { /// An owning iterator over the items of a `HashSet`. /// /// This `struct` is created by the [`into_iter`] method on [`HashSet`] -/// (provided by the `IntoIterator` trait). See its documentation for more. +/// (provided by the [`IntoIterator`] trait). See its documentation for more. /// /// [`into_iter`]: IntoIterator::into_iter +/// [`IntoIterator`]: crate::iter::IntoIterator /// /// # Examples /// From 956f87fb04f589ac2fbe262a043c9f3cad6b2ac0 Mon Sep 17 00:00:00 2001 From: r00ster91 Date: Fri, 24 Sep 2021 12:44:28 +0200 Subject: [PATCH 06/13] consistent big O notation --- RELEASES.md | 6 +++--- .../rustc_data_structures/src/graph/scc/mod.rs | 2 +- .../rustc_data_structures/src/sorted_map.rs | 2 +- library/alloc/src/collections/binary_heap.rs | 8 ++++---- library/alloc/src/vec/mod.rs | 6 +++--- library/core/src/iter/traits/iterator.rs | 3 ++- library/std/src/collections/mod.rs | 18 +++++++++--------- library/std/src/ffi/mod.rs | 4 ++-- .../clippy/clippy_lints/src/methods/mod.rs | 2 +- 9 files changed, 26 insertions(+), 25 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index c0851a1506e13..12f949be47887 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4985,7 +4985,7 @@ Libraries - [Upgrade to Unicode 10.0.0][42999] - [Reimplemented `{f32, f64}::{min, max}` in Rust instead of using CMath.][42430] - [Skip the main thread's manual stack guard on Linux][43072] -- [Iterator::nth for `ops::{Range, RangeFrom}` is now done in O(1) time][43077] +- [Iterator::nth for `ops::{Range, RangeFrom}` is now done in *O*(1) time][43077] - [`#[repr(align(N))]` attribute max number is now 2^31 - 1.][43097] This was previously 2^15. - [`{OsStr, Path}::Display` now avoids allocations where possible][42613] @@ -8288,7 +8288,7 @@ Libraries algorithm][s]. * [`std::io::copy` allows `?Sized` arguments][cc]. * The `Windows`, `Chunks`, and `ChunksMut` iterators over slices all - [override `count`, `nth` and `last` with an O(1) + [override `count`, `nth` and `last` with an *O*(1) implementation][it]. * [`Default` is implemented for arrays up to `[T; 32]`][d]. * [`IntoRawFd` has been added to the Unix-specific prelude, @@ -8810,7 +8810,7 @@ Libraries * The `Default` implementation for `Arc` [no longer requires `Sync + Send`][arc]. * [The `Iterator` methods `count`, `nth`, and `last` have been - overridden for slices to have O(1) performance instead of O(n)][si]. + overridden for slices to have *O*(1) performance instead of *O*(*n*)][si]. * Incorrect handling of paths on Windows has been improved in both the compiler and the standard library. * [`AtomicPtr` gained a `Default` implementation][ap]. diff --git a/compiler/rustc_data_structures/src/graph/scc/mod.rs b/compiler/rustc_data_structures/src/graph/scc/mod.rs index e2cbb09ce5e6d..d8ac815a15821 100644 --- a/compiler/rustc_data_structures/src/graph/scc/mod.rs +++ b/compiler/rustc_data_structures/src/graph/scc/mod.rs @@ -3,7 +3,7 @@ //! Also computes as the resulting DAG if each SCC is replaced with a //! node in the graph. This uses [Tarjan's algorithm]( //! https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm) -//! that completes in *O(n)* time. +//! that completes in *O*(*n*) time. use crate::fx::FxHashSet; use crate::graph::vec_graph::VecGraph; diff --git a/compiler/rustc_data_structures/src/sorted_map.rs b/compiler/rustc_data_structures/src/sorted_map.rs index 9a28f8f4e2106..20e2a3b9696e8 100644 --- a/compiler/rustc_data_structures/src/sorted_map.rs +++ b/compiler/rustc_data_structures/src/sorted_map.rs @@ -9,7 +9,7 @@ mod index_map; pub use index_map::SortedIndexMultiMap; /// `SortedMap` is a data structure with similar characteristics as BTreeMap but -/// slightly different trade-offs: lookup, insertion, and removal are O(log(N)) +/// slightly different trade-offs: lookup, insertion, and removal are *O*(log(*n*)) /// and elements can be iterated in order cheaply. /// /// `SortedMap` can be faster than a `BTreeMap` for small sizes (<50) since it diff --git a/library/alloc/src/collections/binary_heap.rs b/library/alloc/src/collections/binary_heap.rs index 28e4f8bba05c8..be807d733e828 100644 --- a/library/alloc/src/collections/binary_heap.rs +++ b/library/alloc/src/collections/binary_heap.rs @@ -3,7 +3,7 @@ //! Insertion and popping the largest element have *O*(log(*n*)) time complexity. //! Checking the largest element is *O*(1). Converting a vector to a binary heap //! can be done in-place, and has *O*(*n*) complexity. A binary heap can also be -//! converted to a sorted vector in-place, allowing it to be used for an *O*(*n* \* log(*n*)) +//! converted to a sorted vector in-place, allowing it to be used for an *O*(*n* * log(*n*)) //! in-place heapsort. //! //! # Examples @@ -243,9 +243,9 @@ use super::SpecExtend; /// /// # Time complexity /// -/// | [push] | [pop] | [peek]/[peek\_mut] | -/// |--------|-----------|--------------------| -/// | O(1)~ | *O*(log(*n*)) | *O*(1) | +/// | [push] | [pop] | [peek]/[peek\_mut] | +/// |---------|---------------|--------------------| +/// | *O*(1)~ | *O*(log(*n*)) | *O*(1) | /// /// The value for `push` is an expected cost; the method documentation gives a /// more detailed analysis. diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 2f6887229e7a3..04d369257d8de 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -1,8 +1,8 @@ //! A contiguous growable array type with heap-allocated contents, written //! `Vec`. //! -//! Vectors have `O(1)` indexing, amortized `O(1)` push (to the end) and -//! `O(1)` pop (from the end). +//! Vectors have *O*(1) indexing, amortized *O*(1) push (to the end) and +//! *O*(1) pop (from the end). //! //! Vectors ensure they never allocate more than `isize::MAX` bytes. //! @@ -1268,7 +1268,7 @@ impl Vec { /// /// The removed element is replaced by the last element of the vector. /// - /// This does not preserve ordering, but is O(1). + /// This does not preserve ordering, but is *O*(1). /// /// # Panics /// diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index f884340f4e0bd..2c499f6fe4478 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -1798,10 +1798,11 @@ pub trait Iterator { /// The relative order of partitioned items is not maintained. /// /// # Current implementation + /// /// Current algorithms tries finding the first element for which the predicate evaluates /// to false, and the last element for which it evaluates to true and repeatedly swaps them. /// - /// Time Complexity: *O*(*N*) + /// Time complexity: *O*(*n*) /// /// See also [`is_partitioned()`] and [`partition()`]. /// diff --git a/library/std/src/collections/mod.rs b/library/std/src/collections/mod.rs index 71645aadb1d88..23f38ff7e15ad 100644 --- a/library/std/src/collections/mod.rs +++ b/library/std/src/collections/mod.rs @@ -97,11 +97,11 @@ //! //! ## Sequences //! -//! | | get(i) | insert(i) | remove(i) | append | split_off(i) | -//! |----------------|----------------|-----------------|----------------|--------|----------------| -//! | [`Vec`] | O(1) | O(n-i)* | O(n-i) | O(m)* | O(n-i) | -//! | [`VecDeque`] | O(1) | O(min(i, n-i))* | O(min(i, n-i)) | O(m)* | O(min(i, n-i)) | -//! | [`LinkedList`] | O(min(i, n-i)) | O(min(i, n-i)) | O(min(i, n-i)) | O(1) | O(min(i, n-i)) | +//! | | get(i) | insert(i) | remove(i) | append | split_off(i) | +//! |----------------|------------------------|-------------------------|------------------------|-----------|------------------------| +//! | [`Vec`] | *O*(1) | *O*(*n*-*i*)* | *O*(*n*-*i*) | *O*(*m*)* | *O*(*n*-*i*) | +//! | [`VecDeque`] | *O*(1) | *O*(min(*i*, *n*-*i*))* | *O*(min(*i*, *n*-*i*)) | *O*(*m*)* | *O*(min(*i*, *n*-*i*)) | +//! | [`LinkedList`] | *O*(min(*i*, *n*-*i*)) | *O*(min(*i*, *n*-*i*)) | *O*(min(*i*, *n*-*i*)) | *O*(1) | *O*(min(*i*, *n*-*i*)) | //! //! Note that where ties occur, [`Vec`] is generally going to be faster than [`VecDeque`], and //! [`VecDeque`] is generally going to be faster than [`LinkedList`]. @@ -110,10 +110,10 @@ //! //! For Sets, all operations have the cost of the equivalent Map operation. //! -//! | | get | insert | remove | range | append | -//! |--------------|-----------|-----------|-----------|-----------|--------| -//! | [`HashMap`] | O(1)~ | O(1)~* | O(1)~ | N/A | N/A | -//! | [`BTreeMap`] | O(log(n)) | O(log(n)) | O(log(n)) | O(log(n)) | O(n+m) | +//! | | get | insert | remove | range | append | +//! |--------------|---------------|---------------|---------------|---------------|--------------| +//! | [`HashMap`] | *O*(1)~ | *O*(1)~* | *O*(1)~ | N/A | N/A | +//! | [`BTreeMap`] | *O*(log(*n*)) | *O*(log(*n*)) | *O*(log(*n*)) | *O*(log(*n*)) | *O*(*n*+*m*) | //! //! # Correct and Efficient Usage of Collections //! diff --git a/library/std/src/ffi/mod.rs b/library/std/src/ffi/mod.rs index fe4e3af91ad0a..84d65bb3df4d7 100644 --- a/library/std/src/ffi/mod.rs +++ b/library/std/src/ffi/mod.rs @@ -43,8 +43,8 @@ //! terminator, so the buffer length is really `len+1` characters. //! Rust strings don't have a nul terminator; their length is always //! stored and does not need to be calculated. While in Rust -//! accessing a string's length is a `O(1)` operation (because the -//! length is stored); in C it is an `O(length)` operation because the +//! accessing a string's length is an *O*(1) operation (because the +//! length is stored); in C it is an *O*(*n*) operation because the //! length needs to be computed by scanning the string for the nul //! terminator. //! diff --git a/src/tools/clippy/clippy_lints/src/methods/mod.rs b/src/tools/clippy/clippy_lints/src/methods/mod.rs index e89b2d295b923..e4d34524f7207 100644 --- a/src/tools/clippy/clippy_lints/src/methods/mod.rs +++ b/src/tools/clippy/clippy_lints/src/methods/mod.rs @@ -995,7 +995,7 @@ declare_clippy_lint! { declare_clippy_lint! { /// ### What it does /// Checks for use of `.iter().nth()` (and the related - /// `.iter_mut().nth()`) on standard library types with O(1) element access. + /// `.iter_mut().nth()`) on standard library types with *O*(1) element access. /// /// ### Why is this bad? /// `.get()` and `.get_mut()` are more efficient and more From 353d6373ff77853f3399dde04e35ef4e86b8ca00 Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Sat, 25 Sep 2021 00:22:59 +0900 Subject: [PATCH 07/13] change the order of path suggestions --- compiler/rustc_resolve/src/diagnostics.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 0b1687d1bd8c3..7e79de102ae2d 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1707,6 +1707,12 @@ crate fn show_candidates( candidates.iter().map(|c| path_names_to_string(&c.path)).collect(); path_strings.sort(); + let core_path_strings = + path_strings.iter().filter(|p| p.starts_with("core::")).cloned().collect::>(); + if !core_path_strings.is_empty() { + path_strings.retain(|p| !p.starts_with("core::")); + } + path_strings.extend(core_path_strings); path_strings.dedup(); let (determiner, kind) = if candidates.len() == 1 { From 4c239055151ca2717c1d76fc84e0825487cd807c Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Sat, 25 Sep 2021 11:33:53 +0900 Subject: [PATCH 08/13] use `drain_filter` instead of `filter` and `retain` --- compiler/rustc_resolve/src/diagnostics.rs | 5 +---- compiler/rustc_resolve/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 7e79de102ae2d..937319df18a4f 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1708,10 +1708,7 @@ crate fn show_candidates( path_strings.sort(); let core_path_strings = - path_strings.iter().filter(|p| p.starts_with("core::")).cloned().collect::>(); - if !core_path_strings.is_empty() { - path_strings.retain(|p| !p.starts_with("core::")); - } + path_strings.drain_filter(|p| p.starts_with("core::")).collect::>(); path_strings.extend(core_path_strings); path_strings.dedup(); diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index d76ba80e42eab..a9609f188bcc9 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -10,6 +10,7 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![feature(box_patterns)] +#![feature(drain_filter)] #![feature(bool_to_option)] #![feature(crate_visibility_modifier)] #![feature(format_args_capture)] From 3239f065855cb5b5de89bf7570c430eac19bbc92 Mon Sep 17 00:00:00 2001 From: Hirochika Matsumoto Date: Thu, 23 Sep 2021 19:38:01 +0900 Subject: [PATCH 09/13] rustdoc: Don't show hidden trait methods By skipping trait items whose attributes include `hidden`, we void showing such trait methods. --- src/librustdoc/clean/inline.rs | 34 ++++++++++++++++++- ...rait-methods-with-document-hidden-items.rs | 31 +++++++++++++++++ src/test/rustdoc/hidden-trait-methods.rs | 29 ++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 src/test/rustdoc/hidden-trait-methods-with-document-hidden-items.rs create mode 100644 src/test/rustdoc/hidden-trait-methods.rs diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 15d704eb57f1e..e2084667363f1 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -389,13 +389,45 @@ crate fn build_impl( } } + let document_hidden = cx.render_options.document_hidden; let predicates = tcx.explicit_predicates_of(did); let (trait_items, generics) = match impl_item { Some(impl_) => ( impl_ .items .iter() - .map(|item| tcx.hir().impl_item(item.id).clean(cx)) + .map(|item| tcx.hir().impl_item(item.id)) + .filter(|item| { + // Filter out impl items whose corresponding trait item has `doc(hidden)` + // not to document such impl items. + // For inherent impls, we don't do any filtering. + + // When `--document-hidden-items` is passed, we don't + // do any filtering, too. + if document_hidden { + return true; + } + if let Some(associated_trait) = associated_trait { + let assoc_kind = match item.kind { + hir::ImplItemKind::Const(..) => ty::AssocKind::Const, + hir::ImplItemKind::Fn(..) => ty::AssocKind::Fn, + hir::ImplItemKind::TyAlias(..) => ty::AssocKind::Type, + }; + let trait_item = tcx + .associated_items(associated_trait.def_id) + .find_by_name_and_kind( + tcx, + item.ident, + assoc_kind, + associated_trait.def_id, + ) + .unwrap(); // SAFETY: For all impl items there exists trait item that has the same name. + !tcx.get_attrs(trait_item.def_id).lists(sym::doc).has_word(sym::hidden) + } else { + true + } + }) + .map(|item| item.clean(cx)) .collect::>(), impl_.generics.clean(cx), ), diff --git a/src/test/rustdoc/hidden-trait-methods-with-document-hidden-items.rs b/src/test/rustdoc/hidden-trait-methods-with-document-hidden-items.rs new file mode 100644 index 0000000000000..95b3e9b652303 --- /dev/null +++ b/src/test/rustdoc/hidden-trait-methods-with-document-hidden-items.rs @@ -0,0 +1,31 @@ +// compile-flags: -Z unstable-options --document-hidden-items + +// test for trait methods with `doc(hidden)` with `--document-hidden-items` passed. +#![crate_name = "foo"] + +// @has foo/trait.Trait.html +// @has - '//*[@id="associatedtype.Foo"]' 'type Foo' +// @has - '//*[@id="associatedtype.Bar"]' 'type Bar' +// @has - '//*[@id="tymethod.f"]' 'fn f()' +// @has - '//*[@id="tymethod.g"]' 'fn g()' +pub trait Trait { + #[doc(hidden)] + type Foo; + type Bar; + #[doc(hidden)] + fn f(); + fn g(); +} + +// @has foo/struct.S.html +// @has - '//*[@id="associatedtype.Foo"]' 'type Foo' +// @has - '//*[@id="associatedtype.Bar"]' 'type Bar' +// @has - '//*[@id="method.f"]' 'fn f()' +// @has - '//*[@id="method.g"]' 'fn g()' +pub struct S; +impl Trait for S { + type Foo = (); + type Bar = (); + fn f() {} + fn g() {} +} diff --git a/src/test/rustdoc/hidden-trait-methods.rs b/src/test/rustdoc/hidden-trait-methods.rs new file mode 100644 index 0000000000000..e924ba7d0acde --- /dev/null +++ b/src/test/rustdoc/hidden-trait-methods.rs @@ -0,0 +1,29 @@ +// test for trait methods with `doc(hidden)`. +#![crate_name = "foo"] + +// @has foo/trait.Trait.html +// @!has - '//*[@id="associatedtype.Foo"]' 'type Foo' +// @has - '//*[@id="associatedtype.Bar"]' 'type Bar' +// @!has - '//*[@id="tymethod.f"]' 'fn f()' +// @has - '//*[@id="tymethod.g"]' 'fn g()' +pub trait Trait { + #[doc(hidden)] + type Foo; + type Bar; + #[doc(hidden)] + fn f(); + fn g(); +} + +// @has foo/struct.S.html +// @!has - '//*[@id="associatedtype.Foo"]' 'type Foo' +// @has - '//*[@id="associatedtype.Bar"]' 'type Bar' +// @!has - '//*[@id="method.f"]' 'fn f()' +// @has - '//*[@id="method.g"]' 'fn g()' +pub struct S; +impl Trait for S { + type Foo = (); + type Bar = (); + fn f() {} + fn g() {} +} From 195f752109d646327c225fbeea424120048ac043 Mon Sep 17 00:00:00 2001 From: Hirochika Matsumoto Date: Sun, 26 Sep 2021 01:07:10 +0900 Subject: [PATCH 10/13] Elaborate comment Co-authored-by: Joshua Nelson --- src/librustdoc/clean/inline.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index e2084667363f1..4a888b22332ee 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -400,7 +400,7 @@ crate fn build_impl( .filter(|item| { // Filter out impl items whose corresponding trait item has `doc(hidden)` // not to document such impl items. - // For inherent impls, we don't do any filtering. + // For inherent impls, we don't do any filtering, because that's already done in strip_hidden.rs. // When `--document-hidden-items` is passed, we don't // do any filtering, too. From dace2ee674da9550618563babe351f313ede799d Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Sat, 25 Sep 2021 09:50:12 -0700 Subject: [PATCH 11/13] rustdoc: Document `is_assoc_ty()` It's adapted from the old documentation for the `is_generic` field. --- src/librustdoc/clean/types.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 0139c4e879a70..986729dd044e2 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1498,6 +1498,7 @@ impl Type { } } + /// Checks if this is a `T::Name` path for an associated type. crate fn is_assoc_ty(&self) -> bool { match self { ResolvedPath { path, .. } => path.is_assoc_ty(), @@ -1990,6 +1991,7 @@ impl Path { + &self.segments.iter().map(|s| s.name.to_string()).collect::>().join("::") } + /// Checks if this is a `T::Name` path for an associated type. crate fn is_assoc_ty(&self) -> bool { match self.res { Res::SelfTy(..) if self.segments.len() != 1 => true, From 160b93903c15ee46e09e04a156563ded1b152116 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Wed, 15 Sep 2021 17:12:46 +0200 Subject: [PATCH 12/13] Expose the std_detect env_override feature --- library/std/Cargo.toml | 1 + library/test/Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 1b051b0d0f6e5..2b77dc54ab35c 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -72,6 +72,7 @@ panic_immediate_abort = ["core/panic_immediate_abort"] # https://github.com/rust-lang/stdarch/blob/master/crates/std_detect/Cargo.toml std_detect_file_io = ["std_detect/std_detect_file_io"] std_detect_dlsym_getauxval = ["std_detect/std_detect_dlsym_getauxval"] +std_detect_env_override = ["std_detect/std_detect_env_override"] [package.metadata.fortanix-sgx] # Maximum possible number of threads when testing diff --git a/library/test/Cargo.toml b/library/test/Cargo.toml index 80d6072e9b5c2..04dab6b804acc 100644 --- a/library/test/Cargo.toml +++ b/library/test/Cargo.toml @@ -33,3 +33,4 @@ panic_immediate_abort = ["std/panic_immediate_abort"] profiler = ["std/profiler"] std_detect_file_io = ["std/std_detect_file_io"] std_detect_dlsym_getauxval = ["std/std_detect_dlsym_getauxval"] +std_detect_env_override = ["std/std_detect_env_override"] From b51897f604d8e0241e443bd0e6da99b8c13278b3 Mon Sep 17 00:00:00 2001 From: Daniel Giger Date: Sat, 25 Sep 2021 16:34:39 -0400 Subject: [PATCH 13/13] Fix typo in release notes --- RELEASES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASES.md b/RELEASES.md index 82a0cda9f6b74..5ba1f0c055b10 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -17,7 +17,7 @@ Compiler - [Upgrade to LLVM 13.][rust#87570] - [Support memory, address, and thread sanitizers on aarch64-unknown-freebsd.][rust#88023] -- [Allow specifying an deployment target version for all iOS targets][rust#87699] +- [Allow specifying a deployment target version for all iOS targets][rust#87699] - [Warnings can be forced on with `--force-warn`.][rust#87472] This feature is primarily intended for usage by `cargo fix`, rather than end users. - [Promote `aarch64-apple-ios-sim` to Tier 2\*.][rust#87760]