]> git.lizzy.rs Git - rust.git/blob - src/test/ui/range/issue-54505.fixed
Merge commit 'e36a20c24f35a4cee82bbdc600289104c9237c22' into ra-sync-and-pms-component
[rust.git] / src / test / ui / range / issue-54505.fixed
1 // run-rustfix
2
3 // Regression test for #54505 - range borrowing suggestion had
4 // incorrect syntax (missing parentheses).
5
6 use std::ops::RangeBounds;
7
8
9 // take a reference to any built-in range
10 fn take_range(_r: &impl RangeBounds<i8>) {}
11
12
13 fn main() {
14     take_range(&(0..1));
15     //~^ ERROR mismatched types [E0308]
16     //~| HELP consider borrowing here
17     //~| SUGGESTION &(0..1)
18
19     take_range(&(1..));
20     //~^ ERROR mismatched types [E0308]
21     //~| HELP consider borrowing here
22     //~| SUGGESTION &(1..)
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 &(0..=1)
33
34     take_range(&(..5));
35     //~^ ERROR mismatched types [E0308]
36     //~| HELP consider borrowing here
37     //~| SUGGESTION &(..5)
38
39     take_range(&(..=42));
40     //~^ ERROR mismatched types [E0308]
41     //~| HELP consider borrowing here
42     //~| SUGGESTION &(..=42)
43 }