1 // Regression test for #54505 - range borrowing suggestion had
2 // incorrect syntax (missing parentheses).
4 // This test doesn't use std
5 // (so all Ranges resolve to core::ops::Range...)
8 #![feature(lang_items)]
10 use core::ops::RangeBounds;
12 #[cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))]
13 #[lang = "eh_personality"]
14 extern "C" fn eh_personality() {}
15 #[cfg(target_os = "emscripten")]
16 #[lang = "eh_catch_typeinfo"]
17 static EH_CATCH_TYPEINFO: u8 = 0;
21 //~^ ERROR return type should be `!`
22 //~| ERROR function should have one argument
24 // take a reference to any built-in range
25 fn take_range(_r: &impl RangeBounds<i8>) {}
30 //~^ ERROR mismatched types [E0308]
31 //~| HELP consider borrowing here
32 //~| SUGGESTION &(0..1)
35 //~^ ERROR mismatched types [E0308]
36 //~| HELP consider borrowing here
37 //~| SUGGESTION &(1..)
40 //~^ ERROR mismatched types [E0308]
41 //~| HELP consider borrowing here
45 //~^ ERROR mismatched types [E0308]
46 //~| HELP consider borrowing here
47 //~| SUGGESTION &(0..=1)
50 //~^ ERROR mismatched types [E0308]
51 //~| HELP consider borrowing here
52 //~| SUGGESTION &(..5)
55 //~^ ERROR mismatched types [E0308]
56 //~| HELP consider borrowing here
57 //~| SUGGESTION &(..=42)