diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-01-26 16:19:49 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-02-02 15:40:11 +0000 |
| commit | 7795f6233ccc2319ecca3605442ddceb279ee815 (patch) | |
| tree | 467ac32917c854f1ea7a9724743aca1322d37980 | |
| parent | 64c5b9a3d6f26659e0bd388fbb00cd92d888178d (diff) | |
| download | rust-7795f6233ccc2319ecca3605442ddceb279ee815.tar.gz rust-7795f6233ccc2319ecca3605442ddceb279ee815.zip | |
Add explanation for early abort in TAIT hidden type computation
| -rw-r--r-- | compiler/rustc_typeck/src/collect/type_of.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_typeck/src/collect/type_of.rs b/compiler/rustc_typeck/src/collect/type_of.rs index 81faacd4da5..4b61e21c0e0 100644 --- a/compiler/rustc_typeck/src/collect/type_of.rs +++ b/compiler/rustc_typeck/src/collect/type_of.rs @@ -598,6 +598,15 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> { } // Calling `mir_borrowck` can lead to cycle errors through // const-checking, avoid calling it if we don't have to. + // ```rust + // type Foo = impl Fn() -> usize; // when computing type for this + // const fn bar() -> Foo { + // || 0usize + // } + // const BAZR: Foo = bar(); // we would mir-borrowck this, causing cycles + // // because we again need to reveal `Foo` so we can check whether the + // // constant does not contain interior mutability. + // ``` if self.tcx.typeck(def_id).concrete_opaque_types.get(&self.def_id).is_none() { debug!("no constraints in typeck results"); return; |
