File tree Expand file tree Collapse file tree 6 files changed +40
-7
lines changed Expand file tree Collapse file tree 6 files changed +40
-7
lines changed Original file line number Diff line number Diff line change @@ -964,15 +964,15 @@ This does not pose a problem by itself because they can't be accessed directly."
964964 let ( msg, note) = if let UnstableFeatures :: Disallow =
965965 self . tcx . sess . opts . unstable_features {
966966 ( format ! ( "calls in {}s are limited to \
967- struct and enum constructors ",
967+ tuple structs and tuple variants ",
968968 self . mode) ,
969969 Some ( "a limited form of compile-time function \
970970 evaluation is available on a nightly \
971971 compiler via `const fn`") )
972972 } else {
973973 ( format ! ( "calls in {}s are limited \
974974 to constant functions, \
975- struct and enum constructors ",
975+ tuple structs and tuple variants ",
976976 self . mode) ,
977977 None )
978978 } ;
Original file line number Diff line number Diff line change 1111fn xyz ( ) -> u8 { 42 }
1212
1313const NUM : u8 = xyz ( ) ;
14- //~^ ERROR calls in constants are limited to constant functions, struct and enum constructors
14+ //~^ ERROR calls in constants are limited to constant functions, tuple structs and tuple variants
1515//~| ERROR constant evaluation error
1616
1717fn main ( ) {
Original file line number Diff line number Diff line change 77// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88// option. This file may not be copied, modified, or distributed
99// except according to those terms.
10+
11+ // ignore-tidy-linelength
12+
1013#![ feature( const_fn) ]
1114
1215const bad : u32 = {
@@ -20,7 +23,7 @@ const bad_two : u32 = {
2023 {
2124 invalid ( ) ;
2225 //~^ ERROR: blocks in constants are limited to items and tail expressions
23- //~^^ ERROR: calls in constants are limited to constant functions, struct and enum
26+ //~^^ ERROR: calls in constants are limited to constant functions, tuple structs and tuple variants
2427 0
2528 }
2629} ;
@@ -44,7 +47,7 @@ static bad_five : u32 = {
4447 {
4548 invalid ( ) ;
4649 //~^ ERROR: blocks in statics are limited to items and tail expressions
47- //~^^ ERROR: calls in statics are limited to constant functions, struct and enum
50+ //~^^ ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants
4851 0
4952 }
5053} ;
@@ -68,7 +71,7 @@ static mut bad_eight : u32 = {
6871 {
6972 invalid ( ) ;
7073 //~^ ERROR: blocks in statics are limited to items and tail expressions
71- //~^^ ERROR: calls in statics are limited to constant functions, struct and enum
74+ //~^^ ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants
7275 0
7376 }
7477} ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ error[E0016]: blocks in constant functions are limited to items and tail express
44LL | let mut sum = 0;
55 | ^
66
7- error[E0015]: calls in constant functions are limited to constant functions, struct and enum constructors
7+ error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
88 --> $DIR/const-fn-error.rs:18:14
99 |
1010LL | for i in 0..x {
Original file line number Diff line number Diff line change 1+ // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ #![ allow( dead_code) ]
12+
13+ struct Foo { a : u8 }
14+ fn bar ( ) -> Foo {
15+ Foo { a : 5 }
16+ }
17+
18+ static foo: Foo = bar ( ) ;
19+ //~^ ERROR calls in statics are limited to constant functions, tuple structs and tuple variants
20+
21+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
2+ --> $DIR/mir_check_nonconst.rs:18:19
3+ |
4+ LL | static foo: Foo = bar();
5+ | ^^^^^
6+
7+ error: aborting due to previous error
8+
9+ For more information about this error, try `rustc --explain E0015`.
You can’t perform that action at this time.
0 commit comments