Closed
Description
Code
#![feature(type_alias_impl_trait)]
trait Trait {
type Gat<'lt>;
}
fn dyn_hoops<T: Trait>(_: T) -> *const dyn for<'b> Iterator<Item = impl Sized + Captures<'a>> {
loop {}
}
mod typeck {
use super::*;
type Opaque = impl Sized;
fn define() -> Option<Opaque> {
let _: Opaque = dyn_hoops::<u8>(0);
None
}
}
fn main() {}
Meta
rustc --version --verbose
:
rustc 1.82.0-nightly (80eb5a8e9 2024-08-13)
binary: rustc
commit-hash: 80eb5a8e910e5185d47cdefe3732d839c78a5e7e
commit-date: 2024-08-13
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0
Error output
error[E0261]: use of undeclared lifetime name `'a`
--> a.rs:7:90
|
7 | fn dyn_hoops<T: Trait>(_: T) -> *const dyn for<'b> Iterator<Item = impl Sized + Captures<'a>> {
| ^^ undeclared lifetime
|
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'a` lifetime
|
7 | fn dyn_hoops<T: Trait>(_: T) -> *const dyn for<'b> Iterator<Item = impl Sized + for<'a> Captures<'a>> {
| +++++++
help: consider making the bound lifetime-generic with a new `'a` lifetime
|
7 | fn dyn_hoops<T: Trait>(_: T) -> *const dyn for<'a, 'b> Iterator<Item = impl Sized + Captures<'a>> {
| +++
help: consider introducing lifetime `'a` here
|
7 | fn dyn_hoops<'a, T: Trait>(_: T) -> *const dyn for<'b> Iterator<Item = impl Sized + Captures<'a>> {
| +++
error[E0405]: cannot find trait `Captures` in this scope
--> a.rs:7:81
|
7 | fn dyn_hoops<T: Trait>(_: T) -> *const dyn for<'b> Iterator<Item = impl Sized + Captures<'a>> {
| ^^^^^^^^ not found in this scope
Backtrace
thread 'rustc' panicked at core/src/panicking.rs:229:5:
panic in a destructor during cleanup
error: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: please make sure that you have updated to the latest nightly
note: please attach the file at `/tmp/im/rustc-ice-2024-08-14T16_23_00-896091.txt` to your bug report
query stack during panic:
#0 [typeck] type-checking `typeck::define`
#1 [type_of_opaque] computing type of opaque `typeck::Opaque::{opaque#0}`
#2 [type_of] computing type of `typeck::Opaque::{opaque#0}`
#3 [check_well_formed] checking that `typeck::Opaque::{opaque#0}` is well-formed
#4 [check_mod_type_wf] checking that types are well-formed in module `typeck`
#5 [analysis] running analysis passes on this crate
end of query stack
thread caused non-unwinding panic. aborting.
[1] 896091 IOT instruction RUST_BACKTRACE=full rustc a.rs
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done