Skip to content

Commit

Permalink
propagate tainted_by_errors in MirBorrowckCtxt::emit_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Sep 4, 2024
1 parent 842d6fc commit 494e5b7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2522,7 +2522,7 @@ mod diags {
}

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

// Buffer any move errors that we collected and de-duplicated.
for (_, (_, diag)) in std::mem::take(&mut self.diags.buffered_move_errors) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ known-bug: rust-lang/rust#126896
//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes

// reported as rust-lang/rust#126896

#![feature(type_alias_impl_trait)]
type Two<'a, 'b> = impl std::fmt::Debug;

Expand All @@ -13,5 +14,4 @@ fn d(x: Two) {
c1;
}

fn main() {
}
fn main() {}
12 changes: 12 additions & 0 deletions tests/ui/polymorphization/taint.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0792]: expected generic lifetime parameter, found `'_`
--> $DIR/taint.rs:12:17
|
LL | type Two<'a, 'b> = impl std::fmt::Debug;
| -- this generic parameter must be used with a generic lifetime parameter
...
LL | let c1 = || set(x);
| ^^^^^^

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0792`.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ known-bug: #124164
// reported as #124164
static S_COUNT: = std::sync::atomic::AtomicUsize::new(0);

fn main() {}
8 changes: 8 additions & 0 deletions tests/ui/static/missing-type.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: missing type for `static` item
--> $DIR/missing-type.rs:2:16
|
LL | static S_COUNT: = std::sync::atomic::AtomicUsize::new(0);
| ^ help: provide a type for the static variable: `AtomicUsize`

error: aborting due to 1 previous error

0 comments on commit 494e5b7

Please sign in to comment.