]> git.proxmox.com Git - rustc.git/blob - tests/ui/higher-rank-trait-bounds/hrtb-opt-in-copy.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / higher-rank-trait-bounds / hrtb-opt-in-copy.rs
1 // run-pass
2 // Test that we handle binder levels correctly when checking whether a
3 // type can implement `Copy`. In particular, we had a bug where we failed to
4 // liberate the late-bound regions from the impl, and thus wound up
5 // searching for an impl of `for<'tcx> Foo<&'tcx T>`. The impl that
6 // exists however is `impl<T> Copy for Foo<T>` and the current rules
7 // did not consider that a match (something I would like to revise in
8 // a later PR).
9
10 #![allow(dead_code)]
11
12 use std::marker::PhantomData;
13
14 #[derive(Copy, Clone)]
15 struct Foo<T> { x: T }
16
17 type Ty<'tcx> = &'tcx TyS<'tcx>;
18
19 enum TyS<'tcx> {
20 Boop(PhantomData<*mut &'tcx ()>)
21 }
22
23 #[derive(Copy, Clone)]
24 enum Bar<'tcx> {
25 Baz(Foo<Ty<'tcx>>)
26 }
27
28 fn main() { }