Skip to content

Commit

Permalink
Auto merge of #3064 - rust-lang:rustup-2023-09-19, r=RalfJung
Browse files Browse the repository at this point in the history
Automatic sync from rustc
  • Loading branch information
bors committed Sep 19, 2023
2 parents 6ea8639 + 7e1fedb commit 13510ac
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ae9465fee3962c0c895959001302999bc48ba6d5
19dd9535408db0f1ff3d16613619076aef524d19
3 changes: 1 addition & 2 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
fn eval_path_scalar(&self, path: &[&str]) -> Scalar<Provenance> {
let this = self.eval_context_ref();
let instance = this.resolve_path(path, Namespace::ValueNS);
let cid = GlobalId { instance, promoted: None };
// We don't give a span -- this isn't actually used directly by the program anyway.
let const_val = this.eval_global(cid, None).unwrap_or_else(|err| {
let const_val = this.eval_global(instance).unwrap_or_else(|err| {
panic!("failed to evaluate required Rust item: {path:?}\n{err:?}")
});
this.read_scalar(&const_val)
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/const-ub-checks.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
LL | ptr.read();
| ^^^^^^^^^^ accessing memory with alignment ALIGN, but alignment ALIGN is required

note: erroneous constant used
note: erroneous constant encountered
--> $DIR/const-ub-checks.rs:LL:CC
|
LL | let _x = UNALIGNED_READ;
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/erroneous_const.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | const VOID: ! = panic!();
|
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

note: erroneous constant used
note: erroneous constant encountered
--> $DIR/erroneous_const.rs:LL:CC
|
LL | let _ = PrintName::<T>::VOID;
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/erroneous_const2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ error[E0080]: evaluation of constant value failed
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
| ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow

note: erroneous constant used
note: erroneous constant encountered
--> $DIR/erroneous_const2.rs:LL:CC
|
LL | println!("{}", FOO);
| ^^^

note: erroneous constant used
note: erroneous constant encountered
--> $DIR/erroneous_const2.rs:LL:CC
|
LL | println!("{}", FOO);
Expand Down

0 comments on commit 13510ac

Please sign in to comment.