diff --git a/compiler/rustc_incremental/src/assert_dep_graph.rs b/compiler/rustc_incremental/src/assert_dep_graph.rs index 7b5b015d5a509..4691cdd64c10d 100644 --- a/compiler/rustc_incremental/src/assert_dep_graph.rs +++ b/compiler/rustc_incremental/src/assert_dep_graph.rs @@ -103,7 +103,7 @@ struct IfThisChanged<'tcx> { then_this_would_need: Targets, } -impl IfThisChanged<'tcx> { +impl<'tcx> IfThisChanged<'tcx> { fn argument(&self, attr: &ast::Attribute) -> Option { let mut value = None; for list_item in attr.meta_item_list().unwrap_or_default() { @@ -172,7 +172,7 @@ impl IfThisChanged<'tcx> { } } -impl Visitor<'tcx> for IfThisChanged<'tcx> { +impl<'tcx> Visitor<'tcx> for IfThisChanged<'tcx> { type Map = Map<'tcx>; fn nested_visit_map(&mut self) -> NestedVisitorMap { diff --git a/compiler/rustc_incremental/src/assert_module_sources.rs b/compiler/rustc_incremental/src/assert_module_sources.rs index 2cf8f9b08e190..b5974f8fb768f 100644 --- a/compiler/rustc_incremental/src/assert_module_sources.rs +++ b/compiler/rustc_incremental/src/assert_module_sources.rs @@ -56,7 +56,7 @@ struct AssertModuleSource<'tcx> { available_cgus: BTreeSet, } -impl AssertModuleSource<'tcx> { +impl<'tcx> AssertModuleSource<'tcx> { fn check_attr(&self, attr: &ast::Attribute) { let (expected_reuse, comp_kind) = if attr.has_name(sym::rustc_partition_reused) { (CguReuse::PreLto, ComparisonKind::AtLeast) diff --git a/compiler/rustc_incremental/src/lib.rs b/compiler/rustc_incremental/src/lib.rs index 07e9f8b00ca1b..df64534ce54d9 100644 --- a/compiler/rustc_incremental/src/lib.rs +++ b/compiler/rustc_incremental/src/lib.rs @@ -2,7 +2,6 @@ #![deny(missing_docs)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] -#![feature(in_band_lifetimes)] #![feature(let_else)] #![feature(nll)] #![recursion_limit = "256"] diff --git a/compiler/rustc_incremental/src/persist/dirty_clean.rs b/compiler/rustc_incremental/src/persist/dirty_clean.rs index b2eaf61b7d145..7ac00b4609aaf 100644 --- a/compiler/rustc_incremental/src/persist/dirty_clean.rs +++ b/compiler/rustc_incremental/src/persist/dirty_clean.rs @@ -155,7 +155,7 @@ pub struct DirtyCleanVisitor<'tcx> { checked_attrs: FxHashSet, } -impl DirtyCleanVisitor<'tcx> { +impl<'tcx> DirtyCleanVisitor<'tcx> { /// Possibly "deserialize" the attribute into a clean/dirty assertion fn assertion_maybe(&mut self, item_id: LocalDefId, attr: &Attribute) -> Option { if !attr.has_name(sym::rustc_clean) { @@ -352,7 +352,7 @@ impl DirtyCleanVisitor<'tcx> { } } -impl ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'tcx> { +impl<'tcx> ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { self.check_item(item.def_id, item.span); } @@ -415,7 +415,7 @@ pub struct FindAllAttrs<'tcx> { found_attrs: Vec<&'tcx Attribute>, } -impl FindAllAttrs<'tcx> { +impl<'tcx> FindAllAttrs<'tcx> { fn is_active_attr(&mut self, attr: &Attribute) -> bool { if attr.has_name(sym::rustc_clean) && check_config(self.tcx, attr) { return true; @@ -434,7 +434,7 @@ impl FindAllAttrs<'tcx> { } } -impl intravisit::Visitor<'tcx> for FindAllAttrs<'tcx> { +impl<'tcx> intravisit::Visitor<'tcx> for FindAllAttrs<'tcx> { type Map = Map<'tcx>; fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap { diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs index 783a4b08ec19f..3b0e4a31db1c8 100644 --- a/library/core/src/mem/maybe_uninit.rs +++ b/library/core/src/mem/maybe_uninit.rs @@ -972,8 +972,8 @@ impl MaybeUninit { #[rustc_const_unstable(feature = "maybe_uninit_slice", issue = "63569")] #[inline(always)] pub const unsafe fn slice_assume_init_ref(slice: &[Self]) -> &[T] { - // SAFETY: casting slice to a `*const [T]` is safe since the caller guarantees that - // `slice` is initialized, and`MaybeUninit` is guaranteed to have the same layout as `T`. + // SAFETY: casting `slice` to a `*const [T]` is safe since the caller guarantees that + // `slice` is initialized, and `MaybeUninit` is guaranteed to have the same layout as `T`. // The pointer obtained is valid since it refers to memory owned by `slice` which is a // reference and thus guaranteed to be valid for reads. unsafe { &*(slice as *const [Self] as *const [T]) } diff --git a/library/core/src/stream/stream.rs b/library/core/src/stream/stream.rs index d102619b8e5ec..2cfddf9ad013d 100644 --- a/library/core/src/stream/stream.rs +++ b/library/core/src/stream/stream.rs @@ -95,13 +95,13 @@ impl Stream for &mut S { #[unstable(feature = "async_stream", issue = "79024")] impl

Stream for Pin

where - P: DerefMut + Unpin, + P: DerefMut, P::Target: Stream, { type Item = ::Item; fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - self.get_mut().as_mut().poll_next(cx) + ::poll_next(self.as_deref_mut(), cx) } fn size_hint(&self) -> (usize, Option) { diff --git a/library/portable-simd/crates/core_simd/src/masks/bitmask.rs b/library/portable-simd/crates/core_simd/src/masks/bitmask.rs index 4c964cb52e196..b4217dc87ba9c 100644 --- a/library/portable-simd/crates/core_simd/src/masks/bitmask.rs +++ b/library/portable-simd/crates/core_simd/src/masks/bitmask.rs @@ -105,18 +105,14 @@ where #[must_use = "method returns a new vector and does not mutate the original value"] pub fn to_int(self) -> Simd { unsafe { - crate::intrinsics::simd_select_bitmask( - self.0, - Simd::splat(T::TRUE), - Simd::splat(T::FALSE), - ) + intrinsics::simd_select_bitmask(self.0, Simd::splat(T::TRUE), Simd::splat(T::FALSE)) } } #[inline] #[must_use = "method returns a new mask and does not mutate the original value"] pub unsafe fn from_int_unchecked(value: Simd) -> Self { - unsafe { Self(crate::intrinsics::simd_bitmask(value), PhantomData) } + unsafe { Self(intrinsics::simd_bitmask(value), PhantomData) } } #[cfg(feature = "generic_const_exprs")] diff --git a/library/portable-simd/crates/core_simd/src/masks/full_masks.rs b/library/portable-simd/crates/core_simd/src/masks/full_masks.rs index 5421ccbe3d8f5..e5bb784bb910f 100644 --- a/library/portable-simd/crates/core_simd/src/masks/full_masks.rs +++ b/library/portable-simd/crates/core_simd/src/masks/full_masks.rs @@ -115,7 +115,7 @@ where pub fn to_bitmask(self) -> [u8; LaneCount::::BITMASK_LEN] { unsafe { let mut bitmask: [u8; LaneCount::::BITMASK_LEN] = - crate::intrinsics::simd_bitmask(self.0); + intrinsics::simd_bitmask(self.0); // There is a bug where LLVM appears to implement this operation with the wrong // bit order. @@ -144,7 +144,7 @@ where } } - Self::from_int_unchecked(crate::intrinsics::simd_select_bitmask( + Self::from_int_unchecked(intrinsics::simd_select_bitmask( bitmask, Self::splat(true).to_int(), Self::splat(false).to_int(), diff --git a/library/portable-simd/crates/core_simd/src/mod.rs b/library/portable-simd/crates/core_simd/src/mod.rs index ec874a22389d4..85026265956a2 100644 --- a/library/portable-simd/crates/core_simd/src/mod.rs +++ b/library/portable-simd/crates/core_simd/src/mod.rs @@ -27,7 +27,6 @@ pub mod simd { pub use crate::core_simd::lane_count::{LaneCount, SupportedLaneCount}; pub use crate::core_simd::masks::*; - pub use crate::core_simd::select::Select; pub use crate::core_simd::swizzle::*; pub use crate::core_simd::vector::*; } diff --git a/library/portable-simd/crates/core_simd/src/select.rs b/library/portable-simd/crates/core_simd/src/select.rs index 5d696ebf76ec2..8d521057fbd3e 100644 --- a/library/portable-simd/crates/core_simd/src/select.rs +++ b/library/portable-simd/crates/core_simd/src/select.rs @@ -1,54 +1,6 @@ use crate::simd::intrinsics; use crate::simd::{LaneCount, Mask, MaskElement, Simd, SimdElement, SupportedLaneCount}; -mod sealed { - pub trait Sealed { - fn select(mask: Mask, true_values: Self, false_values: Self) -> Self; - } -} -use sealed::Sealed; - -/// Supporting trait for vector `select` function -pub trait Select: Sealed {} - -impl Sealed> for Simd -where - T: SimdElement, - LaneCount: SupportedLaneCount, -{ - #[inline] - #[must_use = "method returns a new vector and does not mutate the original inputs"] - fn select(mask: Mask, true_values: Self, false_values: Self) -> Self { - unsafe { intrinsics::simd_select(mask.to_int(), true_values, false_values) } - } -} - -impl Select> for Simd -where - T: SimdElement, - LaneCount: SupportedLaneCount, -{ -} - -impl Sealed for Mask -where - T: MaskElement, - LaneCount: SupportedLaneCount, -{ - #[inline] - #[must_use = "method returns a new vector and does not mutate the original inputs"] - fn select(mask: Self, true_values: Self, false_values: Self) -> Self { - mask & true_values | !mask & false_values - } -} - -impl Select for Mask -where - T: MaskElement, - LaneCount: SupportedLaneCount, -{ -} - impl Mask where T: MaskElement, @@ -69,8 +21,24 @@ where /// let c = mask.select(a, b); /// assert_eq!(c.to_array(), [0, 5, 6, 3]); /// ``` + #[inline] + #[must_use = "method returns a new vector and does not mutate the original inputs"] + pub fn select( + self, + true_values: Simd, + false_values: Simd, + ) -> Simd + where + U: SimdElement, + { + unsafe { intrinsics::simd_select(self.to_int(), true_values, false_values) } + } + + /// Choose lanes from two masks. + /// + /// For each lane in the mask, choose the corresponding lane from `true_values` if + /// that lane mask is true, and `false_values` if that lane mask is false. /// - /// `select` can also be used on masks: /// ``` /// # #![feature(portable_simd)] /// # #[cfg(feature = "std")] use core_simd::Mask; @@ -78,12 +46,12 @@ where /// let a = Mask::::from_array([true, true, false, false]); /// let b = Mask::::from_array([false, false, true, true]); /// let mask = Mask::::from_array([true, false, false, true]); - /// let c = mask.select(a, b); + /// let c = mask.select_mask(a, b); /// assert_eq!(c.to_array(), [true, false, true, false]); /// ``` #[inline] - #[must_use = "method returns a new vector and does not mutate the original inputs"] - pub fn select>(self, true_values: S, false_values: S) -> S { - S::select(self, true_values, false_values) + #[must_use = "method returns a new mask and does not mutate the original inputs"] + pub fn select_mask(self, true_values: Self, false_values: Self) -> Self { + self & true_values | !self & false_values } } diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 6ce6d88915010..2bd90f67cf4af 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1,7 +1,6 @@ use std::cell::RefCell; use std::default::Default; use std::hash::{Hash, Hasher}; -use std::iter::FromIterator; use std::lazy::SyncOnceCell as OnceCell; use std::path::PathBuf; use std::rc::Rc; @@ -958,16 +957,14 @@ fn add_doc_fragment(out: &mut String, frag: &DocFragment) { } } -impl<'a> FromIterator<&'a DocFragment> for String { - fn from_iter(iter: T) -> Self - where - T: IntoIterator, - { - iter.into_iter().fold(String::new(), |mut acc, frag| { - add_doc_fragment(&mut acc, frag); - acc - }) +/// Collapse a collection of [`DocFragment`]s into one string, +/// handling indentation and newlines as needed. +crate fn collapse_doc_fragments(doc_strings: &[DocFragment]) -> String { + let mut acc = String::new(); + for frag in doc_strings { + add_doc_fragment(&mut acc, frag); } + acc } /// A link that has not yet been rendered. @@ -1113,7 +1110,11 @@ impl Attributes { /// Finds all `doc` attributes as NameValues and returns their corresponding values, joined /// with newlines. crate fn collapsed_doc_value(&self) -> Option { - if self.doc_strings.is_empty() { None } else { Some(self.doc_strings.iter().collect()) } + if self.doc_strings.is_empty() { + None + } else { + Some(collapse_doc_fragments(&self.doc_strings)) + } } crate fn get_doc_aliases(&self) -> Box<[Symbol]> { diff --git a/src/librustdoc/passes/unindent_comments/tests.rs b/src/librustdoc/passes/unindent_comments/tests.rs index daec04e11cd18..3d3d2e50321d9 100644 --- a/src/librustdoc/passes/unindent_comments/tests.rs +++ b/src/librustdoc/passes/unindent_comments/tests.rs @@ -1,4 +1,7 @@ use super::*; + +use crate::clean::collapse_doc_fragments; + use rustc_span::create_default_session_globals_then; use rustc_span::source_map::DUMMY_SP; use rustc_span::symbol::Symbol; @@ -19,7 +22,7 @@ fn run_test(input: &str, expected: &str) { create_default_session_globals_then(|| { let mut s = create_doc_fragment(input); unindent_fragments(&mut s); - assert_eq!(&s.iter().collect::(), expected); + assert_eq!(collapse_doc_fragments(&s), expected); }); } diff --git a/src/test/ui/panics/location-detail-panic-no-column.rs b/src/test/ui/panics/location-detail-panic-no-column.rs index 673e638ca0d6b..7cf1bb09c92f7 100644 --- a/src/test/ui/panics/location-detail-panic-no-column.rs +++ b/src/test/ui/panics/location-detail-panic-no-column.rs @@ -1,6 +1,7 @@ // run-fail // check-run-results // compile-flags: -Zlocation-detail=line,file +// exec-env:RUST_BACKTRACE=0 fn main() { panic!("column-redacted"); diff --git a/src/test/ui/panics/location-detail-panic-no-column.run.stderr b/src/test/ui/panics/location-detail-panic-no-column.run.stderr index 9f35623fba392..46c9b8448d7e4 100644 --- a/src/test/ui/panics/location-detail-panic-no-column.run.stderr +++ b/src/test/ui/panics/location-detail-panic-no-column.run.stderr @@ -1,2 +1,2 @@ -thread 'main' panicked at 'column-redacted', $DIR/location-detail-panic-no-column.rs:6:0 +thread 'main' panicked at 'column-redacted', $DIR/location-detail-panic-no-column.rs:7:0 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/test/ui/panics/location-detail-panic-no-file.rs b/src/test/ui/panics/location-detail-panic-no-file.rs index 0e5d52cfd1534..9bcbf01d1c6f6 100644 --- a/src/test/ui/panics/location-detail-panic-no-file.rs +++ b/src/test/ui/panics/location-detail-panic-no-file.rs @@ -1,6 +1,7 @@ // run-fail // check-run-results // compile-flags: -Zlocation-detail=line,column +// exec-env:RUST_BACKTRACE=0 fn main() { panic!("file-redacted"); diff --git a/src/test/ui/panics/location-detail-panic-no-file.run.stderr b/src/test/ui/panics/location-detail-panic-no-file.run.stderr index 1e07e3a07afd5..811f93bf3085f 100644 --- a/src/test/ui/panics/location-detail-panic-no-file.run.stderr +++ b/src/test/ui/panics/location-detail-panic-no-file.run.stderr @@ -1,2 +1,2 @@ -thread 'main' panicked at 'file-redacted', :6:5 +thread 'main' panicked at 'file-redacted', :7:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/test/ui/panics/location-detail-panic-no-line.rs b/src/test/ui/panics/location-detail-panic-no-line.rs index 57f6d0ebcb9fa..25df092e1fb9c 100644 --- a/src/test/ui/panics/location-detail-panic-no-line.rs +++ b/src/test/ui/panics/location-detail-panic-no-line.rs @@ -1,6 +1,7 @@ // run-fail // check-run-results // compile-flags: -Zlocation-detail=file,column +// exec-env:RUST_BACKTRACE=0 fn main() { panic!("line-redacted"); diff --git a/src/test/ui/panics/location-detail-unwrap-no-file.rs b/src/test/ui/panics/location-detail-unwrap-no-file.rs index d7f96f058e082..16cf8a17ff190 100644 --- a/src/test/ui/panics/location-detail-unwrap-no-file.rs +++ b/src/test/ui/panics/location-detail-unwrap-no-file.rs @@ -1,6 +1,7 @@ // run-fail // check-run-results // compile-flags: -Zlocation-detail=line,column +// exec-env:RUST_BACKTRACE=0 fn main() { let opt: Option = None; diff --git a/src/test/ui/panics/location-detail-unwrap-no-file.run.stderr b/src/test/ui/panics/location-detail-unwrap-no-file.run.stderr index f8f84b5c49a22..7d8e1d93038a3 100644 --- a/src/test/ui/panics/location-detail-unwrap-no-file.run.stderr +++ b/src/test/ui/panics/location-detail-unwrap-no-file.run.stderr @@ -1,2 +1,2 @@ -thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', :7:9 +thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', :8:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace