Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prelude path should not appear in error messages #56861

Open
2 tasks
zackmdavis opened this issue Dec 15, 2018 · 2 comments
Open
2 tasks

prelude path should not appear in error messages #56861

zackmdavis opened this issue Dec 15, 2018 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@zackmdavis
Copy link
Member

(Split off from discussion on #56188.)

There are a few places where the path std::prelude::v1 appears in diagnostic messages.

zmd@ReflectiveCoherence:~/Code/rust/src/test/ui$ ag std::prelude
[...]
27 matches
9 files contained matches

I argue that this is bad because the point of the prelude is to relieve the ordinary programmer from having to think about where necessities like Some and Vec live; the module std::prelude::v1 is an implementation detail that should be mentioned in places like the Book, but which I don't want to see cluttering up error messages.

We are manually stripping off the std::prelude::v1:: in a couple places (one, another proposed in open PR #56188), but we should:

  • strip std::prelude::v1:: for all diagnostic messages
  • do so in a unified DRY way, rather than having that hardcoded string littering the codebase in several places
@zackmdavis zackmdavis added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-diagnostics Area: Messages for errors, warnings, and lints labels Dec 15, 2018
@estebank
Copy link
Contributor

I wouldn't mark this as E-easy because I believe the proper solution is dependent on #21934 and probably #14007 being addressed. Just stripping the text wouldn't be needed if we referred to types using the the local scope-dependent path instead of the fully qualified name.

@zackmdavis zackmdavis removed the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Dec 17, 2018
@estebank estebank added D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 10, 2019
@crlf0710 crlf0710 added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jun 11, 2020
@m-ou-se
Copy link
Member

m-ou-se commented Mar 9, 2021

This is now also an issue for #82217, which uses a different prelude for edition 2021.

diff of stderr:

13   --> $DIR/do-not-attempt-to-add-suggestions-with-no-changes.rs:3:25
14    |
15 LL |     fn into_future() -> Err {}
+    |                         ^^^
+    |                         |
+    |                         not a type
+    |                         not a type
+    |                         help: try using the variant's enum: `std::prelude::rust_2021`
18 error: aborting due to 2 previous errors
19 

(Failure here: #82939 (comment))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants