Merge remote-tracking branch 'origin/master' into gen
This commit is contained in:
commit
b8aa595e6d
168 changed files with 2634 additions and 1443 deletions
|
|
@ -11,6 +11,7 @@
|
|||
// aux-build:attributes-included.rs
|
||||
|
||||
#![feature(proc_macro, rustc_attrs)]
|
||||
#![warn(unused)]
|
||||
|
||||
extern crate attributes_included;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![feature(box_syntax)]
|
||||
#![allow(warnings)]
|
||||
|
||||
const CON : Box<i32> = box 0; //~ ERROR E0010
|
||||
//~| NOTE allocation not allowed in
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
static A: u32 = 0;
|
||||
static B: u32 = A;
|
||||
//~^ ERROR E0394
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
// compile-flags: --cap-lints deny
|
||||
|
||||
#![warn(unused)]
|
||||
#![deny(warnings)]
|
||||
|
||||
use std::option; //~ ERROR
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
// compile-flags: --cap-lints warn
|
||||
|
||||
#![warn(unused)]
|
||||
#![deny(warnings)]
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
// gate-test-drop_types_in_const
|
||||
|
||||
#![allow(warnings)]
|
||||
#![feature(box_syntax)]
|
||||
|
||||
use std::marker;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// Evaluation of constants in refutable patterns goes through
|
||||
// different compiler control-flow paths.
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_imports, warnings)]
|
||||
|
||||
use std::fmt;
|
||||
use std::{i8, i16, i32, i64, isize};
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
const x: bool = match Some(true) {
|
||||
Some(value) => true,
|
||||
//~^ ERROR: constant contains unimplemented expression type [E0019]
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ struct Foo<T> { data: Vec<T> }
|
|||
impl<T> Drop for Foo<T> {
|
||||
#[unsafe_destructor_blind_to_params] // This is the UGEH attribute
|
||||
//~^ ERROR unsafe_destructor_blind_to_params has been replaced
|
||||
//~^^ WARN: use of deprecated attribute
|
||||
fn drop(&mut self) { }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(safe_extern_statics, warnings)]
|
||||
|
||||
extern {
|
||||
pub static symbol: ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(safe_extern_statics)]
|
||||
|
||||
mod Y {
|
||||
pub type X = usize;
|
||||
extern {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![allow(dead_code, warnings)]
|
||||
|
||||
static mut x: isize = 3;
|
||||
static mut y: isize = unsafe {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![warn(unused)]
|
||||
#[deny(warnings)]
|
||||
|
||||
const foo: isize = 3;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
struct Struct { a: usize }
|
||||
|
||||
const C: usize = 1;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ trait A<'a> {
|
|||
}
|
||||
|
||||
impl<'a> A<'a> for B {
|
||||
fn foo<F>(&mut self, f: F) //~ ERROR E0276
|
||||
fn foo<F>(&mut self, f: F) //~ ERROR impl has stricter
|
||||
//~^ WARNING future release
|
||||
where F: fmt::Debug + 'static,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// aux-build:lint_stability.rs
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(warnings)]
|
||||
|
||||
extern crate lint_stability;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
const X: u8 =
|
||||
|| -> u8 { 5 }()
|
||||
//~^ ERROR calls in constants are limited to constant functions
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(safe_extern_statics)]
|
||||
|
||||
extern {
|
||||
static error_message_count: u32;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![warn(unused)]
|
||||
#![deny(warnings)] //~ NOTE: lint level defined here
|
||||
use std::thread;
|
||||
//~^ ERROR: unused import
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
#![warn(unused)]
|
||||
|
||||
type Z = for<'x> Send;
|
||||
//~^ WARN type alias is never used
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#![feature(box_syntax)]
|
||||
#![feature(const_fn)]
|
||||
#![allow(warnings)]
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@
|
|||
// No warnings about removed lint when
|
||||
// allow(renamed_and_removed_lints)
|
||||
|
||||
#![allow(renamed_and_removed_lints)]
|
||||
|
||||
#[deny(raw_pointer_derive)]
|
||||
#[allow(renamed_and_removed_lints)]
|
||||
#[deny(unused_variables)]
|
||||
fn main() { let unused = (); } //~ ERROR unused
|
||||
|
|
|
|||
|
|
@ -16,5 +16,7 @@
|
|||
// error-pattern:lint raw_pointer_derive has been removed
|
||||
// error-pattern:requested on the command line with `-D raw_pointer_derive`
|
||||
|
||||
#![warn(unused)]
|
||||
|
||||
#[deny(warnings)]
|
||||
fn main() { let unused = (); }
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@
|
|||
// No warnings about renamed lint when
|
||||
// allow(renamed_and_removed_lints)
|
||||
|
||||
#![allow(renamed_and_removed_lints)]
|
||||
|
||||
#[deny(unknown_features)]
|
||||
#[allow(renamed_and_removed_lints)]
|
||||
#[deny(unused)]
|
||||
fn main() { let unused = (); } //~ ERROR unused
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@
|
|||
// aux-build:stability_cfg1.rs
|
||||
// aux-build:stability_cfg2.rs
|
||||
|
||||
#![deny(deprecated)]
|
||||
#![warn(deprecated)]
|
||||
#![allow(dead_code)]
|
||||
#![feature(staged_api, test_feature)]
|
||||
#![feature(staged_api, test_feature, rustc_attrs)]
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
|
|
@ -32,41 +32,41 @@ mod cross_crate {
|
|||
type Foo = MethodTester;
|
||||
let foo = MethodTester;
|
||||
|
||||
deprecated(); //~ ERROR use of deprecated item
|
||||
foo.method_deprecated(); //~ ERROR use of deprecated item
|
||||
Foo::method_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
deprecated(); //~ WARN use of deprecated item
|
||||
foo.method_deprecated(); //~ WARN use of deprecated item
|
||||
Foo::method_deprecated(&foo); //~ WARN use of deprecated item
|
||||
<Foo>::method_deprecated(&foo); //~ WARN use of deprecated item
|
||||
foo.trait_deprecated(); //~ WARN use of deprecated item
|
||||
Trait::trait_deprecated(&foo); //~ WARN use of deprecated item
|
||||
<Foo>::trait_deprecated(&foo); //~ WARN use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated(&foo); //~ WARN use of deprecated item
|
||||
|
||||
deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
deprecated_text(); //~ WARN use of deprecated item: text
|
||||
foo.method_deprecated_text(); //~ WARN use of deprecated item: text
|
||||
Foo::method_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo>::method_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
foo.trait_deprecated_text(); //~ WARN use of deprecated item: text
|
||||
Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo>::trait_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
|
||||
deprecated_unstable(); //~ ERROR use of deprecated item
|
||||
foo.method_deprecated_unstable(); //~ ERROR use of deprecated item
|
||||
Foo::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
|
||||
Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
||||
deprecated_unstable(); //~ WARN use of deprecated item
|
||||
foo.method_deprecated_unstable(); //~ WARN use of deprecated item
|
||||
Foo::method_deprecated_unstable(&foo); //~ WARN use of deprecated item
|
||||
<Foo>::method_deprecated_unstable(&foo); //~ WARN use of deprecated item
|
||||
foo.trait_deprecated_unstable(); //~ WARN use of deprecated item
|
||||
Trait::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item
|
||||
<Foo>::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item
|
||||
|
||||
deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
||||
foo.method_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
||||
Foo::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
||||
Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
||||
deprecated_unstable_text(); //~ WARN use of deprecated item: text
|
||||
foo.method_deprecated_unstable_text(); //~ WARN use of deprecated item: text
|
||||
Foo::method_deprecated_unstable_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo>::method_deprecated_unstable_text(&foo); //~ WARN use of deprecated item: text
|
||||
foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item: text
|
||||
Trait::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo>::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item: text
|
||||
|
||||
unstable();
|
||||
foo.method_unstable();
|
||||
|
|
@ -106,30 +106,30 @@ mod cross_crate {
|
|||
|
||||
struct S1<T: TraitWithAssociatedTypes>(T::TypeUnstable);
|
||||
struct S2<T: TraitWithAssociatedTypes>(T::TypeDeprecated);
|
||||
//~^ ERROR use of deprecated item
|
||||
//~^ WARN use of deprecated item
|
||||
|
||||
let _ = DeprecatedStruct { //~ ERROR use of deprecated item
|
||||
i: 0 //~ ERROR use of deprecated item
|
||||
let _ = DeprecatedStruct { //~ WARN use of deprecated item
|
||||
i: 0 //~ WARN use of deprecated item
|
||||
};
|
||||
let _ = DeprecatedUnstableStruct {
|
||||
//~^ ERROR use of deprecated item
|
||||
i: 0 //~ ERROR use of deprecated item
|
||||
//~^ WARN use of deprecated item
|
||||
i: 0 //~ WARN use of deprecated item
|
||||
};
|
||||
let _ = UnstableStruct { i: 0 };
|
||||
let _ = StableStruct { i: 0 };
|
||||
|
||||
let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
|
||||
let _ = DeprecatedUnstableUnitStruct; //~ ERROR use of deprecated item
|
||||
let _ = DeprecatedUnitStruct; //~ WARN use of deprecated item
|
||||
let _ = DeprecatedUnstableUnitStruct; //~ WARN use of deprecated item
|
||||
let _ = UnstableUnitStruct;
|
||||
let _ = StableUnitStruct;
|
||||
|
||||
let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
|
||||
let _ = Enum::DeprecatedUnstableVariant; //~ ERROR use of deprecated item
|
||||
let _ = Enum::DeprecatedVariant; //~ WARN use of deprecated item
|
||||
let _ = Enum::DeprecatedUnstableVariant; //~ WARN use of deprecated item
|
||||
let _ = Enum::UnstableVariant;
|
||||
let _ = Enum::StableVariant;
|
||||
|
||||
let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
|
||||
let _ = DeprecatedUnstableTupleStruct (1); //~ ERROR use of deprecated item
|
||||
let _ = DeprecatedTupleStruct (1); //~ WARN use of deprecated item
|
||||
let _ = DeprecatedUnstableTupleStruct (1); //~ WARN use of deprecated item
|
||||
let _ = UnstableTupleStruct (1);
|
||||
let _ = StableTupleStruct (1);
|
||||
|
||||
|
|
@ -138,28 +138,28 @@ mod cross_crate {
|
|||
// Eventually, we will want to lint the contents of the
|
||||
// macro in the module *defining* it. Also, stability levels
|
||||
// on macros themselves are not yet linted.
|
||||
macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item: text
|
||||
macro_test_arg!(deprecated_unstable_text()); //~ ERROR use of deprecated item: text
|
||||
macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item: text
|
||||
macro_test_arg!(deprecated_text()); //~ WARN use of deprecated item: text
|
||||
macro_test_arg!(deprecated_unstable_text()); //~ WARN use of deprecated item: text
|
||||
macro_test_arg!(macro_test_arg!(deprecated_text())); //~ WARN use of deprecated item: text
|
||||
}
|
||||
|
||||
fn test_method_param<Foo: Trait>(foo: Foo) {
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
|
||||
Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
||||
Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated(); //~ WARN use of deprecated item
|
||||
Trait::trait_deprecated(&foo); //~ WARN use of deprecated item
|
||||
<Foo>::trait_deprecated(&foo); //~ WARN use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated(&foo); //~ WARN use of deprecated item
|
||||
foo.trait_deprecated_text(); //~ WARN use of deprecated item: text
|
||||
Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo>::trait_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
foo.trait_deprecated_unstable(); //~ WARN use of deprecated item
|
||||
Trait::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item
|
||||
<Foo>::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item
|
||||
foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item: text
|
||||
Trait::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo>::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item: text
|
||||
foo.trait_unstable();
|
||||
Trait::trait_unstable(&foo);
|
||||
<Foo>::trait_unstable(&foo);
|
||||
|
|
@ -175,10 +175,10 @@ mod cross_crate {
|
|||
}
|
||||
|
||||
fn test_method_object(foo: &Trait) {
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated(); //~ WARN use of deprecated item
|
||||
foo.trait_deprecated_text(); //~ WARN use of deprecated item: text
|
||||
foo.trait_deprecated_unstable(); //~ WARN use of deprecated item
|
||||
foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item: text
|
||||
foo.trait_unstable();
|
||||
foo.trait_unstable_text();
|
||||
foo.trait_stable();
|
||||
|
|
@ -187,9 +187,9 @@ mod cross_crate {
|
|||
struct S;
|
||||
|
||||
impl UnstableTrait for S { }
|
||||
impl DeprecatedTrait for S {} //~ ERROR use of deprecated item: text
|
||||
impl DeprecatedTrait for S {} //~ WARN use of deprecated item: text
|
||||
trait LocalTrait : UnstableTrait { }
|
||||
trait LocalTrait2 : DeprecatedTrait { } //~ ERROR use of deprecated item: text
|
||||
trait LocalTrait2 : DeprecatedTrait { } //~ WARN use of deprecated item: text
|
||||
|
||||
impl Trait for S {
|
||||
fn trait_stable(&self) {}
|
||||
|
|
@ -208,7 +208,7 @@ mod inheritance {
|
|||
stable_mod::unstable();
|
||||
stable_mod::stable();
|
||||
|
||||
unstable_mod::deprecated(); //~ ERROR use of deprecated item
|
||||
unstable_mod::deprecated(); //~ WARN use of deprecated item
|
||||
unstable_mod::unstable();
|
||||
|
||||
let _ = Unstable::UnstableVariant;
|
||||
|
|
@ -330,23 +330,23 @@ mod this_crate {
|
|||
type Foo = MethodTester;
|
||||
let foo = MethodTester;
|
||||
|
||||
deprecated(); //~ ERROR use of deprecated item
|
||||
foo.method_deprecated(); //~ ERROR use of deprecated item
|
||||
Foo::method_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
deprecated(); //~ WARN use of deprecated item
|
||||
foo.method_deprecated(); //~ WARN use of deprecated item
|
||||
Foo::method_deprecated(&foo); //~ WARN use of deprecated item
|
||||
<Foo>::method_deprecated(&foo); //~ WARN use of deprecated item
|
||||
foo.trait_deprecated(); //~ WARN use of deprecated item
|
||||
Trait::trait_deprecated(&foo); //~ WARN use of deprecated item
|
||||
<Foo>::trait_deprecated(&foo); //~ WARN use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated(&foo); //~ WARN use of deprecated item
|
||||
|
||||
deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
deprecated_text(); //~ WARN use of deprecated item: text
|
||||
foo.method_deprecated_text(); //~ WARN use of deprecated item: text
|
||||
Foo::method_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo>::method_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
foo.trait_deprecated_text(); //~ WARN use of deprecated item: text
|
||||
Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo>::trait_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
|
||||
unstable();
|
||||
foo.method_unstable();
|
||||
|
|
@ -385,34 +385,34 @@ mod this_crate {
|
|||
<Foo as Trait>::trait_stable_text(&foo);
|
||||
|
||||
let _ = DeprecatedStruct {
|
||||
//~^ ERROR use of deprecated item
|
||||
i: 0 //~ ERROR use of deprecated item
|
||||
//~^ WARN use of deprecated item
|
||||
i: 0 //~ WARN use of deprecated item
|
||||
};
|
||||
let _ = UnstableStruct { i: 0 };
|
||||
let _ = StableStruct { i: 0 };
|
||||
|
||||
let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
|
||||
let _ = DeprecatedUnitStruct; //~ WARN use of deprecated item
|
||||
let _ = UnstableUnitStruct;
|
||||
let _ = StableUnitStruct;
|
||||
|
||||
let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
|
||||
let _ = Enum::DeprecatedVariant; //~ WARN use of deprecated item
|
||||
let _ = Enum::UnstableVariant;
|
||||
let _ = Enum::StableVariant;
|
||||
|
||||
let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
|
||||
let _ = DeprecatedTupleStruct (1); //~ WARN use of deprecated item
|
||||
let _ = UnstableTupleStruct (1);
|
||||
let _ = StableTupleStruct (1);
|
||||
}
|
||||
|
||||
fn test_method_param<Foo: Trait>(foo: Foo) {
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated(); //~ WARN use of deprecated item
|
||||
Trait::trait_deprecated(&foo); //~ WARN use of deprecated item
|
||||
<Foo>::trait_deprecated(&foo); //~ WARN use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated(&foo); //~ WARN use of deprecated item
|
||||
foo.trait_deprecated_text(); //~ WARN use of deprecated item: text
|
||||
Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo>::trait_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_text(&foo); //~ WARN use of deprecated item: text
|
||||
foo.trait_unstable();
|
||||
Trait::trait_unstable(&foo);
|
||||
<Foo>::trait_unstable(&foo);
|
||||
|
|
@ -428,8 +428,8 @@ mod this_crate {
|
|||
}
|
||||
|
||||
fn test_method_object(foo: &Trait) {
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated(); //~ WARN use of deprecated item
|
||||
foo.trait_deprecated_text(); //~ WARN use of deprecated item: text
|
||||
foo.trait_unstable();
|
||||
foo.trait_unstable_text();
|
||||
foo.trait_stable();
|
||||
|
|
@ -439,7 +439,7 @@ mod this_crate {
|
|||
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
||||
fn test_fn_body() {
|
||||
fn fn_in_body() {}
|
||||
fn_in_body(); //~ ERROR use of deprecated item: text
|
||||
fn_in_body(); //~ WARN use of deprecated item: text
|
||||
}
|
||||
|
||||
impl MethodTester {
|
||||
|
|
@ -447,7 +447,7 @@ mod this_crate {
|
|||
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
||||
fn test_method_body(&self) {
|
||||
fn fn_in_body() {}
|
||||
fn_in_body(); //~ ERROR use of deprecated item: text
|
||||
fn_in_body(); //~ WARN use of deprecated item: text
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -459,9 +459,9 @@ mod this_crate {
|
|||
|
||||
struct S;
|
||||
|
||||
impl DeprecatedTrait for S { } //~ ERROR use of deprecated item
|
||||
impl DeprecatedTrait for S { } //~ WARN use of deprecated item
|
||||
|
||||
trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item
|
||||
trait LocalTrait : DeprecatedTrait { } //~ WARN use of deprecated item
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
#[rustc_error] fn main() {} //~ ERROR: compilation successful
|
||||
|
|
|
|||
|
|
@ -9,16 +9,18 @@
|
|||
// except according to those terms.
|
||||
//
|
||||
|
||||
#![deny(overflowing_literals)]
|
||||
#![deny(const_err)]
|
||||
#![warn(overflowing_literals)]
|
||||
#![warn(const_err)]
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn main() {
|
||||
let x2: i8 = --128; //~ error: literal out of range for i8
|
||||
//~^ error: attempt to negate with overflow
|
||||
#[rustc_error]
|
||||
fn main() { //~ ERROR: compilation successful
|
||||
let x2: i8 = --128; //~ warn: literal out of range for i8
|
||||
//~^ warn: attempt to negate with overflow
|
||||
|
||||
let x = -3.40282357e+38_f32; //~ error: literal out of range for f32
|
||||
let x = 3.40282357e+38_f32; //~ error: literal out of range for f32
|
||||
let x = -1.7976931348623159e+308_f64; //~ error: literal out of range for f64
|
||||
let x = 1.7976931348623159e+308_f64; //~ error: literal out of range for f64
|
||||
let x = -3.40282357e+38_f32; //~ warn: literal out of range for f32
|
||||
let x = 3.40282357e+38_f32; //~ warn: literal out of range for f32
|
||||
let x = -1.7976931348623159e+308_f64; //~ warn: literal out of range for f64
|
||||
let x = 1.7976931348623159e+308_f64; //~ warn: literal out of range for f64
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,26 @@ fn main() {
|
|||
let x = |mut y: isize| 10; //~ ERROR: variable does not need to be mutable
|
||||
fn what(mut foo: isize) {} //~ ERROR: variable does not need to be mutable
|
||||
|
||||
let mut a = &mut 5; //~ ERROR: variable does not need to be mutable
|
||||
*a = 4;
|
||||
|
||||
let mut a = 5;
|
||||
let mut b = (&mut a,);
|
||||
*b.0 = 4; //~^ ERROR: variable does not need to be mutable
|
||||
|
||||
let mut x = &mut 1; //~ ERROR: variable does not need to be mutable
|
||||
let mut f = || {
|
||||
*x += 1;
|
||||
};
|
||||
f();
|
||||
|
||||
fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] {
|
||||
&mut arg[..] //~^ ERROR: variable does not need to be mutable
|
||||
}
|
||||
|
||||
let mut v : &mut Vec<()> = &mut vec![]; //~ ERROR: variable does not need to be mutable
|
||||
v.push(());
|
||||
|
||||
// positive cases
|
||||
let mut a = 2;
|
||||
a = 3;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![warn(unused)]
|
||||
#![allow(dead_code)]
|
||||
#![deny(non_snake_case)]
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![warn(unused)]
|
||||
#![deny(unused_variables)]
|
||||
#![deny(unused_assignments)]
|
||||
#![allow(dead_code, non_camel_case_types, trivial_numeric_casts)]
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@
|
|||
|
||||
// Test that an assignment of type ! makes the rest of the block dead code.
|
||||
|
||||
#![feature(never_type)]
|
||||
#![deny(unused, unreachable_code)]
|
||||
#![feature(never_type, rustc_attrs)]
|
||||
#![warn(unused)]
|
||||
|
||||
fn main() {
|
||||
let x: ! = panic!("aah"); //~ ERROR unused
|
||||
drop(x); //~ ERROR unreachable
|
||||
//~^ ERROR unreachable
|
||||
#[rustc_error]
|
||||
fn main() { //~ ERROR: compilation successful
|
||||
let x: ! = panic!("aah"); //~ WARN unused
|
||||
drop(x); //~ WARN unreachable
|
||||
//~^ WARN unreachable
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#![feature(associated_consts)]
|
||||
#![feature(conservative_impl_trait)]
|
||||
#![feature(decl_macro)]
|
||||
#![allow(warnings)]
|
||||
|
||||
mod m {
|
||||
fn priv_fn() {}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
// aux-build:private-inferred-type.rs
|
||||
|
||||
#![feature(conservative_impl_trait)]
|
||||
#![allow(warnings)]
|
||||
|
||||
extern crate private_inferred_type as ext;
|
||||
|
||||
|
|
|
|||
14
src/test/compile-fail/rust-unstable-column-gated.rs
Normal file
14
src/test/compile-fail/rust-unstable-column-gated.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
println!("{}", __rust_unstable_column!());
|
||||
//~^ERROR the __rust_unstable_column macro is unstable
|
||||
}
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
static mut a: Box<isize> = box 3;
|
||||
//~^ ERROR allocations are not allowed in statics
|
||||
//~^^ ERROR destructors in statics are an unstable feature
|
||||
//~| ERROR destructors in statics are an unstable feature
|
||||
//~| WARN: constant evaluation error
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -20,17 +20,15 @@ impl Bar for Foo<i32> {
|
|||
}
|
||||
|
||||
impl<T> Foo<T> {
|
||||
fn new<U>(u: U) -> Foo<U> {
|
||||
fn new<U>(u: U) -> Foo<U> { //~ NOTE expected `Foo<U>` because of return type
|
||||
Self {
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected type parameter, found a different type parameter
|
||||
//~| expected type `Foo<U>`
|
||||
//~| found type `Foo<T>`
|
||||
//~| NOTE expected type parameter, found a different type parameter
|
||||
//~| NOTE expected type `Foo<U>`
|
||||
inner: u
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected type parameter, found a different type parameter
|
||||
//~| expected type `T`
|
||||
//~| found type `U`
|
||||
//~| NOTE expected type parameter, found a different type parameter
|
||||
//~| NOTE expected type `T`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(never_type)]
|
||||
#![deny(unreachable_code)]
|
||||
#![deny(unreachable_patterns)]
|
||||
#![feature(never_type, rustc_attrs)]
|
||||
#![warn(unreachable_code)]
|
||||
#![warn(unreachable_patterns)]
|
||||
|
||||
enum Void {}
|
||||
|
||||
|
|
@ -26,8 +26,8 @@ fn bar(x: Result<!, i32>) -> Result<u32, i32> {
|
|||
|
||||
fn foo(x: Result<!, i32>) -> Result<u32, i32> {
|
||||
let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?;
|
||||
//~^ ERROR unreachable pattern
|
||||
//~| ERROR unreachable expression
|
||||
//~^ WARN unreachable pattern
|
||||
//~| WARN unreachable expression
|
||||
Ok(y)
|
||||
}
|
||||
|
||||
|
|
@ -37,11 +37,12 @@ fn qux(x: Result<u32, Void>) -> Result<u32, i32> {
|
|||
|
||||
fn vom(x: Result<u32, Void>) -> Result<u32, i32> {
|
||||
let y = (match x { Ok(n) => Ok(n), Err(e) => Err(e) })?;
|
||||
//~^ ERROR unreachable pattern
|
||||
//~^ WARN unreachable pattern
|
||||
Ok(y)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
#[rustc_error]
|
||||
fn main() { //~ ERROR: compilation successful
|
||||
let _ = bar(Err(123));
|
||||
let _ = foo(Err(123));
|
||||
let _ = qux(Ok(123));
|
||||
|
|
|
|||
23
src/test/run-pass/issue-43057.rs
Normal file
23
src/test/run-pass/issue-43057.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
macro_rules! column {
|
||||
($i:ident) => {
|
||||
$i
|
||||
};
|
||||
}
|
||||
|
||||
fn foo() -> ! {
|
||||
panic!();
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
18
src/test/rustdoc/nul-error.rs
Normal file
18
src/test/rustdoc/nul-error.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// build-aux-docs
|
||||
// ignore-cross-compile
|
||||
|
||||
#![crate_name = "foo"]
|
||||
|
||||
// @has foo/fn.foo.html '//code' ''
|
||||
#[doc = "Attempted to pass a string containing `\0`"]
|
||||
pub fn foo() {}
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
// compile-flags: -A test-lint
|
||||
|
||||
#![feature(plugin)]
|
||||
#![warn(unused)]
|
||||
#![plugin(lint_plugin_test)]
|
||||
|
||||
fn lintme() { }
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
warning: function is never used: `lintme`
|
||||
--> $DIR/lint-plugin-cmdline-allow.rs:19:1
|
||||
--> $DIR/lint-plugin-cmdline-allow.rs:20:1
|
||||
|
|
||||
19 | fn lintme() { }
|
||||
20 | fn lintme() { }
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[warn(dead_code)] on by default
|
||||
note: lint level defined here
|
||||
--> $DIR/lint-plugin-cmdline-allow.rs:17:9
|
||||
|
|
||||
17 | #![warn(unused)]
|
||||
| ^^^^^^
|
||||
= note: #[warn(dead_code)] implied by #[warn(unused)]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/block-must-not-have-result-res.rs:15:9
|
||||
|
|
||||
14 | fn drop(&mut self) {
|
||||
| - expected `()` because of default return type
|
||||
15 | true //~ ERROR mismatched types
|
||||
| ^^^^ expected (), found bool
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-13624.rs:17:5
|
||||
|
|
||||
16 | pub fn get_enum_struct_variant() -> () {
|
||||
| -- expected `()` because of return type
|
||||
17 | Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `a::Enum`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ error[E0277]: the trait bound `{integer}: Scalar` is not satisfied
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-22645.rs:25:3
|
||||
|
|
||||
23 | fn main() {
|
||||
| - expected `()` because of default return type
|
||||
24 | let b = Bob + 3.5;
|
||||
25 | b + 3 //~ ERROR E0277
|
||||
| ^^^^^ expected (), found struct `Bob`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-5500.rs:12:5
|
||||
|
|
||||
11 | fn main() {
|
||||
| - expected `()` because of default return type
|
||||
12 | &panic!()
|
||||
| ^^^^^^^^^ expected (), found reference
|
||||
|
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![feature(exclusive_range_pattern)]
|
||||
#![warn(unreachable_patterns)]
|
||||
|
||||
fn main() {
|
||||
// These cases should generate no warning.
|
||||
|
|
@ -48,4 +49,4 @@ fn main() {
|
|||
9...9 => {},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,24 @@
|
|||
warning: unreachable pattern
|
||||
--> $DIR/issue-43253.rs:36:9
|
||||
--> $DIR/issue-43253.rs:37:9
|
||||
|
|
||||
36 | 9 => {},
|
||||
37 | 9 => {},
|
||||
| ^
|
||||
|
|
||||
= note: #[warn(unreachable_patterns)] on by default
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-43253.rs:12:9
|
||||
|
|
||||
12 | #![warn(unreachable_patterns)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: unreachable pattern
|
||||
--> $DIR/issue-43253.rs:42:9
|
||||
--> $DIR/issue-43253.rs:43:9
|
||||
|
|
||||
42 | 8...9 => {},
|
||||
43 | 8...9 => {},
|
||||
| ^^^^^
|
||||
|
||||
warning: unreachable pattern
|
||||
--> $DIR/issue-43253.rs:48:9
|
||||
--> $DIR/issue-43253.rs:49:9
|
||||
|
|
||||
48 | 9...9 => {},
|
||||
49 | 9...9 => {},
|
||||
| ^^^^^
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0276]: impl has stricter requirements than trait
|
||||
error: impl has stricter requirements than trait
|
||||
--> $DIR/proj-outlives-region.rs:19:5
|
||||
|
|
||||
14 | fn foo() where T: 'a;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0276]: impl has stricter requirements than trait
|
||||
error: impl has stricter requirements than trait
|
||||
--> $DIR/region-unrelated.rs:19:5
|
||||
|
|
||||
14 | fn foo() where T: 'a;
|
||||
|
|
|
|||
19
src/test/ui/extern-const.rs
Normal file
19
src/test/ui/extern-const.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Z continue-parse-after-error
|
||||
|
||||
extern "C" {
|
||||
const C: u8; //~ ERROR extern items cannot be `const`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = C;
|
||||
}
|
||||
8
src/test/ui/extern-const.stderr
Normal file
8
src/test/ui/extern-const.stderr
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
error: extern items cannot be `const`
|
||||
--> $DIR/extern-const.rs:14:5
|
||||
|
|
||||
14 | const C: u8; //~ ERROR extern items cannot be `const`
|
||||
| ^^^^^ help: instead try using: `static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
34
src/test/ui/lint/fn_must_use.rs
Normal file
34
src/test/ui/lint/fn_must_use.rs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![warn(unused_must_use)]
|
||||
|
||||
struct MyStruct {
|
||||
n: usize
|
||||
}
|
||||
|
||||
impl MyStruct {
|
||||
#[must_use]
|
||||
fn need_to_use_this_method_value(&self) -> usize {
|
||||
self.n
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use="it's important"]
|
||||
fn need_to_use_this_value() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn main() {
|
||||
need_to_use_this_value();
|
||||
|
||||
let m = MyStruct { n: 2 };
|
||||
m.need_to_use_this_method_value();
|
||||
}
|
||||
18
src/test/ui/lint/fn_must_use.stderr
Normal file
18
src/test/ui/lint/fn_must_use.stderr
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
warning: unused return value of `need_to_use_this_value` which must be used: it's important
|
||||
--> $DIR/fn_must_use.rs:30:5
|
||||
|
|
||||
30 | need_to_use_this_value();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/fn_must_use.rs:11:9
|
||||
|
|
||||
11 | #![warn(unused_must_use)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
warning: unused return value of `MyStruct::need_to_use_this_method_value` which must be used
|
||||
--> $DIR/fn_must_use.rs:33:5
|
||||
|
|
||||
33 | m.need_to_use_this_method_value();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
@ -16,7 +16,13 @@
|
|||
|
||||
#![forbid(unused, non_snake_case)]
|
||||
|
||||
#[allow(unused, unused_variables, bad_style)]
|
||||
#[allow(unused_variables)]
|
||||
fn foo() {}
|
||||
|
||||
#[allow(unused)]
|
||||
fn bar() {}
|
||||
|
||||
#[allow(bad_style)]
|
||||
fn main() {
|
||||
println!("hello forbidden world")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,29 +1,29 @@
|
|||
error[E0453]: allow(unused) overruled by outer forbid(unused)
|
||||
error[E0453]: allow(unused_variables) overruled by outer forbid(unused)
|
||||
--> $DIR/outer-forbid.rs:19:9
|
||||
|
|
||||
17 | #![forbid(unused, non_snake_case)]
|
||||
| ------ `forbid` level set here
|
||||
18 |
|
||||
19 | #[allow(unused, unused_variables, bad_style)]
|
||||
| ^^^^^^ overruled by previous forbid
|
||||
19 | #[allow(unused_variables)]
|
||||
| ^^^^^^^^^^^^^^^^ overruled by previous forbid
|
||||
|
||||
error[E0453]: allow(unused_variables) overruled by outer forbid(unused)
|
||||
--> $DIR/outer-forbid.rs:19:17
|
||||
error[E0453]: allow(unused) overruled by outer forbid(unused)
|
||||
--> $DIR/outer-forbid.rs:22:9
|
||||
|
|
||||
17 | #![forbid(unused, non_snake_case)]
|
||||
| ------ `forbid` level set here
|
||||
18 |
|
||||
19 | #[allow(unused, unused_variables, bad_style)]
|
||||
| ^^^^^^^^^^^^^^^^ overruled by previous forbid
|
||||
...
|
||||
22 | #[allow(unused)]
|
||||
| ^^^^^^ overruled by previous forbid
|
||||
|
||||
error[E0453]: allow(bad_style) overruled by outer forbid(non_snake_case)
|
||||
--> $DIR/outer-forbid.rs:19:35
|
||||
--> $DIR/outer-forbid.rs:25:9
|
||||
|
|
||||
17 | #![forbid(unused, non_snake_case)]
|
||||
| -------------- `forbid` level set here
|
||||
18 |
|
||||
19 | #[allow(unused, unused_variables, bad_style)]
|
||||
| ^^^^^^^^^ overruled by previous forbid
|
||||
...
|
||||
25 | #[allow(bad_style)]
|
||||
| ^^^^^^^^^ overruled by previous forbid
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:26:5
|
||||
|
|
||||
25 | fn a() -> Foo {
|
||||
| --- expected `Foo` because of return type
|
||||
26 | Some(Foo { bar: 1 })
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `std::option::Option`
|
||||
|
|
||||
|
|
@ -10,6 +12,8 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:30:5
|
||||
|
|
||||
29 | fn a2() -> Foo {
|
||||
| --- expected `Foo` because of return type
|
||||
30 | Ok(Foo { bar: 1})
|
||||
| ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `std::result::Result`
|
||||
|
|
||||
|
|
@ -19,6 +23,8 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:34:5
|
||||
|
|
||||
33 | fn b() -> Option<Foo> {
|
||||
| ----------- expected `std::option::Option<Foo>` because of return type
|
||||
34 | Foo { bar: 1 }
|
||||
| ^^^^^^^^^^^^^^ expected enum `std::option::Option`, found struct `Foo`
|
||||
|
|
||||
|
|
@ -28,6 +34,8 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:38:5
|
||||
|
|
||||
37 | fn c() -> Result<Foo, Bar> {
|
||||
| ---------------- expected `std::result::Result<Foo, Bar>` because of return type
|
||||
38 | Foo { bar: 1 }
|
||||
| ^^^^^^^^^^^^^^ expected enum `std::result::Result`, found struct `Foo`
|
||||
|
|
||||
|
|
@ -37,6 +45,9 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:49:5
|
||||
|
|
||||
41 | fn d() -> X<X<String, String>, String> {
|
||||
| ---------------------------- expected `X<X<std::string::String, std::string::String>, std::string::String>` because of return type
|
||||
...
|
||||
49 | x
|
||||
| ^ expected struct `std::string::String`, found integral variable
|
||||
|
|
||||
|
|
@ -46,6 +57,9 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:60:5
|
||||
|
|
||||
52 | fn e() -> X<X<String, String>, String> {
|
||||
| ---------------------------- expected `X<X<std::string::String, std::string::String>, std::string::String>` because of return type
|
||||
...
|
||||
60 | x
|
||||
| ^ expected struct `std::string::String`, found integral variable
|
||||
|
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
// run-pass
|
||||
|
||||
#![warn(unused)]
|
||||
|
||||
// Parser test for #37765
|
||||
|
||||
fn with_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `with_parens`
|
||||
|
|
|
|||
|
|
@ -1,26 +1,31 @@
|
|||
warning: unnecessary parentheses around `return` value
|
||||
--> $DIR/path-lookahead.rs:16:10
|
||||
--> $DIR/path-lookahead.rs:18:10
|
||||
|
|
||||
16 | return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
|
||||
18 | return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[warn(unused_parens)] on by default
|
||||
|
||||
warning: function is never used: `with_parens`
|
||||
--> $DIR/path-lookahead.rs:15:1
|
||||
--> $DIR/path-lookahead.rs:17:1
|
||||
|
|
||||
15 | / fn with_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `with_parens`
|
||||
16 | | return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
|
||||
17 | | }
|
||||
17 | / fn with_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `with_parens`
|
||||
18 | | return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
|
||||
19 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: #[warn(dead_code)] on by default
|
||||
note: lint level defined here
|
||||
--> $DIR/path-lookahead.rs:13:9
|
||||
|
|
||||
13 | #![warn(unused)]
|
||||
| ^^^^^^
|
||||
= note: #[warn(dead_code)] implied by #[warn(unused)]
|
||||
|
||||
warning: function is never used: `no_parens`
|
||||
--> $DIR/path-lookahead.rs:19:1
|
||||
--> $DIR/path-lookahead.rs:21:1
|
||||
|
|
||||
19 | / fn no_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `no_parens`
|
||||
20 | | return <T as ToString>::to_string(&arg);
|
||||
21 | | }
|
||||
21 | / fn no_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `no_parens`
|
||||
22 | | return <T as ToString>::to_string(&arg);
|
||||
23 | | }
|
||||
| |_^
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,20 @@
|
|||
error: unreachable expression
|
||||
--> $DIR/expr_unary.rs:18:28
|
||||
|
|
||||
18 | let x: ! = ! { return; 22 };
|
||||
| ^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/expr_unary.rs:14:9
|
||||
|
|
||||
14 | #![deny(unreachable_code)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0600]: cannot apply unary operator `!` to type `!`
|
||||
--> $DIR/expr_unary.rs:18:16
|
||||
|
|
||||
18 | let x: ! = ! { return; 22 };
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,13 @@
|
|||
//! A test to ensure that helpful `note` messages aren't emitted more often
|
||||
//! than necessary.
|
||||
|
||||
// Although there are three errors, we should only get two "lint level defined
|
||||
// here" notes pointing at the `warnings` span, one for each error type.
|
||||
#![deny(warnings)]
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
// Although there are three warnings, we should only get two "lint level defined
|
||||
// here" notes pointing at the `warnings` span, one for each error type.
|
||||
#![warn(unused)]
|
||||
|
||||
#[rustc_error]
|
||||
fn main() {
|
||||
let theTwo = 2;
|
||||
let theOtherTwo = 2;
|
||||
|
|
|
|||
|
|
@ -1,34 +1,37 @@
|
|||
error: variable `theTwo` should have a snake case name such as `the_two`
|
||||
--> $DIR/issue-24690.rs:19:9
|
||||
warning: unused variable: `theOtherTwo`
|
||||
--> $DIR/issue-24690.rs:23:9
|
||||
|
|
||||
19 | let theTwo = 2;
|
||||
23 | let theOtherTwo = 2;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-24690.rs:18:9
|
||||
|
|
||||
18 | #![warn(unused)]
|
||||
| ^^^^^^
|
||||
= note: #[warn(unused_variables)] implied by #[warn(unused)]
|
||||
|
||||
warning: variable `theTwo` should have a snake case name such as `the_two`
|
||||
--> $DIR/issue-24690.rs:22:9
|
||||
|
|
||||
22 | let theTwo = 2;
|
||||
| ^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-24690.rs:16:9
|
||||
|
|
||||
16 | #![deny(warnings)]
|
||||
| ^^^^^^^^
|
||||
= note: #[deny(non_snake_case)] implied by #[deny(warnings)]
|
||||
= note: #[warn(non_snake_case)] on by default
|
||||
|
||||
error: variable `theOtherTwo` should have a snake case name such as `the_other_two`
|
||||
--> $DIR/issue-24690.rs:20:9
|
||||
warning: variable `theOtherTwo` should have a snake case name such as `the_other_two`
|
||||
--> $DIR/issue-24690.rs:23:9
|
||||
|
|
||||
20 | let theOtherTwo = 2;
|
||||
23 | let theOtherTwo = 2;
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: unused variable: `theOtherTwo`
|
||||
--> $DIR/issue-24690.rs:20:9
|
||||
error: compilation successful
|
||||
--> $DIR/issue-24690.rs:21:1
|
||||
|
|
||||
20 | let theOtherTwo = 2;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-24690.rs:16:9
|
||||
|
|
||||
16 | #![deny(warnings)]
|
||||
| ^^^^^^^^
|
||||
= note: #[deny(unused_variables)] implied by #[deny(warnings)]
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
21 | / fn main() {
|
||||
22 | | let theTwo = 2;
|
||||
23 | | let theOtherTwo = 2;
|
||||
24 | | println!("{}", theTwo);
|
||||
25 | | }
|
||||
| |_^
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![warn(unused)]
|
||||
|
||||
macro_rules! m {
|
||||
($a:tt $b:tt) => {
|
||||
$b $a;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
warning: struct is never used: `S`
|
||||
--> $DIR/macro-span-replacement.rs:13:9
|
||||
--> $DIR/macro-span-replacement.rs:15:9
|
||||
|
|
||||
13 | $b $a;
|
||||
15 | $b $a;
|
||||
| ^^^^^^
|
||||
...
|
||||
18 | m!(S struct);
|
||||
20 | m!(S struct);
|
||||
| ------------- in this macro invocation
|
||||
|
|
||||
= note: #[warn(dead_code)] on by default
|
||||
note: lint level defined here
|
||||
--> $DIR/macro-span-replacement.rs:11:9
|
||||
|
|
||||
11 | #![warn(unused)]
|
||||
| ^^^^^^
|
||||
= note: #[warn(dead_code)] implied by #[warn(unused)]
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![warn(unused)]
|
||||
|
||||
use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd};
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
warning: unused imports: `Eq`, `Ord`, `PartialEq`, `PartialOrd`
|
||||
--> $DIR/multispan-import-lint.rs:11:16
|
||||
--> $DIR/multispan-import-lint.rs:13:16
|
||||
|
|
||||
11 | use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd};
|
||||
13 | use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd};
|
||||
| ^^ ^^^ ^^^^^^^^^ ^^^^^^^^^^
|
||||
|
|
||||
= note: #[warn(unused_imports)] on by default
|
||||
note: lint level defined here
|
||||
--> $DIR/multispan-import-lint.rs:11:9
|
||||
|
|
||||
11 | #![warn(unused)]
|
||||
| ^^^^^^
|
||||
= note: #[warn(unused_imports)] implied by #[warn(unused)]
|
||||
|
||||
|
|
|
|||
30
src/test/ui/trait-method-private.rs
Normal file
30
src/test/ui/trait-method-private.rs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
mod inner {
|
||||
pub trait Bar {
|
||||
fn method(&self);
|
||||
}
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
impl Foo {
|
||||
fn method(&self) {}
|
||||
}
|
||||
|
||||
impl Bar for Foo {
|
||||
fn method(&self) {}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let foo = inner::Foo;
|
||||
foo.method();
|
||||
}
|
||||
12
src/test/ui/trait-method-private.stderr
Normal file
12
src/test/ui/trait-method-private.stderr
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
error[E0624]: method `method` is private
|
||||
--> $DIR/trait-method-private.rs:29:9
|
||||
|
|
||||
29 | foo.method();
|
||||
| ^^^^^^
|
||||
|
|
||||
= help: items from traits can only be used if the trait is in scope
|
||||
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
|
||||
candidate #1: `use inner::Bar;`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue