Rollup merge of #68744 - JohnTitor:fix-ice-save-analysis, r=cramertj
Do not ICE in `type-alias-impl-trait` with save-analysis FIxes #68621 Fixes #68750
This commit is contained in:
commit
95d1f6ffcd
6 changed files with 35 additions and 4 deletions
|
|
@ -837,8 +837,11 @@ fn has_typeck_tables(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
|||
return tcx.has_typeck_tables(outer_def_id);
|
||||
}
|
||||
|
||||
let id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
primary_body_of(tcx, id).is_some()
|
||||
if let Some(id) = tcx.hir().as_local_hir_id(def_id) {
|
||||
primary_body_of(tcx, id).is_some()
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fn used_trait_imports(tcx: TyCtxt<'_>, def_id: DefId) -> &DefIdSet {
|
||||
|
|
|
|||
17
src/test/ui/save-analysis/issue-68621.rs
Normal file
17
src/test/ui/save-analysis/issue-68621.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// compile-flags: -Zsave-analysis
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
trait Trait {}
|
||||
|
||||
trait Service {
|
||||
type Future: Trait;
|
||||
}
|
||||
|
||||
struct Struct;
|
||||
|
||||
impl Service for Struct {
|
||||
type Future = impl Trait; //~ ERROR: could not find defining uses
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
8
src/test/ui/save-analysis/issue-68621.stderr
Normal file
8
src/test/ui/save-analysis/issue-68621.stderr
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
error: could not find defining uses
|
||||
--> $DIR/issue-68621.rs:14:5
|
||||
|
|
||||
LL | type Future = impl Trait;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
// compile-flags: -Zsave-analysis
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
type Closure = impl FnOnce(); //~ ERROR: type mismatch resolving
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0271]: type mismatch resolving `<[closure@$DIR/issue-63279.rs:6:5: 6:28] as std::ops::FnOnce<()>>::Output == ()`
|
||||
--> $DIR/issue-63279.rs:3:1
|
||||
error[E0271]: type mismatch resolving `<[closure@$DIR/issue-63279.rs:8:5: 8:28] as std::ops::FnOnce<()>>::Output == ()`
|
||||
--> $DIR/issue-63279.rs:5:1
|
||||
|
|
||||
LL | type Closure = impl FnOnce();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected opaque type, found `()`
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// compile-flags: -Zsave-analysis
|
||||
// check-pass
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue