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

[CRATER] Crater rollup #130373

Closed
wants to merge 18 commits into from

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Sep 14, 2024

This is a crater rollup of:

What is a crater rollup? It's simply a (manually set-up) crater job that is run on all of the containing PRs together, and then we can set the crates list for each of these jobs to just the list of failures after it's done. It should cut out on the bulk of "normal" crates that do nothing and simply just waste time to build without being affected by the union of all of these changes.

After this is finished, I will adjust all of the jobs to use only the list of failed crates. That should significantly speed up these jobs from taking like ~6 days to taking ~2. See the last time I did this: #129660.

Given that #130285 is running in build-and-test mode, let's run all of them in build-and-test mode.

nnethercote and others added 18 commits September 14, 2024 18:16
By using `token_descr`, as is done for many other errors, we can get
slightly better descriptions in error messages, e.g.
"macro expansion ignores token `let` and any following" becomes
"macro expansion ignores keyword `let` and any tokens following".

This will be more important once invisible delimiters start being
mentioned in error messages -- without this commit, that leads to error
messages such as "error at ``" because invisible delimiters are
pretty printed as an empty string.
Much like the previous commit.

I think the removal of "the token" in each message is fine here. There
are many more error messages that mention tokens without saying "the
token" than those that do say it.
It's not used meaningfully yet, but will be needed to get rid of
interpolated tokens.
Pasted metavariables are wrapped in invisible delimiters, which
pretty-print as empty strings, and changing that can break some proc
macros. But error messages saying "expected identifer, found ``" are
bad. So this commit adds support for metavariables in `TokenDescription`
so they print as "metavariable" in error messages, instead of "``".

It's not used meaningfully yet, but will be needed to get rid of
interpolated tokens.
Current places where `Interpolated` is used are going to change to
instead use invisible delimiters. This prepares for that.
- It adds invisible delimiter cases to the `can_begin_*`/`may_be_*`
  methods and the `failed_to_match_macro` that are equivalent to the
  existing `Interpolated` cases.
- It adds panics/asserts in some places where invisible delimiters
  should never occur.
- In `Parser::parse_struct_fields` it excludes an ident + invisible
  delimiter from special consideration in an error message, because
  that's quite different to an ident + paren/brace/bracket.
We now use invisible delimiters for expanded `vis` fragments, instead of
`Token::Interpolated`.
Notes about tests:

- tests/ui/parser/macro/trait-object-macro-matcher.rs: the syntax error
  is duplicated, because it occurs now when parsing the decl macro
  input, and also when parsing the expanded decl macro. But this won't
  show up for normal users due to error de-duplication.

- tests/ui/associated-consts/issue-93835.rs: ditto.

- The changes to metavariable descriptions in this PR's earlier commits
  are now visible in error message for several tests.
The one notable test change is `tests/ui/macros/trace_faulty_macros.rs`.
This commit removes the complicated `Interpolated` handling in
`expected_expression_found` that results in a longer error message. But
I think the new, shorter message is actually an improvement.

The original complaint was in rust-lang#71039, when the error message started
with "error: expected expression, found `1 + 1`". That was confusing
because `1 + 1` is an expression. Other than that, the reporter said
"the whole error message is not too bad if you ignore the first line".

Subsequently, extra complexity and wording was added to the error
message. But I don't think the extra wording actually helps all that
much. In particular, it still says of the `1+1` that "this is expected
to be expression". This repeats the problem from the original complaint!

This commit removes the extra complexity, reverting to a simpler error
message. This is primarily because the traversal a pain without
`Interpolated` tokens. Nonetheless, I think the error message is
*improved*. It now starts with "expected expression, found `pat`
metavariable", which is much clearer and the real problem. It also
doesn't say anything specific about `1+1`, which is good, because the
`1+1` isn't really relevant to the error -- it's the `$e:pat` that's
important.
This involves replacing `nt_pretty_printing_compatibility_hack` with
`stream_pretty_printing_compatibility_hack`.

The handling of statements in `transcribe` is slightly different to
other nonterminal kinds, due to the lack of `from_ast` implementation
for empty statements.

Notable test changes:
- `tests/ui/proc-macro/expand-to-derive.rs`: the diff looks large but
  the only difference is the insertion of a single invisible-delimited
  group around a metavar.
Note: there was an existing code path involving `Interpolated` in
`MetaItem::from_tokens` that was dead. This commit transfers that to the
new form, but puts an `unreachable!` call inside it.
Notes about tests:
- tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs: some messages are
  now duplicated due to repeated parsing.

- tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions*.rs: ditto.

- `tests/ui/proc-macro/macro-rules-derive-cfg.rs`: the diff looks large
  but the only difference is the insertion of a single
  invisible-delimited group around a metavar.
`NtBlock` is the last remaining variant of `Nonterminal`, so once it is
gone then `Nonterminal` can be removed as well.
It's no longer needed.

This does slightly worsen the error message for a single test, but that
test contains code that is so badly broken that I'm not worried about
it.
@rustbot
Copy link
Collaborator

rustbot commented Sep 14, 2024

r? @davidtwco

rustbot has assigned @davidtwco.
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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Sep 14, 2024
@rustbot
Copy link
Collaborator

rustbot commented Sep 14, 2024

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

HIR ty lowering was modified

cc @fmease

@compiler-errors
Copy link
Member Author

Ugh. Draft mode would've been nice. Sorry for the pings!

@compiler-errors
Copy link
Member Author

@bors try

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 14, 2024
[CRATER] Crater rollup

This is a crater rollup of:
* rust-lang#124141
* rust-lang#130285
* rust-lang#130367

**What is a crater rollup?** It's simply a (manually set-up) crater job that is run on all of the containing PRs together, and then we can set the crates list for each of these jobs to *just* the list of failures after it's done. It should cut out on the bulk of "normal" crates that do nothing and simply just waste time to build without being affected by the union of all of these changes.

After this is finished, I will adjust all of the jobs to use only the list of failed crates. That should significantly speed up these jobs from taking like ~6 days to taking ~2. See the last time I did this: rust-lang#129660.

Given that rust-lang#130285 is running in build-and-test mode, let's run all of them in build-and-test mode.
@bors
Copy link
Contributor

bors commented Sep 14, 2024

⌛ Trying commit 29ed873 with merge 951e579...

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
#16 2.841 Building wheels for collected packages: reuse
#16 2.842   Building wheel for reuse (pyproject.toml): started
#16 3.086   Building wheel for reuse (pyproject.toml): finished with status 'done'
#16 3.087   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132715 sha256=dfa09868353292d98f811d3efdb0d54d07389e808efc71d68e3b93c514bf8bec
#16 3.087   Stored in directory: /tmp/pip-ephem-wheel-cache-tunh11zz/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#16 3.090 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#16 3.478 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#16 3.479 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#16 DONE 3.6s
---
    Checking rustc_middle v0.0.0 (/checkout/compiler/rustc_middle)
    Checking overload v0.1.1
    Checking lazy_static v1.5.0
    Checking sharded-slab v0.1.7
error[E0069]: `return;` in a function whose return type is not `()`
     |
     |
