Skip to content

Commit 5a7a0ac

Browse files
committed
Auto merge of rust-lang#83890 - Dylan-DPC:rollup-9fqy3fe, r=Dylan-DPC
Rollup of 5 pull requests Successful merges: - rust-lang#83368 (Add `download-rustc = "if-unchanged"`) - rust-lang#83705 (Give a better error when --theme is not a CSS file) - rust-lang#83853 (Disallow the use of high byte registes as operands on x86_64) - rust-lang#83877 (Remove unnecessary exceptions to the platform-specific code check) - rust-lang#83878 (Fix racing file access in tidy) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 39eee17 + d856a26 commit 5a7a0ac

File tree

17 files changed

+50
-53
lines changed

17 files changed

+50
-53
lines changed

compiler/rustc_target/src/asm/arm.rs

-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ fn frame_pointer_r11(
6868
_arch: InlineAsmArch,
6969
has_feature: impl FnMut(&str) -> bool,
7070
target: &Target,
71-
_allocating: bool,
7271
) -> Result<(), &'static str> {
7372
if !frame_pointer_is_r7(has_feature, target) {
7473
Err("the frame pointer (r11) cannot be used as an operand for inline asm")
@@ -81,7 +80,6 @@ fn frame_pointer_r7(
8180
_arch: InlineAsmArch,
8281
has_feature: impl FnMut(&str) -> bool,
8382
target: &Target,
84-
_allocating: bool,
8583
) -> Result<(), &'static str> {
8684
if frame_pointer_is_r7(has_feature, target) {
8785
Err("the frame pointer (r7) cannot be used as an operand for inline asm")

compiler/rustc_target/src/asm/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ macro_rules! def_regs {
9090
match name {
9191
$(
9292
$($alias)|* | $reg_name => {
93-
$($filter(_arch, &mut _has_feature, _target, false)?;)?
93+
$($filter(_arch, &mut _has_feature, _target)?;)?
9494
Ok(Self::$reg)
9595
}
9696
)*
@@ -114,7 +114,7 @@ macro_rules! def_regs {
114114
#[allow(unused_imports)]
115115
use super::{InlineAsmReg, InlineAsmRegClass};
116116
$(
117-
if $($filter(_arch, &mut _has_feature, _target, true).is_ok() &&)? true {
117+
if $($filter(_arch, &mut _has_feature, _target).is_ok() &&)? true {
118118
if let Some(set) = _map.get_mut(&InlineAsmRegClass::$arch($arch_regclass::$class)) {
119119
set.insert(InlineAsmReg::$arch($arch_reg::$reg));
120120
}

compiler/rustc_target/src/asm/riscv.rs

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ fn not_e(
5252
_arch: InlineAsmArch,
5353
mut has_feature: impl FnMut(&str) -> bool,
5454
_target: &Target,
55-
_allocating: bool,
5655
) -> Result<(), &'static str> {
5756
if has_feature("e") {
5857
Err("register can't be used with the `e` target feature")

compiler/rustc_target/src/asm/x86.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ fn x86_64_only(
133133
arch: InlineAsmArch,
134134
_has_feature: impl FnMut(&str) -> bool,
135135
_target: &Target,
136-
_allocating: bool,
137136
) -> Result<(), &'static str> {
138137
match arch {
139138
InlineAsmArch::X86 => Err("register is only available on x86_64"),
@@ -146,13 +145,9 @@ fn high_byte(
146145
arch: InlineAsmArch,
147146
_has_feature: impl FnMut(&str) -> bool,
148147
_target: &Target,
149-
allocating: bool,
150148
) -> Result<(), &'static str> {
151149
match arch {
152-
InlineAsmArch::X86_64 if allocating => {
153-
// The error message isn't actually used...
154-
Err("high byte registers are not allocated by reg_byte")
155-
}
150+
InlineAsmArch::X86_64 => Err("high byte registers cannot be used as an operand on x86_64"),
156151
_ => Ok(()),
157152
}
158153
}

config.toml.example

+3-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,9 @@ changelog-seen = 2
373373
# Whether to download the stage 1 and 2 compilers from CI.
374374
# This is mostly useful for tools; if you have changes to `compiler/` they will be ignored.
375375
#
376-
# FIXME: currently, this also uses the downloaded compiler for stage0, but that causes unnecessary rebuilds.
376+
# You can set this to "if-unchanged" to only download if `compiler/` has not been modified.
377+
#
378+
# FIXME(#82739): currently, this also uses the downloaded compiler for stage0, but that causes unnecessary rebuilds.
377379
#download-rustc = false
378380

379381
# Number of codegen units to use for each compiler invocation. A value of 0

src/bootstrap/bootstrap.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,10 @@ def fix_bin_or_dylib(self, fname, rpath_libz=False):
644644
# If `download-rustc` is set, download the most recent commit with CI artifacts
645645
def maybe_download_ci_toolchain(self):
646646
# If `download-rustc` is not set, default to rebuilding.
647-
if self.get_toml("download-rustc", section="rust") != "true":
647+
download_rustc = self.get_toml("download-rustc", section="rust")
648+
if download_rustc is None or download_rustc == "false":
648649
return None
650+
assert download_rustc == "true" or download_rustc == "if-unchanged", download_rustc
649651

650652
# Handle running from a directory other than the top level
651653
rev_parse = ["git", "rev-parse", "--show-toplevel"]
@@ -660,6 +662,8 @@ def maybe_download_ci_toolchain(self):
660662
# Warn if there were changes to the compiler since the ancestor commit.
661663
status = subprocess.call(["git", "diff-index", "--quiet", commit, "--", compiler])
662664
if status != 0:
665+
if download_rustc == "if-unchanged":
666+
return None
663667
print("warning: `download-rustc` is enabled, but there are changes to compiler/")
664668

665669
if self.verbose:
@@ -1175,6 +1179,8 @@ def bootstrap(help_triggered):
11751179
env["RUSTC_BOOTSTRAP"] = '1'
11761180
if toml_path:
11771181
env["BOOTSTRAP_CONFIG"] = toml_path
1182+
if build.rustc_commit is not None:
1183+
env["BOOTSTRAP_DOWNLOAD_RUSTC"] = '1'
11781184
run(args, env=env, verbose=build.verbose)
11791185

11801186

src/bootstrap/config.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,8 @@ struct Rust {
510510
new_symbol_mangling: Option<bool>,
511511
profile_generate: Option<String>,
512512
profile_use: Option<String>,
513-
download_rustc: Option<bool>,
513+
// ignored; this is set from an env var set by bootstrap.py
514+
download_rustc: Option<StringOrBool>,
514515
}
515516

516517
/// TOML representation of how each build target is configured.
@@ -852,7 +853,7 @@ impl Config {
852853
config.rust_codegen_units_std = rust.codegen_units_std.map(threads_from_config);
853854
config.rust_profile_use = flags.rust_profile_use.or(rust.profile_use);
854855
config.rust_profile_generate = flags.rust_profile_generate.or(rust.profile_generate);
855-
config.download_rustc = rust.download_rustc.unwrap_or(false);
856+
config.download_rustc = env::var("BOOTSTRAP_DOWNLOAD_RUSTC").as_deref() == Ok("1");
856857
} else {
857858
config.rust_profile_use = flags.rust_profile_use;
858859
config.rust_profile_generate = flags.rust_profile_generate;

src/doc/unstable-book/src/library-features/asm.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ Here is the list of currently supported register classes:
501501
| x86 | `reg` | `ax`, `bx`, `cx`, `dx`, `si`, `di`, `r[8-15]` (x86-64 only) | `r` |
502502
| x86 | `reg_abcd` | `ax`, `bx`, `cx`, `dx` | `Q` |
503503
| x86-32 | `reg_byte` | `al`, `bl`, `cl`, `dl`, `ah`, `bh`, `ch`, `dh` | `q` |
504-
| x86-64 | `reg_byte` | `al`, `bl`, `cl`, `dl`, `sil`, `dil`, `r[8-15]b`, `ah`\*, `bh`\*, `ch`\*, `dh`\* | `q` |
504+
| x86-64 | `reg_byte`\* | `al`, `bl`, `cl`, `dl`, `sil`, `dil`, `r[8-15]b` | `q` |
505505
| x86 | `xmm_reg` | `xmm[0-7]` (x86) `xmm[0-15]` (x86-64) | `x` |
506506
| x86 | `ymm_reg` | `ymm[0-7]` (x86) `ymm[0-15]` (x86-64) | `x` |
507507
| x86 | `zmm_reg` | `zmm[0-7]` (x86) `zmm[0-31]` (x86-64) | `v` |
@@ -532,7 +532,7 @@ Here is the list of currently supported register classes:
532532

533533
> **Note**: On x86 we treat `reg_byte` differently from `reg` because the compiler can allocate `al` and `ah` separately whereas `reg` reserves the whole register.
534534
>
535-
> Note #2: On x86-64 the high byte registers (e.g. `ah`) are only available when used as an explicit register. Specifying the `reg_byte` register class for an operand will always allocate a low byte register.
535+
> Note #2: On x86-64 the high byte registers (e.g. `ah`) are not available in the `reg_byte` register class.
536536
>
537537
> Note #3: NVPTX doesn't have a fixed register set, so named registers are not supported.
538538
>

src/librustdoc/config.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,9 @@ impl Options {
484484
return Err(1);
485485
}
486486
if theme_file.extension() != Some(OsStr::new("css")) {
487-
diag.struct_err(&format!("invalid argument: \"{}\"", theme_s)).emit();
487+
diag.struct_err(&format!("invalid argument: \"{}\"", theme_s))
488+
.help("arguments to --theme must have a .css extension")
489+
.emit();
488490
return Err(1);
489491
}
490492
let (success, ret) = theme::test_theme_against(&theme_file, &paths, &diag);

src/test/assembly/asm/x86-types.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -748,10 +748,11 @@ check_reg!(eax_f64 f64 "eax" "mov");
748748
// CHECK: #NO_APP
749749
check_reg!(eax_ptr ptr "eax" "mov");
750750

751-
// CHECK-LABEL: ah_byte:
752-
// CHECK: #APP
753-
// CHECK: mov ah, ah
754-
// CHECK: #NO_APP
751+
// i686-LABEL: ah_byte:
752+
// i686: #APP
753+
// i686: mov ah, ah
754+
// i686: #NO_APP
755+
#[cfg(i686)]
755756
check_reg!(ah_byte i8 "ah" "mov");
756757

757758
// CHECK-LABEL: xmm0_i32:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// compile-flags:--theme {{src-base}}/invalid-theme-name.rs
2+
// error-pattern: invalid argument
3+
// error-pattern: must have a .css extension
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
error: invalid argument: "$DIR/invalid-theme-name.rs"
2+
|
3+
= help: arguments to --theme must have a .css extension
4+

src/test/ui/asm/bad-reg.rs

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ fn main() {
3737
//~^ ERROR invalid register `mm0`: MMX registers are not currently supported as operands
3838
asm!("", in("k0") foo);
3939
//~^ ERROR invalid register `k0`: the k0 AVX mask register cannot be used as an operand
40+
asm!("", in("ah") foo);
41+
//~^ ERROR invalid register `ah`: high byte registers cannot be used as an operand
4042

4143
// Explicit register conflicts
4244
// (except in/lateout which don't conflict)

src/test/ui/asm/bad-reg.stderr

+13-7
Original file line numberDiff line numberDiff line change
@@ -94,49 +94,55 @@ error: invalid register `k0`: the k0 AVX mask register cannot be used as an oper
9494
LL | asm!("", in("k0") foo);
9595
| ^^^^^^^^^^^^
9696

97+
error: invalid register `ah`: high byte registers cannot be used as an operand on x86_64
98+
--> $DIR/bad-reg.rs:40:18
99+
|
100+
LL | asm!("", in("ah") foo);
101+
| ^^^^^^^^^^^^
102+
97103
error: register `al` conflicts with register `ax`
98-
--> $DIR/bad-reg.rs:44:33
104+
--> $DIR/bad-reg.rs:46:33
99105
|
100106
LL | asm!("", in("eax") foo, in("al") bar);
101107
| ------------- ^^^^^^^^^^^^ register `al`
102108
| |
103109
| register `ax`
104110

105111
error: register `ax` conflicts with register `ax`
106-
--> $DIR/bad-reg.rs:46:33
112+
--> $DIR/bad-reg.rs:48:33
107113
|
108114
LL | asm!("", in("rax") foo, out("rax") bar);
109115
| ------------- ^^^^^^^^^^^^^^ register `ax`
110116
| |
111117
| register `ax`
112118
|
113119
help: use `lateout` instead of `out` to avoid conflict
114-
--> $DIR/bad-reg.rs:46:18
120+
--> $DIR/bad-reg.rs:48:18
115121
|
116122
LL | asm!("", in("rax") foo, out("rax") bar);
117123
| ^^^^^^^^^^^^^
118124

119125
error: register `ymm0` conflicts with register `xmm0`
120-
--> $DIR/bad-reg.rs:49:34
126+
--> $DIR/bad-reg.rs:51:34
121127
|
122128
LL | asm!("", in("xmm0") foo, in("ymm0") bar);
123129
| -------------- ^^^^^^^^^^^^^^ register `ymm0`
124130
| |
125131
| register `xmm0`
126132

127133
error: register `ymm0` conflicts with register `xmm0`
128-
--> $DIR/bad-reg.rs:51:34
134+
--> $DIR/bad-reg.rs:53:34
129135
|
130136
LL | asm!("", in("xmm0") foo, out("ymm0") bar);
131137
| -------------- ^^^^^^^^^^^^^^^ register `ymm0`
132138
| |
133139
| register `xmm0`
134140
|
135141
help: use `lateout` instead of `out` to avoid conflict
136-
--> $DIR/bad-reg.rs:51:18
142+
--> $DIR/bad-reg.rs:53:18
137143
|
138144
LL | asm!("", in("xmm0") foo, out("ymm0") bar);
139145
| ^^^^^^^^^^^^^^
140146

141-
error: aborting due to 18 previous errors
147+
error: aborting due to 19 previous errors
142148

src/tools/compiletest/src/runtest.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1909,8 +1909,7 @@ impl<'test> TestCx<'test> {
19091909
} else {
19101910
Command::new(&self.config.rustdoc_path.clone().expect("no rustdoc built yet"))
19111911
};
1912-
// FIXME Why is -L here?
1913-
rustc.arg(input_file); //.arg("-L").arg(&self.config.build_base);
1912+
rustc.arg(input_file);
19141913

19151914
// Use a single thread for efficiency and a deterministic error message order
19161915
rustc.arg("-Zthreads=1");

src/tools/tidy/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub mod unstable_book;
5353

5454
fn filter_dirs(path: &Path) -> bool {
5555
let skip = [
56+
"tidy-test-file",
5657
"compiler/rustc_codegen_cranelift",
5758
"src/llvm-project",
5859
"library/backtrace",

src/tools/tidy/src/pal.rs

-22
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,20 @@ const EXCEPTION_PATHS: &[&str] = &[
4040
"library/panic_abort",
4141
"library/panic_unwind",
4242
"library/unwind",
43-
// black_box implementation is LLVM-version specific and it uses
44-
// target_os to tell targets with different LLVM-versions apart
45-
// (e.g. `wasm32-unknown-emscripten` vs `wasm32-unknown-unknown`):
46-
"library/core/src/hint.rs",
4743
"library/std/src/sys/", // Platform-specific code for std lives here.
4844
// This has the trailing slash so that sys_common is not excepted.
4945
"library/std/src/os", // Platform-specific public interfaces
5046
"library/rtstartup", // Not sure what to do about this. magic stuff for mingw
51-
// temporary exceptions
52-
"library/std/src/lib.rs",
53-
"library/std/src/path.rs",
54-
"library/std/src/f32.rs",
55-
"library/std/src/f64.rs",
5647
// Integration test for platform-specific run-time feature detection:
5748
"library/std/tests/run-time-detect.rs",
5849
"library/std/src/net/test.rs",
5950
"library/std/src/net/addr",
6051
"library/std/src/net/udp",
61-
"library/std/src/sys_common/mod.rs",
62-
"library/std/src/sys_common/net.rs",
63-
"library/std/src/sys_common/backtrace.rs",
6452
"library/std/src/sys_common/remutex.rs",
6553
"library/std/src/sync/mutex.rs",
6654
"library/std/src/sync/rwlock.rs",
67-
// panic_unwind shims
68-
"library/std/src/panicking.rs",
6955
"library/term", // Not sure how to make this crate portable, but test crate needs it.
7056
"library/test", // Probably should defer to unstable `std::sys` APIs.
71-
"library/std/src/sync/mpsc", // some tests are only run on non-emscripten
7257
// std testing crates, okay for now at least
7358
"library/core/tests",
7459
"library/alloc/tests/lib.rs",
@@ -79,13 +64,6 @@ const EXCEPTION_PATHS: &[&str] = &[
7964
// we must use `#[cfg(windows)]` to conditionally compile the
8065
// correct `VaList` structure for windows.
8166
"library/core/src/ffi.rs",
82-
// non-std crates
83-
"src/test",
84-
"src/tools",
85-
"src/librustc",
86-
"src/librustdoc",
87-
"src/librustc_ast",
88-
"src/bootstrap",
8967
];
9068

9169
pub fn check(path: &Path, bad: &mut bool) {

0 commit comments

Comments
 (0)