Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update library subtree to 2024-08-07 #54

Merged
merged 6 commits into from
Aug 19, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
489 changes: 489 additions & 0 deletions library/Cargo.lock

Large diffs are not rendered by default.

44 changes: 44 additions & 0 deletions library/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[workspace]
resolver = "1"
members = [
"std",
"sysroot",
]

exclude = [
# stdarch has its own Cargo workspace
"stdarch",
]

[profile.release.package.compiler_builtins]
# For compiler-builtins we always use a high number of codegen units.
# The goal here is to place every single intrinsic into its own object
# file to avoid symbol clashes with the system libgcc if possible. Note
# that this number doesn't actually produce this many object files, we
# just don't create more than this number of object files.
#
# It's a bit of a bummer that we have to pass this here, unfortunately.
# Ideally this would be specified through an env var to Cargo so Cargo
# knows how many CGUs are for this specific crate, but for now
# per-crate configuration isn't specifiable in the environment.
codegen-units = 10000

# These dependencies of the standard library implement symbolication for
# backtraces on most platforms. Their debuginfo causes both linking to be slower
# (more data to chew through) and binaries to be larger without really all that
# much benefit. This section turns them all to down to have no debuginfo which
# helps to improve link times a little bit.
[profile.release.package]
addr2line.debug = 0
adler.debug = 0
gimli.debug = 0
miniz_oxide.debug = 0
object.debug = 0
rustc-demangle.debug = 0

[patch.crates-io]
# See comments in `library/rustc-std-workspace-core/README.md` for what's going on
# here
rustc-std-workspace-core = { path = 'rustc-std-workspace-core' }
rustc-std-workspace-alloc = { path = 'rustc-std-workspace-alloc' }
rustc-std-workspace-std = { path = 'rustc-std-workspace-std' }
7 changes: 5 additions & 2 deletions library/alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ edition = "2021"

[dependencies]
core = { path = "../core" }
compiler_builtins = { version = "0.1.40", features = ['rustc-dep-of-std'] }
compiler_builtins = { version = "0.1.114", features = ['rustc-dep-of-std'] }

[target.'cfg(not(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")))'.dependencies]
compiler_builtins = { version = "0.1.114", features = ["no-f16-f128"] }

[dev-dependencies]
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
Expand Down Expand Up @@ -38,8 +41,8 @@ harness = false
compiler-builtins-mem = ['compiler_builtins/mem']
compiler-builtins-c = ["compiler_builtins/c"]
compiler-builtins-no-asm = ["compiler_builtins/no-asm"]
compiler-builtins-no-f16-f128 = ["compiler_builtins/no-f16-f128"]
compiler-builtins-mangled-names = ["compiler_builtins/mangled-names"]
compiler-builtins-weak-intrinsics = ["compiler_builtins/weak-intrinsics"]
# Make panics and failed asserts immediately abort without formatting any message
panic_immediate_abort = ["core/panic_immediate_abort"]
# Choose algorithms that are optimized for binary size instead of runtime performance
Expand Down
3 changes: 2 additions & 1 deletion library/alloc/benches/btree/map.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::collections::BTreeMap;
use std::ops::RangeBounds;

use rand::{seq::SliceRandom, Rng};
use rand::seq::SliceRandom;
use rand::Rng;
use test::{black_box, Bencher};

