-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Description
use std::ops::RangeInclusive;
fn take_range(r: &RangeInclusive<i8>) {}
fn main() {
take_range(0..=1);
}
error[E0308]: mismatched types
--> src/main.rs:6:16
|
6 | take_range(0..=1);
| ^^^^^
| |
| expected reference, found struct `std::ops::RangeInclusive`
| help: consider borrowing here: `&0..=1`
|
= note: expected type `&std::ops::RangeInclusive<i8>`
found type `std::ops::RangeInclusive<{integer}>`
&0..=1
is an incorrect suggestion because &
has higher precedence than ..=
. It should suggest &(0..=1)
.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.