-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #50334 - pietroalbini:beta-backports, r=alexcrichton
[beta] Yet another round of backports * #50092: Warn on pointless `#[derive]` in more places * #50227: Fix ICE with erroneous `impl Trait` in a trait impl #50092 also needed some tweaks on the beta branch (see my own two commits). r? @alexcrichton
- Loading branch information
Showing
9 changed files
with
179 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2018 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. | ||
|
||
// must-compile-successfully | ||
|
||
#![warn(unused_attributes)] //~ NOTE lint level defined here | ||
|
||
fn foo() { | ||
match 0 { | ||
#[derive(Debug)] //~ WARN unused attribute | ||
_ => (), | ||
} | ||
} | ||
|
||
fn main() { | ||
// fold_stmt (Item) | ||
#[allow(dead_code)] | ||
#[derive(Debug)] // should not warn | ||
struct Foo; | ||
|
||
// fold_stmt (Mac) | ||
#[derive(Debug)] | ||
//~^ WARN `#[derive]` does nothing on macro invocations | ||
//~| NOTE this may become a hard error in a future release | ||
println!("Hello, world!"); | ||
|
||
// fold_stmt (Semi) | ||
#[derive(Debug)] //~ WARN unused attribute | ||
"Hello, world!"; | ||
|
||
// fold_stmt (Local) | ||
#[derive(Debug)] //~ WARN unused attribute | ||
let _ = "Hello, world!"; | ||
|
||
let _ = [ | ||
// fold_opt_expr | ||
#[derive(Debug)] //~ WARN unused attribute | ||
"Hello, world!" | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
warning: `#[derive]` does nothing on macro invocations | ||
--> $DIR/issue-49934.rs:29:5 | ||
| | ||
LL | #[derive(Debug)] | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this may become a hard error in a future release | ||
|
||
warning: unused attribute | ||
--> $DIR/issue-49934.rs:17:9 | ||
| | ||
LL | #[derive(Debug)] //~ WARN unused attribute | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
note: lint level defined here | ||
--> $DIR/issue-49934.rs:13:9 | ||
| | ||
LL | #![warn(unused_attributes)] //~ NOTE lint level defined here | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
warning: unused attribute | ||
--> $DIR/issue-49934.rs:35:5 | ||
| | ||
LL | #[derive(Debug)] //~ WARN unused attribute | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
warning: unused attribute | ||
--> $DIR/issue-49934.rs:39:5 | ||
| | ||
LL | #[derive(Debug)] //~ WARN unused attribute | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
warning: unused attribute | ||
--> $DIR/issue-49934.rs:44:9 | ||
| | ||
LL | #[derive(Debug)] //~ WARN unused attribute | ||
| ^^^^^^^^^^^^^^^^ | ||
|