Skip to content

Commit e70b414

Browse files
committed
bless tests and tidy
also removes E0452 and splits `tests/rustdoc-ui/lints/renamed-lint-still-applies` into 2 tests this is because of delayed warn lint being lost on compiler aborting on error
1 parent 858ece6 commit e70b414

64 files changed

Lines changed: 854 additions & 987 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

compiler/rustc_attr_parsing/src/interface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<'sess> AttributeParser<'sess, Early> {
133133
)
134134
}
135135

136-
/// This method provides the same functionality as [`parse_limited_all`](Self::parse_limited_all) except filtered,
136+
/// This method provides the same functionality as [`parse_limited_all`](Self::parse_limited_all) except filtered,
137137
/// making sure that only allow-listed symbols are parsed
138138
pub fn parse_limited_all_filtered(
139139
sess: &'sess Session,

compiler/rustc_error_codes/src/error_codes/E0452.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
#### Note: this error code is no longer emitted by the compiler
12
An invalid lint attribute has been given.
23

34
Erroneous code example:
45

5-
```compile_fail,E0452
6+
```compile_fail
67
#![allow(foo = "")] // error: malformed lint attribute
78
```
89

compiler/rustc_lint/src/early.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,7 @@ fn check_ast_node_inner<'a, T: EarlyLintPass>(
425425
) {
426426
let mut cx = EarlyContextAndPass { context, tcx, pass };
427427

428-
cx.with_lint_attrs(
429-
check_node.id(),
430-
check_node.attrs(),
431-
|cx| check_node.check(cx),
432-
DUMMY_SP
433-
);
428+
cx.with_lint_attrs(check_node.id(), check_node.attrs(), |cx| check_node.check(cx), DUMMY_SP);
434429

435430
// All of the buffered lints should have been emitted at this point.
436431
// If not, that means that we somehow buffered a lint for a node id

src/tools/clippy/tests/ui/unknown_clippy_lints.stderr

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
1-
error: unknown lint: `clippy::All`
2-
--> tests/ui/unknown_clippy_lints.rs:3:10
3-
|
4-
LL | #![allow(clippy::All)]
5-
| ^^^^^^^^^^^ help: did you mean: `clippy::all`
6-
|
7-
= note: `-D unknown-lints` implied by `-D warnings`
8-
= help: to override `-D warnings` add `#[allow(unknown_lints)]`
9-
10-
error: unknown lint: `clippy::CMP_OWNED`
11-
--> tests/ui/unknown_clippy_lints.rs:5:9
12-
|
13-
LL | #![warn(clippy::CMP_OWNED)]
14-
| ^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::cmp_owned`
15-
161
error: unknown lint: `clippy::if_not_els`
172
--> tests/ui/unknown_clippy_lints.rs:9:8
183
|
194
LL | #[warn(clippy::if_not_els)]
205
| ^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::if_not_else`
6+
|
7+
= note: `-D unknown-lints` implied by `-D warnings`
8+
= help: to override `-D warnings` add `#[allow(unknown_lints)]`
219

2210
error: unknown lint: `clippy::UNNecsaRy_cAst`
2311
--> tests/ui/unknown_clippy_lints.rs:11:8
@@ -67,5 +55,17 @@ LL - #[warn(clippy::missing_docs)]
6755
LL + #[warn(missing_docs)]
6856
|
6957

58+
error: unknown lint: `clippy::All`
59+
--> tests/ui/unknown_clippy_lints.rs:3:10
60+
|
61+
LL | #![allow(clippy::All)]
62+
| ^^^^^^^^^^^ help: did you mean: `clippy::all`
63+
64+
error: unknown lint: `clippy::CMP_OWNED`
65+
--> tests/ui/unknown_clippy_lints.rs:5:9
66+
|
67+
LL | #![warn(clippy::CMP_OWNED)]
68+
| ^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::cmp_owned`
69+
7070
error: aborting due to 9 previous errors
7171

tests/pretty/delegation-inherit-attributes.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
//@ pretty-compare-only
55
//@ pp-exact:delegation-inherit-attributes.pp
66

7-
#![allow(incomplete_features)]
87
#![feature(fn_delegation)]
8+
#![attr = LintAttribute {kind: Allow,
9+
sub_attrs: [LintAttribute {lint_instances: [LintInstance {lint_name: "incomplete_features",
10+
lint_index: 0, kind: NoTool}], attr_style: Inner, attr_index: 0}]}]
911
extern crate std;
1012
#[attr = PreludeImport]
1113
use std::prelude::rust_2021::*;

tests/pretty/delegation-inline-attribute.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
//@ pretty-mode:hir
33
//@ pp-exact:delegation-inline-attribute.pp
44

5-
#![allow(incomplete_features)]
65
#![feature(fn_delegation)]
6+
#![attr = LintAttribute {kind: Allow,
7+
sub_attrs: [LintAttribute {lint_instances: [LintInstance {lint_name: "incomplete_features",
8+
lint_index: 0, kind: NoTool}], attr_style: Inner, attr_index: 0}]}]
79
extern crate std;
810
#[attr = PreludeImport]
911
use ::std::prelude::rust_2015::*;

tests/pretty/hir-delegation.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
//@ pretty-mode:hir
33
//@ pp-exact:hir-delegation.pp
44

5-
#![allow(incomplete_features)]
65
#![feature(fn_delegation)]
6+
#![attr = LintAttribute {kind: Allow,
7+
sub_attrs: [LintAttribute {lint_instances: [LintInstance {lint_name: "incomplete_features",
8+
lint_index: 0, kind: NoTool}], attr_style: Inner, attr_index: 0}]}]
79
extern crate std;
810
#[attr = PreludeImport]
911
use ::std::prelude::rust_2015::*;

tests/pretty/hir-lifetimes.pp

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,49 @@
1+
#![attr = LintAttribute {kind: Allow,
2+
sub_attrs: [LintAttribute {lint_instances: [LintInstance {lint_name: "unused_imports",
3+
original_name: "unused", lint_index: 0, kind: NoTool},
4+
LintInstance {lint_name: "unused_variables", original_name: "unused",
5+
lint_index: 0, kind: NoTool}, LintInstance {lint_name: "unused_visibilities",
6+
original_name: "unused", lint_index: 0, kind: NoTool},
7+
LintInstance {lint_name: "unused_assignments", original_name: "unused",
8+
lint_index: 0, kind: NoTool}, LintInstance {lint_name: "dead_code",
9+
original_name: "unused", lint_index: 0, kind: NoTool},
10+
LintInstance {lint_name: "unused_mut", original_name: "unused", lint_index: 0,
11+
kind: NoTool}, LintInstance {lint_name: "unreachable_code",
12+
original_name: "unused", lint_index: 0, kind: NoTool},
13+
LintInstance {lint_name: "unreachable_patterns", original_name: "unused",
14+
lint_index: 0, kind: NoTool}, LintInstance {lint_name: "unused_must_use",
15+
original_name: "unused", lint_index: 0, kind: NoTool},
16+
LintInstance {lint_name: "unused_unsafe", original_name: "unused",
17+
lint_index: 0, kind: NoTool}, LintInstance {lint_name: "path_statements",
18+
original_name: "unused", lint_index: 0, kind: NoTool},
19+
LintInstance {lint_name: "unused_attributes", original_name: "unused",
20+
lint_index: 0, kind: NoTool}, LintInstance {lint_name: "unused_macros",
21+
original_name: "unused", lint_index: 0, kind: NoTool},
22+
LintInstance {lint_name: "unused_macro_rules", original_name: "unused",
23+
lint_index: 0, kind: NoTool}, LintInstance {lint_name: "unused_allocation",
24+
original_name: "unused", lint_index: 0, kind: NoTool},
25+
LintInstance {lint_name: "unused_doc_comments", original_name: "unused",
26+
lint_index: 0, kind: NoTool}, LintInstance {lint_name: "unused_extern_crates",
27+
original_name: "unused", lint_index: 0, kind: NoTool},
28+
LintInstance {lint_name: "unused_features", original_name: "unused",
29+
lint_index: 0, kind: NoTool}, LintInstance {lint_name: "unused_labels",
30+
original_name: "unused", lint_index: 0, kind: NoTool},
31+
LintInstance {lint_name: "unused_parens", original_name: "unused",
32+
lint_index: 0, kind: NoTool}, LintInstance {lint_name: "unused_braces",
33+
original_name: "unused", lint_index: 0, kind: NoTool},
34+
LintInstance {lint_name: "redundant_semicolons", original_name: "unused",
35+
lint_index: 0, kind: NoTool}, LintInstance {lint_name: "map_unit_fn",
36+
original_name: "unused", lint_index: 0, kind: NoTool}], attr_style: Inner,
37+
attr_index: 0}]}]
38+
extern crate std;
39+
#[attr = PreludeImport]
40+
use ::std::prelude::rust_2015::*;
141
//@ pretty-compare-only
242
//@ pretty-mode:hir
343
//@ pp-exact:hir-lifetimes.pp
444

545
// This tests the pretty-printing of lifetimes in lots of ways.
646

7-
#![allow(unused)]
8-
extern crate std;
9-
#[attr = PreludeImport]
10-
use ::std::prelude::rust_2015::*;
1147

1248
struct Foo<'a> {
1349
x: &'a u32,

tests/pretty/pin-ergonomics-hir.pp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
//@ pp-exact:pin-ergonomics-hir.pp
44

55
#![feature(pin_ergonomics)]
6-
#![allow(dead_code, incomplete_features)]
6+
#![attr = LintAttribute {kind: Allow,
7+
sub_attrs: [LintAttribute {lint_instances: [LintInstance {lint_name: "dead_code",
8+
lint_index: 0, kind: NoTool}, LintInstance {lint_name: "incomplete_features",
9+
lint_index: 1, kind: NoTool}], attr_style: Inner, attr_index: 0}]}]
710
extern crate std;
811
#[attr = PreludeImport]
912
use ::std::prelude::rust_2015::*;

tests/rustdoc-ui/doctest/dead-code-items.stdout

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11

2-
running 13 tests
2+
running 2 tests
3+
test $DIR/dead-code-items.rs - A::field (line 41) - compile ... ok
4+
test $DIR/dead-code-items.rs - U::field (line 57) - compile ... ok
5+
6+
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
7+
8+
9+
running 11 tests
310
test $DIR/dead-code-items.rs - A (line 34) - compile ... ok
411
test $DIR/dead-code-items.rs - A (line 90) - compile ... ok
5-
test $DIR/dead-code-items.rs - A::field (line 41) - compile ... FAILED
612
test $DIR/dead-code-items.rs - A::method (line 96) - compile ... ok
713
test $DIR/dead-code-items.rs - C (line 24) - compile ... FAILED
814
test $DIR/dead-code-items.rs - Enum (line 72) - compile ... FAILED
@@ -11,27 +17,10 @@ test $DIR/dead-code-items.rs - MyTrait (line 105) - compile ... FAILED
1117
test $DIR/dead-code-items.rs - MyTrait::my_trait_fn (line 112) - compile ... FAILED
1218
test $DIR/dead-code-items.rs - S (line 16) - compile ... ok
1319
test $DIR/dead-code-items.rs - U (line 50) - compile ... ok
14-
test $DIR/dead-code-items.rs - U::field (line 57) - compile ... FAILED
1520
test $DIR/dead-code-items.rs - U::field2 (line 63) - compile ... ok
1621

1722
failures:
1823

19-
---- $DIR/dead-code-items.rs - A::field (line 41) stdout ----
20-
error: trait `DeadCodeInField` is never used
21-
--> $DIR/dead-code-items.rs:42:7
22-
|
23-
LL | trait DeadCodeInField {}
24-
| ^^^^^^^^^^^^^^^
25-
|
26-
note: the lint level is defined here
27-
--> $DIR/dead-code-items.rs:40:9
28-
|
29-
LL | #![deny(dead_code)]
30-
| ^^^^^^^^^
31-
32-
error: aborting due to 1 previous error
33-
34-
Couldn't compile the test.
3524
---- $DIR/dead-code-items.rs - C (line 24) stdout ----
3625
error: unused variable: `unused_error`
3726
--> $DIR/dead-code-items.rs:25:5
@@ -115,33 +104,15 @@ LL | #![deny(warnings)]
115104

116105
error: aborting due to 1 previous error
117106

118-
Couldn't compile the test.
119-
---- $DIR/dead-code-items.rs - U::field (line 57) stdout ----
120-
error: trait `DeadCodeInUnionField` is never used
121-
--> $DIR/dead-code-items.rs:58:7
122-
|
123-
LL | trait DeadCodeInUnionField {}
124-
| ^^^^^^^^^^^^^^^^^^^^
125-
|
126-
note: the lint level is defined here
127-
--> $DIR/dead-code-items.rs:56:9
128-
|
129-
LL | #![deny(dead_code)]
130-
| ^^^^^^^^^
131-
132-
error: aborting due to 1 previous error
133-
134107
Couldn't compile the test.
135108

136109
failures:
137-
$DIR/dead-code-items.rs - A::field (line 41)
138110
$DIR/dead-code-items.rs - C (line 24)
139111
$DIR/dead-code-items.rs - Enum (line 72)
140112
$DIR/dead-code-items.rs - Enum::Variant1 (line 79)
141113
$DIR/dead-code-items.rs - MyTrait (line 105)
142114
$DIR/dead-code-items.rs - MyTrait::my_trait_fn (line 112)
143-
$DIR/dead-code-items.rs - U::field (line 57)
144115

145-
test result: FAILED. 6 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
116+
test result: FAILED. 6 passed; 5 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
146117

147118
all doctests ran in $TIME; merged doctests compilation took $TIME

0 commit comments

Comments
 (0)