Implement #[define_opaque] attribute for functions.

This commit is contained in:
Oli Scherer
2024-07-26 10:04:02 +00:00
committed by Oli Scherer
parent 2c6a12ec44
commit cb4751d4b8
653 changed files with 2911 additions and 2580 deletions

View File

@@ -7,6 +7,7 @@ This means
type Foo<T> = impl std::fmt::Debug;
#[define_opaque(Foo)]
fn foo() -> Foo<u32> {
5u32
}
@@ -19,6 +20,7 @@ is not accepted. If it were accepted, one could create unsound situations like
type Foo<T> = impl Default;
#[define_opaque(Foo)]
fn foo() -> Foo<u32> {
5u32
}
@@ -36,6 +38,7 @@ Instead you need to make the function generic:
type Foo<T> = impl std::fmt::Debug;
#[define_opaque(Foo)]
fn foo<U>() -> Foo<U> {
5u32
}
@@ -56,6 +59,7 @@ use std::fmt::Debug;
type Foo<T: Debug> = impl Debug;
#[define_opaque(Foo)]
fn foo<U: Debug>() -> Foo<U> {
Vec::<U>::new()
}