-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove redundent "<>" for ty::Slice with reference type
this fix #103271
- Loading branch information
Yiming Lei
committed
Nov 2, 2022
1 parent
0da281b
commit 868ccd5
Showing
4 changed files
with
81 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
fn main() { | ||
//~^ HELP the following trait is implemented but not in scope; perhaps add a `use` for it: | ||
let length = <&[_]>::len; | ||
//~^ ERROR the function or associated item `len` exists for reference `&[_]`, but its trait bounds were not satisfied [E0599] | ||
//~| function or associated item cannot be called on `&[_]` due to unsatisfied trait bounds | ||
//~| HELP items from traits can only be used if the trait is in scope | ||
//~| HELP the function `len` is implemented on `[_]` | ||
assert_eq!(length(&[1,3]), 2); | ||
} |
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,22 @@ | ||
error[E0599]: the function or associated item `len` exists for reference `&[_]`, but its trait bounds were not satisfied | ||
--> $DIR/issue-103271.rs:3:26 | ||
| | ||
LL | let length = <&[_]>::len; | ||
| ^^^ function or associated item cannot be called on `&[_]` due to unsatisfied trait bounds | ||
| | ||
= note: the following trait bounds were not satisfied: | ||
`&[_]: ExactSizeIterator` | ||
which is required by `&mut &[_]: ExactSizeIterator` | ||
= help: items from traits can only be used if the trait is in scope | ||
help: the following trait is implemented but not in scope; perhaps add a `use` for it: | ||
| | ||
LL | use object::read::read_ref::ReadRef; | ||
| | ||
help: the function `len` is implemented on `[_]` | ||
| | ||
LL | let length = <[_]>::len; | ||
| ~~~ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0599`. |