rust icon indicating copy to clipboard operation
rust copied to clipboard

rewrite `optimize` attribute to use new attribute parsing infrastructure

Open jdonszelmann opened this issue 8 months ago • 5 comments

r? @oli-obk

I'm afraid we'll get quite a few of these PRs in the future. If we get a lot of trivial changes I'll start merging multiple into one PR. They should be easy to review :)

Waiting on #138165 first

jdonszelmann avatar Mar 09 '25 23:03 jdonszelmann

:umbrella: The latest upstream changes (presumably #138302) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Mar 11 '25 05:03 bors

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Diff in /checkout/compiler/rustc_attr_parsing/src/attributes/deprecation.rs:82:
                                 });
                             }
 
-                            suggestion = Some(get(cx, name, param.span(), param.args(), &suggestion)?);
+                            suggestion =
+                                Some(get(cx, name, param.span(), param.args(), &suggestion)?);
                         }
                         _ => {
                             cx.unknown_key(
Diff in /checkout/compiler/rustc_attr_parsing/src/context.rs:4:
 use std::sync::LazyLock;
 
 use private::Sealed;
-use rustc_ast::{self as ast, MetaItemLit};
-use rustc_ast::NodeId;
+use rustc_ast::{self as ast, MetaItemLit, NodeId};
 use rustc_attr_data_structures::AttributeKind;
 use rustc_attr_data_structures::lints::{AttributeLint, AttributeLintKind};
 use rustc_errors::{DiagCtxtHandle, Diagnostic};
fmt: checked 6057 files
Build completed unsuccessfully in 0:00:43
  local time: Mon Jun  9 22:46:20 UTC 2025
  network time: Mon, 09 Jun 2025 22:46:20 GMT
##[error]Process completed with exit code 1.

rust-log-analyzer avatar Jun 09 '25 22:06 rust-log-analyzer

The job mingw-check-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] rustc_transmute test:false 0.383
    Checking rustc_pattern_analysis v0.0.0 (/checkout/compiler/rustc_pattern_analysis)
[RUSTC-TIMING] rustc_middle test:true 13.367
    Checking rustc_symbol_mangling v0.0.0 (/checkout/compiler/rustc_symbol_mangling)
error[E0599]: no method named `word_without_args` found for reference `&MetaItemParser<'_>` in the current scope
  --> compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs:28:59
   |
28 |         let res = match single.meta_item().and_then(|i| i.word_without_args().map(|i| i.name)) {
   |                                                           ^^^^^^^^^^^^^^^^^ method not found in `&MetaItemParser<'_>`

For more information about this error, try `rustc --explain E0599`.
[RUSTC-TIMING] rustc_attr_parsing test:false 0.640
error: could not compile `rustc_attr_parsing` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

rust-log-analyzer avatar Jun 09 '25 22:06 rust-log-analyzer

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
fmt check
fmt: checked 6057 files
tidy check
Running eslint on rustdoc JS files
tidy error: /checkout/compiler/rustc_codegen_ssa/messages.ftl: message `codegen_ssa_expected_one_argument` is not used
tidy error: /checkout/compiler/rustc_codegen_ssa/messages.ftl: message `codegen_ssa_invalid_argument` is not used
tidy: Skipping binary file check, read-only filesystem
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'venv'
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'virtualenv'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (25.1.1)
linting python files
All checks passed!
checking python file formatting
28 files already formatted
checking C++ file formatting
some tidy checks failed
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:01:24
  local time: Tue Jun 10 07:09:27 UTC 2025
  network time: Tue, 10 Jun 2025 07:09:27 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

rust-log-analyzer avatar Jun 10 '25 07:06 rust-log-analyzer

The job aarch64-gnu-llvm-19-1 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
status: exit status: 1
command: "/checkout/obj/build/aarch64-unknown-linux-gnu/stage0-tools-bin/jsondocck" "--doc-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/rustdoc-json/attrs/inline" "--template" "/checkout/tests/rustdoc-json/attrs/inline.rs"
stdout: none
--- stderr -------------------------------
/checkout/tests/rustdoc-json/attrs/inline.rs:1, directive failed
matched to Array [String("#[attr = Inline(Hint)]")] but want Array [String("#[inline]")]
/checkout/tests/rustdoc-json/attrs/inline.rs:5, directive failed
matched to Array [String("#[attr = Inline(Always)]")] but want Array [String("#[inline(always)]")]
/checkout/tests/rustdoc-json/attrs/inline.rs:9, directive failed
matched to Array [String("#[attr = Inline(Never)]")] but want Array [String("#[inline(never)]")]
------------------------------------------

Rustdoc Output:
status: exit status: 0
command: cd "/checkout/obj/build/aarch64-unknown-linux-gnu/test/rustdoc-json/attrs/inline" && env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustdoc" "-L" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-L" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/rustdoc-json/attrs/inline/auxiliary" "-o" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/rustdoc-json/attrs/inline" "--deny" "warnings" "/checkout/tests/rustdoc-json/attrs/inline.rs" "-A" "internal_features" "--output-format" "json" "-Zunstable-options"
stdout: none
stderr: none



rust-log-analyzer avatar Jun 10 '25 12:06 rust-log-analyzer

:umbrella: The latest upstream changes (presumably #142299) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jun 10 '25 21:06 bors

The job mingw-check-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] rustc_codegen_llvm test:false 3.946
    Checking rustc_passes v0.0.0 (/checkout/compiler/rustc_passes)
[RUSTC-TIMING] rustc_mir_transform test:false 5.155
[RUSTC-TIMING] rustc_borrowck test:false 5.882
error[E0004]: non-exhaustive patterns: `&rustc_hir::Attribute::Parsed(AttributeKind::RustcForceInline(_, _))` not covered
    --> compiler/rustc_passes/src/check_attr.rs:119:19
     |
119  |             match attr {
     |                   ^^^^ pattern `&rustc_hir::Attribute::Parsed(AttributeKind::RustcForceInline(_, _))` not covered
     |
note: `rustc_hir::Attribute` defined here
    --> /checkout/compiler/rustc_hir/src/hir.rs:1196:1
     |
1196 | pub enum Attribute {
---
     = note: the matched value is of type `&rustc_hir::Attribute`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
     |
337  ~                 },
338  +                 &rustc_hir::Attribute::Parsed(AttributeKind::RustcForceInline(_, _)) => todo!()
     |

For more information about this error, try `rustc --explain E0004`.
[RUSTC-TIMING] rustc_passes test:false 1.435
error: could not compile `rustc_passes` (lib) due to 1 previous error

rust-log-analyzer avatar Jun 10 '25 22:06 rust-log-analyzer

:umbrella: The latest upstream changes (presumably #142381) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jun 12 '25 01:06 bors

:umbrella: The latest upstream changes (presumably #142432) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jun 13 '25 08:06 bors

:umbrella: The latest upstream changes (presumably #142589) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jun 16 '25 21:06 bors

rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing src/librustdoc/json/conversions.rs; otherwise, make sure you bump the FORMAT_VERSION constant.

cc @CraftSpider, @aDotInTheVoid, @Enselic, @obi1kenobi

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

These commits modify tests/rustdoc-json. rustdoc-json is a public (but unstable) interface.

Please ensure that if you've changed the output:

  • It's intentional.
  • The FORMAT_VERSION in src/librustdoc-json-types is bumped if necessary.

cc @aDotInTheVoid, @obi1kenobi

Some changes occurred in diagnostic error codes

cc @GuillaumeGomez

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

rustbot avatar Jun 17 '25 21:06 rustbot

@bors r+

oli-obk avatar Jun 18 '25 12:06 oli-obk

:pushpin: Commit 3c418ec505233927d562ff906d8eea309aee1905 has been approved by oli-obk

It is now in the queue for this repository.

bors avatar Jun 18 '25 12:06 bors

yay!

jdonszelmann avatar Jun 20 '25 13:06 jdonszelmann