-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Misleading error when using fully qualified trait syntax without trait #98565
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
Did you mean the ideal output should like:
? |
Not sure, to be honest. This might even better not be E0576, since the problem is not that "something wasn't found for the type" - it's "there's no type to search in". |
Current output:
|
I would like to give it a try and add the test for this. @rustbot claim |
@rustbot review |
jannden
added a commit
to jannden/rust
that referenced
this issue
Oct 21, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 21, 2024
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#130350 (stabilize Strict Provenance and Exposed Provenance APIs) - rust-lang#131737 (linkchecker: add a reminder on broken links to add new/renamed pages to `SUMMARY.md` for mdBooks) - rust-lang#131991 (test: Add test for trait in FQS cast, issue rust-lang#98565) - rust-lang#131997 (Make `rustc_abi` compile on stable again) - rust-lang#131999 (Improve test coverage for `unit_bindings` lint) - rust-lang#132001 (fix coherence error for very large tuples™) - rust-lang#132003 (update ABI compatibility docs for new option-like rules) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 21, 2024
Rollup merge of rust-lang#131991 - jannden:issue-98565-test, r=jieyouxu test: Add test for trait in FQS cast, issue rust-lang#98565 Closes rust-lang#98565 by adding a test to check for diagnostics when the built-in type `str` is used in a cast where a trait is expected.
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code:
Playground
The current output is:
However,
str
is not a trait, therefore the fully-qualified trait syntax should be simply invalid in this case - therefore, the error would better say the real problem ("str
is not a trait"), probably with the help message suggesting the commented-out line.Initially found in this SO question.
The text was updated successfully, but these errors were encountered: