File tree 2 files changed +16
-2
lines changed
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
- #![ allow ( const_err) ]
1
+ #![ warn ( const_err) ]
2
2
3
3
trait ZeroSized : Sized {
4
4
const I_AM_ZERO_SIZED : ( ) ;
5
5
fn requires_zero_size ( self ) ;
6
6
}
7
7
8
8
impl < T : Sized > ZeroSized for T {
9
- const I_AM_ZERO_SIZED : ( ) = [ ( ) ] [ std:: mem:: size_of :: < Self > ( ) ] ;
9
+ const I_AM_ZERO_SIZED : ( ) = [ ( ) ] [ std:: mem:: size_of :: < Self > ( ) ] ; //~ WARN any use of this value
10
10
fn requires_zero_size ( self ) {
11
11
let ( ) = Self :: I_AM_ZERO_SIZED ; //~ ERROR erroneous constant encountered
12
12
println ! ( "requires_zero_size called" ) ;
Original file line number Diff line number Diff line change
1
+ warning: any use of this value will cause an error
2
+ --> $DIR/assoc_const_generic_impl.rs:9:34
3
+ |
4
+ LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()];
5
+ | -----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
6
+ | |
7
+ | index out of bounds: the len is 1 but the index is 4
8
+ |
9
+ note: lint level defined here
10
+ --> $DIR/assoc_const_generic_impl.rs:1:9
11
+ |
12
+ LL | #![warn(const_err)]
13
+ | ^^^^^^^^^
14
+
1
15
error: erroneous constant encountered
2
16
--> $DIR/assoc_const_generic_impl.rs:11:18
3
17
|
You can’t perform that action at this time.
0 commit comments