-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
K-bugKind: BugKind: Bug
Description
The following code
//@ run-pass
//@ edition: 2021
// Test that the precedence of ranges is correct
use core::ops::{Add, RangeTo};
struct Foo {
foo: usize,
}
impl Foo {
fn bar(&self) -> usize {
5
}
}
impl Add<RangeTo<usize>> for Foo {
type Output = usize;
fn add(self, range: RangeTo<usize>) -> Self::Output {
self.foo + range.end
}
}
fn main() {
let x = Foo { foo: 3 } + ..4..;
assert_eq!(x, (4..));
}Compiled successfully ( with --crate-type=lib --cap-lints=warn --edition=2021 ):
warning: method `bar` is never used
--> a.rs:12:8
|
11 | impl Foo {
| -------- method in this implementation
12 | fn bar(&self) -> usize {
| ^^^
|
= note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
warning: 1 warning emitted
However rasur was found to have errors (-e 2021):
error: range operators cannot be chained
--> ./a.rs:25:33
|
25 | let x = Foo { foo: 3 } + ..4..;
| ^^
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
K-bugKind: BugKind: Bug