Skip to content

Commit 4aa9d23

Browse files
committed
Auto merge of rust-lang#92592 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] backports Backports these PRs: * Fix HashStable implementation on InferTy rust-lang#91892 * Revert setting a default for the MACOSX_DEPLOYMENT_TARGET env var for linking rust-lang#91870 * Make rustdoc headings black, and markdown blue rust-lang#91534 * Disable LLVM newPM by default rust-lang#91190 * Deduplicate projection sub-obligations rust-lang#90423 * Sync portable-simd to remove autosplats rust-lang#91484 by dropping portable_simd entirely (keeping the subtree, just from std/core) * Quote bat script command line rust-lang#92208 * Fix failing tests rust-lang#92201 (CI fix) r? `@Mark-Simulacrum`
2 parents 0e07bcb + e458615 commit 4aa9d23

28 files changed

+358
-164
lines changed

compiler/rustc_codegen_llvm/src/back/write.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -395,18 +395,14 @@ fn get_pgo_sample_use_path(config: &ModuleConfig) -> Option<CString> {
395395
}
396396

397397
pub(crate) fn should_use_new_llvm_pass_manager(
398-
cgcx: &CodegenContext<LlvmCodegenBackend>,
398+
_cgcx: &CodegenContext<LlvmCodegenBackend>,
399399
config: &ModuleConfig,
400400
) -> bool {
401-
// The new pass manager is enabled by default for LLVM >= 13.
402-
// This matches Clang, which also enables it since Clang 13.
403-
404-
// FIXME: There are some perf issues with the new pass manager
405-
// when targeting s390x, so it is temporarily disabled for that
406-
// arch, see https://github.com/rust-lang/rust/issues/89609
401+
// The new pass manager is causing significant performance issues such as #91128, and is
402+
// therefore disabled in stable versions of rustc by default.
407403
config
408404
.new_llvm_pass_manager
409-
.unwrap_or_else(|| cgcx.target_arch != "s390x" && llvm_util::get_version() >= (13, 0, 0))
405+
.unwrap_or(false)
410406
}
411407

412408
pub(crate) unsafe fn optimize_with_new_llvm_pass_manager(

compiler/rustc_target/src/spec/aarch64_apple_darwin.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ pub fn target() -> Target {
99
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD;
1010

1111
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-arch".to_string(), "arm64".to_string()]);
12-
base.link_env.extend(super::apple_base::macos_link_env("arm64"));
1312
base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
1413

1514
// Clang automatically chooses a more specific target based on

compiler/rustc_target/src/spec/apple_base.rs

-12
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,6 @@ pub fn macos_llvm_target(arch: &str) -> String {
7979
format!("{}-apple-macosx{}.{}.0", arch, major, minor)
8080
}
8181

82-
pub fn macos_link_env(arch: &str) -> Vec<(String, String)> {
83-
// Use the default deployment target for linking just as with the LLVM target if not
84-
// specified via MACOSX_DEPLOYMENT_TARGET, otherwise the system linker would use its
85-
// default which varies with Xcode version.
86-
if env::var("MACOSX_DEPLOYMENT_TARGET").is_err() {
87-
let default = macos_default_deployment_target(arch);
88-
vec![("MACOSX_DEPLOYMENT_TARGET".to_string(), format!("{}.{}", default.0, default.1))]
89-
} else {
90-
vec![]
91-
}
92-
}
93-
9482
pub fn macos_link_env_remove() -> Vec<String> {
9583
let mut env_remove = Vec::with_capacity(2);
9684
// Remove the `SDKROOT` environment variable if it's clearly set for the wrong platform, which

compiler/rustc_target/src/spec/i686_apple_darwin.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ pub fn target() -> Target {
55
base.cpu = "yonah".to_string();
66
base.max_atomic_width = Some(64);
77
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m32".to_string()]);
8-
base.link_env.extend(super::apple_base::macos_link_env("i686"));
98
base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
109
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
1110
base.stack_probes = StackProbeType::Call;

compiler/rustc_target/src/spec/x86_64_apple_darwin.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pub fn target() -> Target {
1010
LinkerFlavor::Gcc,
1111
vec!["-m64".to_string(), "-arch".to_string(), "x86_64".to_string()],
1212
);
13-
base.link_env.extend(super::apple_base::macos_link_env("x86_64"));
1413
base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
1514
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
1615
base.stack_probes = StackProbeType::Call;

compiler/rustc_trait_selection/src/traits/project.rs

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use super::{Normalized, NormalizedTy, ProjectionCacheEntry, ProjectionCacheKey};
2020
use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
2121
use crate::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime};
2222
use crate::traits::error_reporting::InferCtxtExt as _;
23+
use rustc_data_structures::sso::SsoHashSet;
2324
use rustc_data_structures::stack::ensure_sufficient_stack;
2425
use rustc_errors::ErrorReported;
2526
use rustc_hir::def_id::DefId;
@@ -944,9 +945,14 @@ fn opt_normalize_projection_type<'a, 'b, 'tcx>(
944945
Normalized { value: projected_ty, obligations: projected_obligations }
945946
};
946947

948+
let mut deduped: SsoHashSet<_> = Default::default();
947949
let mut canonical =
948950
SelectionContext::with_query_mode(selcx.infcx(), TraitQueryMode::Canonical);
951+
949952
result.obligations.drain_filter(|projected_obligation| {
953+
if !deduped.insert(projected_obligation.clone()) {
954+
return true;
955+
}
950956
// If any global obligations always apply, considering regions, then we don't
951957
// need to include them. The `is_global` check rules out inference variables,
952958
// so there's no need for the caller of `opt_normalize_projection_type`

compiler/rustc_type_ir/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ impl<CTX> HashStable<CTX> for FloatTy {
559559
impl<CTX> HashStable<CTX> for InferTy {
560560
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
561561
use InferTy::*;
562+
discriminant(self).hash_stable(ctx, hasher);
562563
match self {
563564
TyVar(v) => v.as_u32().hash_stable(ctx, hasher),
564565
IntVar(v) => v.index.hash_stable(ctx, hasher),

library/core/src/lib.rs

-23
Original file line numberDiff line numberDiff line change
@@ -398,27 +398,4 @@ pub mod arch {
398398
}
399399
}
400400

401-
// Pull in the `core_simd` crate directly into libcore. The contents of
402-
// `core_simd` are in a different repository: rust-lang/portable-simd.
403-
//
404-
// `core_simd` depends on libcore, but the contents of this module are
405-
// set up in such a way that directly pulling it here works such that the
406-
// crate uses this crate as its libcore.
407-
#[path = "../../portable-simd/crates/core_simd/src/mod.rs"]
408-
#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
409-
#[allow(rustdoc::bare_urls)]
410-
#[unstable(feature = "portable_simd", issue = "86656")]
411-
#[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics
412-
#[cfg(not(bootstrap))]
413-
mod core_simd;
414-
415-
#[doc = include_str!("../../portable-simd/crates/core_simd/src/core_simd_docs.md")]
416-
#[unstable(feature = "portable_simd", issue = "86656")]
417-
#[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics
418-
#[cfg(not(bootstrap))]
419-
pub mod simd {
420-
#[unstable(feature = "portable_simd", issue = "86656")]
421-
pub use crate::core_simd::simd::*;
422-
}
423-
424401
include!("primitive_docs.rs");

library/core/tests/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
#![feature(never_type)]
6262
#![feature(unwrap_infallible)]
6363
#![feature(result_into_ok_or_err)]
64-
#![cfg_attr(not(bootstrap), feature(portable_simd))]
6564
#![feature(ptr_metadata)]
6665
#![feature(once_cell)]
6766
#![feature(unsized_tuple_coercion)]
@@ -107,8 +106,6 @@ mod pattern;
107106
mod pin;
108107
mod ptr;
109108
mod result;
110-
#[cfg(not(bootstrap))]
111-
mod simd;
112109
mod slice;
113110
mod str;
114111
mod str_lossy;

library/core/tests/simd.rs

-15
This file was deleted.

library/std/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@
323323
#![feature(panic_internals)]
324324
#![feature(panic_unwind)]
325325
#![feature(pin_static_ref)]
326-
#![cfg_attr(not(bootstrap), feature(portable_simd))]
327326
#![feature(prelude_import)]
328327
#![feature(ptr_internals)]
329328
#![feature(rustc_attrs)]
@@ -475,9 +474,6 @@ pub use core::pin;
475474
pub use core::ptr;
476475
#[stable(feature = "rust1", since = "1.0.0")]
477476
pub use core::result;
478-
#[unstable(feature = "portable_simd", issue = "86656")]
479-
#[cfg(not(bootstrap))]
480-
pub use core::simd;
481477
#[unstable(feature = "async_stream", issue = "79024")]
482478
pub use core::stream;
483479
#[stable(feature = "i128", since = "1.26.0")]

library/std/src/process/tests.rs

+26-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ use super::{Command, Output, Stdio};
44
use crate::io::ErrorKind;
55
use crate::str;
66

7+
fn known_command() -> Command {
8+
if cfg!(windows) { Command::new("help") } else { Command::new("echo") }
9+
}
10+
711
#[cfg(target_os = "android")]
812
fn shell_cmd() -> Command {
913
Command::new("/system/bin/sh")
@@ -305,23 +309,23 @@ fn test_interior_nul_in_progname_is_error() {
305309

306310
#[test]
307311
fn test_interior_nul_in_arg_is_error() {
308-
match Command::new("rustc").arg("has-some-\0\0s-inside").spawn() {
312+
match known_command().arg("has-some-\0\0s-inside").spawn() {
309313
Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput),
310314
Ok(_) => panic!(),
311315
}
312316
}
313317

314318
#[test]
315319
fn test_interior_nul_in_args_is_error() {
316-
match Command::new("rustc").args(&["has-some-\0\0s-inside"]).spawn() {
320+
match known_command().args(&["has-some-\0\0s-inside"]).spawn() {
317321
Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput),
318322
Ok(_) => panic!(),
319323
}
320324
}
321325

322326
#[test]
323327
fn test_interior_nul_in_current_dir_is_error() {
324-
match Command::new("rustc").current_dir("has-some-\0\0s-inside").spawn() {
328+
match known_command().current_dir("has-some-\0\0s-inside").spawn() {
325329
Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput),
326330
Ok(_) => panic!(),
327331
}
@@ -416,3 +420,22 @@ fn env_empty() {
416420
let p = Command::new("cmd").args(&["/C", "exit 0"]).env_clear().spawn();
417421
assert!(p.is_ok());
418422
}
423+
424+
// See issue #91991
425+
#[test]
426+
#[cfg(windows)]
427+
fn run_bat_script() {
428+
let tempdir = crate::sys_common::io::test::tmpdir();
429+
let script_path = tempdir.join("hello.cmd");
430+
431+
crate::fs::write(&script_path, "@echo Hello, %~1!").unwrap();
432+
let output = Command::new(&script_path)
433+
.arg("fellow Rustaceans")
434+
.stdout(crate::process::Stdio::piped())
435+
.spawn()
436+
.unwrap()
437+
.wait_with_output()
438+
.unwrap();
439+
assert!(output.status.success());
440+
assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "Hello, fellow Rustaceans!");
441+
}

library/std/src/sys/windows/process.rs

+16
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,19 @@ fn make_command_line(prog: &OsStr, args: &[Arg], force_quotes: bool) -> io::Resu
704704
// Encode the command and arguments in a command line string such
705705
// that the spawned process may recover them using CommandLineToArgvW.
706706
let mut cmd: Vec<u16> = Vec::new();
707+
708+
// CreateFileW has special handling for .bat and .cmd files, which means we
709+
// need to add an extra pair of quotes surrounding the whole command line
710+
// so they are properly passed on to the script.
711+
// See issue #91991.
712+
let is_batch_file = Path::new(prog)
713+
.extension()
714+
.map(|ext| ext.eq_ignore_ascii_case("cmd") || ext.eq_ignore_ascii_case("bat"))
715+
.unwrap_or(false);
716+
if is_batch_file {
717+
cmd.push(b'"' as u16);
718+
}
719+
707720
// Always quote the program name so CreateProcess doesn't interpret args as
708721
// part of the name if the binary wasn't found first time.
709722
append_arg(&mut cmd, prog, Quote::Always)?;
@@ -715,6 +728,9 @@ fn make_command_line(prog: &OsStr, args: &[Arg], force_quotes: bool) -> io::Resu
715728
};
716729
append_arg(&mut cmd, arg, quote)?;
717730
}
731+
if is_batch_file {
732+
cmd.push(b'"' as u16);
733+
}
718734
return Ok(cmd);
719735

720736
fn append_arg(cmd: &mut Vec<u16>, arg: &OsStr, quote: Quote) -> io::Result<()> {

library/std/src/sys/windows/process/tests.rs

+4
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ fn windows_exe_resolver() {
160160
io::ErrorKind::InvalidInput
161161
);
162162

163+
/* FIXME: fix and re-enable these tests before making changes to the resolver.
164+
163165
/*
164166
Some of the following tests may need to be changed if you are deliberately
165167
changing the behaviour of `resolve_exe`.
@@ -179,4 +181,6 @@ fn windows_exe_resolver() {
179181
// The application's directory is also searched.
180182
let current_exe = env::current_exe().unwrap();
181183
assert!(resolve_exe(current_exe.file_name().unwrap().as_ref(), None).is_ok());
184+
185+
*/
182186
}

src/librustdoc/html/render/print_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
296296
let (short, name) = item_ty_to_strs(myty.unwrap());
297297
write!(
298298
w,
299-
"<h2 id=\"{id}\" class=\"section-header\">\
299+
"<h2 id=\"{id}\" class=\"small-section-header\">\
300300
<a href=\"#{id}\">{name}</a>\
301301
</h2>\n{}",
302302
ITEM_TABLE_OPEN,

src/librustdoc/html/static/css/themes/ayu.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ a {
219219
a.srclink,
220220
a#toggle-all-docs,
221221
a.anchor,
222-
.section-header a,
222+
.small-section-header a,
223223
#source-sidebar a,
224224
pre.rust a,
225225
.sidebar a,

src/librustdoc/html/static/css/themes/dark.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ a {
181181
a.srclink,
182182
a#toggle-all-docs,
183183
a.anchor,
184-
.section-header a,
184+
.small-section-header a,
185185
#source-sidebar a,
186186
pre.rust a,
187187
.sidebar a,

src/librustdoc/html/static/css/themes/light.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ a {
176176
a.srclink,
177177
a#toggle-all-docs,
178178
a.anchor,
179-
.section-header a,
179+
.small-section-header a,
180180
#source-sidebar a,
181181
pre.rust a,
182182
.sidebar a,

0 commit comments

Comments
 (0)