Loosen an assertion to account for stashed errors. · rust-lang/rust@bb60ded (original) (raw)
File tree
3 files changed
lines changed
- compiler/rustc_hir_analysis/src/check
3 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1283,7 +1283,8 @@ fn check_type_alias_type_params_are_used<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalD | ||
1283 | 1283 | let ty = tcx.type_of(def_id).instantiate_identity(); |
1284 | 1284 | if ty.references_error() { |
1285 | 1285 | // If there is already another error, do not emit an error for not using a type parameter. |
1286 | -assert!(tcx.dcx().has_errors().is_some()); | |
1286 | +// Without the `stashed_err_count` part this can fail (#120856). | |
1287 | +assert!(tcx.dcx().has_errors().is_some() | | |
1287 | 1288 | return; |
1288 | 1289 | } |
1289 | 1290 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
1 | +pub type Archived<T> = <m::Alias as n::Trait>::Archived; | |
2 | +//~^ ERROR failed to resolve: use of undeclared crate or module `m` | |
3 | +//~| ERROR failed to resolve: use of undeclared crate or module `n` | |
4 | + | |
5 | +fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
1 | +error[E0433]: failed to resolve: use of undeclared crate or module `n` | |
2 | + --> $DIR/issue-120856.rs:1:37 | |
3 | + | | |
4 | +LL | pub type Archived = <m::Alias as n::Trait>::Archived; | |
5 | + | ^ | |
6 | + | | |
7 | + | use of undeclared crate or module `n` | |
8 | + | help: a trait with a similar name exists: `Fn` | |
9 | + | |
10 | +error[E0433]: failed to resolve: use of undeclared crate or module `m` | |
11 | + --> $DIR/issue-120856.rs:1:25 | |
12 | + | | |
13 | +LL | pub type Archived = <m::Alias as n::Trait>::Archived; | |
14 | + | ^ | |
15 | + | | |
16 | + | use of undeclared crate or module `m` | |
17 | + | help: a type parameter with a similar name exists: `T` | |
18 | + | |
19 | +error: aborting due to 2 previous errors | |
20 | + | |
21 | +For more information about this error, try `rustc --explain E0433`. |