Closed
Description
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a5d74dbaa80fd7833c2b937fc94f58fa
fn main() {
let x = [1, 2, 3].length();
}
The current output is:
error[E0599]: no method named `length` found for array `[{integer}; 3]` in the current scope
--> src/main.rs:2:23
|
2 | let x = [1, 2, 3].length();
| ^^^^^^ method not found in `[{integer}; 3]`
Ideally the output should look like:
error[E0599]: no method named `length` found for array `[{integer}; 3]` in the current scope
--> src/main.rs:2:23
|
2 | let x = [1, 2, 3].length();
| ^^^^^^ help: a function with an alias to `length` exists: `len`
Searching for length
will already bring up len
in the docs: https://doc.rust-lang.org/std/?search=length
It would be nice if the CLI errors had feature parity.
Meta
rustc --version
: 1.51.0
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: A feature request, i.e: not implemented / a PR.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity
Badel2 commentedon Apr 9, 2022
Not anymore?
amab8901 commentedon Jan 16, 2023
I think this issue should be closed. The solution has already been implemented.
in playground (https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a5d74dbaa80fd7833c2b937fc94f58fa)
yields the following output:
jyn514 commentedon Jan 16, 2023
@Badel2 @amab8901 this specific issue with
len
has been fixed, but the underlying problem thatdoc(alias)
is ignored has not been fixed. https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=2aecfff005336e11136e0d063fd93ff8jyn514 commentedon Jan 16, 2023
Mentoring instructions: change
rust/compiler/rustc_hir_typeck/src/method/probe.rs
Lines 1923 to 1938 in 9644684
doc(alias)
, not just the names themselves.sulami commentedon Jan 18, 2023
This looks doable.
@rustbot claim
10 remaining items