Stabilize min_const_fn

This commit is contained in:
Oliver Schneider 2018-10-05 10:17:16 +02:00
parent b8bea5a0a6
commit ec74d3533a
68 changed files with 143 additions and 223 deletions

View file

@ -11,6 +11,5 @@
// Crate that exports a const fn. Used for testing cross-crate.
#![crate_type="rlib"]
#![feature(min_const_fn)]
pub const fn foo() -> usize { 22 } //~ ERROR const fn is unstable

View file

@ -10,8 +10,6 @@
#![warn(const_err)]
#![feature(min_const_fn)]
const fn foo(x: u32) -> u32 {
x
}

View file

@ -1,5 +1,5 @@
warning: this constant cannot be used
--> $DIR/issue-43197.rs:20:5
--> $DIR/issue-43197.rs:18:5
|
LL | const X: u32 = 0-1;
| ^^^^^^^^^^^^^^^---^
@ -13,7 +13,7 @@ LL | #![warn(const_err)]
| ^^^^^^^^^
warning: this constant cannot be used
--> $DIR/issue-43197.rs:22:5
--> $DIR/issue-43197.rs:20:5
|
LL | const Y: u32 = foo(0-1);
| ^^^^^^^^^^^^^^^^^^^---^^
@ -21,7 +21,7 @@ LL | const Y: u32 = foo(0-1);
| attempt to subtract with overflow
error[E0080]: referenced constant has errors
--> $DIR/issue-43197.rs:24:26
--> $DIR/issue-43197.rs:22:26
|
LL | const Y: u32 = foo(0-1);
| --- attempt to subtract with overflow
@ -30,13 +30,13 @@ LL | println!("{} {}", X, Y);
| ^
error[E0080]: erroneous constant used
--> $DIR/issue-43197.rs:24:26
--> $DIR/issue-43197.rs:22:26
|
LL | println!("{} {}", X, Y);
| ^ referenced constant has errors
error[E0080]: referenced constant has errors
--> $DIR/issue-43197.rs:24:23
--> $DIR/issue-43197.rs:22:23
|
LL | const X: u32 = 0-1;
| --- attempt to subtract with overflow
@ -45,7 +45,7 @@ LL | println!("{} {}", X, Y);
| ^
error[E0080]: erroneous constant used
--> $DIR/issue-43197.rs:24:23
--> $DIR/issue-43197.rs:22:23
|
LL | println!("{} {}", X, Y);
| ^ referenced constant has errors

View file

