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

add missing feature gate for rustc_safe_intrinsic #116159

Closed
wants to merge 1 commit into from

Conversation

Noratrieb
Copy link
Member

@Noratrieb Noratrieb commented Sep 25, 2023

https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Removal.20of.20.60auto.20trait.60.20syntax/near/393075179

We don't seem to have feature gate tests for those usually.

This was added as ungated in https://github.com/rust-lang/rust/pull/100719/files#diff-09c366d3ad3ec9a42125253b610ca83cad6b156aa2a723f6c7e83eddef7b1e8fR502, probably because the author looked at the surrounding attributes, which are ungated because they are gated specially behind the staged_api feature.

I don't think we need to crater this, the attribute is entirely useless without the intrinsics feature, which is already unstable..

@rustbot
Copy link
Collaborator

rustbot commented Sep 25, 2023

r? @cjgillot

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 25, 2023
@rust-log-analyzer

This comment has been minimized.

@fmease
Copy link
Member

fmease commented Sep 25, 2023

Oh no you were faster 😢 👍

@fmease
Copy link
Member

fmease commented Sep 25, 2023

I've created #116162 anyway since it also adds validation but I can close it again since you were faster.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-15 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_2b8df952-52f9-466c-a20a-71609d81d868
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://github.com/gitapi/graphql
GITHUB_HEAD_REF=gate-the-oops
GITHUB_JOB=pr
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_2b8df952-52f9-466c-a20a-71609d81d868
GITHUB_REF=refs/pull/116159/merge
GITHUB_REF_NAME=116159/merge
GITHUB_REF_PROTECTED=false
---
........i.....iii....................................................................... 11352/15523
........................................................................................ 11440/15523
........................................................................................ 11528/15523
........................................................................................ 11616/15523
.............................................................F...F...................... 11704/15523
........................................................................................ 11880/15523
........................................................................................ 11968/15523
........................................................................................ 12056/15523
........................................................................................ 12144/15523
---
........................................................................................ 12760/15523
........................................................................................ 12848/15523
...............................................................................i........ 12936/15523
........................................................................................ 13024/15523
.................F..F................................................................... 13112/15523
........................................................................................ 13288/15523
........................................................................................ 13376/15523
........................................................................................ 13464/15523
.....................................i..........i........i.....i........................ 13552/15523
---

---- [ui] tests/ui/error-codes/E0094.rs stdout ----
diff of stderr:

+ error[E0658]: #[rustc_safe_intrinsics] declares intrinsics that are safe to use, tying it to the internal intrinsic mechanisms.
+   --> $DIR/E0094.rs:4:5
+    |
+ LL |     #[rustc_safe_intrinsic]
+    |
+    = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
+ 
+ 
1 error[E0094]: intrinsic has wrong number of type parameters: found 2, expected 1
2   --> $DIR/E0094.rs:5:15


