Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2697924
Do not pass `-no-pie` on Windows
mati865 Jul 23, 2026
0ec97c2
Remove unnecessary fmt::Display use for overflow assertion
fereidani Aug 8, 2026
9be1177
Miri: give the incremental session a chance to finish
RalfJung Aug 8, 2026
e8c3f61
fix unused features in Miri tests
RalfJung Aug 8, 2026
f61d317
rustc-book: update sys-v abi link
vilgotf Aug 9, 2026
c1bfb4b
Improve overflow check code generation further
fereidani Aug 8, 2026
dd905cd
std: Adjust cfgs again for TLS on WASI
alexcrichton Aug 10, 2026
0166f50
Add rust_analyzer to check-cfg names
dronavallipranav Aug 10, 2026
1d06f70
Allow running an arbitrary number of try jobs per PR
Kobzol Aug 11, 2026
91de2e3
tests/run-make-cargo/thumb-none-cortex-m: bump `cortex-m` dependency
japaric Aug 11, 2026
6408d38
Add -Zwasm-proc-macro flag
Mark-Simulacrum Aug 10, 2026
4789fa3
Update check-cfg documentation
dronavallipranav Aug 11, 2026
38ef4c8
No longer mention the removed generic
ada4a Aug 11, 2026
152b6c1
Rollup merge of #160620 - mati865:no-no-pie-windows, r=bjorn3
JonathanBrouwer Aug 11, 2026
d703f2b
Rollup merge of #160731 - fereidani:sync_overflow_check, r=joboet
JonathanBrouwer Aug 11, 2026
8db364a
Rollup merge of #160760 - RalfJung:miri-incremental, r=bjorn3
JonathanBrouwer Aug 11, 2026
6aa656f
Rollup merge of #160854 - Mark-Simulacrum:wasm-macro-partial, r=bjorn…
JonathanBrouwer Aug 11, 2026
1647f45
Rollup merge of #160868 - alexcrichton:adjust-wasi-tls-again, r=clarf…
JonathanBrouwer Aug 11, 2026
26d49ef
Rollup merge of #160894 - Kobzol:try-job-nolimit, r=Mark-Simulacrum
JonathanBrouwer Aug 11, 2026
c0f8b12
Rollup merge of #160790 - vilgotf:sysv-abi, r=mejrs
JonathanBrouwer Aug 11, 2026
ce0d50c
Rollup merge of #160878 - dronavallipranav:add-rust-analyzer-cfg, r=U…
JonathanBrouwer Aug 11, 2026
8e04459
Rollup merge of #160909 - ferrocene:ja/bump-cortex-m-version, r=mejrs
JonathanBrouwer Aug 11, 2026
0b644dc
Rollup merge of #160920 - ada4a:ada/push-lsklksypvrqk, r=lqd
JonathanBrouwer Aug 11, 2026
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
12 changes: 12 additions & 0 deletions bootstrap.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,18 @@
# because bootstrap will attempt to download the JSON docs data for this commit from its CI.
#rust.stdlib-semver-baseline = "<commit-sha>"

# Enables building a wasm proc macro compatible toolchain.
#
# This requires building an additional standard library for a different target and adding it
# to the sysroot before running tests, and so needs special handling in bootstrap. Currently
# off by default.
#
# This currently opts compiletest into running/building proc-macro tests via wasm.
#
# The implementation for this has not finished landing, so you probably don't
# want to enable this right now.
#rust.wasm-proc-macros = false

# =============================================================================
# Distribution options
#
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2383,7 +2383,7 @@ pub enum AbiFromStrErr {
NoExplicitUnwind,
}