macro_rules! map_insert_rand_bench {
Expand Down
1 change: 1 addition & 0 deletions library/alloc/benches/linked_list.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::collections::LinkedList;

use test::Bencher;

#[bench]
Expand Down
1 change: 1 addition & 0 deletions library/alloc/benches/string.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::iter::repeat;

use test::{black_box, Bencher};

#[bench]
Expand Down
3 changes: 2 additions & 1 deletion library/alloc/benches/vec.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use rand::RngCore;
use std::iter::repeat;

use rand::RngCore;
use test::{black_box, Bencher};

#[bench]
Expand Down
7 changes: 3 additions & 4 deletions library/alloc/benches/vec_deque.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::{
collections::{vec_deque, VecDeque},
mem,
};
use std::collections::{vec_deque, VecDeque};
use std::mem;

use test::{black_box, Bencher};

#[bench]
Expand Down
3 changes: 2 additions & 1 deletion library/alloc/benches/vec_deque_append.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{collections::VecDeque, time::Instant};
use std::collections::VecDeque;
use std::time::Instant;

const VECDEQUE_LEN: i32 = 100000;
const WARMUP_N: usize = 100;
Expand Down
18 changes: 8 additions & 10 deletions library/alloc/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

#![stable(feature = "alloc_module", since = "1.28.0")]

#[stable(feature = "alloc_module", since = "1.28.0")]
#[doc(inline)]
pub use core::alloc::*;
#[cfg(not(test))]
use core::hint;

#[cfg(not(test))]
use core::ptr::{self, NonNull};

#[stable(feature = "alloc_module", since = "1.28.0")]
#[doc(inline)]
pub use core::alloc::*;

#[cfg(test)]
mod tests;

Expand Down Expand Up @@ -57,7 +55,7 @@ pub struct Global;
#[cfg(test)]
pub use std::alloc::Global;

/// Allocate memory with the global allocator.
/// Allocates memory with the global allocator.
///
/// This function forwards calls to the [`GlobalAlloc::alloc`] method
/// of the allocator registered with the `#[global_allocator]` attribute
Expand Down Expand Up @@ -101,7 +99,7 @@ pub unsafe fn alloc(layout: Layout) -> *mut u8 {
}
}

/// Deallocate memory with the global allocator.
/// Deallocates memory with the global allocator.
///
/// This function forwards calls to the [`GlobalAlloc::dealloc`] method
/// of the allocator registered with the `#[global_allocator]` attribute
Expand All @@ -119,7 +117,7 @@ pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) {
unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
}

/// Reallocate memory with the global allocator.
/// Reallocates memory with the global allocator.
///
/// This function forwards calls to the [`GlobalAlloc::realloc`] method
/// of the allocator registered with the `#[global_allocator]` attribute
Expand All @@ -138,7 +136,7 @@ pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
unsafe { __rust_realloc(ptr, layout.size(), layout.align(), new_size) }
}

/// Allocate zero-initialized memory with the global allocator.
/// Allocates zero-initialized memory with the global allocator.
///
/// This function forwards calls to the [`GlobalAlloc::alloc_zeroed`] method
/// of the allocator registered with the `#[global_allocator]` attribute
Expand Down Expand Up @@ -345,7 +343,7 @@ extern "Rust" {
fn __rust_alloc_error_handler(size: usize, align: usize) -> !;
}

/// Signal a memory allocation error.
/// Signals a memory allocation error.
///
/// Callers of memory allocation APIs wishing to cease execution
/// in response to an allocation error are encouraged to call this function,
Expand Down
3 changes: 2 additions & 1 deletion library/alloc/src/alloc/tests.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use super::*;

extern crate test;
use crate::boxed::Box;
use test::Bencher;

use crate::boxed::Box;

#[test]
fn allocate_zeroed() {
unsafe {
Expand Down
7 changes: 3 additions & 4 deletions library/alloc/src/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@

#![stable(feature = "rust1", since = "1.0.0")]

#[stable(feature = "rust1", since = "1.0.0")]
pub use core::borrow::{Borrow, BorrowMut};
use core::cmp::Ordering;
use core::hash::{Hash, Hasher};
#[cfg(not(no_global_oom_handling))]
use core::ops::{Add, AddAssign};
use core::ops::{Deref, DerefPure};

#[stable(feature = "rust1", since = "1.0.0")]
pub use core::borrow::{Borrow, BorrowMut};
use Cow::*;

use crate::fmt;
#[cfg(not(no_global_oom_handling))]
use crate::string::String;

use Cow::*;

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, B: ?Sized> Borrow<B> for Cow<'a, B>
where
Expand Down
Loading
Loading