]> git.lizzy.rs Git - rust.git/blob - tests/ui/associated-types/issue-25700-2.rs
Rollup merge of #107709 - tialaramex:master, r=compiler-errors
[rust.git] / tests / ui / associated-types / issue-25700-2.rs
1 // run-pass
2 pub trait Parser {
3     type Input;
4 }
5
6 pub struct Iter<P: Parser>(#[allow(unused_tuple_struct_fields)] P, P::Input);
7
8 #[allow(unused_tuple_struct_fields)]
9 pub struct Map<P, F>(P, F);
10 impl<P, F> Parser for Map<P, F> where F: FnMut(P) {
11     type Input = u8;
12 }
13
14 trait AstId { type Untyped; }
15 impl AstId for u32 { type Untyped = u32; }
16
17 fn record_type<Id: AstId>(i: Id::Untyped) -> u8 {
18     Iter(Map(i, |_: Id::Untyped| {}), 42).1
19 }
20
21 pub fn main() {
22     assert_eq!(record_type::<u32>(3), 42);
23 }