Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 8dce0b1

Browse files
committed
Auto merge of rust-lang#136614 - workingjubilee:rollup-vm143qj, r=workingjubilee
Rollup of 9 pull requests Successful merges: - rust-lang#135439 (Make `-O` mean `OptLevel::Aggressive`) - rust-lang#136193 (Implement pattern type ffi checks) - rust-lang#136235 (Pretty print pattern type values with transmute if they don't satisfy their pattern) - rust-lang#136311 (Ensure that we never try to monomorphize the upcasting or vtable calls of impossible dyn types) - rust-lang#136315 (Use short ty string for binop and unop errors) - rust-lang#136393 (Fix accidentally not emitting overflowing literals lints anymore in patterns) - rust-lang#136530 (Implement `x perf` directly in bootstrap) - rust-lang#136580 (Couple of changes to run rustc in miri) - rust-lang#136589 (Enable "jump to def" feature on rustc docs) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 942db67 + 932bb59 commit 8dce0b1

File tree

49 files changed

+3890
-479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3890
-479
lines changed

Cargo.lock

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3287,13 +3287,6 @@ dependencies = [
32873287
"tikv-jemalloc-sys",
32883288
]
32893289

3290-
[[package]]
3291-
name = "rustc-perf-wrapper"
3292-
version = "0.1.0"
3293-
dependencies = [
3294-
"clap",
3295-
]
3296-
32973290
[[package]]
32983291
name = "rustc-rayon"
32993292
version = "0.5.1"

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ members = [
4545
"src/tools/rustdoc-gui-test",
4646
"src/tools/opt-dist",
4747
"src/tools/coverage-dump",
48-
"src/tools/rustc-perf-wrapper",
4948
"src/tools/wasm-component-ld",
5049
"src/tools/features-status-dump",
5150
]

