Addressed minor issues brought up in review.

This commit is contained in:
Alexander Regueiro 2018-09-18 04:26:39 +01:00 committed by Oliver Scherer
parent bf8471aeda
commit 7c34f2da57
4 changed files with 14 additions and 14 deletions

View file

@ -19,17 +19,15 @@ union Bar {
const fn bar() -> u8 {
unsafe {
// this will error as long as this test
// is run on a system whose pointers need more
// than 8 bits
// This will error as long as this test is run on a system whose
// pointers need more than 8 bits.
Bar { a: &42 }.b as u8
}
}
fn main() {
// FIXME(oli-obk): this should panic at runtime
// this will actually compile, but then
// abort at runtime (not panic, hard abort).
// This will compile, but then hard-abort at runtime.
// FIXME(oli-obk): this should instead panic (not hard-abort) at runtime.
let x: &'static u8 = &(bar() + 1);
let y = *x;
unreachable!();

View file

@ -1,5 +1,5 @@
error: reaching this expression at runtime will panic or abort
--> $DIR/promoted_const_fn_fail_deny_const_err.rs:33:26
--> $DIR/promoted_const_fn_fail_deny_const_err.rs:31:26
|
LL | Bar { a: &42 }.b as u8
| ---------------------- a raw memory access tried to access part of a pointer value as raw bytes
@ -16,4 +16,3 @@ LL | #![deny(const_err)]
| ^^^^^^^^^
error: aborting due to previous error