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
3 changes: 1 addition & 2 deletions library/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies = [
name = "alloc"
version = "0.0.0"
dependencies = [
"bdwgc",
"compiler_builtins",
"core",
"rand",
Expand Down Expand Up @@ -359,7 +360,6 @@ version = "0.0.0"
dependencies = [
"addr2line",
"alloc",
"bdwgc",
"cfg-if",
"compiler_builtins",
"core",
Expand Down Expand Up @@ -409,7 +409,6 @@ dependencies = [
name = "sysroot"
version = "0.0.0"
dependencies = [
"bdwgc",
"proc_macro",
"profiler_builtins",
"std",
Expand Down
2 changes: 2 additions & 0 deletions library/alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ autobenches = false
edition = "2021"

[dependencies]
bdwgc = { path = "../bdwgc" }
core = { path = "../core", public = true }
compiler_builtins = { version = "=0.1.150", features = ['rustc-dep-of-std'] }

Expand Down Expand Up @@ -54,6 +55,7 @@ check-cfg = [
'cfg(bootstrap)',
'cfg(no_global_oom_handling)',
'cfg(no_rc)',
'cfg(no_gc)',
'cfg(no_sync)',
'cfg(randomized_layouts)',
]
4 changes: 4 additions & 0 deletions library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ pub mod __export {
pub use core::hint::must_use;
}

#[cfg(not(no_gc))]
#[unstable(feature = "gc", issue = "none")]
pub use bdwgc;

#[cfg(test)]
#[allow(dead_code)] // Not used in all configurations
pub(crate) mod test_helpers {
Expand Down
5 changes: 0 additions & 5 deletions library/bdwgc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,3 @@ libc = { version = "0.2.148", default-features = false, features = ['rustc-dep-o

[build-dependencies]
cmake = "0.1"

[features]
link-shared = []
gc-assertions = []
gc-debug = []
3 changes: 0 additions & 3 deletions library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ crate-type = ["dylib", "rlib"]
[dependencies]
alloc = { path = "../alloc", public = true }
cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
bdwgc = { path = "../bdwgc" }
panic_unwind = { path = "../panic_unwind", optional = true }
panic_abort = { path = "../panic_abort" }
core = { path = "../core", public = true }
Expand Down Expand Up @@ -108,8 +107,6 @@ log-stats = ["alloc/log-stats"]
premature-finalizer-prevention = []
premature-finalizer-prevention-optimize = []
finalizer-elision = []
bdwgc-assertions = ["bdwgc/gc-assertions"]
bdwgc-debug = ["bdwgc/gc-debug"]
bdwgc-disable = []

# Make panics and failed asserts immediately abort without formatting any message
Expand Down
1 change: 1 addition & 0 deletions library/std/src/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ use core::{fmt, iter};
use crate::alloc::GC_COUNTERS;
#[cfg(not(no_global_oom_handling))]
use crate::alloc::{Global, handle_alloc_error};
use crate::bdwgc;
use crate::sync::{Condvar, Mutex};

#[cfg(feature = "log-stats")]
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ pub use core::unsafe_binder;
#[allow(deprecated, deprecated_in_future)]
pub use core::usize;

#[unstable(feature = "gc", issue = "none")]
pub use alloc_crate::bdwgc;
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc_crate::borrow;
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -604,8 +606,6 @@ pub mod ascii;
pub mod backtrace;
#[unstable(feature = "bstr", issue = "134915")]
pub mod bstr;
#[unstable(feature = "gc", issue = "none")]
use bdwgc;
pub mod collections;
pub mod env;
pub mod error;
Expand Down
6 changes: 3 additions & 3 deletions library/std/src/sys/pal/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Thread {

let ret = crate::bdwgc::GC_pthread_create(
&mut native,
attr.as_ptr() as *const bdwgc::pthread_attr_t,
attr.as_ptr() as *const crate::bdwgc::pthread_attr_t,
Some(thread_start),
p as *mut _,
);
Expand Down Expand Up @@ -323,7 +323,7 @@ impl Thread {

pub fn join(self) {
let id = self.into_id();
let ret = unsafe { bdwgc::GC_pthread_join(id, ptr::null_mut()) };
let ret = unsafe { crate::bdwgc::GC_pthread_join(id, ptr::null_mut()) };
assert!(ret == 0, "failed to join thread: {}", io::Error::from_raw_os_error(ret));
}

Expand All @@ -338,7 +338,7 @@ impl Thread {

impl Drop for Thread {
fn drop(&mut self) {
let ret = unsafe { bdwgc::GC_pthread_detach(self.id) };
let ret = unsafe { crate::bdwgc::GC_pthread_detach(self.id) };
debug_assert_eq!(ret, 0);
}
}
Expand Down
3 changes: 0 additions & 3 deletions library/sysroot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ proc_macro = { path = "../proc_macro", public = true }
profiler_builtins = { path = "../profiler_builtins", optional = true }
std = { path = "../std", public = true }
test = { path = "../test", public = true }
bdwgc = { path = "../bdwgc", public = true }

# Forward features to the `std` crate as necessary
[features]
Expand Down Expand Up @@ -39,6 +38,4 @@ log-stats = ["std/log-stats"]
finalizer-elision = ["std/finalizer-elision"]
premature-finalizer-prevention = ["std/premature-finalizer-prevention"]
premature-finalizer-prevention-optimize = ["std/premature-finalizer-prevention-optimize"]
bdwgc-assertions = ["std/bdwgc-assertions"]
bdwgc-debug = ["std/bdwgc-debug"]
bdwgc-disable = ["std/bdwgc-disable"]
6 changes: 0 additions & 6 deletions src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -692,12 +692,6 @@ impl Build {
if self.config.premature_finalizer_prevention_optimize {
features.insert("premature-finalizer-prevention-optimize");
}
if self.config.bdwgc_assertions {
features.insert("bdwgc-assertions");
}
if self.config.bdwgc_debug {
features.insert("bdwgc-debug");
}
if self.config.bdwgc_disable {
features.insert("bdwgc-disable");
}
Expand Down
1 change: 1 addition & 0 deletions tests/run-make/alloc-no-oom-handling/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ fn main() {
.crate_type("rlib")
.input(source_root().join("library/alloc/src/lib.rs"))
.cfg("no_global_oom_handling")
.cfg("no_gc")
.run();
}
1 change: 1 addition & 0 deletions tests/run-make/alloc-no-rc/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ fn main() {
.crate_type("rlib")
.input(source_root().join("library/alloc/src/lib.rs"))
.cfg("no_rc")
.cfg("no_gc")
.run();
}
1 change: 1 addition & 0 deletions tests/run-make/alloc-no-sync/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ fn main() {
.crate_type("rlib")
.input(source_root().join("library/alloc/src/lib.rs"))
.cfg("no_sync")
.cfg("no_gc")
.run();
}
1 change: 1 addition & 0 deletions tests/run-make/linker-warning/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fn run_rustc() -> Rustc {
.arg("-Clink-self-contained=-linker")
.arg("-Zunstable-options")
.arg("-Wlinker-messages")
.cfg("no_gc")
.output("main")
.linker("./fake-linker");
if run_make_support::target() == "x86_64-unknown-linux-gnu" {
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/linker-warning/short-error.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
error: linking with `./fake-linker` failed: exit status: 1
|
= note: "./fake-linker" "-m64" "/symbols.o" "-Wl,-rpath,<sysroot>/lib" "-Wl,-Bdynamic" "-Wl,--no-as-needed" "-lgc" "-Wl,--as-needed" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libbdwgc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,liballoc-*,librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgc" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build-root/test/run-make/linker-warning/rmake_out" "-L" "/build-root/bdwgc/lib" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error"
= note: "./fake-linker" "-m64" "/symbols.o" "-Wl,-rpath,<sysroot>/lib" "-Wl,-Bdynamic" "-Wl,--no-as-needed" "-lgc" "-Wl,--as-needed" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liballoc-*,libbdwgc-*,liblibc-*,librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lgc" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build-root/test/run-make/linker-warning/rmake_out" "-L" "/build-root/bdwgc/lib" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: error: baz

Expand Down