@ -10,8 +10,6 @@
// compile-pass
#![feature(min_const_fn)]
struct S(pub &'static u32, pub u32);
const fn g(ss: &S) -> &u32 { &ss.1 }

View file

@ -10,8 +10,6 @@
// compile-pass
#![feature(min_const_fn)]
#[derive(PartialEq, Eq)]
enum Cake {
BlackForest,

View file

@ -0,0 +1,5 @@
const fn cmp(x: fn(), y: fn()) -> bool { //~ ERROR function pointers in const fn are unstable
x == y
}
fn main() {}

View file

@ -0,0 +1,8 @@
error: function pointers in const fn are unstable
--> $DIR/cmp_fn_pointers.rs:1:14
|
LL | const fn cmp(x: fn(), y: fn()) -> bool { //~ ERROR function pointers in const fn are unstable
| ^
error: aborting due to previous error

View file

@ -1,197 +1,197 @@
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/min_const_fn.rs:49:25
--> $DIR/min_const_fn.rs:47:25
|
LL | const fn into_inner(self) -> T { self.0 } //~ destructors cannot be evaluated
| ^^^^ constant functions cannot evaluate destructors
error: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:51:36
--> $DIR/min_const_fn.rs:49:36
|
LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 }
| ^^^^^^
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/min_const_fn.rs:56:28
--> $DIR/min_const_fn.rs:54:28
|
LL | const fn into_inner_lt(self) -> T { self.0 } //~ destructors cannot be evaluated
| ^^^^ constant functions cannot evaluate destructors
error: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:58:42
--> $DIR/min_const_fn.rs:56:42
|
LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
| ^^^^^^
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/min_const_fn.rs:63:27
--> $DIR/min_const_fn.rs:61:27
|
LL | const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructors
| ^^^^ constant functions cannot evaluate destructors
error: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:65:38
--> $DIR/min_const_fn.rs:63:38
|
LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
| ^^^^^^
error: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:70:39
--> $DIR/min_const_fn.rs:68:39
|
LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
| ^^^^^^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:88:16
--> $DIR/min_const_fn.rs:86:16
|
LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
| ^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:90:18
--> $DIR/min_const_fn.rs:88:18
|
LL | const fn foo11_2<T: Send>(t: T) -> T { t }
| ^
error: only int, `bool` and `char` operations are stable in const fn
--> $DIR/min_const_fn.rs:92:33
--> $DIR/min_const_fn.rs:90:33
|
LL | const fn foo19(f: f32) -> f32 { f * 2.0 }
| ^^^^^^^
error: only int, `bool` and `char` operations are stable in const fn
--> $DIR/min_const_fn.rs:94:35
--> $DIR/min_const_fn.rs:92:35
|
LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f }
| ^^^^^^^
error: only int and `bool` operations are stable in const fn
--> $DIR/min_const_fn.rs:96:35
--> $DIR/min_const_fn.rs:94:35
|
LL | const fn foo19_3(f: f32) -> f32 { -f }
| ^^
error: only int, `bool` and `char` operations are stable in const fn
--> $DIR/min_const_fn.rs:98:43
--> $DIR/min_const_fn.rs:96:43
|
LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g }
| ^^^^^
error: cannot access `static` items in const fn
--> $DIR/min_const_fn.rs:102:27
--> $DIR/min_const_fn.rs:100:27
|
LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in const fn
| ^^^
error: cannot access `static` items in const fn
--> $DIR/min_const_fn.rs:103:36
--> $DIR/min_const_fn.rs:101:36
|
LL | const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access `static` items
| ^^^^
error: casting pointers to ints is unstable in const fn
--> $DIR/min_const_fn.rs:104:42
--> $DIR/min_const_fn.rs:102:42
|
LL | const fn foo30(x: *const u32) -> usize { x as usize }
| ^^^^^^^^^^
error: casting pointers to ints is unstable in const fn
--> $DIR/min_const_fn.rs:106:42
--> $DIR/min_const_fn.rs:104:42
|
LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }
| ^^^^^^^^^^
error: `if`, `match`, `&&` and `||` are not stable in const fn
--> $DIR/min_const_fn.rs:108:38
--> $DIR/min_const_fn.rs:106:38
|
LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
| ^^^^^^^^^^^^^^^^^^^^^^
error: `if`, `match`, `&&` and `||` are not stable in const fn
--> $DIR/min_const_fn.rs:110:29
--> $DIR/min_const_fn.rs:108:29
|
LL | const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn
| ^^^^^^^^^^^
error: local variables in const fn are unstable
--> $DIR/min_const_fn.rs:111:34
--> $DIR/min_const_fn.rs:109:34
|
LL | const fn foo30_6() -> bool { let x = true; x } //~ ERROR local variables in const fn are unstable
| ^
error: `if`, `match`, `&&` and `||` are not stable in const fn
--> $DIR/min_const_fn.rs:112:44
--> $DIR/min_const_fn.rs:110:44
|
LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
| ^^^^^^
error: `if`, `match`, `&&` and `||` are not stable in const fn
--> $DIR/min_const_fn.rs:114:44
--> $DIR/min_const_fn.rs:112:44
|
LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
| ^^^^^^
error: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:116:14
--> $DIR/min_const_fn.rs:114:14
|
LL | const fn inc(x: &mut i32) { *x += 1 }
| ^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:121:6
--> $DIR/min_const_fn.rs:119:6
|
LL | impl<T: std::fmt::Debug> Foo<T> {
| ^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:126:6
--> $DIR/min_const_fn.rs:124:6
|
LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
| ^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:131:6
--> $DIR/min_const_fn.rs:129:6
|
LL | impl<T: Sync + Sized> Foo<T> {
| ^
error: `impl Trait` in const fn is unstable
--> $DIR/min_const_fn.rs:137:24
--> $DIR/min_const_fn.rs:135:24
|
LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:139:34
--> $DIR/min_const_fn.rs:137:34
|
LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
| ^^^^^^^^^^^^^^^^^^^^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:141:22
--> $DIR/min_const_fn.rs:139:22
|
LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
| ^^^^^^^^^^^^^^^^^^^^
error: `impl Trait` in const fn is unstable
--> $DIR/min_const_fn.rs:142:23
--> $DIR/min_const_fn.rs:140:23
|
LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable
| ^^^^^^^^^^^^^^^^^^^^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:143:23
--> $DIR/min_const_fn.rs:141:23
|
LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
| ^^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:144:32
--> $DIR/min_const_fn.rs:142:32
|
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0716]: temporary value dropped while borrowed
--> $DIR/min_const_fn.rs:144:64
--> $DIR/min_const_fn.rs:142:64
|
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
| ^^ - temporary value is freed at the end of this statement
@ -201,19 +201,19 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
= note: borrowed value must be valid for the static lifetime...
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:149:41
--> $DIR/min_const_fn.rs:147:41
|
LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: function pointers in const fn are unstable
--> $DIR/min_const_fn.rs:152:21
--> $DIR/min_const_fn.rs:150:21
|
LL | const fn no_fn_ptrs(_x: fn()) {}
| ^^
error: function pointers in const fn are unstable
--> $DIR/min_const_fn.rs:154:27
--> $DIR/min_const_fn.rs:152:27
|
LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
| ^^^^

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(min_const_fn)]
// ok
const fn foo1() {}
const fn foo2(x: i32) -> i32 { x }

