Skip to content

Commit c8ca44c

Browse files
committed
Auto merge of #145223 - jhpratt:rollup-xcqbwqe, r=jhpratt
Rollup of 7 pull requests Successful merges: - #144553 (Rehome 32 `tests/ui/issues/` tests to other subdirectories under `tests/ui/`) - #145064 (Add regression test for `saturating_sub` bounds check issue) - #145121 (bootstrap: `x.py dist rustc-src` should keep LLVM's siphash) - #145150 (Replace unsafe `security_attributes` function with safe `inherit_handle` alternative) - #145152 (Use `eq_ignore_ascii_case` to avoid heap alloc in `detect_confuse_type`) - #145200 (mbe: Fix typo in attribute tracing) - #145222 (Fix typo with paren rustc_llvm/build.rs) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 29737cb + c9847db commit c8ca44c

File tree

55 files changed

+130
-69
lines changed

Some content is hidden

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

55 files changed

+130
-69
lines changed

compiler/rustc_errors/src/emitter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3546,7 +3546,7 @@ pub fn detect_confusion_type(sm: &SourceMap, suggested: &str, sp: Span) -> Confu
35463546

35473547
for (f, s) in iter::zip(found.chars(), suggested.chars()) {
35483548
if f != s {
3549-
if f.to_lowercase().to_string() == s.to_lowercase().to_string() {
3549+
if f.eq_ignore_ascii_case(&s) {
35503550
// Check for case differences (any character that differs only in case)
35513551
if ascii_confusables.contains(&f) || ascii_confusables.contains(&s) {
35523552
has_case_diff = true;

compiler/rustc_expand/src/mbe/macro_rules.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ fn expand_macro_attr(
347347

348348
if cx.trace_macros() {
349349
let msg = format!(
350-
"expanding `$[{name}({})] {}`",
350+
"expanding `#[{name}({})] {}`",
351351
pprust::tts_to_string(&args),
352352
pprust::tts_to_string(&body),
353353
);

compiler/rustc_llvm/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ fn main() {
255255
println!("cargo:rustc-link-lib=kstat");
256256
}
257257

258-
if (target.starts_with("arm") && !target.contains("freebsd")) && !target.contains("ohos")
258+
if (target.starts_with("arm") && !target.contains("freebsd") && !target.contains("ohos"))
259259
|| target.starts_with("mips-")
260260
|| target.starts_with("mipsel-")
261261
|| target.starts_with("powerpc-")

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub struct OpenOptions {
8080
attributes: u32,
8181
share_mode: u32,
8282
security_qos_flags: u32,
83-
security_attributes: *mut c::SECURITY_ATTRIBUTES,
83+
inherit_handle: bool,
8484
}
8585

8686
#[derive(Clone, PartialEq, Eq, Debug)]
@@ -203,7 +203,7 @@ impl OpenOptions {
203203
share_mode: c::FILE_SHARE_READ | c::FILE_SHARE_WRITE | c::FILE_SHARE_DELETE,
204204
attributes: 0,
205205
security_qos_flags: 0,
206-
security_attributes: ptr::null_mut(),
206+
inherit_handle: false,
207207
}
208208
}
209209

@@ -243,8 +243,8 @@ impl OpenOptions {
243243
// receive is `SECURITY_ANONYMOUS = 0x0`, which we can't check for later on.
244244
self.security_qos_flags = flags | c::SECURITY_SQOS_PRESENT;
245245
}
246-
pub fn security_attributes(&mut self, attrs: *mut c::SECURITY_ATTRIBUTES) {
247-
self.security_attributes = attrs;
246+
pub fn inherit_handle(&mut self, inherit: bool) {
247+
self.inherit_handle = inherit;
248248
}
249249

250250
fn get_access_mode(&self) -> io::Result<u32> {
@@ -307,12 +307,17 @@ impl File {
307307

308308
fn open_native(path: &WCStr, opts: &OpenOptions) -> io::Result<File> {
309309
let creation = opts.get_creation_mode()?;
310+
let sa = c::SECURITY_ATTRIBUTES {
311+
nLength: size_of::<c::SECURITY_ATTRIBUTES>() as u32,
312+
lpSecurityDescriptor: ptr::null_mut(),
313+
bInheritHandle: opts.inherit_handle as c::BOOL,
314+
};
310315
let handle = unsafe {
311316
c::CreateFileW(
312317
path.as_ptr(),
313318
opts.get_access_mode()?,
314319
opts.share_mode,
315-
opts.security_attributes,
320+
if opts.inherit_handle { &sa } else { ptr::null() },
316321
creation,
317322
opts.get_flags_and_attributes(),
318323
ptr::null_mut(),

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -623,16 +623,10 @@ impl Stdio {
623623
// permissions as well as the ability to be inherited to child
624624
// processes (as this is about to be inherited).
625625
Stdio::Null => {
626-
let size = size_of::<c::SECURITY_ATTRIBUTES>();
627-
let mut sa = c::SECURITY_ATTRIBUTES {
628-
nLength: size as u32,
629-
lpSecurityDescriptor: ptr::null_mut(),
630-
bInheritHandle: 1,
631-
};
632626
let mut opts = OpenOptions::new();
633627
opts.read(stdio_id == c::STD_INPUT_HANDLE);
634628
opts.write(stdio_id != c::STD_INPUT_HANDLE);
635-
opts.security_attributes(&mut sa);
629+
opts.inherit_handle(true);
636630
File::open(Path::new(r"\\.\NUL"), &opts).map(|file| file.into_inner())
637631
}
638632
}

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,8 @@ fn copy_src_dirs(
925925
"llvm-project\\cmake",
926926
"llvm-project/runtimes",
927927
"llvm-project\\runtimes",
928+
"llvm-project/third-party",
929+
"llvm-project\\third-party",
928930
];
929931
if spath.contains("llvm-project")
930932
&& !spath.ends_with("llvm-project")
@@ -933,6 +935,18 @@ fn copy_src_dirs(
933935
return false;
934936
}
935937

938+
// Keep only these third party libraries
939+
const LLVM_THIRD_PARTY: &[&str] =
940+
&["llvm-project/third-party/siphash", "llvm-project\\third-party\\siphash"];
941+
if (spath.starts_with("llvm-project/third-party")
942+
|| spath.starts_with("llvm-project\\third-party"))
943+
&& !(spath.ends_with("llvm-project/third-party")
944+
|| spath.ends_with("llvm-project\\third-party"))
945+
&& !LLVM_THIRD_PARTY.iter().any(|path| spath.contains(path))
946+
{
947+
return false;
948+
}
949+
936950
const LLVM_TEST: &[&str] = &["llvm-project/llvm/test", "llvm-project\\llvm\\test"];
937951
if LLVM_TEST.iter().any(|path| spath.contains(path))
938952
&& (spath.ends_with(".ll") || spath.ends_with(".td") || spath.ends_with(".s"))
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Test that calculating an index with saturating subtraction from an in-bounds
2+
// index doesn't generate another bounds check.
3+
4+
//@ compile-flags: -Copt-level=3
5+
//@ min-llvm-version: 21
6+
7+
#![crate_type = "lib"]
8+
9+
// CHECK-LABEL: @bounds_check_is_elided
10+
#[no_mangle]
11+
pub fn bounds_check_is_elided(s: &[i32], index: usize) -> i32 {
12+
// CHECK-NOT: panic_bounds_check
13+
if index < s.len() {
14+
let lower_bound = index.saturating_sub(1);
15+
s[lower_bound]
16+
} else {
17+
-1
18+
}
19+
}

tests/ui/issues/issue-23442.rs renamed to tests/ui/associated-types/unioned-keys-with-associated-type-23442.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// https://github.com/rust-lang/rust/issues/23442
12
//@ check-pass
23
#![allow(dead_code)]
34
use std::marker::PhantomData;

tests/ui/issues/issue-91489.rs renamed to tests/ui/autoref-autoderef/auto-deref-on-cow-regression-91489.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// https://github.com/rust-lang/rust/issues/91489
12
//@ check-pass
23

34
// regression test for #91489

tests/ui/issues/issue-9725.rs renamed to tests/ui/binding/struct-destructuring-repeated-bindings-9725.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// https://github.com/rust-lang/rust/issues/9725
12
struct A { foo: isize }
23

34
fn main() {

0 commit comments

Comments
 (0)