Skip to content

Conversation

compiler-errors
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

wdunicornpro and others added 30 commits November 10, 2023 12:51
Currently, `Handler::fatal` returns `FatalError`. But `Session::fatal`
returns `!`, because it calls `Handler::fatal` and then calls `raise` on
the result. This inconsistency is unfortunate.

This commit changes `Handler::fatal` to do the `raise` itself, changing
its return type to `!`. This is safe because there are only two calls to
`Handler::fatal`, one in `rustc_session` and one in
`rustc_codegen_cranelift`, and they both call `raise` on the result.

`HandlerInner::fatal` still returns `FatalError`, so I renamed it
`fatal_no_raise` to emphasise the return type difference.
They each have a single call site.

Note: the `make_diagnostic_builder` calls in `lib.rs` will be replaced
in a subsequent commit.
`sess` is a terribly misleading name for a `Handler`! This confused me
for a bit.
That's what is mostly used. This commit changes a few `EM` and `E` and
`T` type variables to `G`.
`Diagnostic::new` can be used instead.
These impls are all needed for just a single `IntoDiagnostic` type, not
a family of them.

Note that `ErrorGuaranteed` is the default type parameter for
`IntoDiagnostic`.
By making it generic, instead of only for `EmissionGuarantee = ()`, we
can use it everywhere.
`Handler` is a wrapper around `HanderInner`. Some functions on
on `Handler` just forward to the samed-named functions on
`HandlerInner`.

This commit removes as many of those as possible, implementing functions
on `Handler` where possible, to avoid the boilerplate required for
forwarding. The commit is moderately large but it's very mechanical.
This is weird: `HandlerInner::emit` calls
`HandlerInner::emit_diagnostic`, but only after doing a
`treat-err-as-bug` check. Which is fine, *except* that there are
multiple others paths for an `Error` or `Fatal` diagnostic to be passed
to `HandlerInner::emit_diagnostic` without going through
`HandlerInner::emit`, e.g. `Handler::span_err` call
`Handler::emit_diag_at_span`, which calls `emit_diagnostic`.
So that suggests that the coverage for `treat-err-as-bug` is incomplete.

