-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust the method ambiguity lint too
- Loading branch information
1 parent
bd12444
commit 0aafa34
Showing
6 changed files
with
102 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// See https://github.com/rust-lang/rust/issues/88475 | ||
//@ run-rustfix | ||
//@ edition:2021 | ||
//@ check-pass | ||
#![warn(boxed_slice_into_iter)] | ||
#![allow(unused)] | ||
|
||
struct FooIter; | ||
|
||
trait MyIntoIter { | ||
fn into_iter(self) -> FooIter; | ||
} | ||
|
||
impl<T> MyIntoIter for Box<[T]> { | ||
fn into_iter(self) -> FooIter { | ||
FooIter | ||
} | ||
} | ||
|
||
struct Point; | ||
|
||
pub fn main() { | ||
let points: Box<[_]> = vec![Point].into_boxed_slice(); | ||
let y = MyIntoIter::into_iter(points); | ||
//~^ WARNING trait method `into_iter` will become ambiguous in Rust 2024 | ||
//~| WARNING this changes meaning in Rust 2024 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// See https://github.com/rust-lang/rust/issues/88475 | ||
//@ run-rustfix | ||
//@ edition:2021 | ||
//@ check-pass | ||
#![warn(boxed_slice_into_iter)] | ||
#![allow(unused)] | ||
|
||
struct FooIter; | ||
|
||
trait MyIntoIter { | ||
fn into_iter(self) -> FooIter; | ||
} | ||
|
||
impl<T> MyIntoIter for Box<[T]> { | ||
fn into_iter(self) -> FooIter { | ||
FooIter | ||
} | ||
} | ||
|
||
struct Point; | ||
|
||
pub fn main() { | ||
let points: Box<[_]> = vec![Point].into_boxed_slice(); | ||
let y = points.into_iter(); | ||
//~^ WARNING trait method `into_iter` will become ambiguous in Rust 2024 | ||
//~| WARNING this changes meaning in Rust 2024 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
warning: trait method `into_iter` will become ambiguous in Rust 2024 | ||
--> $DIR/box-slice-into-iter-ambiguous.rs:24:13 | ||
| | ||
LL | let y = points.into_iter(); | ||
| ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `MyIntoIter::into_iter(points)` | ||
| | ||
= warning: this changes meaning in Rust 2024 | ||
note: the lint level is defined here | ||
--> $DIR/box-slice-into-iter-ambiguous.rs:5:9 | ||
| | ||
LL | #![warn(boxed_slice_into_iter)] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
warning: 1 warning emitted | ||
|