rollup merge of #17927 : alexcrichton/more-const
This commit is contained in:
commit
412f4d1fc7
6 changed files with 34 additions and 41 deletions
|
|
@ -12,5 +12,6 @@
|
|||
|
||||
const foo: int = 3;
|
||||
//~^ ERROR: should have an uppercase name such as
|
||||
//~^^ ERROR: constant item is never used
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,13 @@ pub static used_static2: int = used_static;
|
|||
const USED_STATIC: int = 0;
|
||||
const STATIC_USED_IN_ENUM_DISCRIMINANT: int = 10;
|
||||
|
||||
pub const pub_const: int = 0;
|
||||
const priv_const: int = 0; //~ ERROR: constant item is never used
|
||||
const used_const: int = 0;
|
||||
pub const used_const2: int = used_const;
|
||||
const USED_CONST: int = 1;
|
||||
const CONST_USED_IN_ENUM_DISCRIMINANT: int = 11;
|
||||
|
||||
pub type typ = *const UsedStruct4;
|
||||
pub struct PubStruct;
|
||||
struct PrivStruct; //~ ERROR: struct is never used
|
||||
|
|
@ -61,7 +68,10 @@ pub struct PubStruct2 {
|
|||
|
||||
pub enum pub_enum { foo1, bar1 }
|
||||
pub enum pub_enum2 { a(*const StructUsedInEnum) }
|
||||
pub enum pub_enum3 { Foo = STATIC_USED_IN_ENUM_DISCRIMINANT }
|
||||
pub enum pub_enum3 {
|
||||
Foo = STATIC_USED_IN_ENUM_DISCRIMINANT,
|
||||
Bar = CONST_USED_IN_ENUM_DISCRIMINANT,
|
||||
}
|
||||
|
||||
enum priv_enum { foo2, bar2 } //~ ERROR: enum is never used
|
||||
enum used_enum {
|
||||
|
|
@ -82,6 +92,7 @@ pub fn pub_fn() {
|
|||
let i = 1i;
|
||||
match i {
|
||||
USED_STATIC => (),
|
||||
USED_CONST => (),
|
||||
_ => ()
|
||||
}
|
||||
f::<StructUsedInGeneric>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue