]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mir/issue-75053.rs
Allow combining -Cprofile-generate and -Cpanic=unwind when targeting
[rust.git] / src / test / ui / mir / issue-75053.rs
1 // compile-flags: -Z mir-opt-level=3
2
3 // revisions: min_tait full_tait in_bindings
4 #![feature(min_type_alias_impl_trait, rustc_attrs)]
5 #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
6 //[full_tait]~^ WARN incomplete
7 #![cfg_attr(in_bindings, feature(impl_trait_in_bindings))]
8 //[in_bindings]~^ WARN incomplete
9
10 use std::marker::PhantomData;
11
12 trait MyIndex<T> {
13     type O;
14     fn my_index(self) -> Self::O;
15 }
16 trait MyFrom<T>: Sized {
17     type Error;
18     fn my_from(value: T) -> Result<Self, Self::Error>;
19 }
20
21 trait F {}
22 impl F for () {}
23 type DummyT<T> = impl F;
24 fn _dummy_t<T>() -> DummyT<T> {}
25
26 struct Phantom1<T>(PhantomData<T>);
27 struct Phantom2<T>(PhantomData<T>);
28 struct Scope<T>(Phantom2<DummyT<T>>);
29
30 impl<T> Scope<T> {
31     fn new() -> Self {
32         unimplemented!()
33     }
34 }
35
36 impl<T> MyFrom<Phantom2<T>> for Phantom1<T> {
37     type Error = ();
38     fn my_from(_: Phantom2<T>) -> Result<Self, Self::Error> {
39         unimplemented!()
40     }
41 }
42
43 impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<Phantom1<T>> for Scope<U> {
44     type O = T;
45     fn my_index(self) -> Self::O {
46         MyFrom::my_from(self.0).ok().unwrap()
47     }
48 }
49
50 #[rustc_error]
51 fn main() {
52     let _pos: Phantom1<DummyT<()>> = Scope::new().my_index();
53     //[min_tait,full_tait]~^ ERROR not permitted here
54     //[in_bindings]~^^ ERROR type annotations needed
55 }