Skip to content
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

Automatic Rustup #4169

Merged
merged 37 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4348b4f
More assertions, tests, and miri coverage
compiler-errors Jan 11, 2025
f6e5eac
Auto merge of #135318 - compiler-errors:vtable-fixes, r=lcnr
bors Jan 31, 2025
0c19146
Rollup merge of #135414 - tgross35:stabilize-const_black_box, r=dtolnay
jhpratt Jan 31, 2025
239029d
Rollup merge of #136150 - marcoieni:windows-25-i686-mingw, r=Kobzol
jhpratt Jan 31, 2025
7aa296d
Rollup merge of #136258 - notriddle:notriddle/issue-d, r=fmease
jhpratt Jan 31, 2025
549dce4
Rollup merge of #136270 - nnethercote:rm-NamedVarMap, r=jackh726
jhpratt Jan 31, 2025
a443c70
Rollup merge of #136278 - lqd:polonius-debugger-episode-3, r=matthewj…
jhpratt Jan 31, 2025
598ee72
Rollup merge of #136287 - zmodem:nocapture, r=nikic
jhpratt Jan 31, 2025
1c51960
Rollup merge of #136291 - lcnr:compare-mode, r=oli-obk
jhpratt Jan 31, 2025
e8942ba
Rollup merge of #136296 - RalfJung:float-min-max, r=tgross35
jhpratt Jan 31, 2025
5ac7cef
Rollup merge of #132156 - estebank:closure-return, r=Nadrieril,compil…
jhpratt Jan 31, 2025
ee157d7
Rollup merge of #133429 - EnzymeAD:autodiff-middle, r=oli-obk
jhpratt Jan 31, 2025
a727b88
Rollup merge of #136281 - nnethercote:rustc_hir_analysis, r=lcnr
jhpratt Jan 31, 2025
8c06611
Rollup merge of #136297 - zeenix:patch-1, r=lqd
jhpratt Jan 31, 2025
0f6b162
Rollup merge of #136300 - RalfJung:compare-and-swap, r=joboet
jhpratt Jan 31, 2025
0b1d7cd
Rollup merge of #136310 - lqd:long-types, r=compiler-errors
jhpratt Jan 31, 2025
63bccea
Rollup merge of #136312 - compiler-errors:overflow_delimited_expr-202…
jhpratt Jan 31, 2025
f7458fe
Rollup merge of #136313 - compiler-errors:too-many-args, r=lqd
jhpratt Jan 31, 2025
7a6850c
Rollup merge of #136323 - etaoins:fix-typo-in-conventions-md, r=tgross35
jhpratt Jan 31, 2025
a16fef4
Auto merge of #136331 - jhpratt:rollup-curo1f4, r=jhpratt
bors Jan 31, 2025
1a8cc75
Auto merge of #136332 - jhpratt:rollup-aa69d0e, r=jhpratt
bors Jan 31, 2025
5c034a5
Insert null checks for pointer dereferences when debug assertions are…
1c3t3a Dec 17, 2024
bc18ada
Rollup merge of #134531 - GuillaumeGomez:extract-doctests, r=notriddl…
matthiaskrgr Jan 31, 2025
eab7f66
Rollup merge of #135860 - fmease:compiler-mv-obj-save-dyn-compat-ii, …
matthiaskrgr Jan 31, 2025
d7eda54
Rollup merge of #135992 - madsmtm:new-target-docs, r=jieyouxu
matthiaskrgr Jan 31, 2025
665c461
Rollup merge of #136194 - taiki-e:bpf-clobber-abi, r=amanieu
matthiaskrgr Jan 31, 2025
9cbb2c1
Rollup merge of #136325 - compiler-errors:indirectly, r=RalfJung
matthiaskrgr Jan 31, 2025
9fb798d
Rollup merge of #136326 - Zalathar:llvm-di-builder-ref, r=nikic
matthiaskrgr Jan 31, 2025
c0341f1
Rollup merge of #136330 - nnethercote:rm-unnecessary-hooks, r=oli-obk
matthiaskrgr Jan 31, 2025
0c38931
Rollup merge of #136336 - nnethercote:overhaul-rustc_middle-util, r=j…
matthiaskrgr Jan 31, 2025
c2ae2cc
Rollup merge of #136341 - jieyouxu:unvac, r=jieyouxu
matthiaskrgr Jan 31, 2025
dd6efe1
Auto merge of #134424 - 1c3t3a:null-checks, r=saethlin
bors Jan 31, 2025
d5a9484
Auto merge of #136350 - matthiaskrgr:rollup-6eqfyvh, r=matthiaskrgr
bors Jan 31, 2025
b28db99
Auto merge of #135768 - jieyouxu:migrate-symbol-mangling-hashed, r=No…
bors Feb 1, 2025
3cf8563
Preparing for merge from rustc
Feb 1, 2025
bb0e872
Merge from rustc
Feb 1, 2025
2f40c01
fmt
Feb 1, 2025
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
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6c1d960d88dd3755548b3818630acb63fa98187e
9709af79014a150df7807671e6250ed940c488eb
18 changes: 10 additions & 8 deletions src/borrow_tracker/stacked_borrows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,10 +904,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
new_perm: NewPermission,
) -> InterpResult<'tcx> {
let val = self.ecx.read_immediate(&self.ecx.place_to_op(place)?)?;
let val = self.ecx.sb_retag_reference(&val, new_perm, RetagInfo {
cause: self.retag_cause,
in_field: self.in_field,
})?;
let val = self.ecx.sb_retag_reference(
&val,
new_perm,
RetagInfo { cause: self.retag_cause, in_field: self.in_field },
)?;
self.ecx.write_immediate(*val, place)?;
interp_ok(())
}
Expand Down Expand Up @@ -996,10 +997,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
access: Some(AccessKind::Write),
protector: Some(ProtectorKind::StrongProtector),
};
this.sb_retag_place(place, new_perm, RetagInfo {
cause: RetagCause::InPlaceFnPassing,
in_field: false,
})
this.sb_retag_place(
place,
new_perm,
RetagInfo { cause: RetagCause::InPlaceFnPassing, in_field: false },
)
}

/// Mark the given tag as exposed. It was found on a pointer with the given AllocId.
Expand Down
20 changes: 12 additions & 8 deletions src/borrow_tracker/tree_borrows/perms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,18 @@ pub mod diagnostics {
use super::*;
impl fmt::Display for PermissionPriv {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", match self {
ReservedFrz { conflicted: false } => "Reserved",
ReservedFrz { conflicted: true } => "Reserved (conflicted)",
ReservedIM => "Reserved (interior mutable)",
Active => "Active",
Frozen => "Frozen",
Disabled => "Disabled",
})
write!(
f,
"{}",
match self {
ReservedFrz { conflicted: false } => "Reserved",
ReservedFrz { conflicted: true } => "Reserved (conflicted)",
ReservedIM => "Reserved (interior mutable)",
Active => "Active",
Frozen => "Frozen",
Disabled => "Disabled",
}
)
}
}

Expand Down
40 changes: 23 additions & 17 deletions src/borrow_tracker/tree_borrows/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,15 +581,18 @@ impl Tree {
let mut debug_info = NodeDebugInfo::new(root_tag, root_default_perm, span);
// name the root so that all allocations contain one named pointer
debug_info.add_name("root of the allocation");
nodes.insert(root_idx, Node {
tag: root_tag,
parent: None,
children: SmallVec::default(),
default_initial_perm: root_default_perm,
// The root may never be skipped, all accesses will be local.
default_initial_idempotent_foreign_access: IdempotentForeignAccess::None,
debug_info,
});
nodes.insert(
root_idx,
Node {
tag: root_tag,
parent: None,
children: SmallVec::default(),
default_initial_perm: root_default_perm,
// The root may never be skipped, all accesses will be local.
default_initial_idempotent_foreign_access: IdempotentForeignAccess::None,
debug_info,
},
);
nodes
};
let rperms = {
Expand Down Expand Up @@ -624,14 +627,17 @@ impl<'tcx> Tree {
let parent_idx = self.tag_mapping.get(&parent_tag).unwrap();
let strongest_idempotent = default_initial_perm.strongest_idempotent_foreign_access(prot);
// Create the node
self.nodes.insert(idx, Node {
tag: new_tag,
parent: Some(parent_idx),
children: SmallVec::default(),
default_initial_perm,
default_initial_idempotent_foreign_access: strongest_idempotent,
debug_info: NodeDebugInfo::new(new_tag, default_initial_perm, span),
});
self.nodes.insert(
idx,
Node {
tag: new_tag,
parent: Some(parent_idx),
children: SmallVec::default(),
default_initial_perm,
default_initial_idempotent_foreign_access: strongest_idempotent,
debug_info: NodeDebugInfo::new(new_tag, default_initial_perm, span),
},
);
// Register new_tag as a child of parent_tag
self.nodes.get_mut(parent_idx).unwrap().children.push(idx);
// Initialize perms
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ pub const MIRI_DEFAULT_ARGS: &[&str] = &[
"-Zmir-emit-retag",
"-Zmir-keep-place-mention",
"-Zmir-opt-level=0",
"-Zmir-enable-passes=-CheckAlignment",
"-Zmir-enable-passes=-CheckAlignment,-CheckNull",
// Deduplicating diagnostics means we miss events when tracking what happens during an
// execution. Let's not do that.
"-Zdeduplicate-diagnostics=no",
Expand Down
11 changes: 7 additions & 4 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,10 +1111,13 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
// Call the lang item.
let panic = ecx.tcx.lang_items().get(reason.lang_item()).unwrap();
let panic = ty::Instance::mono(ecx.tcx.tcx, panic);
ecx.call_function(panic, ExternAbi::Rust, &[], None, StackPopCleanup::Goto {
ret: None,
unwind: mir::UnwindAction::Unreachable,
})?;
ecx.call_function(
panic,
ExternAbi::Rust,
&[],
None,
StackPopCleanup::Goto { ret: None, unwind: mir::UnwindAction::Unreachable },
)?;
interp_ok(())
}

Expand Down
8 changes: 4 additions & 4 deletions src/shims/extern_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ impl<'tcx> MiriMachine<'tcx> {

match ecx.tcx.sess.target.os.as_ref() {
"linux" => {
Self::null_ptr_extern_statics(ecx, &[
"__cxa_thread_atexit_impl",
"__clock_gettime64",
])?;
Self::null_ptr_extern_statics(
ecx,
&["__cxa_thread_atexit_impl", "__clock_gettime64"],
)?;
Self::weak_symbol_extern_statics(ecx, &["getrandom", "statx"])?;
}
"freebsd" => {
Expand Down
11 changes: 7 additions & 4 deletions src/shims/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
// Call the lang item associated with this message.
let fn_item = this.tcx.require_lang_item(msg.panic_function(), None);
let instance = ty::Instance::mono(this.tcx.tcx, fn_item);
this.call_function(instance, ExternAbi::Rust, &[], None, StackPopCleanup::Goto {
ret: None,
unwind,
})?;
this.call_function(
instance,
ExternAbi::Rust,
&[],
None,
StackPopCleanup::Goto { ret: None, unwind },
)?;
}
}
interp_ok(())
Expand Down
24 changes: 12 additions & 12 deletions tests/pass-dep/libc/libc-epoll-no-blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ fn test_two_same_fd_in_same_epoll_instance() {
//Two notification should be received.
let expected_event = u32::try_from(libc::EPOLLIN | libc::EPOLLOUT).unwrap();
let expected_value = 5 as u64;
check_epoll_wait::<8>(epfd, &[
(expected_event, expected_value),
(expected_event, expected_value),
]);
check_epoll_wait::<8>(
epfd,
&[(expected_event, expected_value), (expected_event, expected_value)],
);
}

fn test_epoll_eventfd() {
Expand Down Expand Up @@ -290,10 +290,10 @@ fn test_epoll_socketpair_both_sides() {
let expected_value0 = fds[0] as u64;
let expected_event1 = u32::try_from(libc::EPOLLOUT).unwrap();
let expected_value1 = fds[1] as u64;
check_epoll_wait::<8>(epfd, &[
(expected_event0, expected_value0),
(expected_event1, expected_value1),
]);
check_epoll_wait::<8>(
epfd,
&[(expected_event0, expected_value0), (expected_event1, expected_value1)],
);

// Read from fds[0].
let mut buf: [u8; 5] = [0; 5];
Expand Down Expand Up @@ -453,10 +453,10 @@ fn test_socketpair_read() {
let expected_value0 = fds[0] as u64;
let expected_event1 = u32::try_from(libc::EPOLLOUT).unwrap();
let expected_value1 = fds[1] as u64;
check_epoll_wait::<8>(epfd, &[
(expected_event0, expected_value0),
(expected_event1, expected_value1),
]);
check_epoll_wait::<8>(
epfd,
&[(expected_event0, expected_value0), (expected_event1, expected_value1)],
);

// Read 3 bytes from fds[0].
let mut buf: [u8; 3] = [0; 3];
Expand Down
52 changes: 52 additions & 0 deletions tests/pass/dyn-upcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ fn main() {
replace_vptr();
vtable_nop_cast();
drop_principal();
modulo_binder();
modulo_assoc();
}

fn vtable_nop_cast() {
Expand Down Expand Up @@ -482,3 +484,53 @@ fn drop_principal() {
println!("before");
drop(y);
}

// Test for <https://github.com/rust-lang/rust/issues/135316>.
fn modulo_binder() {
trait Supertrait<T> {
fn _print_numbers(&self, mem: &[usize; 100]) {
println!("{mem:?}");
}
}
impl<T> Supertrait<T> for () {}

trait Trait<T, U>: Supertrait<T> + Supertrait<U> {
fn say_hello(&self, _: &usize) {
println!("Hello!");
}
}
impl<T, U> Trait<T, U> for () {}

(&() as &'static dyn for<'a> Trait<&'static (), &'a ()>
as &'static dyn Trait<&'static (), &'static ()>)
.say_hello(&0);
}

// Test for <https://github.com/rust-lang/rust/issues/135315>.
fn modulo_assoc() {
trait Supertrait<T> {
fn _print_numbers(&self, mem: &[usize; 100]) {
println!("{mem:?}");
}
}
impl<T> Supertrait<T> for () {}

trait Identity {
type Selff;
}
impl<Selff> Identity for Selff {
type Selff = Selff;
}

trait Middle<T>: Supertrait<()> + Supertrait<T> {
fn say_hello(&self, _: &usize) {
println!("Hello!");
}
}
impl<T> Middle<T> for () {}

trait Trait: Middle<<() as Identity>::Selff> {}
impl Trait for () {}

(&() as &dyn Trait as &dyn Middle<()>).say_hello(&0);
}
2 changes: 2 additions & 0 deletions tests/pass/dyn-upcast.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ before
goodbye
before
goodbye
Hello!
Hello!
33 changes: 18 additions & 15 deletions tests/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,25 @@ fn miri_config(
config.comment_defaults.base().add_custom("edition", Edition("2021".into()));

if let Some(WithDependencies { bless }) = with_dependencies {
config.comment_defaults.base().set_custom("dependencies", DependencyBuilder {
program: CommandBuilder {
// Set the `cargo-miri` binary, which we expect to be in the same folder as the `miri` binary.
// (It's a separate crate, so we don't get an env var from cargo.)
program: miri_path()
.with_file_name(format!("cargo-miri{}", env::consts::EXE_SUFFIX)),
// There is no `cargo miri build` so we just use `cargo miri run`.
args: ["miri", "run"].into_iter().map(Into::into).collect(),
// Reset `RUSTFLAGS` to work around <https://github.com/rust-lang/rust/pull/119574#issuecomment-1876878344>.
envs: vec![("RUSTFLAGS".into(), None)],
..CommandBuilder::cargo()
config.comment_defaults.base().set_custom(
"dependencies",
DependencyBuilder {
program: CommandBuilder {
// Set the `cargo-miri` binary, which we expect to be in the same folder as the `miri` binary.
// (It's a separate crate, so we don't get an env var from cargo.)
program: miri_path()
.with_file_name(format!("cargo-miri{}", env::consts::EXE_SUFFIX)),
// There is no `cargo miri build` so we just use `cargo miri run`.
args: ["miri", "run"].into_iter().map(Into::into).collect(),
// Reset `RUSTFLAGS` to work around <https://github.com/rust-lang/rust/pull/119574#issuecomment-1876878344>.
envs: vec![("RUSTFLAGS".into(), None)],
..CommandBuilder::cargo()
},
crate_manifest_path: Path::new("test_dependencies").join("Cargo.toml"),
build_std: None,
bless_lockfile: bless,
},
crate_manifest_path: Path::new("test_dependencies").join("Cargo.toml"),
build_std: None,
bless_lockfile: bless,
});
);
}
config
}
Expand Down