Skip to content

Commit f7679d0

Browse files
committed
propagate tainted_by_errors in MirBorrowckCtxt::emit_errors
1 parent 842d6fc commit f7679d0

File tree

7 files changed

+35
-8
lines changed

7 files changed

+35
-8
lines changed

compiler/rustc_borrowck/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2522,7 +2522,7 @@ mod diags {
25222522
}
25232523

25242524
pub(crate) fn emit_errors(&mut self) -> Option<ErrorGuaranteed> {
2525-
let mut res = None;
2525+
let mut res = self.infcx.tainted_by_errors();
25262526

25272527
// Buffer any move errors that we collected and de-duplicated.
25282528
for (_, (_, diag)) in std::mem::take(&mut self.diags.buffered_move_errors) {

tests/ui/consts/missing_assoc_const_type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl Range for TwoDigits {
1616

1717
const fn digits(x: u8) -> usize {
1818
match x {
19-
TwoDigits::FIRST..=TwoDigits::LAST => 0,
19+
TwoDigits::FIRST..=TwoDigits::LAST => 0, //~ ERROR: could not evaluate constant pattern
2020
0..=9 | 100..=255 => panic!(),
2121
}
2222
}

tests/ui/consts/missing_assoc_const_type.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@ error: missing type for `const` item
44
LL | const FIRST: = 10;
55
| ^ help: provide a type for the associated constant: `u8`
66

7-
error: aborting due to 1 previous error
7+
error: could not evaluate constant pattern
8+
--> $DIR/missing_assoc_const_type.rs:19:9
9+
|
10+
LL | TwoDigits::FIRST..=TwoDigits::LAST => 0,
11+
| ^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to 2 previous errors
814

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//@ known-bug: #124164
1+
// reported as #124164
22
static S_COUNT: = std::sync::atomic::AtomicUsize::new(0);
3+
//~^ ERROR: missing type for `static` item
34

45
fn main() {}

tests/ui/static/missing-type.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: missing type for `static` item
2+
--> $DIR/missing-type.rs:2:16
3+
|
4+
LL | static S_COUNT: = std::sync::atomic::AtomicUsize::new(0);
5+
| ^ help: provide a type for the static variable: `AtomicUsize`
6+
7+
error: aborting due to 1 previous error
8+
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
//@ known-bug: rust-lang/rust#126896
21
//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes
32

3+
// reported as rust-lang/rust#126896
4+
45
#![feature(type_alias_impl_trait)]
56
type Two<'a, 'b> = impl std::fmt::Debug;
67

@@ -9,9 +10,8 @@ fn set(x: &mut isize) -> isize {
910
}
1011

1112
fn d(x: Two) {
12-
let c1 = || set(x);
13+
let c1 = || set(x); //~ ERROR: expected generic lifetime parameter, found `'_`
1314
c1;
1415
}
1516

16-
fn main() {
17-
}
17+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0792]: expected generic lifetime parameter, found `'_`
2+
--> $DIR/taint.rs:13:17
3+
|
4+
LL | type Two<'a, 'b> = impl std::fmt::Debug;
5+
| -- this generic parameter must be used with a generic lifetime parameter
6+
...
7+
LL | let c1 = || set(x);
8+
| ^^^^^^
9+
10+
error: aborting due to 1 previous error
11+
12+
For more information about this error, try `rustc --explain E0792`.

0 commit comments

Comments
 (0)