• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // https://github.com/rust-lang/rust-clippy/issues/3969
2 // used to crash: error: internal compiler error:
3 // src/librustc_traits/normalize_erasing_regions.rs:43: could not fully normalize `<i32 as
4 // std::iter::Iterator>::Item test from rustc ./ui/trivial-bounds/trivial-bounds-inconsistent.rs
5 
6 // Check that tautalogically false bounds are accepted, and are used
7 // in type inference.
8 #![feature(trivial_bounds)]
9 #![allow(unused)]
10 trait A {}
11 
12 impl A for i32 {}
13 
14 struct Dst<X: ?Sized> {
15     x: X,
16 }
17 
18 struct TwoStrs(str, str)
19 where
20     str: Sized;
21 
unsized_local() where for<'a> Dst<dyn A + 'a>: Sized,22 fn unsized_local()
23 where
24     for<'a> Dst<dyn A + 'a>: Sized,
25 {
26     let x: Dst<dyn A> = *(Box::new(Dst { x: 1 }) as Box<Dst<dyn A>>);
27 }
28 
return_str() -> str where str: Sized,29 fn return_str() -> str
30 where
31     str: Sized,
32 {
33     *"Sized".to_string().into_boxed_str()
34 }
35 
use_op(s: String) -> String where String: ::std::ops::Neg<Output = String>,36 fn use_op(s: String) -> String
37 where
38     String: ::std::ops::Neg<Output = String>,
39 {
40     -s
41 }
42 
use_for() where i32: Iterator,43 fn use_for()
44 where
45     i32: Iterator,
46 {
47     for _ in 2i32 {}
48 }
49 
main()50 fn main() {}
51