diff options
| author | lcnr <rust@lcnr.de> | 2025-08-07 14:29:11 +0200 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2025-08-07 14:29:11 +0200 |
| commit | 8441f95ec70a2ee5cde4d1b8c81203860e4f5bb9 (patch) | |
| tree | ec51e9631f1dc01ed19045064129766ae28c3e32 /tests/ui/impl-trait/member-constraints/incomplete-constraint.rs | |
| parent | 064d5886544de3f28b0804fb15654ea49eb6b9c7 (diff) | |
| download | rust-8441f95ec70a2ee5cde4d1b8c81203860e4f5bb9.tar.gz rust-8441f95ec70a2ee5cde4d1b8c81203860e4f5bb9.zip | |
add opaque type member constraint tests
Diffstat (limited to 'tests/ui/impl-trait/member-constraints/incomplete-constraint.rs')
| -rw-r--r-- | tests/ui/impl-trait/member-constraints/incomplete-constraint.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/member-constraints/incomplete-constraint.rs b/tests/ui/impl-trait/member-constraints/incomplete-constraint.rs new file mode 100644 index 00000000000..92fd31516d7 --- /dev/null +++ b/tests/ui/impl-trait/member-constraints/incomplete-constraint.rs @@ -0,0 +1,21 @@ +//@ check-pass +// FIXME(-Znext-solver): enable this test + +// These functions currently does not normalize the opaque type but will do +// so in the future. At this point we've got a new use of the opaque will fully +// universal arguments but for which lifetimes in the hidden type are unconstrained. +// +// Applying the member constraints would then incompletely infer `'unconstrained` to `'static`. +fn new_defining_use<F: FnOnce(T) -> R, T, R>(_: F) {} + +fn rpit1<'a, 'b: 'b>(x: &'b ()) -> impl Sized + use<'a, 'b> { + new_defining_use(rpit1::<'a, 'b>); + x +} + +struct Inv<'a, 'b>(*mut (&'a (), &'b ())); +fn rpit2<'a>(_: ()) -> impl Sized + use<'a> { + new_defining_use(rpit2::<'a>); + Inv::<'a, 'static>(std::ptr::null_mut()) +} +fn main() {} |
