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

Emit an error for invalid item of instruction_set #129002

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

chansuke
Copy link
Contributor

Closes #128489

Emit an error on invalid item of instruction_set.

This PR merges the instruction_set error handling into rustc_passes/check_attr.rs. This change was necessary because the codegen_attrs only handle the Fn target.

@rustbot
Copy link
Collaborator

rustbot commented Aug 12, 2024

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Aug 12, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@chansuke chansuke force-pushed the fix/instruction_set branch from 256ac63 to 92fbd2c Compare August 12, 2024 16:21
@bors
Copy link
Contributor

bors commented Aug 17, 2024

☔ The latest upstream changes (presumably #129202) made this pull request unmergeable. Please resolve the merge conflicts.

@Dylan-DPC
Copy link
Member

@chansuke if you can resolve the conflicts we can then push this pr forward. Thanks

@Dylan-DPC Dylan-DPC added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 6, 2024
@@ -2349,6 +2353,43 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
}
}
}

fn check_instruction_set(&self, attr: &Attribute, _item: Option<ItemLike<'_>>) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also want to valid that item is a function or closure and not anything else like a module or type (and use on any of those should give a specific error that the attribute can only be used on functions and such).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wesleywiser
Thank you for your review!! Ok, i'll fix that.

@chansuke chansuke force-pushed the fix/instruction_set branch from 92fbd2c to 35363d5 Compare November 9, 2024 09:33
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@chansuke chansuke force-pushed the fix/instruction_set branch from 4ad825d to d696b47 Compare November 16, 2024 16:50
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@chansuke chansuke force-pushed the fix/instruction_set branch from 564be4b to f3a6be9 Compare November 22, 2024 02:07
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
#17 exporting to docker image format
#17 sending tarball 28.1s done
#17 DONE 34.6s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-18/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
  Downloaded boml v0.3.1
   Compiling boml v0.3.1
   Compiling y v0.1.0 (/checkout/compiler/rustc_codegen_gcc/build_system)
    Finished `release` profile [optimized] target(s) in 3.96s
     Running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/y test --use-system-gcc --use-backend gcc --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc --release --mini-tests --std-tests`
Using system GCC
[BUILD] example
[AOT] mini_core_hello_world
/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc/mini_core_hello_world
abc
---
test /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0801 (line 18206) ... ok

failures:

---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0779 (line 17426) stdout ----
error: `[instruction_set]` attribute argument should be valid
  |
  |
4 | #[instruction_set(intel::x64)] // error: `[instruction_set]` attribute argument

warning: the feature `isa_attribute` has been stable since 1.67.0 and no longer requires an attribute to enable
##[warning] --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:17427:12
  |
  |
2 | #![feature(isa_attribute)]
  |            ^^^^^^^^^^^^^
  |
  = note: `#[warn(stable_features)]` on by default

error: aborting due to 1 previous error; 1 warning emitted

Some expected error codes were not found: ["E0779"]
---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0778 (line 17389) stdout ----
error: `[instruction_set]` requires an argument
  |
  |
4 | #[instruction_set()] // error: `[instruction_set]` requires an argument

warning: the feature `isa_attribute` has been stable since 1.67.0 and no longer requires an attribute to enable
##[warning] --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:17390:12
  |
  |
2 | #![feature(isa_attribute)]
  |            ^^^^^^^^^^^^^
  |
  = note: `#[warn(stable_features)]` on by default

error: aborting due to 1 previous error; 1 warning emitted

Some expected error codes were not found: ["E0778"]
failures:
    /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0778 (line 17389)
    /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0779 (line 17426)


test result: FAILED. 1043 passed; 2 failed; 61 ignored; 0 measured; 0 filtered out; finished in 8.94s



Command CFG_RELEASE_CHANNEL="nightly" RUSTC_BOOTSTRAP="1" RUSTC_STAGE="2" RUSTC_SYSROOT="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" RUSTDOC_LIBDIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" RUSTDOC_REAL="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" RUST_TEST_THREADS="16" "/checkout/obj/build/bootstrap/debug/rustdoc" "-Wrustdoc::invalid_codeblock_attributes" "-Dwarnings" "-Znormalize-docs" "-Z" "unstable-options" "--test" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md" "--test-args" "" (failure_mode=DelayFail) has failed. Rerun with -v to see more details.
  local time: Tue Nov 26 15:48:40 UTC 2024
  network time: Tue, 26 Nov 2024 15:48:40 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

@alex-semenyuk
Copy link
Member

alex-semenyuk commented Dec 28, 2024

@chansuke
From wg-triage. Any updates on this PR? Could you please resolve merge conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

instruction_set attribute can be applied to anything
7 participants