compiler/rustc_codegen_cranelift/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ fn build_isa(sess: &Session) -> Arc<dyn TargetIsa + 'static> {
290290
flags_builder.set("opt_level", "none").unwrap();
291291
}
292292
OptLevel::Less
293-
| OptLevel::Default
293+
| OptLevel::More
294294
| OptLevel::Size
295295
| OptLevel::SizeMin
296296
| OptLevel::Aggressive => {

compiler/rustc_codegen_gcc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ fn to_gcc_opt_level(optlevel: Option<OptLevel>) -> OptimizationLevel {
476476
Some(level) => match level {
477477
OptLevel::No => OptimizationLevel::None,
478478
OptLevel::Less => OptimizationLevel::Limited,
479-
OptLevel::Default => OptimizationLevel::Standard,
479+
OptLevel::More => OptimizationLevel::Standard,
480480
OptLevel::Aggressive => OptimizationLevel::Aggressive,
481481
OptLevel::Size | OptLevel::SizeMin => OptimizationLevel::Limited,
482482
},

compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ fn to_llvm_opt_settings(cfg: config::OptLevel) -> (llvm::CodeGenOptLevel, llvm::
138138
match cfg {
139139
No => (llvm::CodeGenOptLevel::None, llvm::CodeGenOptSizeNone),
140140
Less => (llvm::CodeGenOptLevel::Less, llvm::CodeGenOptSizeNone),
141-
Default => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeNone),
141+
More => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeNone),
142142
Aggressive => (llvm::CodeGenOptLevel::Aggressive, llvm::CodeGenOptSizeNone),
143143
Size => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeDefault),
144144
SizeMin => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeAggressive),
@@ -150,7 +150,7 @@ fn to_pass_builder_opt_level(cfg: config::OptLevel) -> llvm::PassBuilderOptLevel
150150
match cfg {
151151
No => llvm::PassBuilderOptLevel::O0,
152152
Less => llvm::PassBuilderOptLevel::O1,
153-
Default => llvm::PassBuilderOptLevel::O2,
153+
More => llvm::PassBuilderOptLevel::O2,
154154
Aggressive => llvm::PassBuilderOptLevel::O3,
155155
Size => llvm::PassBuilderOptLevel::Os,
156156
SizeMin => llvm::PassBuilderOptLevel::Oz,

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl<'a> GccLinker<'a> {
410410
let opt_level = match self.sess.opts.optimize {
411411
config::OptLevel::No => "O0",
412412
config::OptLevel::Less => "O1",
413-
config::OptLevel::Default | config::OptLevel::Size | config::OptLevel::SizeMin => "O2",
413+
config::OptLevel::More | config::OptLevel::Size | config::OptLevel::SizeMin => "O2",
414414
config::OptLevel::Aggressive => "O3",
415415
};
416416

@@ -685,7 +685,7 @@ impl<'a> Linker for GccLinker<'a> {
685685

686686
// GNU-style linkers support optimization with -O. GNU ld doesn't
687687
// need a numeric argument, but other linkers do.
688-
if self.sess.opts.optimize == config::OptLevel::Default
688+
if self.sess.opts.optimize == config::OptLevel::More
689689
|| self.sess.opts.optimize == config::OptLevel::Aggressive
690690
{
691691
self.link_arg("-O1");
@@ -1213,7 +1213,7 @@ impl<'a> Linker for EmLinker<'a> {
12131213
self.cc_arg(match self.sess.opts.optimize {
12141214
OptLevel::No => "-O0",
12151215
OptLevel::Less => "-O1",
1216-
OptLevel::Default => "-O2",
1216+
OptLevel::More => "-O2",
12171217
OptLevel::Aggressive => "-O3",
12181218
OptLevel::Size => "-Os",
12191219
OptLevel::SizeMin => "-Oz",
@@ -1384,7 +1384,7 @@ impl<'a> Linker for WasmLd<'a> {
13841384
self.link_arg(match self.sess.opts.optimize {
13851385
OptLevel::No => "-O0",
13861386
OptLevel::Less => "-O1",
1387-
OptLevel::Default => "-O2",
1387+
OptLevel::More => "-O2",
13881388
OptLevel::Aggressive => "-O3",
13891389
// Currently LLD doesn't support `Os` and `Oz`, so pass through `O2`
13901390
// instead.
@@ -1451,7 +1451,7 @@ impl<'a> WasmLd<'a> {
14511451
let opt_level = match self.sess.opts.optimize {
14521452
config::OptLevel::No => "O0",
14531453
config::OptLevel::Less => "O1",
1454-
config::OptLevel::Default => "O2",
1454+
config::OptLevel::More => "O2",
14551455
config::OptLevel::Aggressive => "O3",
14561456
// wasm-ld only handles integer LTO opt levels. Use O2
14571457
config::OptLevel::Size | config::OptLevel::SizeMin => "O2",
@@ -1525,7 +1525,7 @@ impl<'a> Linker for L4Bender<'a> {
15251525
fn optimize(&mut self) {
15261526
// GNU-style linkers support optimization with -O. GNU ld doesn't
15271527
// need a numeric argument, but other linkers do.
1528-
if self.sess.opts.optimize == config::OptLevel::Default
1528+
if self.sess.opts.optimize == config::OptLevel::More
15291529
|| self.sess.opts.optimize == config::OptLevel::Aggressive
15301530
{
15311531
self.link_arg("-O1");
@@ -1929,7 +1929,7 @@ impl<'a> Linker for LlbcLinker<'a> {
19291929
match self.sess.opts.optimize {
19301930
OptLevel::No => "-O0",
19311931
OptLevel::Less => "-O1",
1932-
OptLevel::Default => "-O2",
1932+
OptLevel::More => "-O2",
19331933
OptLevel::Aggressive => "-O3",
19341934
OptLevel::Size => "-Os",
19351935
OptLevel::SizeMin => "-Oz",
@@ -2006,7 +2006,7 @@ impl<'a> Linker for BpfLinker<'a> {
20062006
self.link_arg(match self.sess.opts.optimize {
20072007
OptLevel::No => "-O0",
20082008
OptLevel::Less => "-O1",
2009-
OptLevel::Default => "-O2",
2009+
OptLevel::More => "-O2",
20102010
OptLevel::Aggressive => "-O3",
20112011
OptLevel::Size => "-Os",
20122012
OptLevel::SizeMin => "-Oz",

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ impl ModuleConfig {
236236
// Copy what clang does by turning on loop vectorization at O2 and
237237
// slp vectorization at O3.
238238
vectorize_loop: !sess.opts.cg.no_vectorize_loops
239-
&& (sess.opts.optimize == config::OptLevel::Default
239+
&& (sess.opts.optimize == config::OptLevel::More
240240
|| sess.opts.optimize == config::OptLevel::Aggressive),
241241
vectorize_slp: !sess.opts.cg.no_vectorize_slp
242242
&& sess.opts.optimize == config::OptLevel::Aggressive,
@@ -260,7 +260,7 @@ impl ModuleConfig {
260260
MergeFunctions::Trampolines | MergeFunctions::Aliases => {
261261
use config::OptLevel::*;
262262
match sess.opts.optimize {
263-
Aggressive | Default | SizeMin | Size => true,
263+
Aggressive | More | SizeMin | Size => true,
264264
Less | No => false,
265265
}
266266
}

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,12 +1054,12 @@ pub(crate) fn provide(providers: &mut Providers) {
10541054
config::OptLevel::No => return config::OptLevel::No,
10551055
// If globally optimise-speed is already specified, just use that level.
10561056
config::OptLevel::Less => return config::OptLevel::Less,
1057-
config::OptLevel::Default => return config::OptLevel::Default,
1057+
config::OptLevel::More => return config::OptLevel::More,
10581058
config::OptLevel::Aggressive => return config::OptLevel::Aggressive,
10591059
// If globally optimize-for-size has been requested, use -O2 instead (if optimize(size)
10601060
// are present).
1061-
config::OptLevel::Size => config::OptLevel::Default,
1062-
config::OptLevel::SizeMin => config::OptLevel::Default,
1061+
config::OptLevel::Size => config::OptLevel::More,
1062+
config::OptLevel::SizeMin => config::OptLevel::More,
10631063
};
10641064

10651065
let defids = tcx.collect_and_partition_mono_items(cratenum).all_mono_items;

compiler/rustc_data_structures/src/memmap.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ use std::io;
33
use std::ops::{Deref, DerefMut};
44

55
/// A trivial wrapper for [`memmap2::Mmap`] (or `Vec<u8>` on WASM).
6-
#[cfg(not(target_arch = "wasm32"))]
6+
#[cfg(not(any(miri, target_arch = "wasm32")))]
77
pub struct Mmap(memmap2::Mmap);
88

9-
#[cfg(target_arch = "wasm32")]
9+
#[cfg(any(miri, target_arch = "wasm32"))]
1010
pub struct Mmap(Vec<u8>);
1111

12-
#[cfg(not(target_arch = "wasm32"))]
12+
#[cfg(not(any(miri, target_arch = "wasm32")))]
1313
impl Mmap {
1414
/// # Safety
1515
///
@@ -29,7 +29,7 @@ impl Mmap {
2929
}
3030
}
3131

32-
#[cfg(target_arch = "wasm32")]
32+
#[cfg(any(miri, target_arch = "wasm32"))]
3333
impl Mmap {
3434
#[inline]
3535
pub unsafe fn map(mut file: File) -> io::Result<Self> {
@@ -56,13 +56,13 @@ impl AsRef<[u8]> for Mmap {
5656
}
5757
}
5858

59-
#[cfg(not(target_arch = "wasm32"))]
59+
#[cfg(not(any(miri, target_arch = "wasm32")))]
6060
pub struct MmapMut(memmap2::MmapMut);
6161

62-
#[cfg(target_arch = "wasm32")]
62+
#[cfg(any(miri, target_arch = "wasm32"))]
6363
pub struct MmapMut(Vec<u8>);
6464

65-
#[cfg(not(target_arch = "wasm32"))]
65+
#[cfg(not(any(miri, target_arch = "wasm32")))]
6666
impl MmapMut {
6767
#[inline]
6868
pub fn map_anon(len: usize) -> io::Result<Self> {
@@ -82,7 +82,7 @@ impl MmapMut {
8282
}
8383
}
8484

85-
#[cfg(target_arch = "wasm32")]
85+
#[cfg(any(miri, target_arch = "wasm32"))]
8686
impl MmapMut {
8787
#[inline]
8888
pub fn map_anon(len: usize) -> io::Result<Self> {

compiler/rustc_data_structures/src/stack.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ const STACK_PER_RECURSION: usize = 16 * 1024 * 1024; // 16MB
1717
///
1818
/// Should not be sprinkled around carelessly, as it causes a little bit of overhead.
1919
#[inline]
20+
#[cfg(not(miri))]
2021
pub fn ensure_sufficient_stack<R>(f: impl FnOnce() -> R) -> R {
2122
stacker::maybe_grow(RED_ZONE, STACK_PER_RECURSION, f)
2223
}
24+
25+
/// Grows the stack on demand to prevent stack overflow. Call this in strategic locations
26+
/// to "break up" recursive calls. E.g. almost any call to `visit_expr` or equivalent can benefit
27+
/// from this.
28+
///
29+
/// Should not be sprinkled around carelessly, as it causes a little bit of overhead.
30+
#[cfg(miri)]
31+
#[inline]
32+
pub fn ensure_sufficient_stack<R>(f: impl FnOnce() -> R) -> R {
33+
f()
34+
}

0 commit comments

Comments
 (0)