Skip to content

Commit 98407bd

Browse files
committed
Remove crate-checking code
1 parent 91084bf commit 98407bd

File tree

6 files changed

+7495
-35
lines changed

6 files changed

+7495
-35
lines changed

compiler/rustc_lint/src/late.rs

+2-35
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ fn late_lint_mod_inner<'tcx, T: LateLintPass<'tcx>>(
437437

438438
fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) {
439439
// Note: `passes` is often empty.
440-
let passes: Vec<_> =
440+
let mut passes: Vec<_> =
441441
unerased_lint_store(tcx.sess).late_passes.iter().map(|mk_pass| (mk_pass)(tcx)).collect();
442442

443443
if passes.is_empty() {
@@ -455,40 +455,7 @@ fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) {
455455
only_module: false,
456456
};
457457

458-
let (lints_to_emit, lints_allowed) = &**tcx.lints_that_can_emit(());
459-
460-
// Now, we'll filtered passes in a way that discards any lint that
461-
let mut filtered_passes: Vec<Box<dyn LateLintPass<'tcx>>> = passes
462-
.into_iter()
463-
.filter(|pass| {
464-
let pass = LintPass::get_lints(pass);
465-
pass.iter().any(|&lint| {
466-
lint.is_externally_loaded ||
467-
{
468-
let lint_name = &lint.name.to_lowercase()
469-
// Doing some calculations here to account for those separators
470-
[lint.name.find("::").unwrap_or(lint.name.len() - 2) + 2..]
471-
.to_string();
472-
lints_to_emit.contains(&lint_name)
473-
|| (!lints_allowed.contains(lint_name)
474-
&& lint.default_level != crate::Level::Allow)
475-
}
476-
})
477-
// if passes_lints[i].iter().any(|&lint| {
478-
// let symbol =
479-
// &lint.name.to_lowercase()
480-
// // Doing some calculations here to account for those separators
481-
// [lint.name.find("::").unwrap_or(lint.name.len() - 2) + 2..]
482-
483-
// // ^^^ Expensive, but more expensive would be having to
484-
// // cast every element to &str
485-
486-
// (!lints_allowed.contains(&lint.name)
487-
// && lint.default_level != crate::Level::Allow)
488-
})
489-
.collect();
490-
491-
let pass = RuntimeCombinedLateLintPass { passes: &mut filtered_passes[..] };
458+
let pass = RuntimeCombinedLateLintPass { passes: &mut passes[..] };
492459
late_lint_crate_inner(tcx, context, pass);
493460
}
494461

ice-9463-logs

Whitespace-only changes.

ice-9463-logs1

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
Building stage0 library artifacts (x86_64-unknown-linux-gnu)
2+
Building compiler artifacts (stage0 -> stage1, x86_64-unknown-linux-gnu)
3+
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
4+
Building stage1 library artifacts (x86_64-unknown-linux-gnu)
5+
Building compiler artifacts (stage1 -> stage2, x86_64-unknown-linux-gnu)
6+
Creating a sysroot for stage2 compiler (use `rustup toolchain link 'name' build/host/stage2`)
7+
Uplifting library (stage1 -> stage2)
8+
Uplifting rustc (stage1 -> stage3)
9+
Building tool clippy-driver (stage2 -> stage3, x86_64-unknown-linux-gnu)
10+
Building tool rustdoc (stage1 -> stage2, x86_64-unknown-linux-gnu)
11+
Testing clippy (stage2 -> stage3, x86_64-unknown-linux-gnu)
12+
13+
running 1 test
14+
.
15+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
16+
17+
18+
running 1 test
19+
.
20+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
21+
22+
23+
FAILED TEST: tests/ui/crashes/ice-9463.rs
24+
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-0cd35ebd41eb72f1.rlib" "--extern=clippy_lints=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-c96f175cccb2d539.rlib" "--extern=clippy_utils=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-fd859a3ecf6f55ed.rlib" "--extern=futures=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-0b71f644e2bc8726.rlib" "--extern=if_chain=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-0ea1dd1509ea0022.rlib" "--extern=itertools=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-bac5d36c307485ee.rlib" "--extern=parking_lot=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-859ce241e5f0659a.rlib" "--extern=quote=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-eb8380dd0960802e.rlib" "--extern=regex=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-6719df5da40cd34c.rlib" "--extern=serde=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-2030fb584e4f27dc.rlib" "--extern=serde_derive=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-5716afe404137539.so" "--extern=syn=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-152f3ca11d174b39.rlib" "--extern=tokio=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-77f2f32d01011546.rlib" "-Ldependency=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui/crashes" "tests/ui/crashes/ice-9463.rs" "--edition" "2021"
25+
26+
error: actual output differed from expected
27+
Execute `cargo uibless` to update `tests/ui/crashes/ice-9463.stderr` to the actual output
28+
--- tests/ui/crashes/ice-9463.stderr
29+
+++ <stderr output>
30+
-error: this arithmetic operation will overflow
31+
- --> tests/ui/crashes/ice-9463.rs:3:14
32+
- |
33+
-LL | let _x = -1_i32 >> -1;
34+
- | ^^^^^^^^^^^^ attempt to shift right by `-1_i32`, which would overflow
35+
- |
36+
-note: the lint level is defined here
37+
- --> tests/ui/crashes/ice-9463.rs:1:9
38+
- |
39+
-LL | #![deny(arithmetic_overflow)]
40+
- | ^^^^^^^^^^^^^^^^^^^
41+
-
42+
-error: this arithmetic operation will overflow
43+
- --> tests/ui/crashes/ice-9463.rs:5:14
44+
- |
45+
-LL | let _y = 1u32 >> 10000000000000u32;
46+
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to shift right by `1316134912_u32`, which would overflow
47+
-
48+
error: literal out of range for `u32`
49+
--> tests/ui/crashes/ice-9463.rs:5:22
50+
... 5 lines skipped ...
51+
= note: `#[deny(overflowing_literals)]` on by default
52+
53+
-error: aborting due to 3 previous errors
54+
+error: aborting due to 1 previous error
55+
56+
57+
58+
error: `this arithmetic operation will overflow` not found in diagnostics on line 3
59+
--> tests/ui/crashes/ice-9463.rs:4:17
60+
|
61+
4 | //~^ ERROR: this arithmetic operation will overflow
62+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected because of this pattern
63+
|
64+
65+
error: `this arithmetic operation will overflow` not found in diagnostics on line 5
66+
--> tests/ui/crashes/ice-9463.rs:6:17
67+
|
68+
6 | //~^ ERROR: this arithmetic operation will overflow
69+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected because of this pattern
70+
|
71+
72+
full stderr:
73+
error: literal out of range for `u32`
74+
--> tests/ui/crashes/ice-9463.rs:5:22
75+
|
76+
LL | let _y = 1u32 >> 10000000000000u32;
77+
| ^^^^^^^^^^^^^^^^^
78+
|
79+
= note: the literal `10000000000000u32` does not fit into the type `u32` whose range is `0..=4294967295`
80+
= note: `#[deny(overflowing_literals)]` on by default
81+
82+
error: aborting due to 1 previous error
83+
84+
85+
full stdout:
86+
87+
88+
FAILURES:
89+
tests/ui/crashes/ice-9463.rs
90+
91+
test result: FAIL. 1 failed; 972 filtered out;
92+
93+
94+
95+
Command did not execute successfully.
96+
Expected success, got: exit status: 101
97+
Add `-v` to see more details.
98+

