Skip to content

Rollup of 10 pull requests #120710

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 33 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

oli-obk and others added 30 commits January 29, 2024 08:53
This makes it possible for two nodes/edges in the coverage graph to share the
same counter, without causing the instrumentor to inject unwanted duplicate
counter-increment statements.
with this, alias-relate treats all aliases the same way
and it can be used for structural normalization.
And make sure all other imports have non-empty resolution lists.
It doesn't affect behaviour, but makes sense with (a) `FailureNote` having
`()` as its emission guarantee, and (b) in `Level` the `is_error` levels
now are all listed before the non-`is_error` levels.
I.e. `Bug` and `Fatal` level diagnostics are never downgraded.
- Combine two different blocks involving
  `diagnostic.level.get_expectation_id()` into one.
- Combine several `if`s involving `diagnostic.level` into a single
  `match`.

This requires reordering some of the operations, but this has no
functional effect.
The two kinds of delayed bug have quite different semantics so a
stronger conceptual separation is nice. (`is_error` is a good example,
because the two kinds have different behaviour.)

The commit also moves the `DelayedBug` variant after `Error` in `Level`,
to reflect the fact that it's weaker than `Error` -- it might trigger an
error but also might not. (The pre-existing `downgrade_to_delayed_bug`
function also reflects the notion that delayed bugs are lower/after
normal errors.)

Plus it condenses some of the comments on `Level` into a table, for
easier reading, and introduces `can_be_top_or_sub` to indicate which
levels can be used in top-level diagnostics vs. subdiagnostics.

Finally, it renames `DiagCtxtInner::span_delayed_bugs` as
`DiagCtxtInner::delayed_bugs`. The `span_` prefix is unnecessary because
some delayed bugs don't have a span.
All the other `emit`/`emit_diagnostic` methods were recently made
consuming (e.g. rust-lang#119606), but this one wasn't. But it makes sense to.

Much of this is straightforward, and lots of `clone` calls are avoided.
There are a couple of tricky bits.
- `Emitter::primary_span_formatted` no longer takes a `Diagnostic` and
  returns a pair. Instead it takes the two fields from `Diagnostic` that
  it used (`span` and `suggestions`) as `&mut`, and modifies them. This
  is necessary to avoid the cloning of `diag.children` in two emitters.
- `from_errors_diagnostic` is rearranged so various uses of `diag` occur
  before the consuming `emit_diagnostic` call.
Co-authored-by: Ralf Jung <post@ralfj.de>
…alfJung

various const interning cleanups

After rust-lang#119044 I noticed that some things can be simplified and refactored.

This is also a requirement for rust-lang#116564 as there we'll need to treat the base allocation differently from the others

r? `@RalfJung`
…i-obk

Some cleanups around diagnostic levels.

Plus some refactoring in and around diagnostic levels and emission. Details in the individual commit logs.

r? ``@oli-obk``
…ructors, r=dtolnay,oli-obk

Make `NonZero` constructors generic.

This makes `NonZero` constructors generic, so that `NonZero::new` can be used without turbofish syntax.

Tracking issue: rust-lang#120257

~~I cannot figure out how to make this work with `const` traits. Not sure if I'm using it wrong or whether there's a bug:~~

```rust
101 |         if n == T::ZERO {
    |            ^^^^^^^^^^^^ expected `host`, found `true`
    |
    = note: expected constant `host`
               found constant `true`
```

r? `@dtolnay`
…ochenkov

Switch OwnedStore handle count to AtomicU32

This is already panics if overflowing a u32, so let's use the smaller int size to save a tiny bit of memory.
modify alias-relate to also normalize ambiguous opaques

allows a bunch of further cleanups and generally simplifies the type system. To handle rust-lang/trait-system-refactor-initiative#8 we'll have to add a some additional complexity to the `(Alias, Infer)` branches in alias-relate, so removing the opaque type special case here is really valuable.

It does worsen `deduce_closure_signature` and friends even more as they now receive an inference variable which is only constrained via an `AliasRelate` goal. These probably have to look into alias relate goals somehow. Leaving that for a future PR as this is something we'll have to tackle regardless.

r? `@compiler-errors`
coverage: Split out counter increment sites from BCB node/edge counters

This makes it possible for two nodes/edges in the coverage graph to share the same counter, without causing the instrumentor to inject unwanted duplicate counter-increment statements.

---

`@rustbot` label +A-code-coverage
…handling, r=estebank

Simplify codegen diagnostic handling

Some nice improvements. Details in the individual commit logs.

r? ``@estebank``
…in-pat, r=estebank

Suggest `[tail @ ..]` on `[..tail]` and `[...tail]` where `tail` is unresolved

Fixes rust-lang#120591.
~~Will conflict with rust-lang#120570~~ (rebased).

r? estebank or compiler
…r-errors

hir: Stop keeping prefixes for most of `use` list stems

And make sure all other imports have non-empty resolution lists.

Addresses one of FIXMEs in rust-lang#120206.
…rrors

pattern_analysis: gather up place-relevant info

We track 3 things about each place during exhaustiveness: its type, its (data) validity, and whether it's the scrutinee place. This PR gathers all three into a single struct.

r? `@compiler-errors`
@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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-libs Relevant to the library 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) rollup A PR which is a rollup labels Feb 6, 2024
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=10

