Skip to content

[beta] backports #143757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions compiler/rustc_lint/src/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3261,7 +3261,7 @@ impl Subdiagnostic for MismatchedLifetimeSyntaxesSuggestion {
diag.multipart_suggestion_with_style(
fluent::lint_mismatched_lifetime_syntaxes_suggestion_implicit,
suggestions,
Applicability::MachineApplicable,
Applicability::MaybeIncorrect,
style(tool_only),
);
}
Expand All @@ -3276,7 +3276,7 @@ impl Subdiagnostic for MismatchedLifetimeSyntaxesSuggestion {
diag.multipart_suggestion_with_style(
fluent::lint_mismatched_lifetime_syntaxes_suggestion_mixed,
suggestions,
Applicability::MachineApplicable,
Applicability::MaybeIncorrect,
style(tool_only),
);
}
Expand All @@ -3291,7 +3291,7 @@ impl Subdiagnostic for MismatchedLifetimeSyntaxesSuggestion {
diag.multipart_suggestion_with_style(
msg,
suggestions,
Applicability::MachineApplicable,
Applicability::MaybeIncorrect,
style(tool_only),
);
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir_transform/src/ssa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ fn compute_copy_classes(ssa: &mut SsaLocals, body: &Body<'_>) {
// visited before `local`, and we just have to copy the representing local.
let head = copies[rhs];

// Do not unify two borrowed locals.
if borrowed_classes.contains(local) && borrowed_classes.contains(head) {
// Do not unify borrowed locals.
if borrowed_classes.contains(local) || borrowed_classes.contains(head) {
continue;
}

Expand Down
2 changes: 2 additions & 0 deletions library/compiler-builtins/compiler-builtins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ links = "compiler-rt"
bench = false
doctest = false
test = false
# make sure this crate isn't included in public standard library docs
doc = false

[dependencies]
core = { path = "../../core", optional = true }
Expand Down
9 changes: 9 additions & 0 deletions library/std/src/sys/fs/windows/remove_dir_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,16 @@ fn open_link_no_reparse(
static ATTRIBUTES: Atomic<u32> = AtomicU32::new(c::OBJ_DONT_REPARSE);

let result = unsafe {
// Workaround for #143078.
// While the Windows OS itself handles zero length strings,
// some security software that hooks system functions may expect it to
// be null terminated. So as a workaround we ensure zero length strings
// always point to a zero u16 even though it should never be read.
static EMPTY_STR: [u16; 1] = [0];
let mut path_str = c::UNICODE_STRING::from_ref(path);
if path_str.Length == 0 {
path_str.Buffer = EMPTY_STR.as_ptr().cast_mut();
}
let mut object = c::OBJECT_ATTRIBUTES {
ObjectName: &mut path_str,
RootDirectory: parent.as_raw_handle(),
Expand Down
5 changes: 3 additions & 2 deletions library/std/src/sys/pal/windows/pipe.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
use crate::ops::Neg;
use crate::os::windows::prelude::*;
use crate::sys::api::utf16;
use crate::sys::api::wide_str;
use crate::sys::c;
use crate::sys::handle::Handle;
use crate::sys_common::{FromInner, IntoInner};
Expand Down Expand Up @@ -73,7 +73,8 @@ pub fn anon_pipe(ours_readable: bool, their_handle_inheritable: bool) -> io::Res
// Open a handle to the pipe filesystem (`\??\PIPE\`).
// This will be used when creating a new annon pipe.
let pipe_fs = {
let path = c::UNICODE_STRING::from_ref(utf16!(r"\??\PIPE\"));
static PIPE_PATH: [u16; 10] = *wide_str!(r"\??\PIPE\");
let path = c::UNICODE_STRING::from_ref(&PIPE_PATH[..PIPE_PATH.len() - 1]);
object_attributes.ObjectName = &path;
let mut pipe_fs = ptr::null_mut();
let status = c::NtOpenFile(
Expand Down
4 changes: 4 additions & 0 deletions library/sysroot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ name = "sysroot"
version = "0.0.0"
edition = "2024"

[lib]
# make sure this crate isn't included in public standard library docs
doc = false

# this is a dummy crate to ensure that all required crates appear in the sysroot
[dependencies]
proc_macro = { path = "../proc_macro", public = true }
Expand Down
4 changes: 0 additions & 4 deletions src/bootstrap/src/core/build_steps/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,10 +734,6 @@ fn doc_std(
}

for krate in requested_crates {
if krate == "sysroot" {
// The sysroot crate is an implementation detail, don't include it in public docs.
continue;
}
cargo.arg("-p").arg(krate);
}

Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/core/builder/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ impl Builder<'_> {
.arg("--print=file-names")
.arg("--crate-type=proc-macro")
.arg("-")
.stdin(std::process::Stdio::null())
.run_capture(self)
.stderr();

Expand Down
5 changes: 5 additions & 0 deletions src/bootstrap/src/utils/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ impl<'a> BootstrapCommand {
self
}

pub fn stdin(&mut self, stdin: std::process::Stdio) -> &mut Self {
self.command.stdin(stdin);
self
}

#[must_use]
pub fn delay_failure(self) -> Self {
Self { failure_behavior: BehaviorOnFailure::DelayFail, ..self }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
- // MIR for `borrow_in_loop` before CopyProp
+ // MIR for `borrow_in_loop` after CopyProp

fn borrow_in_loop() -> () {
let mut _0: ();
let mut _1: bool;
let _3: bool;
let mut _4: !;
let mut _5: ();
let mut _7: bool;
let mut _9: bool;
let mut _10: bool;
let mut _11: &bool;
let _12: &bool;
let mut _13: bool;
let mut _14: bool;
let mut _15: bool;
let mut _16: !;
scope 1 {
debug c => _1;
let mut _2: &bool;
let mut _17: &bool;
scope 2 {
debug p => _2;
let _6: bool;
scope 3 {
debug a => _6;
let _8: bool;
scope 4 {
debug b => _8;
}
}
}
}

bb0: {
StorageLive(_1);
StorageLive(_2);
_17 = const borrow_in_loop::promoted[0];
_2 = &(*_17);
- StorageLive(_4);
goto -> bb1;
}

bb1: {
- StorageLive(_6);
StorageLive(_7);
_7 = copy (*_2);
_6 = Not(move _7);
StorageDead(_7);
- StorageLive(_8);
StorageLive(_9);
_9 = copy (*_2);
_8 = Not(move _9);
StorageDead(_9);
- StorageLive(_10);
- _10 = copy _6;
- _1 = move _10;
- StorageDead(_10);
+ _1 = copy _6;
StorageLive(_11);
StorageLive(_12);
_12 = &_1;
_11 = &(*_12);
_2 = move _11;
StorageDead(_11);
StorageDead(_12);
StorageLive(_13);
- StorageLive(_14);
- _14 = copy _6;
- StorageLive(_15);
- _15 = copy _8;
- _13 = Ne(move _14, move _15);
+ _13 = Ne(copy _6, copy _8);
switchInt(move _13) -> [0: bb3, otherwise: bb2];
}

bb2: {
- StorageDead(_15);
- StorageDead(_14);
_0 = const ();
StorageDead(_13);
- StorageDead(_8);
- StorageDead(_6);
- StorageDead(_4);
StorageDead(_2);
StorageDead(_1);
return;
}

bb3: {
- StorageDead(_15);
- StorageDead(_14);
- _5 = const ();
StorageDead(_13);
- StorageDead(_8);
- StorageDead(_6);
goto -> bb1;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
- // MIR for `borrow_in_loop` before CopyProp
+ // MIR for `borrow_in_loop` after CopyProp

fn borrow_in_loop() -> () {
let mut _0: ();
let mut _1: bool;
let _3: bool;
let mut _4: !;
let mut _5: ();
let mut _7: bool;
let mut _9: bool;
let mut _10: bool;
let mut _11: &bool;
let _12: &bool;
let mut _13: bool;
let mut _14: bool;
let mut _15: bool;
let mut _16: !;
scope 1 {
debug c => _1;
let mut _2: &bool;
let mut _17: &bool;
scope 2 {
debug p => _2;
let _6: bool;
scope 3 {
debug a => _6;
let _8: bool;
scope 4 {
debug b => _8;
}
}
}
}

bb0: {
StorageLive(_1);
StorageLive(_2);
_17 = const borrow_in_loop::promoted[0];
_2 = &(*_17);
- StorageLive(_4);
goto -> bb1;
}

bb1: {
- StorageLive(_6);
StorageLive(_7);
_7 = copy (*_2);
_6 = Not(move _7);
StorageDead(_7);
- StorageLive(_8);
StorageLive(_9);
_9 = copy (*_2);
_8 = Not(move _9);
StorageDead(_9);
- StorageLive(_10);
- _10 = copy _6;
- _1 = move _10;
- StorageDead(_10);
+ _1 = copy _6;
StorageLive(_11);
StorageLive(_12);
_12 = &_1;
_11 = &(*_12);
_2 = move _11;
StorageDead(_11);
StorageDead(_12);
StorageLive(_13);
- StorageLive(_14);
- _14 = copy _6;
- StorageLive(_15);
- _15 = copy _8;
- _13 = Ne(move _14, move _15);
+ _13 = Ne(copy _6, copy _8);
switchInt(move _13) -> [0: bb3, otherwise: bb2];
}

bb2: {
- StorageDead(_15);
- StorageDead(_14);
_0 = const ();
StorageDead(_13);
- StorageDead(_8);
- StorageDead(_6);
- StorageDead(_4);
StorageDead(_2);
StorageDead(_1);
return;
}

bb3: {
- StorageDead(_15);
- StorageDead(_14);
- _5 = const ();
StorageDead(_13);
- StorageDead(_8);
- StorageDead(_6);
goto -> bb1;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
let mut _3: &T;

bb0: {
- _2 = copy _1;
_2 = copy _1;
_3 = &_1;
_0 = opaque::<&T>(copy _3) -> [return: bb1, unwind unreachable];
}

bb1: {
- _0 = opaque::<T>(copy _2) -> [return: bb2, unwind unreachable];
+ _0 = opaque::<T>(copy _1) -> [return: bb2, unwind unreachable];
_0 = opaque::<T>(copy _2) -> [return: bb2, unwind unreachable];
}

bb2: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
let mut _3: &T;

bb0: {
- _2 = copy _1;
_2 = copy _1;
_3 = &_1;
_0 = opaque::<&T>(copy _3) -> [return: bb1, unwind continue];
}

bb1: {
- _0 = opaque::<T>(copy _2) -> [return: bb2, unwind continue];
+ _0 = opaque::<T>(copy _1) -> [return: bb2, unwind continue];
_0 = opaque::<T>(copy _2) -> [return: bb2, unwind continue];
}

bb2: {
Expand Down
Loading
Loading