ice-9463-logs2

Whitespace-only changes.

ice-9463-logs3

+186
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
Building stage0 library artifacts (x86_64-unknown-linux-gnu)
2+
Building compiler artifacts (stage0 -> stage1, x86_64-unknown-linux-gnu)
3+
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
4+
WARNING: Using a potentially old libstd. This may not behave well.
5+
WARNING: Using a potentially old librustc. This may not behave well.
6+
WARNING: Use `--keep-stage-std` if you want to rebuild the compiler when it changes
7+
Creating a sysroot for stage2 compiler (use `rustup toolchain link 'name' build/host/stage2`)
8+
Uplifting library (stage1 -> stage2)
9+
Uplifting rustc (stage1 -> stage3)
10+
Building tool clippy-driver (stage2 -> stage3, x86_64-unknown-linux-gnu)
11+
Building tool rustdoc (stage1 -> stage2, x86_64-unknown-linux-gnu)
12+
Testing clippy (stage2 -> stage3, x86_64-unknown-linux-gnu)
13+
14+
running 1 test
15+
.
16+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
17+
18+
19+
running 1 test
20+
.
21+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
22+
23+
24+
FAILED TEST: tests/ui/indexing_slicing_index.rs
25+
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-0cd35ebd41eb72f1.rlib" "--extern=clippy_lints=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-c96f175cccb2d539.rlib" "--extern=clippy_utils=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-fd859a3ecf6f55ed.rlib" "--extern=futures=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-0b71f644e2bc8726.rlib" "--extern=if_chain=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-0ea1dd1509ea0022.rlib" "--extern=itertools=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-bac5d36c307485ee.rlib" "--extern=parking_lot=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-859ce241e5f0659a.rlib" "--extern=quote=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-eb8380dd0960802e.rlib" "--extern=regex=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-6719df5da40cd34c.rlib" "--extern=serde=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-2030fb584e4f27dc.rlib" "--extern=serde_derive=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-5716afe404137539.so" "--extern=syn=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-152f3ca11d174b39.rlib" "--extern=tokio=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-77f2f32d01011546.rlib" "-Ldependency=/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/home/meow/git/rust/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/indexing_slicing_index.rs" "-Zdeduplicate-diagnostics=yes" "--edition" "2021"
26+
27+
error: actual output differed from expected
28+
Execute `cargo uibless` to update `tests/ui/indexing_slicing_index.stderr` to the actual output
29+
--- tests/ui/indexing_slicing_index.stderr
30+
+++ <stderr output>
31+
error: indexing may panic
32+
--> tests/ui/indexing_slicing_index.rs:15:20
33+
... 7 lines skipped ...
34+
= help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
35+
36+
-error[E0080]: evaluation of `main::{constant#3}` failed
37+
- --> tests/ui/indexing_slicing_index.rs:47:14
38+
- |
39+
-LL | const { &ARR[idx4()] };
40+
- | ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
41+
-
42+
-note: erroneous constant encountered
43+
- --> tests/ui/indexing_slicing_index.rs:47:5
44+
- |
45+
-LL | const { &ARR[idx4()] };
46+
- | ^^^^^^^^^^^^^^^^^^^^^^
47+
-
48+
error: indexing may panic
49+
--> tests/ui/indexing_slicing_index.rs:28:5
50+
... 95 lines skipped ...
51+
| ^^^^
52+
53+
-error: aborting due to 15 previous errors
54+
+error: aborting due to 14 previous errors
55+
56+
-For more information about this error, try `rustc --explain E0080`.
57+
58+
59+
full stderr:
60+
error: indexing may panic
61+
--> tests/ui/indexing_slicing_index.rs:15:20
62+
|
63+
LL | const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
64+
| ^^^^^^^^^^
65+
|
66+
= help: consider using `.get(n)` or `.get_mut(n)` instead
67+
= note: the suggestion might not be applicable in constant blocks
68+
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
69+
= help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
70+
71+
error: indexing may panic
72+
--> tests/ui/indexing_slicing_index.rs:28:5
73+
|
74+
LL | x[index];
75+
| ^^^^^^^^
76+
|
77+
= help: consider using `.get(n)` or `.get_mut(n)` instead
78+
79+
error: index is out of bounds
80+
--> tests/ui/indexing_slicing_index.rs:31:5
81+
|
82+
LL | x[4];
83+
| ^^^^
84+
|
85+
= note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings`
86+
= help: to override `-D warnings` add `#[allow(clippy::out_of_bounds_indexing)]`
87+
88+
error: index is out of bounds
89+
--> tests/ui/indexing_slicing_index.rs:33:5
90+
|
91+
LL | x[1 << 3];
92+
| ^^^^^^^^^
93+
94+
error: indexing may panic
95+
--> tests/ui/indexing_slicing_index.rs:44:14
96+
|
97+
LL | const { &ARR[idx()] };
98+
| ^^^^^^^^^^
99+
|
100+
= help: consider using `.get(n)` or `.get_mut(n)` instead
101+
= note: the suggestion might not be applicable in constant blocks
102+
103+
error: indexing may panic
104+
--> tests/ui/indexing_slicing_index.rs:47:14
105+
|
106+
LL | const { &ARR[idx4()] };
107+
| ^^^^^^^^^^^
108+
|
109+
= help: consider using `.get(n)` or `.get_mut(n)` instead
110+
= note: the suggestion might not be applicable in constant blocks
111+
112+
error: index is out of bounds
113+
--> tests/ui/indexing_slicing_index.rs:54:5
114+
|
115+
LL | y[4];
116+
| ^^^^
117+
118+
error: indexing may panic
119+
--> tests/ui/indexing_slicing_index.rs:57:5
120+
|
121+
LL | v[0];
122+
| ^^^^
123+
|
124+
= help: consider using `.get(n)` or `.get_mut(n)` instead
125+
126+
error: indexing may panic
127+
--> tests/ui/indexing_slicing_index.rs:59:5
128+
|
129+
LL | v[10];
130+
| ^^^^^
131+
|
132+
= help: consider using `.get(n)` or `.get_mut(n)` instead
133+
134+
error: indexing may panic
135+
--> tests/ui/indexing_slicing_index.rs:61:5
136+
|
137+
LL | v[1 << 3];
138+
| ^^^^^^^^^
139+
|
140+
= help: consider using `.get(n)` or `.get_mut(n)` instead
141+
142+
error: index is out of bounds
143+
--> tests/ui/indexing_slicing_index.rs:69:5
144+
|
145+
LL | x[N];
146+
| ^^^^
147+
148+
error: indexing may panic
149+
--> tests/ui/indexing_slicing_index.rs:72:5
150+
|
151+
LL | v[N];
152+
| ^^^^
153+
|
154+
= help: consider using `.get(n)` or `.get_mut(n)` instead
155+
156+
error: indexing may panic
157+
--> tests/ui/indexing_slicing_index.rs:74:5
158+
|
159+
LL | v[M];
160+
| ^^^^
161+
|
162+
= help: consider using `.get(n)` or `.get_mut(n)` instead
163+
164+
error: index is out of bounds
165+
--> tests/ui/indexing_slicing_index.rs:78:13
166+
|
167+
LL | let _ = x[4];
168+
| ^^^^
169+
170+
error: aborting due to 14 previous errors
171+
172+
173+
full stdout:
174+
175+
176+
FAILURES:
177+
tests/ui/indexing_slicing_index.rs
178+
179+
test result: FAIL. 1 failed; 972 filtered out;
180+
181+
182+
183+
Command did not execute successfully.
184+
Expected success, got: exit status: 101
185+
Add `-v` to see more details.
186+

0 commit comments

Comments
 (0)