This commit removes `HandlerInner::emit` and moves the
`treat-err-as-bug` check to `HandlerInner::emit_diagnostic`, so it
cannot by bypassed.
This makes `Handler::fatal` more like `Handler::{err,warn,bug,note}`.
…pressions_from_macros`

This already wasn't passed in bootstrap.py and the lint itself already warns-by-default for 2 years now and has already been added to the future-incompat group in Rust 1.68.

See rust-lang#79813 for the tracking issue.
…ilee

Update variable name to fix `unused_variables` warning

This PR fixes an `unused_variables` warning within `os.rs` when targeting `espidf`.
…compiler-errors

Add support for making lib features internal

We have the notion of an "internal" lang feature: a feature that is never intended to be stabilized, and using which can cause ICEs and other issues without that being considered a bug.

This extends that idea to lib features as well. It is an alternative to rust-lang#115623: instead of using an attribute to declare lib features internal, we simply do this based on the name. Everything ending in `_internals` or `_internal` is considered internal.

Then we rename `core_intrinsics` to `core_intrinsics_internal`, which fixes rust-lang#115597.
…tebank

Pretty print `Fn<(..., ...)>` trait refs with parentheses (almost) always

It's almost always better, at least in diagnostics, to print `Fn(i32, u32)` instead of `Fn<(i32, u32)>`.

Related to but doesn't fix rust-lang#118225. That needs a separate fix.
…or-diagnostic, r=lcnr

Add `deeply_normalize_for_diagnostics`, use it in coherence

r? lcnr

Normalize trait refs used for coherence error reporting with `-Ztrait-solver=next-coherence`.

Two things:
1. I said before that we can't add this to `TyErrCtxt` because we compute `OverlapResult`s even if there are no diagnostics being emitted, e.g. for a reservation impl.
2. I didn't want to add this to an `InferCtxtExt` trait because I felt it was unnecessary. I don't particularly care about the API though.
…jubilee

Simplify Default for tuples

Doesn't need a separate block for each element
…ilee

Use OnceCell in cell module documentation

The spanning tree example in the std cell module implementation was created before `OnceCell` was added to Rust so it uses `RefCell`. However, in this case using `OnceCell` seems more appropriate and produces simpler code. As a bonus, this also means that all three cell types are presented in the examples of std cell module.
@compiler-errors
Copy link
Member Author

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 5, 2023
@bors
Copy link
Collaborator

bors commented Dec 5, 2023

⌛ Testing commit 0a8c0f7 with merge 2e366fc...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 5, 2023
…mpiler-errors

Rollup of 9 pull requests

Successful merges:

 - rust-lang#117793 (Update variable name to fix `unused_variables` warning)
 - rust-lang#118123 (Add support for making lib features internal)
 - rust-lang#118268 (Pretty print `Fn<(..., ...)>` trait refs with parentheses (almost) always)
 - rust-lang#118346 (Add `deeply_normalize_for_diagnostics`, use it in coherence)
 - rust-lang#118350 (Simplify Default for tuples)
 - rust-lang#118450 (Use OnceCell in cell module documentation)
 - rust-lang#118585 (Fix parser ICE when recovering `dyn`/`impl` after `for<...>`)
 - rust-lang#118587 (Cleanup error handlers some more)
 - rust-lang#118642 (bootstrap(builder.rs): Don't explicitly warn against `semicolon_in_expressions_from_macros`)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
test [ui] tests/ui/traits/impl-for-module.rs ... ok
test [ui] tests/ui/traits/default-method/xc-2.rs ... ok
test [ui] tests/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.rs ... ok
test [ui] tests/ui/traits/impl_trait_as_trait_return_position.rs ... ok
##[error]The runner has received a shutdown signal. This can happen when the runner service is stopped, or a manually started runner is canceled.
test [ui] tests/ui/traits/impl-inherent-prefer-over-trait.rs ... ok
test [ui] tests/ui/traits/impl-object-overlap-issue-23853.rs ... ok
test [ui] tests/ui/traits/inductive-overflow/simultaneous.rs ... ok
test [ui] tests/ui/traits/impl-implicit-trait.rs ... ok
---
test [ui] tests/ui/traits/infer-from-object-issue-26952.rs ... ok

##[group]Clock drift check
  local time: Wed Dec  6 00:02:12 UTC 2023
Session terminated, killing shell... ...killed.
##[error]The operation was canceled.
Cleaning up orphan processes

@bors
Copy link
Collaborator

bors commented Dec 6, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 6, 2023
@compiler-errors
Copy link
Member Author

Again? wtf

@bors retry spurious, runner seems to have died

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 6, 2023
@bors
Copy link
Collaborator

bors commented Dec 6, 2023

⌛ Testing commit 0a8c0f7 with merge 9ad0af5...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 6, 2023
…mpiler-errors

Rollup of 9 pull requests

Successful merges:

 - rust-lang#117793 (Update variable name to fix `unused_variables` warning)
 - rust-lang#118123 (Add support for making lib features internal)
 - rust-lang#118268 (Pretty print `Fn<(..., ...)>` trait refs with parentheses (almost) always)
 - rust-lang#118346 (Add `deeply_normalize_for_diagnostics`, use it in coherence)
 - rust-lang#118350 (Simplify Default for tuples)
 - rust-lang#118450 (Use OnceCell in cell module documentation)
 - rust-lang#118585 (Fix parser ICE when recovering `dyn`/`impl` after `for<...>`)
 - rust-lang#118587 (Cleanup error handlers some more)
 - rust-lang#118642 (bootstrap(builder.rs): Don't explicitly warn against `semicolon_in_expressions_from_macros`)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@bors
Copy link
Collaborator

bors commented Dec 6, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 6, 2023
@compiler-errors
Copy link
Member Author

wtf

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 6, 2023
@compiler-errors
Copy link
Member Author

I'm only gonna do this one more time.

@bors
Copy link
Collaborator

bors commented Dec 6, 2023

⌛ Testing commit 0a8c0f7 with merge 1dd4db5...

@bors
Copy link
Collaborator

bors commented Dec 6, 2023

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing 1dd4db5 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 6, 2023
@bors bors merged commit 1dd4db5 into rust-lang:master Dec 6, 2023
@rustbot rustbot added this to the 1.76.0 milestone Dec 6, 2023
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#117793 Update variable name to fix unused_variables warning a73474aa89de425f05d7e4dd85f4d282c49a5211 (link)
#118123 Add support for making lib features internal 66e78d887aa75ad7a074991a87d0918ef960cf2c (link)
#118268 Pretty print Fn<(..., ...)> trait refs with parentheses (… e023b21f007626548dc7ce8450c3316bbc5efcb2 (link)
#118346 Add deeply_normalize_for_diagnostics, use it in coherence a71787b9c0da9e9df58e2d2c03eaf93dc6ada9ef (link)
#118350 Simplify Default for tuples 92581ef5e6e3c09d38996b17141e1d0c4e275e5b (link)
#118450 Use OnceCell in cell module documentation efb7747355ec70f2fe700b754118e5e763fc1415 (link)
#118585 Fix parser ICE when recovering dyn/impl after for<...> d11142456b44515fc12ba162e503d4653d3ead55 (link)
#118587 Cleanup error handlers some more 436afaee66fd8b338e601a737ac490142937d9dc (link)
#118642 bootstrap(builder.rs): Don't explicitly warn against `semic… c31e4d7cc8395a2e1ee022644c2b515dee166fee (link)

previous master: 84a554cda9

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1dd4db5): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.9% [2.9%, 2.9%] 1
Improvements ✅
(primary)
-1.6% [-1.6%, -1.6%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.6% [-1.6%, -1.6%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.9% [-4.4%, -3.2%] 6
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 673.722s -> 675.785s (0.31%)
Artifact size: 314.15 MiB -> 314.17 MiB (0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) merged-by-bors This PR was explicitly merged by bors. O-unix Operating system: Unix-like rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.