View file

@ -1,209 +1,209 @@
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/min_const_fn.rs:49:25
--> $DIR/min_const_fn.rs:47:25
|
LL | const fn into_inner(self) -> T { self.0 } //~ destructors cannot be evaluated
| ^^^^ constant functions cannot evaluate destructors
error: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:51:36
--> $DIR/min_const_fn.rs:49:36
|
LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 }
| ^^^^^^
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/min_const_fn.rs:56:28
--> $DIR/min_const_fn.rs:54:28
|
LL | const fn into_inner_lt(self) -> T { self.0 } //~ destructors cannot be evaluated
| ^^^^ constant functions cannot evaluate destructors
error: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:58:42
--> $DIR/min_const_fn.rs:56:42
|
LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
| ^^^^^^
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/min_const_fn.rs:63:27
--> $DIR/min_const_fn.rs:61:27
|
LL | const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructors
| ^^^^ constant functions cannot evaluate destructors
error: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:65:38
--> $DIR/min_const_fn.rs:63:38
|
LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
| ^^^^^^
error: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:70:39
--> $DIR/min_const_fn.rs:68:39
|
LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
| ^^^^^^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:88:16
--> $DIR/min_const_fn.rs:86:16
|
LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
| ^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:90:18
--> $DIR/min_const_fn.rs:88:18
|
LL | const fn foo11_2<T: Send>(t: T) -> T { t }
| ^
error: only int, `bool` and `char` operations are stable in const fn
--> $DIR/min_const_fn.rs:92:33
--> $DIR/min_const_fn.rs:90:33
|
LL | const fn foo19(f: f32) -> f32 { f * 2.0 }
| ^^^^^^^
error: only int, `bool` and `char` operations are stable in const fn
--> $DIR/min_const_fn.rs:94:35
--> $DIR/min_const_fn.rs:92:35
|
LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f }
| ^^^^^^^
error: only int and `bool` operations are stable in const fn
--> $DIR/min_const_fn.rs:96:35
--> $DIR/min_const_fn.rs:94:35
|
LL | const fn foo19_3(f: f32) -> f32 { -f }
| ^^
error: only int, `bool` and `char` operations are stable in const fn
--> $DIR/min_const_fn.rs:98:43
--> $DIR/min_const_fn.rs:96:43
|
LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g }
| ^^^^^
error: cannot access `static` items in const fn
--> $DIR/min_const_fn.rs:102:27
--> $DIR/min_const_fn.rs:100:27
|
LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in const fn
| ^^^
error: cannot access `static` items in const fn
--> $DIR/min_const_fn.rs:103:36
--> $DIR/min_const_fn.rs:101:36
|
LL | const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access `static` items
| ^^^^
error: casting pointers to ints is unstable in const fn
--> $DIR/min_const_fn.rs:104:42
--> $DIR/min_const_fn.rs:102:42
|
LL | const fn foo30(x: *const u32) -> usize { x as usize }
| ^^^^^^^^^^
error: casting pointers to ints is unstable in const fn
--> $DIR/min_const_fn.rs:106:42
--> $DIR/min_const_fn.rs:104:42
|
LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }
| ^^^^^^^^^^
error: `if`, `match`, `&&` and `||` are not stable in const fn
--> $DIR/min_const_fn.rs:108:38
--> $DIR/min_const_fn.rs:106:38
|
LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
| ^^^^^^^^^^^^^^^^^^^^^^
error: `if`, `match`, `&&` and `||` are not stable in const fn
--> $DIR/min_const_fn.rs:110:29
--> $DIR/min_const_fn.rs:108:29
|
LL | const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn
| ^^^^^^^^^^^
error: local variables in const fn are unstable
--> $DIR/min_const_fn.rs:111:34
--> $DIR/min_const_fn.rs:109:34
|
LL | const fn foo30_6() -> bool { let x = true; x } //~ ERROR local variables in const fn are unstable
| ^
error: `if`, `match`, `&&` and `||` are not stable in const fn
--> $DIR/min_const_fn.rs:112:44
--> $DIR/min_const_fn.rs:110:44
|
LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
| ^^^^^^
error: `if`, `match`, `&&` and `||` are not stable in const fn
--> $DIR/min_const_fn.rs:114:44
--> $DIR/min_const_fn.rs:112:44
|
LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
| ^^^^^^
error: mutable references in const fn are unstable
--> $DIR/min_const_fn.rs:116:14
--> $DIR/min_const_fn.rs:114:14
|
LL | const fn inc(x: &mut i32) { *x += 1 }
| ^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:121:6
--> $DIR/min_const_fn.rs:119:6
|
LL | impl<T: std::fmt::Debug> Foo<T> {
| ^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:126:6
--> $DIR/min_const_fn.rs:124:6
|
LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
| ^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:131:6
--> $DIR/min_const_fn.rs:129:6
|
LL | impl<T: Sync + Sized> Foo<T> {
| ^
error: `impl Trait` in const fn is unstable
--> $DIR/min_const_fn.rs:137:24
--> $DIR/min_const_fn.rs:135:24
|
LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:139:34
--> $DIR/min_const_fn.rs:137:34
|
LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
| ^^^^^^^^^^^^^^^^^^^^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:141:22
--> $DIR/min_const_fn.rs:139:22
|
LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
| ^^^^^^^^^^^^^^^^^^^^
error: `impl Trait` in const fn is unstable
--> $DIR/min_const_fn.rs:142:23
--> $DIR/min_const_fn.rs:140:23
|
LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable
| ^^^^^^^^^^^^^^^^^^^^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:143:23
--> $DIR/min_const_fn.rs:141:23
|
LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
| ^^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:144:32
--> $DIR/min_const_fn.rs:142:32
|
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn.rs:149:41
--> $DIR/min_const_fn.rs:147:41
|
LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: function pointers in const fn are unstable
--> $DIR/min_const_fn.rs:152:21
--> $DIR/min_const_fn.rs:150:21
|
LL | const fn no_fn_ptrs(_x: fn()) {}
| ^^
error: function pointers in const fn are unstable
--> $DIR/min_const_fn.rs:154:27
--> $DIR/min_const_fn.rs:152:27
|
LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
| ^^^^

View file

@ -1,17 +1,17 @@
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn_dyn.rs:21:5
--> $DIR/min_const_fn_dyn.rs:19:5
|
LL | x.0.field;
| ^^^^^^^^^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn_dyn.rs:24:66
--> $DIR/min_const_fn_dyn.rs:22:66
|
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
| ^^
error[E0716]: temporary value dropped while borrowed
--> $DIR/min_const_fn_dyn.rs:24:67
--> $DIR/min_const_fn_dyn.rs:22:67
|
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
| ^ - temporary value is freed at the end of this statement

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(min_const_fn)]
struct HasDyn {
field: &'static dyn std::fmt::Debug,
}

View file

@ -1,11 +1,11 @@
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn_dyn.rs:21:5
--> $DIR/min_const_fn_dyn.rs:19:5
|
LL | x.0.field;
| ^^^^^^^^^
error: trait bounds other than `Sized` on const fn parameters are unstable
--> $DIR/min_const_fn_dyn.rs:24:66
--> $DIR/min_const_fn_dyn.rs:22:66
|
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
| ^^

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(min_const_fn)]
struct HasPtr {
field: fn(),
}

