Skip to content

Commit

Permalink
Rollup merge of rust-lang#104515 - chenyukang:yukang/fix-104510-ice, …
Browse files Browse the repository at this point in the history
…r=compiler-errors

ICE fixing, remove is_tainted_by_errors since we have ty_error for delay bug

Fixes rust-lang#104510
  • Loading branch information
matthiaskrgr authored Nov 17, 2022
2 parents 43fa291 + 9c2d4dd commit 5829287
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
1 change: 0 additions & 1 deletion compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let ty = self.typeck_results.borrow().expr_ty_adjusted(expr);
let ty = self.resolve_vars_if_possible(ty);
if ty.has_non_region_infer() {
assert!(self.is_tainted_by_errors());
self.tcx.ty_error()
} else {
self.tcx.erase_regions(ty)
Expand Down
16 changes: 16 additions & 0 deletions src/test/ui/typeck/issue-104510-ice.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// needs-asm-support
// only-x86_64

struct W<T: ?Sized>(Oops);
//~^ ERROR cannot find type `Oops` in this scope

unsafe fn test() {
let j = W(());
let pointer = &j as *const _;
core::arch::asm!(
"nop",
in("eax") pointer,
);
}

fn main() {}
9 changes: 9 additions & 0 deletions src/test/ui/typeck/issue-104510-ice.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0412]: cannot find type `Oops` in this scope
--> $DIR/issue-104510-ice.rs:4:21
|
LL | struct W<T: ?Sized>(Oops);
| ^^^^ not found in this scope

error: aborting due to previous error

For more information about this error, try `rustc --explain E0412`.

0 comments on commit 5829287

Please sign in to comment.