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

regression: cfg_match resolution ambiguity #117057

Closed
Mark-Simulacrum opened this issue Oct 22, 2023 · 9 comments · Fixed by #117162
Closed

regression: cfg_match resolution ambiguity #117057

Mark-Simulacrum opened this issue Oct 22, 2023 · 9 comments · Fixed by #117162
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Milestone

Comments

@Mark-Simulacrum
Copy link
Member

In:

[INFO] [stdout] error[E0658]: use of unstable library feature 'cfg_match'
[INFO] [stdout]   --> src/maybe_dangling.rs:65:1
[INFO] [stdout]    |
[INFO] [stdout] 65 | crate::cfg_match! {
[INFO] [stdout]    | ^^^^^^^^^^^^^^^^
[INFO] [stdout]    |
[INFO] [stdout]    = note: see issue #115585 <https://github.com/rust-lang/rust/issues/115585> for more information
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error: no rules expected the token `feature`
[INFO] [stdout]   --> src/maybe_dangling.rs:66:5
[INFO] [stdout]    |
[INFO] [stdout] 66 |     feature = "nightly-dropck_eyepatch" => {
[INFO] [stdout]    |     ^^^^^^^ no rules expected this token in macro call
[INFO] [stdout]    |
[INFO] [stdout] note: while trying to match `cfg`
[INFO] [stdout]   --> /rustc/489647f984b2b3a5ee6b2a0d46a527c8d926ceae/library/core/src/macros/mod.rs:358:11
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error[E0659]: `cfg_match` is ambiguous
[INFO] [stdout]   --> src/lib.rs:42:5
[INFO] [stdout]    |
[INFO] [stdout] 42 | use cfg_match;
[INFO] [stdout]    |     ^^^^^^^^^ ambiguous name
[INFO] [stdout]    |
[INFO] [stdout]    = note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution
[INFO] [stdout]    = note: `cfg_match` could refer to a macro from prelude
@Mark-Simulacrum Mark-Simulacrum added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Oct 22, 2023
@Mark-Simulacrum Mark-Simulacrum added this to the 1.74.0 milestone Oct 22, 2023
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 22, 2023
@Noratrieb
Copy link
Member

@crlf0710

@Noratrieb Noratrieb removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 22, 2023
@Noratrieb
Copy link
Member

mean to ping @c410-f3r instead 😅

@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 23, 2023
@c410-f3r
Copy link
Contributor

The macro was originally named match_cfg to avoid this situation (#115416).

I don't know if it is possible to solve this issue in the compiler so I will just revert the changes.

@Noratrieb
Copy link
Member

cc @petrochenkov, maybe you have ideas

@Mark-Simulacrum
Copy link
Member Author

This may just be acceptable breakage - I don't know that we need to revert things. I would wait on libs-api weighing in, impact is pretty minimal in crater.

@Noratrieb
Copy link
Member

the problem is that this adds it to the prelude. maybe there's a way to add it somewhere where it doesn't get added to the prelude? for example by making it a macro 2.0. @c410-f3r

@c410-f3r
Copy link
Contributor

Looks like a good short-term solution. Preferably, it would be nice to have prelude support with a different name or an acceptable breakage.

@petrochenkov
Copy link
Contributor

cc @petrochenkov, maybe you have ideas

#82775 (comment)

@danielhenrymantilla
Copy link
Contributor

FWIW, I can take care of fixing maybe_dangling too, if that makes things simpler. I don't know about the eponymous ::cfg_match crate, however.

  • The funny thing is that I am working around the current issue by renaming cfg_match as match_cfg 🙃, so if this were to become the decision here please let me know so that I pick some third name 😄

workingjubilee added a commit to workingjubilee/rustc that referenced this issue Oct 28, 2023
@bors bors closed this as completed in 61cd3d0 Oct 29, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 29, 2023
Rollup merge of rust-lang#117162 - c410-f3r:try, r=workingjubilee

Remove `cfg_match` from the prelude

Fixes rust-lang#117057

cc rust-lang#115585
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants