]> git.proxmox.com Git - rustc.git/blob - src/test/ui/trait-bounds/select-param-env-instead-of-blanket.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / trait-bounds / select-param-env-instead-of-blanket.rs
1 // known-bug
2 // build-fail
3 // failure-status: 101
4 // compile-flags:--crate-type=lib -Zmir-opt-level=3
5 // rustc-env:RUST_BACKTRACE=0
6
7 // normalize-stderr-test "thread 'rustc' panicked.*" -> "thread 'rustc' panicked"
8 // normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""
9 // normalize-stderr-test "error: internal compiler error.*" -> "error: internal compiler error"
10 // normalize-stderr-test "encountered.*with incompatible types:" "encountered ... with incompatible types:"
11 // normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
12 // normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
13 // normalize-stderr-test "note: compiler flags.*\n\n" -> ""
14 // normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
15 // normalize-stderr-test "query stack during panic:\n" -> ""
16 // normalize-stderr-test "we're just showing a limited slice of the query stack\n" -> ""
17 // normalize-stderr-test "end of query stack\n" -> ""
18 // normalize-stderr-test "#.*\n" -> ""
19
20 // This is a known bug that @compiler-errors tried to fix in #94238,
21 // but the solution was probably not correct.
22
23 pub trait Factory<T> {
24 type Item;
25 }
26
27 pub struct IntFactory;
28
29 impl<T> Factory<T> for IntFactory {
30 type Item = usize;
31 }
32
33 pub fn foo<T>()
34 where
35 IntFactory: Factory<T>,
36 {
37 let mut x: <IntFactory as Factory<T>>::Item = bar::<T>();
38 }
39
40 #[inline]
41 pub fn bar<T>() -> <IntFactory as Factory<T>>::Item {
42 0usize
43 }