4 LL |     fn size_of<T, U>() -> usize;
5    |               ^^^^^^ expected 1 type parameter
- error: aborting due to previous error
+ error: aborting due to 2 previous errors
8 
- For more information about this error, try `rustc --explain E0094`.
---
To only update this specific test, also pass `--test-args error-codes/E0094.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/error-codes/E0094.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0094" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0094/auxiliary"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0658]: #[rustc_safe_intrinsics] declares intrinsics that are safe to use, tying it to the internal intrinsic mechanisms.
   |
LL |     #[rustc_safe_intrinsic]
   |     ^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable

error[E0094]: intrinsic has wrong number of type parameters: found 2, expected 1
   |
   |
LL |     fn size_of<T, U>() -> usize; //~ ERROR E0094
   |               ^^^^^^ expected 1 type parameter
error: aborting due to 2 previous errors

Some errors have detailed explanations: E0094, E0658.
For more information about an error, try `rustc --explain E0094`.
For more information about an error, try `rustc --explain E0094`.
------------------------------------------


---- [ui] tests/ui/extern/extern-with-type-bounds.rs stdout ----
diff of stderr:

4 LL |     fn align_of<T: NoSuchTrait>() -> usize;
6 
- error: aborting due to previous error
- error: aborting due to previous error
+ error[E0658]: #[rustc_safe_intrinsics] declares intrinsics that are safe to use, tying it to the internal intrinsic mechanisms.
+    |
+    |
+ LL |     #[rustc_safe_intrinsic]
+    |
+    = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
8 
- For more information about this error, try `rustc --explain E0405`.
- For more information about this error, try `rustc --explain E0405`.
+ error[E0658]: #[rustc_safe_intrinsics] declares intrinsics that are safe to use, tying it to the internal intrinsic mechanisms.
+    |
+    |
+ LL |     #[rustc_safe_intrinsic]
+    |
+    = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
+ 
+ error: aborting due to 3 previous errors
---
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/extern/extern-with-type-bounds.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/extern/extern-with-type-bounds" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/extern/extern-with-type-bounds/auxiliary"
stdout: none
--- stderr -------------------------------
error[E0405]: cannot find trait `NoSuchTrait` in this scope
   |
   |
LL |     fn align_of<T: NoSuchTrait>() -> usize;


error[E0658]: #[rustc_safe_intrinsics] declares intrinsics that are safe to use, tying it to the internal intrinsic mechanisms.
   |
LL |     #[rustc_safe_intrinsic]
   |     ^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable

error[E0658]: #[rustc_safe_intrinsics] declares intrinsics that are safe to use, tying it to the internal intrinsic mechanisms.
   |
LL |     #[rustc_safe_intrinsic]
   |     ^^^^^^^^^^^^^^^^^^^^^^^
   |
---
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/intrinsics/intrinsic-alignment.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/intrinsics/intrinsic-alignment/a" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/intrinsics/intrinsic-alignment/auxiliary"
stdout: none
--- stderr -------------------------------
error[E0658]: #[rustc_safe_intrinsics] declares intrinsics that are safe to use, tying it to the internal intrinsic mechanisms.
   |
LL |         #[rustc_safe_intrinsic]
   |         ^^^^^^^^^^^^^^^^^^^^^^^
   |
---


---- [ui] tests/ui/repr/16-bit-repr-c-enum.rs#avr stdout ----

error in revision `avr`: test compilation failed although it shouldn't!
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/repr/16-bit-repr-c-enum.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--cfg" "avr" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/16-bit-repr-c-enum.avr" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/16-bit-repr-c-enum.avr/auxiliary" "--target=avr-unknown-gnu-atmega328" "--crate-type=rlib"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0658]: #[rustc_safe_intrinsics] declares intrinsics that are safe to use, tying it to the internal intrinsic mechanisms.
   |
LL |     #[rustc_safe_intrinsic]
   |     ^^^^^^^^^^^^^^^^^^^^^^^
   |
---


---- [ui] tests/ui/repr/16-bit-repr-c-enum.rs#msp430 stdout ----

error in revision `msp430`: test compilation failed although it shouldn't!
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/repr/16-bit-repr-c-enum.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--cfg" "msp430" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/16-bit-repr-c-enum.msp430" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/16-bit-repr-c-enum.msp430/auxiliary" "--target=msp430-none-elf" "--crate-type=rlib"
stdout: none
--- stderr -------------------------------
--- stderr -------------------------------
error[E0658]: #[rustc_safe_intrinsics] declares intrinsics that are safe to use, tying it to the internal intrinsic mechanisms.
   |
LL |     #[rustc_safe_intrinsic]
   |     ^^^^^^^^^^^^^^^^^^^^^^^
   |
---
---- [ui] tests/ui/structs-enums/rec-align-u32.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/structs-enums/rec-align-u32.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/structs-enums/rec-align-u32/a" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/structs-enums/rec-align-u32/auxiliary"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0658]: #[rustc_safe_intrinsics] declares intrinsics that are safe to use, tying it to the internal intrinsic mechanisms.
   |
LL |         #[rustc_safe_intrinsic]
   |         ^^^^^^^^^^^^^^^^^^^^^^^
   |
---
---- [ui] tests/ui/structs-enums/rec-align-u64.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/structs-enums/rec-align-u64.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/structs-enums/rec-align-u64/a" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/structs-enums/rec-align-u64/auxiliary"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0658]: #[rustc_safe_intrinsics] declares intrinsics that are safe to use, tying it to the internal intrinsic mechanisms.
   |
LL |         #[rustc_safe_intrinsic]
   |         ^^^^^^^^^^^^^^^^^^^^^^^
   |

@Noratrieb
Copy link
Member Author

@fmease let's go with yours, it's better 😄

@Noratrieb Noratrieb closed this Sep 25, 2023
@fmease
Copy link
Member

fmease commented Sep 25, 2023

Appreciate it :)

@Noratrieb Noratrieb deleted the gate-the-oops branch September 25, 2023 20:03
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 26, 2023
…intrinsic, r=Nilstrieb

Gate and validate `#[rustc_safe_intrinsic]`

Copied over from rust-lang#116159:

> This was added as ungated in https://github.com/rust-lang/rust/pull/100719/files#diff-09c366d3ad3ec9a42125253b610ca83cad6b156aa2a723f6c7e83eddef7b1e8fR502, probably because the author looked at the surrounding attributes, which are ungated because they are gated specially behind the staged_api feature.
>
> I don't think we need to crater this, the attribute is entirely useless without the intrinsics feature, which is already unstable..

r? `@Nilstrieb`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 26, 2023
…intrinsic, r=Nilstrieb

Gate and validate `#[rustc_safe_intrinsic]`

Copied over from rust-lang#116159:

> This was added as ungated in https://github.com/rust-lang/rust/pull/100719/files#diff-09c366d3ad3ec9a42125253b610ca83cad6b156aa2a723f6c7e83eddef7b1e8fR502, probably because the author looked at the surrounding attributes, which are ungated because they are gated specially behind the staged_api feature.
>
> I don't think we need to crater this, the attribute is entirely useless without the intrinsics feature, which is already unstable..

r? ``@Nilstrieb``
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 26, 2023
Rollup merge of rust-lang#116162 - fmease:gate-n-validate-rustc_safe_intrinsic, r=Nilstrieb

Gate and validate `#[rustc_safe_intrinsic]`

Copied over from rust-lang#116159:

> This was added as ungated in https://github.com/rust-lang/rust/pull/100719/files#diff-09c366d3ad3ec9a42125253b610ca83cad6b156aa2a723f6c7e83eddef7b1e8fR502, probably because the author looked at the surrounding attributes, which are ungated because they are gated specially behind the staged_api feature.
>
> I don't think we need to crater this, the attribute is entirely useless without the intrinsics feature, which is already unstable..

r? ``@Nilstrieb``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants