]> git.proxmox.com Git - rustc.git/blame - src/test/ui/where-clauses/where-for-self-2.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / where-clauses / where-for-self-2.rs
CommitLineData
85aaf69f
SL
1// Test that we can quantify lifetimes outside a constraint (i.e., including
2// the self type) in a where clause. Specifically, test that implementing for a
b7449926 3// specific lifetime is not enough to satisfy the `for<'a> ...` constraint, which
85aaf69f
SL
4// should require *all* lifetimes.
5
6static X: &'static u32 = &42;
7
8trait Bar {
9 fn bar(&self);
10}
11
12impl Bar for &'static u32 {
13 fn bar(&self) {}
14}
15
16fn foo<T>(x: &T)
f035d41b
XL
17where
18 for<'a> &'a T: Bar,
19{
20}
85aaf69f
SL
21
22fn main() {
f035d41b 23 foo(&X); //~ ERROR implementation of `Bar` is not general enough
85aaf69f 24}