fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1013 B43 linesraw
1// run-rustfix
2
3// Regression test for #54505 - range borrowing suggestion had
4// incorrect syntax (missing parentheses).
5
6use std::ops::RangeBounds;
7
8
9// take a reference to any built-in range
10fn take_range(_r: &impl RangeBounds<i8>) {}
11
12
13fn main() {
14    take_range(&(0..1));
15    //~^ ERROR mismatched types [E0308]
16    //~| HELP consider borrowing here
17    //~| SUGGESTION &(
18
19    take_range(&(1..));
20    //~^ ERROR mismatched types [E0308]
21    //~| HELP consider borrowing here
22    //~| SUGGESTION &(
23
24    take_range(&(..));
25    //~^ ERROR mismatched types [E0308]
26    //~| HELP consider borrowing here
27    //~| SUGGESTION &(
28
29    take_range(&(0..=1));
30    //~^ ERROR mismatched types [E0308]
31    //~| HELP consider borrowing here
32    //~| SUGGESTION &(
33
34    take_range(&(..5));
35    //~^ ERROR mismatched types [E0308]
36    //~| HELP consider borrowing here
37    //~| SUGGESTION &(
38
39    take_range(&(..=42));
40    //~^ ERROR mismatched types [E0308]
41    //~| HELP consider borrowing here
42    //~| SUGGESTION &(
43}