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

Commit da378d7

Browse files
committed
Auto merge of rust-lang#140788 - matthiaskrgr:rollup-rgsbl0h, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#140716 (Improve `-Zremap-path-scope` tests with dependency) - rust-lang#140732 (make it possible to run in-tree rustfmt with `x run rustfmt`) - rust-lang#140736 (trait selection: check `&` before suggest remove deref) - rust-lang#140755 ([win][arm64] Disable various DebugInfo tests that don't work on Arm64 Windows) - rust-lang#140756 ([arm64] Pointer auth test should link with C static library statically) - rust-lang#140758 ([win][arm64] Disable MSVC Linker 'Arm Hazard' warning) - rust-lang#140759 ([win][arm64] Disable std::fs tests that require symlinks) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1973872 + ba6f590 commit da378d7

File tree

41 files changed

+443
-12
lines changed

Some content is hidden

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

41 files changed

+443
-12
lines changed

compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
use crate::spec::{Target, TargetMetadata, base};
1+
use crate::spec::{LinkerFlavor, Lld, Target, TargetMetadata, base};
22

33
pub(crate) fn target() -> Target {
44
let mut base = base::windows_msvc::opts();
55
base.max_atomic_width = Some(128);
66
base.features = "+v8a,+neon,+fp-armv8".into();
77

8+
// MSVC emits a warning about code that may trip "Cortex-A53 MPCore processor bug #843419" (see
9+
// https://developer.arm.com/documentation/epm048406/latest) which is sometimes emitted by LLVM.
10+
// Since Arm64 Windows 10+ isn't supported on that processor, it's safe to disable the warning.
11+
base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/arm64hazardfree"]);
12+
813
Target {
914
llvm_target: "aarch64-pc-windows-msvc".into(),
1015
metadata: TargetMetadata {

compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,6 +1516,12 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
15161516
} else {
15171517
expr.span.with_hi(expr.span.lo() + BytePos(1))
15181518
};
1519+
1520+
match self.tcx.sess.source_map().span_to_snippet(span) {
1521+
Ok(snippet) if snippet.starts_with("&") => {}
1522+
_ => break 'outer,
1523+
}
1524+
15191525
suggestions.push((span, String::new()));
15201526

15211527
let ty::Ref(_, inner_ty, _) = suggested_ty.kind() else {

library/std/src/fs/tests.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,10 @@ fn recursive_mkdir_empty() {
730730
}
731731

732732
#[test]
733+
#[cfg_attr(
734+
all(windows, target_arch = "aarch64"),
735+
ignore = "SymLinks not enabled on Arm64 Windows runners https://github.com/actions/partner-runner-images/issues/94"
736+
)]
733737
fn recursive_rmdir() {
734738
let tmpdir = tmpdir();
735739
let d1 = tmpdir.join("d1");
@@ -749,6 +753,10 @@ fn recursive_rmdir() {
749753
}
750754

751755
#[test]
756+
#[cfg_attr(
757+
all(windows, target_arch = "aarch64"),
758+
ignore = "SymLinks not enabled on Arm64 Windows runners https://github.com/actions/partner-runner-images/issues/94"
759+
)]
752760
fn recursive_rmdir_of_symlink() {
753761
// test we do not recursively delete a symlink but only dirs.
754762
let tmpdir = tmpdir();
@@ -1533,6 +1541,10 @@ fn file_open_not_found() {
15331541
}
15341542

15351543
#[test]
1544+
#[cfg_attr(
1545+
all(windows, target_arch = "aarch64"),
1546+
ignore = "SymLinks not enabled on Arm64 Windows runners https://github.com/actions/partner-runner-images/issues/94"
1547+
)]
15361548
fn create_dir_all_with_junctions() {
15371549
let tmpdir = tmpdir();
15381550
let target = tmpdir.join("target");
@@ -2011,6 +2023,10 @@ fn test_rename_symlink() {
20112023

20122024
#[test]
20132025
#[cfg(windows)]
2026+
#[cfg_attr(
2027+
all(windows, target_arch = "aarch64"),
2028+
ignore = "SymLinks not enabled on Arm64 Windows runners https://github.com/actions/partner-runner-images/issues/94"
2029+
)]
20142030
fn test_rename_junction() {
20152031
let tmpdir = tmpdir();
20162032
let original = tmpdir.join("original");

src/bootstrap/src/core/build_steps/format.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::sync::mpsc::SyncSender;
99
use build_helper::git::get_git_modified_files;
1010
use ignore::WalkBuilder;
1111

12-
use crate::core::builder::Builder;
12+
use crate::core::builder::{Builder, Kind};
1313
use crate::utils::build_stamp::BuildStamp;
1414
use crate::utils::exec::command;
1515
use crate::utils::helpers::{self, t};
@@ -122,6 +122,12 @@ fn print_paths(verb: &str, adjective: Option<&str>, paths: &[String]) {
122122
}
123123

124124
pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
125+
if build.kind == Kind::Format && build.top_stage != 0 {
126+
eprintln!("ERROR: `x fmt` only supports stage 0.");
127+
eprintln!("HELP: Use `x run rustfmt` to run in-tree rustfmt.");
128+
crate::exit!(1);
129+
}
130+
125131
if !paths.is_empty() {
126132
eprintln!(
127133
"fmt error: path arguments are no longer accepted; use `--all` to format everything"

src/bootstrap/src/core/build_steps/run.rs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,56 @@ impl Step for CoverageDump {
420420
cmd.run(builder);
421421
}
422422
}
423+
424+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
425+
pub struct Rustfmt;
426+
427+
impl Step for Rustfmt {
428+
type Output = ();
429+
const ONLY_HOSTS: bool = true;
430+
431+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
432+
run.path("src/tools/rustfmt")
433+
}
434+
435+
fn make_run(run: RunConfig<'_>) {
436+
run.builder.ensure(Rustfmt);
437+
}
438+
439+
fn run(self, builder: &Builder<'_>) {
440+
let host = builder.build.build;
441+
442+
// `x run` uses stage 0 by default but rustfmt does not work well with stage 0.
443+
// Change the stage to 1 if it's not set explicitly.
444+
let stage = if builder.config.is_explicit_stage() || builder.top_stage >= 1 {
445+
builder.top_stage
446+
} else {
447+
1
448+
};
449+
450+
if stage == 0 {
451+
eprintln!("rustfmt cannot be run at stage 0");
452+
eprintln!("HELP: Use `x fmt` to use stage 0 rustfmt.");
453+
std::process::exit(1);
454+
}
455+
456+
let compiler = builder.compiler(stage, host);
457+
let rustfmt_build = builder.ensure(tool::Rustfmt { compiler, target: host });
458+
459+
let mut rustfmt = tool::prepare_tool_cargo(
460+
builder,
461+
rustfmt_build.build_compiler,
462+
Mode::ToolRustc,
463+
host,
464+
Kind::Run,
465+
"src/tools/rustfmt",
466+
SourceType::InTree,
467+
&[],
468+
);
469+
470+
rustfmt.args(["--bin", "rustfmt", "--"]);
471+
rustfmt.args(builder.config.args());
472+
473+
rustfmt.into_cmd().run(builder);
474+
}
475+
}

src/bootstrap/src/core/builder/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,7 @@ impl<'a> Builder<'a> {
11161116
run::FeaturesStatusDump,
11171117
run::CyclicStep,
11181118
run::CoverageDump,
1119+
run::Rustfmt,
11191120
),
11201121
Kind::Setup => {
11211122
describe!(setup::Profile, setup::Hook, setup::Link, setup::Editor)

src/bootstrap/src/utils/change_tracker.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,4 +406,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
406406
severity: ChangeSeverity::Info,
407407
summary: "Added a new option `rust.debug-assertions-tools` to control debug asssertions for tools.",
408408
},
409+
ChangeInfo {
410+
change_id: 140732,
411+
severity: ChangeSeverity::Info,
412+
summary: "`./x run` now supports running in-tree `rustfmt`, e.g., `./x run rustfmt -- --check /path/to/file.rs`.",
413+
},
409414
];

src/tools/compiletest/src/directive-list.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
3535
"ignore-32bit",
3636
"ignore-64bit",
3737
"ignore-aarch64",
38+
"ignore-aarch64-pc-windows-msvc",
3839
"ignore-aarch64-unknown-linux-gnu",
3940
"ignore-aix",
4041
"ignore-android",

tests/debuginfo/step-into-match.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
//@ compile-flags: -g
22
//@ ignore-android: FIXME(#10381)
33

4+
// On Arm64 Windows, stepping at the end of a function on goes to the callsite, not the instruction
5+
// after it.
6+
//@ ignore-aarch64-pc-windows-msvc: Stepping out of functions behaves differently.
7+
48
// === GDB TESTS ==============================================================
59

610
// gdb-command: r

tests/debuginfo/type-names.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@ ignore-lldb
22

3+
//@ ignore-aarch64-pc-windows-msvc: Arm64 Windows cdb doesn't support JavaScript extensions.
4+
35
// GDB changed the way that it formatted Foreign types
46
//@ min-gdb-version: 9.2
57

0 commit comments

Comments
 (0)