]> git.proxmox.com Git - rustc.git/blame - tests/ui/lifetimes/unusual-rib-combinations.rs
Merge 1.70 into proxmox/bookworm
[rustc.git] / tests / ui / lifetimes / unusual-rib-combinations.rs
CommitLineData
2b03887a
FG
1#![feature(inline_const)]
2
3struct S<'a>(&'a u8);
4fn foo() {}
5
6// Paren generic args in AnonConst
7fn a() -> [u8; foo::()] {
8//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
9//~| ERROR mismatched types
10 panic!()
11}
12
13// Paren generic args in ConstGeneric
14fn b<const C: u8()>() {}
15//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
16
17// Paren generic args in AnonymousReportError
18fn c<T = u8()>() {}
19//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
20//~| ERROR defaults for type parameters are only allowed in
21//~| WARN this was previously accepted
22
23// Elided lifetime in path in ConstGeneric
24fn d<const C: S>() {}
25//~^ ERROR missing lifetime specifier
9ffffee4 26//~| ERROR `S<'_>` is forbidden as the type of a const generic parameter
2b03887a 27
353b0b11
FG
28trait Foo<'a> {}
29struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>;
30//~^ ERROR use of non-static lifetime `'a` in const generic
31//~| ERROR `&dyn for<'a> Foo<'a>` is forbidden as the type of a const generic parameter
32
2b03887a 33fn main() {}