File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 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) ]
22
33trait ZeroSized : Sized {
44 const I_AM_ZERO_SIZED : ( ) ;
55 fn requires_zero_size ( self ) ;
66}
77
88impl < 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
1010 fn requires_zero_size ( self ) {
1111 let ( ) = Self :: I_AM_ZERO_SIZED ; //~ ERROR erroneous constant encountered
1212 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+
115error: erroneous constant encountered
216 --> $DIR/assoc_const_generic_impl.rs:11:18
317 |
You can’t perform that action at this time.
0 commit comments