// NOTE: This struct is generic over the FieldIdx and VariantIdx for rust-analyzer usage.
// NOTE: This struct is generic over the FieldIdx for rust-analyzer usage.
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
#[cfg_attr(feature = "nightly", derive(StableHash))]
pub struct VariantLayout<FieldIdx: Idx> {
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,8 @@ impl<'a> Linker for GccLinker<'a> {
LinkOutputKind::StaticNoPicExe => {
// `-static` works for both gcc wrapper and ld.
self.link_or_cc_arg("-static");
if !self.is_ld && self.is_gnu {
// noop on windows w/ gcc, warning w/ clang
if !self.is_ld && self.is_gnu && !self.sess.target.is_like_windows {
self.cc_arg("-no-pie");
}
}
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_interface/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ pub(crate) struct MixedBinCrate;
#[diag("cannot mix `proc-macro` crate type with others")]
pub(crate) struct MixedProcMacroCrate;

#[derive(Diagnostic)]
#[diag("cannot compile `proc-macro` crate to wasm targets without -Zwasm-proc-macros")]
pub(crate) struct UnstableWasmProcMacro;

#[derive(Diagnostic)]
#[diag("error writing dependencies to `{$path}`: {$error}")]
pub(crate) struct ErrorWritingDependencies<'a> {
Expand Down
8 changes: 7 additions & 1 deletion compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ fn configure_and_expand(
sess.dcx().emit_err(diagnostics::MixedProcMacroCrate);
}
}

if is_proc_macro_crate && sess.target.is_like_wasm && !sess.opts.unstable_opts.wasm_proc_macros
{
sess.dcx().emit_err(diagnostics::UnstableWasmProcMacro);
}

if crate_types.contains(&CrateType::Sdylib) && !tcx.features().export_stable() {
feature_err(sess, sym::export_stable, DUMMY_SP, "`sdylib` crate type is unstable").emit();
}
Expand Down Expand Up @@ -1312,7 +1318,7 @@ pub(crate) fn start_codegen<'tcx>(
// Skip crate items and just output metadata in -Z no-codegen mode.
tcx.sess.dcx().abort_if_errors();

// Linker::link will skip join_codegen in case of a CodegenResults Any value.
// Linker::link will skip join_codegen in case of a `CompiledModules` Any value.
Box::new(CompiledModules { modules: vec![], allocator_module: None })
} else {
codegen_backend.codegen_crate(tcx)
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ fn test_unstable_options_tracking_hash() {
tracked!(verify_llvm_ir, true);
tracked!(virtual_function_elimination, true);
tracked!(wasi_exec_model, Some(WasiExecModel::Reactor));
tracked!(wasm_proc_macros, true);
// tidy-alphabetical-end

macro_rules! tracked_no_crate_hash {
Expand Down
10 changes: 2 additions & 8 deletions compiler/rustc_interface/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ pub fn get_codegen_backend(
filename if filename.contains('.') => {
load_backend_from_dylib(early_dcx, filename.as_ref())
}
"dummy" => || Box::new(DummyCodegenBackend { target_config_override: None }),
"dummy" => || Box::new(DummyCodegenBackend),
#[cfg(feature = "llvm")]
"llvm" => rustc_codegen_llvm::LlvmCodegenBackend::new,
backend_name => get_codegen_sysroot(early_dcx, sysroot, backend_name),
Expand All @@ -376,20 +376,14 @@ pub fn get_codegen_backend(
unsafe { load() }
}

pub struct DummyCodegenBackend {
pub target_config_override: Option<Box<dyn Fn(&Session) -> TargetConfig>>,
}
pub struct DummyCodegenBackend;

impl CodegenBackend for DummyCodegenBackend {
fn name(&self) -> &'static str {
"dummy"
}

fn target_config(&self, sess: &Session) -> TargetConfig {
if let Some(target_config_override) = &self.target_config_override {
return target_config_override(sess);
}

let abi_required_features = sess.target.abi_required_features();
let internal_target_features = internal_target_features::<0>(
sess,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2027,10 +2027,10 @@ rustc_queries! {
// The hash should not be calculated before the `analysis` pass is complete, specifically
// until `tcx.untracked().definitions.freeze()` has been called, otherwise if incremental
// compilation is enabled calculating this hash can freeze this structure too early in
// compilation and cause subsequent crashes when attempting to write to `definitions`
// compilation and cause subsequent crashes when attempting to write to `definitions`.
query crate_hash(_: CrateNum) -> Svh {
eval_always
desc { "looking up the hash a crate" }
desc { "looking up the hash of a crate" }
separate_provide_extern
}

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_session/src/config/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ impl CheckCfg {
ins!(sym::doc, no_values);
ins!(sym::doctest, no_values);
ins!(sym::miri, no_values);
ins!(sym::rust_analyzer, no_values);
ins!(sym::rustfmt, no_values);

ins!(sym::overflow_checks, no_values);
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2979,6 +2979,8 @@ written to standard error output)"),
// FIXME remove this after a couple releases
wasm_c_abi: () = ((), parse_wasm_c_abi, [TRACKED],
"use spec-compliant C ABI for `wasm32-unknown-unknown` (deprecated, always enabled)"),
wasm_proc_macros: bool = (false, parse_bool, [TRACKED],
"enable support for compiling and loading wasm proc macros"),
write_long_types_to_disk: bool = (true, parse_bool, [UNTRACKED],
"whether long type names should be written to files instead of being printed in errors"),
// tidy-alphabetical-end
Expand Down
18 changes: 13 additions & 5 deletions library/alloc/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ use crate::vec::Vec;
/// See comment in `Arc::clone`.
const MAX_REFCOUNT: usize = (isize::MAX) as usize;

/// The error in case either counter reaches above `MAX_REFCOUNT`, and we can `panic` safely.
const INTERNAL_OVERFLOW_ERROR: &str = "Arc counter overflow";
#[cold]
#[cfg_attr(not(panic = "immediate-abort"), inline(never))]
#[cfg_attr(panic = "immediate-abort", inline)]
#[track_caller]
fn panic_arc_overflow() -> ! {
panic!("Arc counter overflow");
}

#[cfg(not(sanitize = "thread"))]
macro_rules! acquire {
Expand Down Expand Up @@ -1954,8 +1959,9 @@ impl<T: ?Sized, A: Allocator> Arc<T, A> {
}

// We can't allow the refcount to increase much past `MAX_REFCOUNT`.
assert!(cur <= MAX_REFCOUNT, "{}", INTERNAL_OVERFLOW_ERROR);

if cur > MAX_REFCOUNT {
panic_arc_overflow();
}
// NOTE: this code currently ignores the possibility of overflow
// into usize::MAX; in general both Rc and Arc need to be adjusted
// to deal with overflow.
Expand Down Expand Up @@ -3319,7 +3325,9 @@ impl<T: ?Sized, A: Allocator> Weak<T, A> {
return None;
}
// See comments in `Arc::clone` for why we do this (for `mem::forget`).
assert!(n <= MAX_REFCOUNT, "{}", INTERNAL_OVERFLOW_ERROR);
if n > MAX_REFCOUNT {
panic_arc_overflow();
}
Some(n + 1)
}

Expand Down
8 changes: 4 additions & 4 deletions library/std/src/sys/thread_local/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

cfg_select! {
any(
all(target_family = "wasm", not(target_feature = "atomics"), not(target_os = "wasi")),
all(target_family = "wasm", not(target_feature = "atomics"), not(target_env = "p3")),
target_os = "uefi",
target_os = "zkvm",
target_os = "trusty",
Expand Down Expand Up @@ -56,7 +56,7 @@ cfg_select! {
/// single callback that runs all of the destructors in the list.
#[cfg(all(
target_thread_local,
not(all(target_family = "wasm", not(target_feature = "atomics"), not(target_os = "wasi")))
not(all(target_family = "wasm", not(target_feature = "atomics"), not(target_env = "p3")))
))]
pub(crate) mod destructors {
cfg_select! {
Expand Down Expand Up @@ -96,7 +96,7 @@ pub(crate) mod guard {
pub(crate) use windows::enable;
}
any(
all(target_family = "wasm", not(target_os = "wasi")),
all(target_family = "wasm", not(target_env = "p3")),
target_os = "uefi",
target_os = "zkvm",
target_os = "trusty",
Expand Down Expand Up @@ -151,7 +151,7 @@ pub(crate) mod key {
),
all(not(target_thread_local), target_vendor = "apple"),
target_os = "teeos",
target_os = "wasi",
all(target_os = "wasi", target_env = "p3"),
) => {
mod racy;
mod unix;
Expand Down
12 changes: 12 additions & 0 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2277,6 +2277,14 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
builder.ensure(compile::Rustc::new(test_compiler, target));
}

// Build the standard library for wasm32-wasip2 (current target for wasm proc macros).
if builder.config.wasm_proc_macros {
builder.ensure(compile::Std::new(
test_compiler,
TargetSelection::from_user("wasm32-wasip2"),
));
}

if suite == "debuginfo" {
builder.ensure(dist::DebuggerScripts {
sysroot: builder.sysroot(test_compiler).to_path_buf(),
Expand Down Expand Up @@ -2326,6 +2334,10 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the

let is_rustdoc = suite == "rustdoc-ui" || suite == "rustdoc-js";

if builder.config.wasm_proc_macros {
cmd.arg("--wasm-proc-macros");
}

// There are (potentially) 2 `cargo`s to consider:
//
// - A "bootstrap" cargo, which is the same cargo used to build bootstrap itself, and is
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ pub struct Config {
pub skip_std_check_if_no_download_rustc: bool,

pub exec_ctx: ExecutionContext,

pub wasm_proc_macros: bool,
}

impl Config {
Expand Down Expand Up @@ -615,6 +617,7 @@ impl Config {
break_on_ice: rust_break_on_ice,
rustflags: rust_rustflags,
stdlib_semver_baseline: rust_stdlib_semver_baseline,
wasm_proc_macros,
} = toml_rust.unwrap_or_default();

let Llvm {
Expand Down Expand Up @@ -1611,6 +1614,7 @@ NOTE: Please add `--stage 2` to your command line, or if you're sure you want to
.unwrap_or(rust_debug == Some(true)),
vendor,
verbose_tests,
wasm_proc_macros: wasm_proc_macros.unwrap_or(false),
windows_rc: build_windows_rc.map(PathBuf::from),
yarn: build_yarn.map(PathBuf::from),
// tidy-alphabetical-end
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/src/core/config/toml/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ define_config! {
break_on_ice: Option<bool> = "break-on-ice",
parallel_frontend_threads: Option<u32> = "parallel-frontend-threads",
stdlib_semver_baseline: Option<String> = "stdlib-semver-baseline",
wasm_proc_macros: Option<bool> = "wasm-proc-macros",
}
}

Expand Down Expand Up @@ -393,6 +394,7 @@ pub fn check_incompatible_options_for_ci_rustc(
bootstrap_override_lld: _,
rustflags: _,
stdlib_semver_baseline: _,
wasm_proc_macros: _,
} = ci_rust_config;

// There are two kinds of checks for CI rustc incompatible options:
Expand Down
11 changes: 9 additions & 2 deletions src/bootstrap/src/utils/cc_detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn new_cc_build(build: &Build, target: TargetSelection) -> cc::Build {
/// by combining the primary build target, host targets, and any additional targets. For
/// each target, it calls [`fill_target_compiler`] to configure the necessary compiler tools.
pub fn fill_compilers(build: &mut Build) {
let targets: HashSet<_> = match build.config.cmd {
let mut targets: HashSet<_> = match build.config.cmd {
// We don't need to check cross targets for these commands.
crate::Subcommand::Clean { .. }
| crate::Subcommand::Check { .. }
Expand All @@ -90,7 +90,14 @@ pub fn fill_compilers(build: &mut Build) {
}
};

for target in targets.into_iter() {
// When we intend to build wasm proc macros, we'll need to detect a toolchain for linking those
// as well. In the future it would be good to make this a no-op given that we shouldn't need to
// build any C/C++ code for wasm...
if build.config.wasm_proc_macros {
targets.insert(TargetSelection::from_user("wasm32-wasip2"));
}

for target in targets {
fill_target_compiler(build, target);
}
}
Expand Down
12 changes: 8 additions & 4 deletions src/ci/citool/src/jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ pub enum RunType {
/// Workflows that run after a push to a PR branch
PullRequest,
/// Try run started with @bors try
TryJob { job_patterns: Option<Vec<String>> },
TryJob {
job_patterns: Option<Vec<String>>,
/// Should the limit on the number of try jobs be ignored?
nolimit: bool,
},
/// Merge attempt workflow
AutoJob,
/// Fake job only used for sharing Github Actions cache.
Expand All @@ -289,7 +293,7 @@ fn calculate_jobs(
) -> anyhow::Result<Vec<GithubActionsJob>> {
let (jobs, prefix, base_env) = match run_type {
RunType::PullRequest => (db.pr_jobs.clone(), "PR", &db.envs.pr_env),
RunType::TryJob { job_patterns } => {
RunType::TryJob { job_patterns, nolimit } => {
let jobs = if let Some(patterns) = job_patterns {
let mut jobs: Vec<Job> = vec![];
let mut unknown_patterns = vec![];
Expand All @@ -311,7 +315,7 @@ fn calculate_jobs(
unknown_patterns.join(", ")
));
}
if jobs.len() > MAX_TRY_JOBS_COUNT {
if jobs.len() > MAX_TRY_JOBS_COUNT && !nolimit {
return Err(anyhow::anyhow!(
"It is only possible to schedule up to {MAX_TRY_JOBS_COUNT} custom jobs, received {} custom jobs expanded from {} pattern(s)",
jobs.len(),
Expand Down Expand Up @@ -342,7 +346,7 @@ fn calculate_jobs(
// built toolchain using `rustup-toolchain-install-master`),
// we inject the `DIST_TRY_BUILD` environment variable to the jobs
// to tell `opt-dist` to make the build faster by skipping certain steps.
if let RunType::TryJob { job_patterns } = run_type {
if let RunType::TryJob { job_patterns, nolimit: _ } = run_type {
if job_patterns.is_none() {
env.insert(
"DIST_TRY_BUILD".to_string(),
Expand Down
Loading
Loading