Skip to content

what is purpose of core::prelude ? #14246

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

Closed
pnkfelix opened this issue May 16, 2014 · 0 comments · Fixed by #14249
Closed

what is purpose of core::prelude ? #14246

pnkfelix opened this issue May 16, 2014 · 0 comments · Fixed by #14249

Comments

@pnkfelix
Copy link
Member

The docs for core::prelude just say "for more information, see std::prelude."

But the std::prelude does not mention core::prelude in its code nor in its documentation. As far as I can tell, it is not used by any of the libraries.

As far as I can tell, all of our prelude injection code in rustc is solely devoted to injecting the std::prelude.

Is the intent here that after someone says #[no_prelude] that they might follow that up with use core::prelude::* ? If so, it might be worthwhile to just mention that in the doc for core::prelude.

alexcrichton added a commit to alexcrichton/rust that referenced this issue May 18, 2014
lnicola pushed a commit to lnicola/rust that referenced this issue Mar 13, 2023
rust-analyzer used the token at the cursor after macro expansion
to decide whether to replace the token at the cursor before macro
expansion. In most cases these two are the same but in some cases these
can mismatch which can lead to incorrect replacements.

For example if an ident/expr macro argument is missing rust-analyzer
generates a "missing" identifier as a placeholder, there is only a
brace at the cursor. Therefore, rust-analyzer will incorrectly replace
the macro brace with the completion in that case leading to rust-lang#14246.

Using the expanded token type was intentional. However, this doesn't
seem to ever be desirable (this is supported by the fact that there
were no tests that relied on this behavior) since the type of edit to
perform should always be determined by the token it's actually applied
to.
lnicola pushed a commit to lnicola/rust that referenced this issue Mar 13, 2023
generate correct completion edits for missing macro arguments

Fixes rust-lang#14246

rust-analyzer used the token at the cursor after macro expansion to decide whether to replace the token at the cursor before macro expansion. In most cases these two are the same but in some cases these can mismatch which can lead to incorrect replacements.

For example if an ident/expr macro argument is missing rust-analyzer generates a "missing" identifier as a placeholder, there is only a brace at the cursor. Therefore, rust-analyzer will incorrectly replace the macro brace with the completion in that case leading to rust-lang#14246.

Using the expanded token type was intentional. However, this doesn't seem to ever be desirable (this is supported by the fact that there were no tests that relied on this behavior) since the type of edit to perform should always be determined by the token it's actually applied to. Therefore this PR simply switches the relevant match to use the unexpanded token instead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant