]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mir/mir-typeck-normalize-fn-sig.rs
Revert "Auto merge of #65134 - davidtwco:issue-19834-improper-ctypes-in-extern-C...
[rust.git] / src / test / ui / mir / mir-typeck-normalize-fn-sig.rs
1 // run-pass
2 #![allow(unused_variables)]
3 // This code was creating an ICE in the MIR type checker. The reason
4 // is that we are reifying a reference to a function (`foo::<'x>`),
5 // which involves extracting its signature, but we were not
6 // normalizing the signature afterwards. As a result, we sometimes got
7 // errors around the `<u32 as Foo<'x>>::Value`, which can be
8 // normalized to `f64`.
9
10 #![allow(dead_code)]
11
12 trait Foo<'x> {
13     type Value;
14 }
15
16 impl<'x> Foo<'x> for u32 {
17     type Value = f64;
18 }
19
20 struct Providers<'x> {
21     foo: for<'y> fn(x: &'x u32, y: &'y u32) -> <u32 as Foo<'x>>::Value,
22 }
23
24 fn foo<'y, 'x: 'x>(x: &'x u32, y: &'y u32) -> <u32 as Foo<'x>>::Value {
25     *x as f64
26 }
27
28 fn main() {
29     Providers { foo };
30 }