@bors
Copy link
Collaborator

bors commented Feb 6, 2024

📌 Commit cdd7317 has been approved by matthiaskrgr

It is now in the queue for this repository.

@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 Feb 6, 2024
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-16 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_cd92a055-cf51-4843-8793-78485341562f
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=rollup-2ymidm4
GITHUB_JOB=pr
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_cd92a055-cf51-4843-8793-78485341562f
GITHUB_REF=refs/pull/120710/merge
GITHUB_REF_NAME=120710/merge
GITHUB_REF_PROTECTED=false
---
#12 writing image sha256:eb6921df0ca7a52b7618aeeac04da6b87c6385b0ef353363e112b0c6068b4476 done
#12 naming to docker.io/library/rust-ci done
#12 DONE 10.2s
##[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-16]
##[group]Clock drift check
  local time: Tue Feb  6 16:57:21 UTC 2024
  network time: Tue, 06 Feb 2024 16:57:21 GMT
  network time: Tue, 06 Feb 2024 16:57:21 GMT
##[endgroup]
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-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--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', 'build.optimized-compiler-builtins', '--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-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---

---- [ui] tests/ui/type-alias-impl-trait/type-alias-impl-trait-tuple.rs#next stdout ----
diff of stderr:

4 LL |         Blah { my_foo: make_foo(), my_u8: 12 }
5    |                        ^^^^^^^^^^ cannot satisfy `Foo == _`
- error[E0282]: type annotations needed
-   --> $DIR/type-alias-impl-trait-tuple.rs:24:28
-   --> $DIR/type-alias-impl-trait-tuple.rs:24:28
+ error[E0284]: type annotations needed: cannot satisfy `Foo == _`
9    |
9    |
- LL |     fn into_inner(self) -> (Foo, u8, Foo) {
-    |                            ^^^^^^^^^^^^^^ cannot infer type for tuple `(Foo, u8, Foo)`
+ LL |         (self.my_foo, self.my_u8, make_foo())
+    |          ^^^^^^^^^^^ cannot satisfy `Foo == _`
13 error: aborting due to 2 previous errors
14 

- Some errors have detailed explanations: E0282, E0284.
---
To only update this specific test, also pass `--test-args type-alias-impl-trait/type-alias-impl-trait-tuple.rs`

error in revision `next`: 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/type-alias-impl-trait/type-alias-impl-trait-tuple.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" "--cfg" "next" "--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/type-alias-impl-trait/type-alias-impl-trait-tuple.next" "-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/type-alias-impl-trait/type-alias-impl-trait-tuple.next/auxiliary" "-Znext-solver"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0284]: type annotations needed: cannot satisfy `Foo == _`
   |
   |
LL |         Blah { my_foo: make_foo(), my_u8: 12 }
   |                        ^^^^^^^^^^ cannot satisfy `Foo == _`

error[E0284]: type annotations needed: cannot satisfy `Foo == _`
   |
   |
LL |         (self.my_foo, self.my_u8, make_foo())
   |          ^^^^^^^^^^^ cannot satisfy `Foo == _`
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0284`.
------------------------------------------

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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-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. T-rustdoc Relevant to the rustdoc 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.