View file

@ -1,11 +1,11 @@
error: function pointers in const fn are unstable
--> $DIR/min_const_fn_fn_ptr.rs:23:5
--> $DIR/min_const_fn_fn_ptr.rs:21:5
|
LL | x.0.field;
| ^^^^^^^^^
error: function pointers in const fn are unstable
--> $DIR/min_const_fn_fn_ptr.rs:26:59
--> $DIR/min_const_fn_fn_ptr.rs:24:59
|
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasPtr { field }) }
| ^^^^^

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(integer_atomics, min_const_fn)]
#![feature(integer_atomics)]
// compile-pass

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(min_const_fn)]
// ok
const unsafe fn foo4() -> i32 { 42 }
const unsafe fn foo5<T>() -> *const T { 0 as *const T }

View file

@ -1,5 +1,5 @@
error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911)
--> $DIR/min_const_fn_unsafe.rs:29:51
--> $DIR/min_const_fn_unsafe.rs:27:51
|
LL | const unsafe fn foo30_3(x: *mut usize) -> usize { *x } //~ ERROR not allowed in const fn
| ^^
@ -7,7 +7,7 @@ LL | const unsafe fn foo30_3(x: *mut usize) -> usize { *x } //~ ERROR not allowe
= help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable
error[E0658]: unions in const fn are unstable (see issue #51909)
--> $DIR/min_const_fn_unsafe.rs:36:5
--> $DIR/min_const_fn_unsafe.rs:34:5
|
LL | Foo { x: () }.y //~ ERROR not allowed in const fn
| ^^^^^^^^^^^^^^^
@ -15,7 +15,7 @@ LL | Foo { x: () }.y //~ ERROR not allowed in const fn
= help: add #![feature(const_fn_union)] to the crate attributes to enable
error: call to unsafe function is unsafe and unsafe operations are not allowed in const fn
--> $DIR/min_const_fn_unsafe.rs:21:14
--> $DIR/min_const_fn_unsafe.rs:19:14
|
LL | unsafe { foo4() } //~ ERROR unsafe operations are not allowed in const fn
| ^^^^^^ call to unsafe function
@ -23,7 +23,7 @@ LL | unsafe { foo4() } //~ ERROR unsafe operations are not allowed in const
= note: consult the function's documentation for information on how to avoid undefined behavior
error: call to unsafe function is unsafe and unsafe operations are not allowed in const fn
--> $DIR/min_const_fn_unsafe.rs:24:14
--> $DIR/min_const_fn_unsafe.rs:22:14
|
LL | unsafe { foo5::<String>() } //~ ERROR unsafe operations are not allowed in const fn
| ^^^^^^^^^^^^^^^^ call to unsafe function
@ -31,7 +31,7 @@ LL | unsafe { foo5::<String>() } //~ ERROR unsafe operations are not allowed
= note: consult the function's documentation for information on how to avoid undefined behavior
error: call to unsafe function is unsafe and unsafe operations are not allowed in const fn
--> $DIR/min_const_fn_unsafe.rs:27:14
--> $DIR/min_const_fn_unsafe.rs:25:14
|
LL | unsafe { foo6::<Vec<std::cell::Cell<u32>>>() } //~ ERROR not allowed in const fn
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
@ -39,7 +39,7 @@ LL | unsafe { foo6::<Vec<std::cell::Cell<u32>>>() } //~ ERROR not allowed in
= note: consult the function's documentation for information on how to avoid undefined behavior
error: dereference of raw pointer is unsafe and unsafe operations are not allowed in const fn
--> $DIR/min_const_fn_unsafe.rs:29:51
--> $DIR/min_const_fn_unsafe.rs:27:51
|
LL | const unsafe fn foo30_3(x: *mut usize) -> usize { *x } //~ ERROR not allowed in const fn
| ^^ dereference of raw pointer
@ -47,7 +47,7 @@ LL | const unsafe fn foo30_3(x: *mut usize) -> usize { *x } //~ ERROR not allowe
= note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
error: access to union field is unsafe and unsafe operations are not allowed in const fn
--> $DIR/min_const_fn_unsafe.rs:36:5
--> $DIR/min_const_fn_unsafe.rs:34:5
|
LL | Foo { x: () }.y //~ ERROR not allowed in const fn
| ^^^^^^^^^^^^^^^ access to union field

View file

@ -1,5 +1,5 @@
error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:13:27
--> $DIR/promotion.rs:11:27
|
LL | let x: &'static () = &foo1(); //~ ERROR does not live long enough
| ^^^^^^ creates a temporary which is freed while still in use
@ -10,7 +10,7 @@ LL | }
= note: borrowed value must be valid for the static lifetime...
error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:14:28
--> $DIR/promotion.rs:12:28
|
LL | let y: &'static i32 = &foo2(42); //~ ERROR does not live long enough
| ^^^^^^^^ creates a temporary which is freed while still in use
@ -21,7 +21,7 @@ LL | }
= note: borrowed value must be valid for the static lifetime...
error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:15:28
--> $DIR/promotion.rs:13:28
|
LL | let z: &'static i32 = &foo3(); //~ ERROR does not live long enough
| ^^^^^^ creates a temporary which is freed while still in use
@ -32,7 +32,7 @@ LL | }
= note: borrowed value must be valid for the static lifetime...
error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:16:34
--> $DIR/promotion.rs:14:34
|
LL | let a: &'static Cell<i32> = &foo4(); //~ ERROR does not live long enough
| ^^^^^^ creates a temporary which is freed while still in use
@ -43,7 +43,7 @@ LL | }
= note: borrowed value must be valid for the static lifetime...
error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:17:42
--> $DIR/promotion.rs:15:42
|
LL | let a: &'static Option<Cell<i32>> = &foo5(); //~ ERROR does not live long enough
| ^^^^^^ creates a temporary which is freed while still in use
@ -54,7 +54,7 @@ LL | }
= note: borrowed value must be valid for the static lifetime...
error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:18:42
--> $DIR/promotion.rs:16:42
|
LL | let a: &'static Option<Cell<i32>> = &foo6(); //~ ERROR does not live long enough
| ^^^^^^ creates a temporary which is freed while still in use

View file

@ -1,5 +1,3 @@
#![feature(min_const_fn)]
use std::cell::Cell;
const fn foo1() {}

View file

@ -1,5 +1,5 @@
error[E0597]: borrowed value does not live long enough
--> $DIR/promotion.rs:13:27
--> $DIR/promotion.rs:11:27
|
LL | let x: &'static () = &foo1(); //~ ERROR does not live long enough
| ^^^^^^ temporary value does not live long enough
@ -10,7 +10,7 @@ LL | }
= note: borrowed value must be valid for the static lifetime...
error[E0597]: borrowed value does not live long enough
--> $DIR/promotion.rs:14:28
--> $DIR/promotion.rs:12:28
|
LL | let y: &'static i32 = &foo2(42); //~ ERROR does not live long enough
| ^^^^^^^^ temporary value does not live long enough
@ -21,7 +21,7 @@ LL | }
= note: borrowed value must be valid for the static lifetime...
error[E0597]: borrowed value does not live long enough
--> $DIR/promotion.rs:15:28
--> $DIR/promotion.rs:13:28
|
LL | let z: &'static i32 = &foo3(); //~ ERROR does not live long enough
| ^^^^^^ temporary value does not live long enough
@ -32,7 +32,7 @@ LL | }
= note: borrowed value must be valid for the static lifetime...
error[E0597]: borrowed value does not live long enough
--> $DIR/promotion.rs:16:34
--> $DIR/promotion.rs:14:34
|
LL | let a: &'static Cell<i32> = &foo4(); //~ ERROR does not live long enough
| ^^^^^^ temporary value does not live long enough
@ -43,7 +43,7 @@ LL | }
= note: borrowed value must be valid for the static lifetime...
error[E0597]: borrowed value does not live long enough
--> $DIR/promotion.rs:17:42
--> $DIR/promotion.rs:15:42
|
LL | let a: &'static Option<Cell<i32>> = &foo5(); //~ ERROR does not live long enough
| ^^^^^^ temporary value does not live long enough
@ -54,7 +54,7 @@ LL | }
= note: borrowed value must be valid for the static lifetime...
error[E0597]: borrowed value does not live long enough
--> $DIR/promotion.rs:18:42
--> $DIR/promotion.rs:16:42
|
LL | let a: &'static Option<Cell<i32>> = &foo6(); //~ ERROR does not live long enough
| ^^^^^^ temporary value does not live long enough