1025 |     fn error_unexpected_after_dot(&self) -> ErrorGuaranteed {
     |                                             --------------- expected `ErrorGuaranteed` because of this return type
1035 |                 return;
     |                 ^^^^^^ return type is not `()`
     |
     |
help: give the `return` a value of the expected type
     |
1035 |                 return /* value */;

    Checking nu-ansi-term v0.46.0
    Checking matchers v0.1.0
    Checking flate2 v1.0.31

@compiler-errors
Copy link
Member Author

🤦 rebased incorrectly!

@rust-log-analyzer
Copy link
Collaborator

The job dist-x86_64-linux failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
file:.git/config remote.origin.url=https://github.com/rust-lang-ci/rust
file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config gc.auto=0
file:.git/config http.https://github.com/.extraheader=AUTHORIZATION: basic ***
file:.git/config branch.try.remote=origin
file:.git/config branch.try.merge=refs/heads/try
file:.git/config submodule.library/backtrace.url=https://github.com/rust-lang/backtrace-rs.git
file:.git/config submodule.library/stdarch.active=true
file:.git/config submodule.library/stdarch.url=https://github.com/rust-lang/stdarch.git
file:.git/config submodule.src/doc/book.active=true
---
   Compiling rustc_attr v0.0.0 (/checkout/compiler/rustc_attr)
   Compiling rustc_query_system v0.0.0 (/checkout/compiler/rustc_query_system)
   Compiling rustc_parse v0.0.0 (/checkout/compiler/rustc_parse)
   Compiling rustc_middle v0.0.0 (/checkout/compiler/rustc_middle)
error[E0069]: `return;` in a function whose return type is not `()`
     |
     |
1025 |     fn error_unexpected_after_dot(&self) -> ErrorGuaranteed {
     |                                             --------------- expected `ErrorGuaranteed` because of this return type
1035 |                 return;
     |                 ^^^^^^ return type is not `()`
     |
     |
help: give the `return` a value of the expected type
     |
1035 |                 return /* value */;

For more information about this error, try `rustc --explain E0069`.
[RUSTC-TIMING] rustc_parse test:false 3.786
error: could not compile `rustc_parse` (lib) due to 1 previous error
---
Caused by:
    Command RUST_BACKTRACE=full python3 /checkout/x.py build --target x86_64-unknown-linux-gnu --host x86_64-unknown-linux-gnu --stage 2 library/std --rust-profile-generate /tmp/tmp-multistage/opt-artifacts/rustc-pgo --set llvm.thin-lto=false --set llvm.link-shared=true [at /checkout/obj] has failed with exit code Some(1)

Stack backtrace:
   0: <anyhow::Error>::msg::<alloc::string::String>
             at /rust/deps/anyhow-1.0.86/src/backtrace.rs:27:14
   1: <opt_dist::exec::CmdBuilder>::run
             at /rustc/951e579abb43f418c0a62bf3d4f40d32fc39e9f4/src/tools/opt-dist/src/exec.rs:80:17
   2: <opt_dist::exec::Bootstrap>::run
             at /rustc/951e579abb43f418c0a62bf3d4f40d32fc39e9f4/src/tools/opt-dist/src/exec.rs:181:9
             at /rustc/951e579abb43f418c0a62bf3d4f40d32fc39e9f4/src/tools/opt-dist/src/main.rs:225:13
             at /rustc/951e579abb43f418c0a62bf3d4f40d32fc39e9f4/src/tools/opt-dist/src/main.rs:225:13
   4: <opt_dist::timer::TimerSection>::section::<opt_dist::execute_pipeline::{closure#1}::{closure#0}, ()>
             at /rustc/951e579abb43f418c0a62bf3d4f40d32fc39e9f4/src/tools/opt-dist/src/timer.rs:111:22
             at /rustc/951e579abb43f418c0a62bf3d4f40d32fc39e9f4/src/tools/opt-dist/src/main.rs:214:9
             at /rustc/951e579abb43f418c0a62bf3d4f40d32fc39e9f4/src/tools/opt-dist/src/main.rs:214:9
   6: <opt_dist::timer::TimerSection>::section::<opt_dist::execute_pipeline::{closure#1}, opt_dist::training::RustcPGOProfile>
             at /rustc/951e579abb43f418c0a62bf3d4f40d32fc39e9f4/src/tools/opt-dist/src/timer.rs:111:22
             at /rustc/951e579abb43f418c0a62bf3d4f40d32fc39e9f4/src/tools/opt-dist/src/main.rs:211:29
   8: opt_dist::main
             at /rustc/951e579abb43f418c0a62bf3d4f40d32fc39e9f4/src/tools/opt-dist/src/main.rs:401:18
   9: <fn() -> core::result::Result<(), anyhow::Error> as core::ops::function::FnOnce<()>>::call_once
   9: <fn() -> core::result::Result<(), anyhow::Error> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/fb1a6f7f4e154e5787e5410867cf07f7557360c1/library/core/src/ops/function.rs:250:5
  10: std::sys::backtrace::__rust_begin_short_backtrace::<fn() -> core::result::Result<(), anyhow::Error>, core::result::Result<(), anyhow::Error>>
             at /rustc/fb1a6f7f4e154e5787e5410867cf07f7557360c1/library/std/src/sys/backtrace.rs:154:18
  11: std::rt::lang_start::<core::result::Result<(), anyhow::Error>>::{closure#0}
             at /rustc/fb1a6f7f4e154e5787e5410867cf07f7557360c1/library/std/src/rt.rs:164:18
  12: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
  13: std::panicking::try::do_call
             at /rustc/fb1a6f7f4e154e5787e5410867cf07f7557360c1/library/std/src/panicking.rs:554:40
  14: std::panicking::try
             at /rustc/fb1a6f7f4e154e5787e5410867cf07f7557360c1/library/std/src/panicking.rs:518:19

@bors
Copy link
Contributor

bors commented Sep 14, 2024

💔 Test failed - checks-actions

@bors bors 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 Sep 14, 2024
@compiler-errors
Copy link
Member Author

Ugh actually I don't wanna deal with this. Crater be damned!

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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants