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

allow_internal_unstable does not work for min_specialization #119950

Closed
clubby789 opened this issue Jan 14, 2024 · 2 comments · Fixed by #119963
Closed

allow_internal_unstable does not work for min_specialization #119950

clubby789 opened this issue Jan 14, 2024 · 2 comments · Fixed by #119963
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-specialization Area: Trait impl specialization C-bug Category: This is a bug.

Comments

@clubby789
Copy link
Contributor

clubby789 commented Jan 14, 2024

This also applies to proc macros
https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.60SpecOptionPartialEq.60.20error

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=45d821a040bf825549fe07efa2c87572

#![allow(internal_features)]
#![feature(allow_internal_unstable)]

#[allow_internal_unstable(min_specialization)]
macro_rules! test {
    () => {
        struct T<U>(U);
        trait Tr {}
        impl<U> Tr for T<U> {}
        impl Tr for T<u8> {}
    }
}

test! {}
   Compiling playground v0.0.1 (/playground)
error[E0119]: conflicting implementations of trait `Tr` for type `T<u8>`
  --> src/lib.rs:10:9
   |
9  |         impl<U> Tr for T<U> {}
   |         ------------------- first implementation here
10 |         impl Tr for T<u8> {}
   |         ^^^^^^^^^^^^^^^^^ conflicting implementation for `T<u8>`
...
14 | test! {}
   | -------- in this macro invocation```
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 14, 2024
@clubby789 clubby789 added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-specialization Area: Trait impl specialization C-bug Category: This is a bug. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 14, 2024
@compiler-errors
Copy link
Member

There are probably also a bunch of other features that simply check validity with tcx.features().feature_name rather than checking for feature enablement a span. Would be cool to find out which ones do.

@Noratrieb
Copy link
Member

I would guess mst of them, all the ones that are not used in a macro in the standard library.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 15, 2024
…able, r=compiler-errors

Fix `allow_internal_unstable` for `(min_)specialization`

Fixes rust-lang#119950

Blocked on rust-lang#119949 (comment doesn't make sense until that merges)

I'd like to follow this up and look for more instances of not properly checking spans for features but I wanted to fix the motivating issue.
@bors bors closed this as completed in 0891cb4 Jan 15, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 15, 2024
Rollup merge of rust-lang#119963 - clubby789:spec-allow-internal-unstable, r=compiler-errors

Fix `allow_internal_unstable` for `(min_)specialization`

Fixes rust-lang#119950

Blocked on rust-lang#119949 (comment doesn't make sense until that merges)

I'd like to follow this up and look for more instances of not properly checking spans for features but I wanted to fix the motivating issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-specialization Area: Trait impl specialization C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants