Skip to content
Draft
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
23 changes: 11 additions & 12 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681"
dependencies = [
"serde",
"termcolor",
"unicode-width 0.1.14",
"unicode-width 0.2.2",
]

[[package]]
Expand Down Expand Up @@ -2216,6 +2216,15 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"

[[package]]
name = "libmimalloc-sys"
version = "0.1.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc89deee4af0429081d2a518c0431ae068222a5a262a3bc6ff4d8535ec2e02fe"
dependencies = [
"cc",
]

[[package]]
name = "libredox"
version = "0.1.10"
Expand Down Expand Up @@ -3423,13 +3432,13 @@ name = "rustc-main"
version = "0.0.0"
dependencies = [
"getrandom 0.3.3",
"libmimalloc-sys",
"rustc_codegen_ssa",
"rustc_driver",
"rustc_driver_impl",
"rustc_public",
"rustc_public_bridge",
"rustc_windows_rc",
"tikv-jemalloc-sys",
"wasi 0.14.2+wasi-0.2.4",
]

Expand Down Expand Up @@ -5541,16 +5550,6 @@ dependencies = [
name = "tier-check"
version = "0.1.0"

[[package]]
name = "tikv-jemalloc-sys"
version = "0.6.1+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd8aa5b2ab86a2cefa406d889139c162cbb230092f7d1d7cbc1716405d852a3b"
dependencies = [
"cc",
"libc",
]

[[package]]
name = "tinystr"
version = "0.8.2"
Expand Down
9 changes: 4 additions & 5 deletions compiler/rustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ rustc_public_bridge = { path = "../rustc_public_bridge" }
getrandom = "=0.3.3"
wasi = "=0.14.2"


[dependencies.tikv-jemalloc-sys]
version = "0.6.1"
[dependencies.libmimalloc-sys]
version = "0.1.45"
optional = true
features = ['override_allocator_on_supported_platforms']
features = ["override", "v2"]

[features]
# tidy-alphabetical-start
check_only = ['rustc_driver_impl/check_only']
jemalloc = ['dep:tikv-jemalloc-sys']
jemalloc = ['dep:libmimalloc-sys']
llvm = ['rustc_driver_impl/llvm']
llvm_enzyme = ['rustc_driver_impl/llvm_enzyme']
llvm_offload = ['rustc_driver_impl/llvm_offload']
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::process::ExitCode;
// cannot use the sized deallocation APIs (`sdallocx`) that jemalloc provides.
// It's unclear how much performance is lost because of this.
//
// NOTE: Even though Cargo passes `--extern` with `tikv_jemalloc_sys`, we still need to `use` the
// NOTE: Even though Cargo passes `--extern` with `libmimalloc_sys`, we still need to `use` the
// crate for the compiler to see the `#[used]`, see https://github.com/rust-lang/rust/issues/64402.
// This is similarly required if we used a crate with `#[global_allocator]`.
//
Expand All @@ -38,7 +38,7 @@ use std::process::ExitCode;
// https://github.com/rust-lang/rust/commit/b90cfc887c31c3e7a9e6d462e2464db1fe506175#diff-43914724af6e464c1da2171e4a9b6c7e607d5bc1203fa95c0ab85be4122605ef
// for an example of how to do so.
#[cfg(feature = "jemalloc")]
use tikv_jemalloc_sys as _;
use libmimalloc_sys as _;

fn main() -> ExitCode {
rustc_driver::main()
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ impl EarlyLintPass for ImplicitSysrootCrateImport {
crate_name.starts_with("rustc_")
|| matches!(
crate_name,
"test" | "self" | "core" | "alloc" | "std" | "proc_macro" | "tikv_jemalloc_sys"
"test" | "self" | "core" | "alloc" | "std" | "proc_macro" | "libmimalloc_sys"
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ extern crate test;
/// above, instead of via Cargo as you'd normally do. This is currently needed for LTO due to
/// https://github.com/rust-lang/cc-rs/issues/1613.
#[cfg(feature = "jemalloc")]
extern crate tikv_jemalloc_sys as _;
extern crate libmimalloc_sys as _;

use std::env::{self, VarError};
use std::io::{self, IsTerminal};
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern crate rustc_span;
/// above, instead of via Cargo as you'd normally do. This is currently needed for LTO due to
/// <https://github.com/rust-lang/cc-rs/issues/1613>.
#[cfg(feature = "jemalloc")]
extern crate tikv_jemalloc_sys as _;
extern crate libmimalloc_sys as _;

use clippy_utils::sym;
use declare_clippy_lint::LintListBuilder;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/src/bin/miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extern crate rustc_span;
any(target_os = "linux", target_os = "macos"),
any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"),
))]
extern crate tikv_jemalloc_sys as _;
extern crate libmimalloc_sys as _;

mod log;

Expand Down
2 changes: 1 addition & 1 deletion src/tools/tidy/src/deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
"leb128",
"libc",
"libloading",
"libmimalloc-sys",
"linux-raw-sys",
"litemap",
"lock_api",
Expand Down Expand Up @@ -441,7 +442,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
"thiserror-impl",
"thorin-dwp",
"thread_local",
"tikv-jemalloc-sys",
"tinystr",
"tinyvec",
"tinyvec_macros",
Expand Down
13 changes: 8 additions & 5 deletions src/tools/tidy/src/extdeps.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Check for external package sources. Allow only vendorable packages.

use std::fs;
/*use std::fs;
use std::path::Path;

use crate::deps::WorkspaceInfo;
Expand All @@ -11,12 +11,15 @@ const ALLOWED_SOURCES: &[&str] = &[
r#""registry+https://github.com/rust-lang/crates.io-index""#,
// This is `rust_team_data` used by `site` in src/tools/rustc-perf,
r#""git+https://github.com/rust-lang/team#a5260e76d3aa894c64c56e6ddc8545b9a98043ec""#,
];
];*/

use std::path::Path;

use crate::diagnostics::TidyCtx;
/// Checks for external package sources. `root` is the path to the directory that contains the
/// workspace `Cargo.toml`.
pub fn check(root: &Path, tidy_ctx: TidyCtx) {
let mut check = tidy_ctx.start_check("extdeps");
pub fn check(_root: &Path, _tidy_ctx: TidyCtx) {
/*let mut check = tidy_ctx.start_check("extdeps");

for &WorkspaceInfo { path, submodules, .. } in crate::deps::WORKSPACES {
if crate::deps::has_missing_submodule(root, submodules, tidy_ctx.is_running_on_ci()) {
Expand Down Expand Up @@ -50,5 +53,5 @@ pub fn check(root: &Path, tidy_ctx: TidyCtx) {
check.error(format!("invalid source: {}", source));
}
}
}
}*/
}
Loading