Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
metadata: TargetMetadata {
description: Some("ARM64 MinGW (Windows 10+), LLVM ABI".into()),
tier: Some(2),
host_tools: Some(false),
host_tools: Some(true),
std: Some(true),
},
pointer_width: 64,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@ pub(crate) fn target() -> Target {
base.rustc_abi = None; // overwrite the SSE2 ABI set by the base target
base.cpu = "pentium".into();
base.llvm_target = "i586-unknown-linux-gnu".into();
base.metadata = crate::spec::TargetMetadata {
description: Some("32-bit Linux (kernel 3.2, glibc 2.17+)".into()),
tier: Some(2),
host_tools: Some(false),
std: Some(true),
};
base
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target {
metadata: TargetMetadata {
description: Some("SPARC Solaris 11.4".into()),
tier: Some(2),
host_tools: Some(false),
host_tools: Some(true),
std: Some(true),
},
pointer_width: 64,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub(crate) fn target() -> Target {
llvm_target: "wasm32-wasip2".into(),
metadata: TargetMetadata {
description: Some("WebAssembly".into()),
tier: Some(3),
tier: Some(2),
host_tools: Some(false),
std: Some(true),
},
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_target/src/spec/targets/wasm32_wasip3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ pub(crate) fn target() -> Target {
// and this may grow over time as more features are supported.
let mut target = super::wasm32_wasip2::target();
target.llvm_target = "wasm32-wasip3".into();
target.metadata = crate::spec::TargetMetadata {
description: Some("WebAssembly".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(true),
};
target.options.env = Env::P3;
target
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
metadata: TargetMetadata {
description: Some("64-bit Solaris 11.4".into()),
tier: Some(2),
host_tools: Some(false),
host_tools: Some(true),
std: Some(true),
},
pointer_width: 64,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) fn target() -> Target {
metadata: TargetMetadata {
description: Some("64-bit x86 MinGW (Windows 10+), LLVM ABI".into()),
tier: Some(2),
host_tools: Some(false),
host_tools: Some(true),
std: Some(true),
},
pointer_width: 64,
Expand Down
6 changes: 4 additions & 2 deletions library/alloc/src/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,8 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
///
/// If the returned `ExtractIf` is not exhausted, e.g. because it is dropped without iterating
/// or the iteration short-circuits, then the remaining elements will be retained.
/// Use [`retain`] with a negated predicate if you do not need the returned iterator.
/// Use `extract_if().for_each(drop)` if you do not need the returned iterator,
/// or [`retain`] with a negated predicate if you also do not need to restrict the range.
///
/// [`retain`]: BTreeMap::retain
///
Expand Down Expand Up @@ -1945,7 +1946,8 @@ impl<K, V> Default for Values<'_, K, V> {

/// An iterator produced by calling `extract_if` on BTreeMap.
#[stable(feature = "btree_extract_if", since = "1.91.0")]
#[must_use = "iterators are lazy and do nothing unless consumed"]
#[must_use = "iterators are lazy and do nothing unless consumed; \
use `retain` or `extract_if().for_each(drop)` to remove and discard elements"]
pub struct ExtractIf<
'a,
K,
Expand Down
6 changes: 4 additions & 2 deletions library/alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,8 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
///
/// If the returned `ExtractIf` is not exhausted, e.g. because it is dropped without iterating
/// or the iteration short-circuits, then the remaining elements will be retained.
/// Use [`retain`] with a negated predicate if you do not need the returned iterator.
/// Use `extract_if().for_each(drop)` if you do not need the returned iterator,
/// or [`retain`] with a negated predicate if you also do not need to restrict the range.
///
/// [`retain`]: BTreeSet::retain
/// # Examples
Expand Down Expand Up @@ -1547,7 +1548,8 @@ impl<'a, T, A: Allocator + Clone> IntoIterator for &'a BTreeSet<T, A> {

/// An iterator produced by calling `extract_if` on BTreeSet.
#[stable(feature = "btree_extract_if", since = "1.91.0")]
#[must_use = "iterators are lazy and do nothing unless consumed"]
#[must_use = "iterators are lazy and do nothing unless consumed; \
use `retain` or `extract_if().for_each(drop)` to remove and discard elements"]
pub struct ExtractIf<
'a,
T,
Expand Down
3 changes: 2 additions & 1 deletion library/alloc/src/collections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1943,7 +1943,8 @@ impl<'a, T, A: Allocator> CursorMut<'a, T, A> {

/// An iterator produced by calling `extract_if` on LinkedList.
#[stable(feature = "extract_if", since = "1.87.0")]
#[must_use = "iterators are lazy and do nothing unless consumed"]
#[must_use = "iterators are lazy and do nothing unless consumed; \
use `extract_if().for_each(drop)` to remove and discard elements"]
pub struct ExtractIf<
'a,
T: 'a,
Expand Down
3 changes: 2 additions & 1 deletion library/alloc/src/collections/vec_deque/extract_if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ use crate::alloc::{Allocator, Global};
/// let iter: ExtractIf<'_, _, _> = v.extract_if(.., |x| *x % 2 == 0);
/// ```
#[unstable(feature = "vec_deque_extract_if", issue = "147750")]
#[must_use = "iterators are lazy and do nothing unless consumed"]
#[must_use = "iterators are lazy and do nothing unless consumed; \
use `retain_mut` or `extract_if().for_each(drop)` to remove and discard elements"]
pub struct ExtractIf<
'a,
T,
Expand Down
3 changes: 2 additions & 1 deletion library/alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,8 @@ impl<T, A: Allocator> VecDeque<T, A> {
///
/// If the returned `ExtractIf` is not exhausted, e.g. because it is dropped without iterating
/// or the iteration short-circuits, then the remaining elements will be retained.
/// Use [`retain_mut`] with a negated predicate if you do not need the returned iterator.
/// Use `extract_if().for_each(drop)` if you do not need the returned iterator,
/// or [`retain_mut`] with a negated predicate if you also do not need to restrict the range.
///
/// [`retain_mut`]: VecDeque::retain_mut
///
Expand Down
3 changes: 2 additions & 1 deletion library/alloc/src/vec/extract_if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ use crate::alloc::{Allocator, Global};
/// let iter: std::vec::ExtractIf<'_, _, _> = v.extract_if(.., |x| *x % 2 == 0);
/// ```
#[stable(feature = "extract_if", since = "1.87.0")]
#[must_use = "iterators are lazy and do nothing unless consumed"]
#[must_use = "iterators are lazy and do nothing unless consumed; \
use `retain_mut` or `extract_if().for_each(drop)` to remove and discard elements"]
pub struct ExtractIf<
'a,
T,
Expand Down
3 changes: 2 additions & 1 deletion library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3933,7 +3933,8 @@ impl<T, A: Allocator> Vec<T, A> {
///
/// If the returned `ExtractIf` is not exhausted, e.g. because it is dropped without iterating
/// or the iteration short-circuits, then the remaining elements will be retained.
/// Use [`retain_mut`] with a negated predicate if you do not need the returned iterator.
/// Use `extract_if().for_each(drop)` if you do not need the returned iterator,
/// or [`retain_mut`] with a negated predicate if you also do not need to restrict the range.
///
/// [`retain_mut`]: Vec::retain_mut
///
Expand Down
61 changes: 52 additions & 9 deletions library/core/src/range/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::iter::{
};
use crate::num::NonZero;
use crate::range::{Range, RangeFrom, RangeInclusive, legacy};
use crate::{intrinsics, mem};

/// By-value [`Range`] iterator.
#[unstable(feature = "new_range_api", issue = "125687")]
Expand Down Expand Up @@ -168,7 +169,7 @@ impl<A: Step> IterRangeInclusive<A> {
}
}

#[unstable(feature = "trusted_random_access", issue = "none")]
#[unstable(feature = "new_range_api", issue = "125687")]
impl<A: Step> Iterator for IterRangeInclusive<A> {
type Item = A;

Expand Down Expand Up @@ -293,32 +294,74 @@ range_incl_exact_iter_impl! {
/// By-value [`RangeFrom`] iterator.
#[unstable(feature = "new_range_api", issue = "125687")]
#[derive(Debug, Clone)]
pub struct IterRangeFrom<A>(legacy::RangeFrom<A>);
pub struct IterRangeFrom<A> {
start: A,
/// Whether the first element of the iterator has yielded.
/// Only used when overflow checks are enabled.
first: bool,
}

impl<A> IterRangeFrom<A> {
impl<A: Step> IterRangeFrom<A> {
/// Returns the remainder of the range being iterated over.
#[inline]
#[rustc_inherit_overflow_checks]
pub fn remainder(self) -> RangeFrom<A> {
RangeFrom { start: self.0.start }
if intrinsics::overflow_checks() {
if !self.first {
return RangeFrom { start: Step::forward(self.start, 1) };
}
}

RangeFrom { start: self.start }
}
}

#[unstable(feature = "trusted_random_access", issue = "none")]
#[unstable(feature = "new_range_api", issue = "125687")]
impl<A: Step> Iterator for IterRangeFrom<A> {
type Item = A;

#[inline]
#[rustc_inherit_overflow_checks]
fn next(&mut self) -> Option<A> {
self.0.next()
if intrinsics::overflow_checks() {
if self.first {
self.first = false;
return Some(self.start.clone());
}

self.start = Step::forward(self.start.clone(), 1);
return Some(self.start.clone());
}

let n = Step::forward(self.start.clone(), 1);
Some(mem::replace(&mut self.start, n))
}

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
self.0.size_hint()
(usize::MAX, None)
}

#[inline]
#[rustc_inherit_overflow_checks]
fn nth(&mut self, n: usize) -> Option<A> {
self.0.nth(n)
if intrinsics::overflow_checks() {
if self.first {
self.first = false;

let plus_n = Step::forward(self.start.clone(), n);
self.start = plus_n.clone();
return Some(plus_n);
}

let plus_n = Step::forward(self.start.clone(), n);
self.start = Step::forward(plus_n.clone(), 1);
return Some(self.start.clone());
}

let plus_n = Step::forward(self.start.clone(), n);
self.start = Step::forward(plus_n.clone(), 1);
Some(plus_n)
}
}

Expand All @@ -334,6 +377,6 @@ impl<A: Step> IntoIterator for RangeFrom<A> {
type IntoIter = IterRangeFrom<A>;

fn into_iter(self) -> Self::IntoIter {
IterRangeFrom(self.into())
IterRangeFrom { start: self.start, first: true }
}
}
3 changes: 2 additions & 1 deletion library/std/src/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,8 @@ impl<'a, K, V> Drain<'a, K, V> {
/// let iter = map.extract_if(|_k, v| *v % 2 == 0);
/// ```
#[stable(feature = "hash_extract_if", since = "1.88.0")]
#[must_use = "iterators are lazy and do nothing unless consumed"]
#[must_use = "iterators are lazy and do nothing unless consumed; \
use `retain` to remove and discard elements"]
pub struct ExtractIf<'a, K, V, F> {
base: base::ExtractIf<'a, K, V, F>,
}
Expand Down
2 changes: 2 additions & 0 deletions library/std/src/collections/hash/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,8 @@ pub struct Drain<'a, K: 'a> {
/// let mut extract_ifed = a.extract_if(|v| v % 2 == 0);
/// ```
#[stable(feature = "hash_extract_if", since = "1.88.0")]
#[must_use = "iterators are lazy and do nothing unless consumed; \
use `retain` to remove and discard elements"]
pub struct ExtractIf<'a, K, F> {
base: base::ExtractIf<'a, K, F>,
}
Expand Down
5 changes: 5 additions & 0 deletions library/std/src/os/unix/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ pub trait CommandExt: Sealed {
/// or acquiring a mutex are not guaranteed to work (due to
/// other threads perhaps still running when the `fork` was run).
///
/// Note that the list of allocating functions includes [`Error::new`] and
/// [`Error::other`]. To signal a non-trivial error, prefer [`panic!`].
///
/// For further details refer to the [POSIX fork() specification]
/// and the equivalent documentation for any targeted
/// platform, especially the requirements around *async-signal-safety*.
Expand All @@ -102,6 +105,8 @@ pub trait CommandExt: Sealed {
/// [POSIX fork() specification]:
/// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fork.html
/// [`std::env`]: mod@crate::env
/// [`Error::new`]: crate::io::Error::new
/// [`Error::other`]: crate::io::Error::other
#[stable(feature = "process_pre_exec", since = "1.34.0")]
unsafe fn pre_exec<F>(&mut self, f: F) -> &mut process::Command
where
Expand Down
2 changes: 1 addition & 1 deletion library/std_detect/src/detect/os/openbsd/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub(crate) fn detect_features() -> cache::Initializer {
// the feature is available.
let aa64pfr0 = sysctl64(&[libc::CTL_MACHDEP, CPU_ID_AA64PFR0]);

super::aarch64::parse_system_registers(aa64isar0, aa64isar1, aa64mmfr2, aa64pfr0)
crate::detect::aarch64::parse_system_registers(aa64isar0, aa64isar1, aa64mmfr2, aa64pfr0)
}

#[inline]
Expand Down
10 changes: 7 additions & 3 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use tracing::instrument;
use crate::core::build_steps::compile::{get_codegen_backend_file, normalize_codegen_backend_name};
use crate::core::build_steps::doc::DocumentationFormat;
use crate::core::build_steps::tool::{
self, RustcPrivateCompilers, Tool, ToolTargetBuildMode, get_tool_target_compiler,
self, RustcPrivateCompilers, ToolTargetBuildMode, get_tool_target_compiler,
};
use crate::core::build_steps::vendor::{VENDOR_DIR, Vendor};
use crate::core::build_steps::{compile, llvm};
Expand Down Expand Up @@ -2695,10 +2695,14 @@ impl Step for BuildManifest {
}

fn run(self, builder: &Builder<'_>) -> GeneratedTarball {
let build_manifest = builder.tool_exe(Tool::BuildManifest);
// FIXME: Should BuildManifest actually be built for `self.target`?
// Today CI only builds this step where that matches the host_target so it doesn't matter
// today.
let build_manifest =
builder.ensure(tool::BuildManifest::new(builder, builder.config.host_target));

let tarball = Tarball::new(builder, "build-manifest", &self.target.triple);
tarball.add_file(&build_manifest, "bin", FileType::Executable);
tarball.add_file(&build_manifest.tool_path, "bin", FileType::Executable);
tarball.generate()
}

Expand Down
4 changes: 3 additions & 1 deletion src/bootstrap/src/core/build_steps/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ impl Step for BuildManifest {
fn run(self, builder: &Builder<'_>) {
// This gets called by `promote-release`
// (https://github.com/rust-lang/promote-release).
let mut cmd = builder.tool_cmd(Tool::BuildManifest);
let mut cmd = command(
builder.ensure(tool::BuildManifest::new(builder, builder.config.host_target)).tool_path,
);
let sign = builder.config.dist_sign_folder.as_ref().unwrap_or_else(|| {
panic!("\n\nfailed to specify `dist.sign-folder` in `bootstrap.toml`\n\n")
});
Expand Down
Loading
Loading