mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Add regression tests
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
#[deprecated = "AAA"]
|
||||
//~^ NOTE also specified here
|
||||
#[deprecated = "BBB"]
|
||||
//~^ ERROR multiple `deprecated` attributes
|
||||
fn deprecated() { }
|
||||
|
||||
fn main() {
|
||||
deprecated();
|
||||
//~^ WARN use of deprecated function `deprecated`: AAA [deprecated]
|
||||
//~| NOTE `#[warn(deprecated)]` on by default
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
error: multiple `deprecated` attributes
|
||||
--> $DIR/attr-order-deprecated.rs:3:1
|
||||
|
|
||||
LL | #[deprecated = "BBB"]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
note: attribute also specified here
|
||||
--> $DIR/attr-order-deprecated.rs:1:1
|
||||
|
|
||||
LL | #[deprecated = "AAA"]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: use of deprecated function `deprecated`: AAA
|
||||
--> $DIR/attr-order-deprecated.rs:8:5
|
||||
|
|
||||
LL | deprecated();
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: aborting due to 1 previous error; 1 warning emitted
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#![deny(unused)]
|
||||
//~^ NOTE lint level is defined here
|
||||
|
||||
#[must_use = "AAA"]
|
||||
//~^ NOTE also specified here
|
||||
#[must_use = "BBB"]
|
||||
//~^ ERROR unused attribute
|
||||
//~| WARN previously accepted
|
||||
//~| NOTE `#[deny(unused_attributes)]` implied by `#[deny(unused)]`
|
||||
fn must_use() -> usize {
|
||||
0
|
||||
}
|
||||
|
||||
fn main() {
|
||||
must_use();
|
||||
//~^ ERROR unused return value of `must_use` that must be used
|
||||
//~| NOTE AAA
|
||||
//~| NOTE `#[deny(unused_must_use)]` implied by `#[deny(unused)]`
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
error: unused attribute
|
||||
--> $DIR/attr-order-must-use.rs:6:1
|
||||
|
|
||||
LL | #[must_use = "BBB"]
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
note: attribute also specified here
|
||||
--> $DIR/attr-order-must-use.rs:4:1
|
||||
|
|
||||
LL | #[must_use = "AAA"]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
note: the lint level is defined here
|
||||
--> $DIR/attr-order-must-use.rs:1:9
|
||||
|
|
||||
LL | #![deny(unused)]
|
||||
| ^^^^^^
|
||||
= note: `#[deny(unused_attributes)]` implied by `#[deny(unused)]`
|
||||
|
||||
error: unused return value of `must_use` that must be used
|
||||
--> $DIR/attr-order-must-use.rs:15:5
|
||||
|
|
||||
LL | must_use();
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: AAA
|
||||
= note: `#[deny(unused_must_use)]` implied by `#[deny(unused)]`
|
||||
help: use `let _ = ...` to ignore the resulting value
|
||||
|
|
||||
LL | let _ = must_use();
|
||||
| +++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Reference in New Issue
Block a user