Skip to content

Commit 6a3a321

Browse files
committed
update test suite
1 parent 76240d7 commit 6a3a321

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

Diff for: src/test/ui/consts/const-eval/ub-ref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
2626
const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
2727
//~^ ERROR it is undefined behavior to use this value
2828

29-
const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
29+
const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute(&[&0] as &[_]) };
3030
//~^ ERROR it is undefined behavior to use this value
3131

3232
const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };

Diff for: src/test/ui/consts/const-eval/ub-ref.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
4949
error[E0080]: it is undefined behavior to use this value
5050
--> $DIR/ub-ref.rs:29:1
5151
|
52-
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
53-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer at .<deref>, but expected plain (non-pointer) bytes
52+
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute(&[&0] as &[_]) };
53+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer at .<deref>, but expected plain (non-pointer) bytes
5454
|
5555
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
5656

Diff for: src/test/ui/consts/rfc-2203-const-array-repeat-exprs/fn-call-in-const.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// run-pass
22

3-
#![allow(unused)]
3+
#![allow(unused, incomplete_features)]
44
#![feature(const_in_array_repeat_expressions)]
5+
#![feature(inline_const)]
56

67
// Some type that is not copyable.
78
struct Bar;
@@ -16,8 +17,6 @@ const fn type_copy() -> u32 {
1617

1718
const _: [u32; 2] = [type_copy(); 2];
1819

19-
// This is allowed because all promotion contexts use the explicit rules for promotability when
20-
// inside an explicit const context.
21-
const _: [Option<Bar>; 2] = [type_no_copy(); 2];
20+
const _: [Option<Bar>; 2] = [const { type_no_copy() }; 2];
2221

2322
fn main() {}

0 commit comments

Comments
 (0)