Open
Description
Code:
#![feature(type_alias_impl_trait)]
type A = impl Sized;
type B = impl Future<Output = A>;
#[define_opaque(A)]
fn a() -> A {
5
}
#[define_opaque(B)]
fn b(a: A) -> B {
async { a }
}
// Or like this too:
//
// #[define_opaque(B)]
// fn b() -> B {
// async { a() }
// }
I expected it to compile, but instead got an error:
error: item does not constrain `A::{opaque#0}`
--> src/main.rs:12:4
|
12 | fn b(a: A) -> B {
| ^
|
= note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
note: this opaque type is supposed to be constrained
--> src/main.rs:3:10
|
3 | type A = impl Sized;
|
Meta
rustc --version --verbose
:
rustc 1.87.0-nightly (b48576b4d 2025-03-22)
binary: rustc
commit-hash: b48576b4db5a595f453891f0b7243ef75d8c0afa
commit-date: 2025-03-22
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.1