Stabilize underscore_const_names.
This commit is contained in:
parent
61a60ce7d3
commit
56d71c2910
9 changed files with 12 additions and 69 deletions
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(underscore_const_names)]
|
||||
|
||||
const _: bool = false && false;
|
||||
const _: bool = true && false;
|
||||
const _: bool = {
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
error: new features like let bindings are not permitted in constants which also use short circuiting operators
|
||||
--> $DIR/const_short_circuit.rs:6:9
|
||||
--> $DIR/const_short_circuit.rs:4:9
|
||||
|
|
||||
LL | let mut x = true && false;
|
||||
| ^^^^^
|
||||
|
|
||||
note: use of `&&` operator here does not actually short circuit due to the const evaluator presently not being able to do control flow. See https://github.com/rust-lang/rust/issues/49146 for more information.
|
||||
--> $DIR/const_short_circuit.rs:6:22
|
||||
--> $DIR/const_short_circuit.rs:4:22
|
||||
|
|
||||
LL | let mut x = true && false;
|
||||
| ^^
|
||||
|
||||
error: new features like let bindings are not permitted in constants which also use short circuiting operators
|
||||
--> $DIR/const_short_circuit.rs:11:9
|
||||
--> $DIR/const_short_circuit.rs:9:9
|
||||
|
|
||||
LL | let x = true && false;
|
||||
| ^
|
||||
|
|
||||
note: use of `&&` operator here does not actually short circuit due to the const evaluator presently not being able to do control flow. See https://github.com/rust-lang/rust/issues/49146 for more information.
|
||||
--> $DIR/const_short_circuit.rs:11:18
|
||||
--> $DIR/const_short_circuit.rs:9:18
|
||||
|
|
||||
LL | let x = true && false;
|
||||
| ^^
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
// compile-pass
|
||||
|
||||
#![feature(underscore_const_names)]
|
||||
#![deny(unused)]
|
||||
|
||||
trait Trt {}
|
||||
struct Str {}
|
||||
pub struct Str {}
|
||||
impl Trt for Str {}
|
||||
|
||||
macro_rules! check_impl {
|
||||
|
|
@ -17,7 +17,6 @@ macro_rules! check_impl {
|
|||
}
|
||||
}
|
||||
|
||||
#[deny(unused)]
|
||||
const _ : () = ();
|
||||
|
||||
const _ : i32 = 42;
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
trait Trt {}
|
||||
struct Str {}
|
||||
|
||||
impl Trt for Str {}
|
||||
|
||||
const _ : () = {
|
||||
//~^ ERROR is unstable
|
||||
use std::marker::PhantomData;
|
||||
struct ImplementsTrait<T: Trt>(PhantomData<T>);
|
||||
let _ = ImplementsTrait::<Str>(PhantomData);
|
||||
()
|
||||
};
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
error[E0658]: naming constants with `_` is unstable
|
||||
--> $DIR/feature-gate-underscore_const_names.rs:6:1
|
||||
|
|
||||
LL | / const _ : () = {
|
||||
LL | |
|
||||
LL | | use std::marker::PhantomData;
|
||||
LL | | struct ImplementsTrait<T: Trt>(PhantomData<T>);
|
||||
LL | | let _ = ImplementsTrait::<Str>(PhantomData);
|
||||
LL | | ()
|
||||
LL | | };
|
||||
| |__^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/54912
|
||||
= help: add #![feature(underscore_const_names)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
const _: () = (); //~ ERROR is unstable
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
error[E0658]: naming constants with `_` is unstable
|
||||
--> $DIR/underscore_const_names_feature_gate.rs:1:1
|
||||
|
|
||||
LL | const _: () = ();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/54912
|
||||
= help: add #![feature(underscore_const_names)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue