Commit Graph

235774 Commits

Author SHA1 Message Date
bors d627cf07ce Auto merge of #113915 - cjgillot:ssa-call, r=tmiasko
Also consider call and yield as MIR SSA.

The SSA analysis on MIR only considered `Assign` statements as defining a SSA local.
This PR adds assignments as part of a `Call` or `Yield` terminator in that category.

This mainly allows to perform CopyProp on a call return place.

The only subtlety is in the dominance property: the assignment is only complete at the beginning of the target block.
2023-10-10 20:37:55 +00:00
bors c30b28bdc1 Auto merge of #116605 - GuillaumeGomez:rollup-12ba2o6, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #109422 (rustdoc-search: add impl disambiguator to duplicate assoc items)
 - #116250 (On type error of closure call argument, point at earlier calls that affected inference)
 - #116444 (add test for const-eval error in dead code during monomorphization)
 - #116503 (Update docs for mips target tier demotion.)
 - #116559 (Mark `new_in` as `const` for BTree collections)
 - #116560 (In smir use `FxIndexMap` to store indexed ids)
 - #116574 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-10 17:37:15 +00:00
Guillaume Gomez 49dd50bf93
Rollup merge of #116574 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/reference

2 commits in 5262e1c3b43a2c489df8f6717683a44c7a2260fd..142b2ed77d33f37a9973772bd95e6144ed9dce43
2023-10-07 19:41:21 UTC to 2023-09-26 12:26:35 UTC

- replace 'UB on raw ptr deref' with UB on place projection/access (rust-lang/reference#1387)
- docs: Fix links to ECMA standards in `attributes.md` (rust-lang/reference#1408)

## rust-lang/rust-by-example

11 commits in c954202c1e1720cba5628f99543cc01188c7d6fc..8eb3a01ab74c567b7174784892fb807f2c632d6b
2023-09-26 12:38:17 UTC to 2023-09-26 12:29:10 UTC

- fixed a typo in the lifetime.md (rust-lang/rust-by-example#1737)
- Misleading textual statement in HOF (rust-lang/rust-by-example#1731)
- Equalize title from respective file with title in SUMMARY.md (rust-lang/rust-by-example#1738)
- Added explanation for compiling and executing match_args.rs. (rust-lang/rust-by-example#1739)
- Wrapped long lines and put #[doc] in backquotes. (rust-lang/rust-by-example#1740)
- Update read_lines example to flatten iterator (rust-lang/rust-by-example#1742)
- Update while_let.md: address inconsistent use of fn main between 2 co… (rust-lang/rust-by-example#1744)
- [TRIVIAL] Remove confusing `also` (rust-lang/rust-by-example#1746)
- Fix and extend the explanation of outer vs inner attributes. (rust-lang/rust-by-example#1748)
- Fix uncorresponded back quote (rust-lang/rust-by-example#1749)
- Fix format in constants.md (rust-lang/rust-by-example#1741)

## rust-lang/rustc-dev-guide

3 commits in a13b7c28ed705891c681ce5417b3d1cdb12cecd1..b98af7d661e4744baab81fb8dc7a049e44a4a998
2023-10-05 19:48:35 UTC to 2023-09-27 22:57:27 UTC

- update new trait solver docs (rust-lang/rustc-dev-guide#1802)
- update rustc_driver examples (rust-lang/rustc-dev-guide#1803)
- test headers: fix `compile-flags` example (rust-lang/rustc-dev-guide#1800)
2023-10-10 18:44:47 +02:00
Guillaume Gomez 100713ef08
Rollup merge of #116560 - ouz-a:efficient_ids, r=oli-obk
In smir use `FxIndexMap` to store indexed ids

Previously we used `vec` for storing indexed types, which is fine for small cases but will lead to huge performance issues when we use `smir` for real world cases.

Addresses https://github.com/rust-lang/project-stable-mir/issues/35

r? ``@oli-obk``
2023-10-10 18:44:46 +02:00
Guillaume Gomez b72db84fd0
Rollup merge of #116559 - Kritzefitz:btree-new-in-const, r=Amanieu
Mark `new_in` as `const` for BTree collections

Discussed in and closes rust-lang/wg-allocators#118
2023-10-10 18:44:46 +02:00
Guillaume Gomez fccf9ec224
Rollup merge of #116503 - ehuss:fix-mips-tier, r=Amanieu
Update docs for mips target tier demotion.

These mips targets were demoted in #113274, but the documentation was not updated. I have also elected to document this in the release notes for 1.72 because I think that should have been included.
2023-10-10 18:44:45 +02:00
Guillaume Gomez bbaf6bd136
Rollup merge of #116444 - RalfJung:broken-unused-const, r=oli-obk
add test for const-eval error in dead code during monomorphization
2023-10-10 18:44:45 +02:00
Guillaume Gomez 0e5e04b89a
Rollup merge of #116250 - estebank:closure-arg-inference-span, r=petrochenkov
On type error of closure call argument, point at earlier calls that affected inference

Mitigate part of  https://github.com/rust-lang/rust/issues/71209.

When we encounter a type error on a specific argument of a closure call argument, where the closure's definition doesn't have a type specified, look for other calls of the closure to try and find the specific call that cased that argument to be inferred of the expected type.

```
error[E0308]: mismatched types
  --> $DIR/unboxed-closures-type-mismatch.rs:30:18
   |
LL |         identity(1u16);
   |         -------- ^^^^ expected `u8`, found `u16`
   |         |
   |         arguments to this function are incorrect
   |
note: expected because the closure was earlier called with an argument of type `u8`
  --> $DIR/unboxed-closures-type-mismatch.rs:29:18
   |
LL |         identity(1u8);
   |         -------- ^^^ expected because this argument is of type `u8`
   |         |
   |         in this closure call
note: closure parameter defined here
  --> $DIR/unboxed-closures-type-mismatch.rs:28:25
   |
LL |         let identity = |x| x;
   |                         ^
help: change the type of the numeric literal from `u16` to `u8`
   |
LL |         identity(1u8);
   |                   ~~
```
2023-10-10 18:44:44 +02:00
Guillaume Gomez 4be9cfabf2
Rollup merge of #109422 - notriddle:notriddle/impl-disambiguate-search, r=GuillaumeGomez
rustdoc-search: add impl disambiguator to duplicate assoc items

Preview (to see the difference, click the link and pay attention to the specific function that comes up):

| Before | After |
|--|--|
| [`simd<i64>, simd<i64> -> simd<i64>`](https://doc.rust-lang.org/nightly/std/?search=simd%3Ci64%3E%2C%20simd%3Ci64%3E%20-%3E%20simd%3Ci64%3E) | [`simd<i64>, simd<i64> -> simd<i64>`](https://notriddle.com/rustdoc-demo-html-3/impl-disambiguate-search/std/index.html?search=simd%3Ci64%3E%2C%20simd%3Ci64%3E%20-%3E%20simd%3Ci64%3E) |
| [`cow, vec -> bool`](https://doc.rust-lang.org/nightly/std/?search=cow%2C%20vec%20-%3E%20bool) | [`cow, vec -> bool`](https://notriddle.com/rustdoc-demo-html-3/impl-disambiguate-search/std/index.html?search=cow%2C%20vec%20-%3E%20bool)

Helps with #90929

This changes the search results, specifically, when there's more than one impl with an associated item with the same name. For example, the search queries `simd<i8> -> simd<i8>` and `simd<i64> -> simd<i64>` don't link to the same function, but most of the functions have the same names.

This change should probably be FCP-ed, especially since it adds a new anchor link format for `main.js` to handle, so that URLs like `struct.Vec.html#impl-AsMut<[T]>-for-Vec<T,+A>/method.as_mut` redirect to `struct.Vec.html#method.as_mut-2`. It's a strange design, but there are a few reasons for it:

* I'd like to avoid making the HTML bigger. Obviously, fixing this bug is going to add at least a little more data to the search index, but adding more HTML penalises viewers for the benefit of searchers.

* Breaking `struct.Vec.html#method.len` would also be a disappointment.

On the other hand:

* The path-style anchors might be less prone to link rot than the numbered anchors. It's definitely less likely to have URLs that appear to "work", but silently point at the wrong thing.

* This commit arranges the path-style anchor to redirect to the numbered anchor. Nothing stops rustdoc from doing the opposite, making path-style anchors the default and redirecting the "legacy" numbered ones.

### The bug

On the "Before" links, this example search calls for `i64`:

![image](https://github.com/rust-lang/rust/assets/1593513/9431d89d-41dc-4f68-bbb1-3e2704a973d2)

But if I click any of the results, I get `f64` instead.

![image](https://github.com/rust-lang/rust/assets/1593513/6d89c692-1847-421a-84d9-22e359d9cf82)

The PR fixes this problem by adding enough information to the search result `href` to disambiguate methods with different types but the same name.

More detailed description of the problem at:
https://github.com/rust-lang/rust/pull/109422#issuecomment-1491089293

> When a struct/enum/union has multiple impls with different type parameters, it can have multiple methods that have the same name, but which are on different impls. Besides Simd, [Any](https://doc.rust-lang.org/nightly/std/any/trait.Any.html?search=any%3A%3Adowncast) also demonstrates this pattern. It has three methods named `downcast`, on three different impls.
>
> When that happens, it presents a challenge in linking to the method. Normally we link like `#method.foo`. When there are multiple `foo`, we number them like `#method.foo`, `#method.foo-1`, `#method.foo-2`, etc.
>
> It also presents a challenge for our search code. Currently we store all the variants in the index, but don’t have any way to generate unambiguous URLs in the results page, or to distinguish them in the SERP.
>
> To fix this, we need three things:
>
> 1. A fragment format that fully specifies the impl type parameters when needed to disambiguate (`#impl-SimdOrd-for-Simd<i64,+LANES>/method.simd_max`)
> 2. A search index that stores methods with enough information to disambiguate the impl they were on.
> 3. A search results interface that can display multiple methods on the same type with the same name, when appropriate OR a disambiguation landing section on item pages?
>
> For reviewers: it can be hard to see the new fragment format in action since it immediately gets rewritten to the numbered form.
2023-10-10 18:44:43 +02:00
bors 5b88d659f8 Auto merge of #116598 - matthiaskrgr:rollup-6xra4jx, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #116586 (use env variable to control thread ids in rustc_log)
 - #116589 (coverage: Unbox and simplify `bcb_filtered_successors`)
 - #116595 (-Zmir-enable-passes: document that this may enable unsound passes)
 - #116596 (reorder files in solve)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-10 13:29:09 +00:00
Matthias Krüger da42858b14
Rollup merge of #116596 - lcnr:normalize-subdir, r=compiler-errors
reorder files in solve

r? `@compiler-errors`
2023-10-10 14:07:48 +02:00
Matthias Krüger de4980cf44
Rollup merge of #116595 - RalfJung:mir-enable-passes, r=oli-obk
-Zmir-enable-passes: document that this may enable unsound passes

also add some comments explaining why MIR opts are marked as unsound
2023-10-10 14:07:48 +02:00
Matthias Krüger f4de82c2b3
Rollup merge of #116589 - Zalathar:successors, r=oli-obk
coverage: Unbox and simplify `bcb_filtered_successors`

This is a small cleanup in the coverage instrumentor's graph-building code.

---
This function already has access to the MIR body, so instead of taking a reference to a terminator, it's simpler and easier to pass in a basic block index.

There is no need to box the returned iterator if we instead add appropriate lifetime captures, and make `short_circuit_preorder` generic over the type of iterator it expects.

We can also greatly simplify the function's implementation by observing that the only difference between its two cases is whether we take all of a BB's successors, or just the first one.

---

`@rustbot` label +A-code-coverage
2023-10-10 14:07:47 +02:00
Matthias Krüger 0bc5696dd9
Rollup merge of #116586 - SparrowLii:parallel_log, r=oli-obk
use env variable to control thread ids in rustc_log

Currently, when parallel rustc is enabled, even if the number of threads is 1, the thread ID will be included before all the logs.
E.g.
`WARN rustc_mir_build::thir::pattern::const_to_pat ...`
=>
`2:rustcWARN rustc_mir_build::thir::pattern::const_to_pat ...`
This makes the logs confusing and results in inconsistent UI test results for serial and parallel rustc. Therefore I think we should let users decide whether thread id information is needed through explicit control.
2023-10-10 14:07:47 +02:00
bors 061c33051a Auto merge of #116551 - RalfJung:nondet-nan, r=oli-obk
miri: make NaN generation non-deterministic

This implements the [LLVM semantics for NaN generation](https://llvm.org/docs/LangRef.html#behavior-of-floating-point-nan-values). I will soon submit an RFC to make this also officially the Rust semantics, but it has been our de-facto semantics for a long time so there's no reason Miri has to wait for that RFC. This PR just better aligns Miri with codegen.

This PR does that just for the operations that have MIR primitives; a future PR will adjust the intrinsics.
2023-10-10 11:42:27 +00:00
Oğuz Ağcayazı 0bcb058fb1 add new wrapper for FxIndexMap 2023-10-10 13:18:31 +03:00
lcnr c70ef36f2c reorder files in solve 2023-10-10 09:55:22 +00:00
bors 5c37696f60 Auto merge of #116409 - Zalathar:span-extraction, r=oli-obk
coverage: Separate initial span extraction from span processing

One of the main subtasks of coverage instrumentation is looking through MIR to determine a list of source code spans that require coverage counters.

That task is in turn subdivided into a few main steps:
- Getting the initial spans from MIR statements/terminators
- Processing the list of spans to merge or truncate nearby spans as necessary
- Grouping the processed spans by their corresponding coverage graph node

---

This PR enforces a firmer separation between the first two steps (span extraction and span processing), which ends up slightly simplifying both steps, since they don't need to deal with state that is only meaningful for the other step.

---

`@rustbot` label +A-code-coverage
2023-10-10 09:55:15 +00:00
Ralf Jung d805b265db add some comments explaining why MIR opts are marked as unsound 2023-10-10 11:17:27 +02:00
Ralf Jung 2de454637f -Zmir-enable-passes: document that this may enable unsound passes 2023-10-10 11:08:47 +02:00
bors 091bb74e7e Auto merge of #116548 - nnethercote:assert-long-condition, r=matthewjasper
Improve handling of assertion failures with very long conditions

It's not perfectly clear what the best behaviour is here, but I think this is an improvement.

r? `@matthewjasper`
cc `@m-ou-se`
2023-10-10 08:02:20 +00:00
Zalathar 5d629457fd coverage: Unbox and simplify `bcb_filtered_successors`
This function already has access to the MIR body, so instead of taking a
reference to a terminator, it's simpler and easier to pass in a basic block
index.

There is no need to box the returned iterator if we instead add appropriate
lifetime captures, since `short_circuit_preorder` is now generic over the type
of iterator it expects.

We can also greatly simplify the function's implementation by observing that
the only difference between its two cases is whether we take all of a BB's
successors, or just the first one.
2023-10-10 18:45:29 +11:00
Zalathar f214497d22 coverage: Replace `ShortCircuitPreorder` with a single function
Instead of defining a named struct, we can use `std::iter::from_fn` and store
intermediate state in a closure.
2023-10-10 18:44:16 +11:00
bors 84d44dd1d8 Auto merge of #116366 - estebank:issue-103982, r=oli-obk
Suggest labeling block if `break` is in bare block

Fix #103982.
2023-10-10 06:04:08 +00:00
Zalathar 6c44425e98 coverage: Remove enum `CoverageStatement`
This enum was mainly needed to track the precise origin of a span in MIR, for
debug printing purposes. Since the old debug code was removed in #115962, we
can replace it with just the span itself.
2023-10-10 13:39:23 +11:00
Zalathar 4b471df25d coverage: Disconnect span extraction from `CoverageSpansGenerator`
By performal initial span extraction in a separate free function, we can remove
some accidental complexity from the main generator code.
2023-10-10 13:39:23 +11:00
Zalathar 972ab8863d coverage: Move initial MIR span extraction into a submodule 2023-10-10 13:39:23 +11:00
SparrowLii 2dcc828863 use env variable to control thread ids in rustc_log 2023-10-10 09:39:47 +08:00
bors fa6d1e7512 Auto merge of #109882 - ecnelises:aix_std, r=workingjubilee
Support AIX in Rust standard library

Also containing original contributions from `@bzEq` .
2023-10-10 00:08:23 +00:00
Esteban Küber d23dc2093c Account for macros 2023-10-09 22:48:10 +00:00
Nicholas Nethercote 7528fdc4c4 Don't `escape_debug` the condition of `assert!`.
The assertion in `assert-long-condition.rs` used to be fail like this, all on
one line:
```
thread 'main' panicked at 'assertion failed: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18\n                                + 19 + 20 + 21 + 22 + 23 + 24 + 25 == 0', tests/ui/macros/assert-long-condition.rs:7:5
```
The `\n` and subsequent indent is because the condition is pretty-printed, and
the pretty-printer inserts a newline. Printing the newline in this way is
arguably reasonable given that the message appears within single quotes, which
is very similar to a string literal.

However, after the assertion printing improvements that were released in 1.73,
the assertion now fails like this:
```
thread 'main' panicked at tests/ui/macros/assert-long-condition.rs:7:5:
assertion failed: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18\n                                + 19 + 20 + 21 + 22 + 23 + 24 + 25 == 0
```
Now that there are no single quotes around the pretty-printed condition, the
`\n` is quite strange.

This commit gets rid of the `\n`, by removing the `escape_debug` done on the
pretty-printed message. This results in the following:
```
thread 'main' panicked at tests/ui/macros/assert-long-condition.rs:7:5:
assertion failed: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18
                                + 19 + 20 + 21 + 22 + 23 + 24 + 25 == 0
```
The overly-large indent is still strange, but that's a separate pretty-printing issue.

This change helps with #108341.
2023-10-10 09:08:11 +11:00
Nicholas Nethercote 15c1a6b9e0 Add a ui test with an assertion that has a really long condition.
The `\n` in the output is a little surprising. The next commit will deal
with it.
2023-10-10 09:05:58 +11:00
bors 59edd67056 Auto merge of #116497 - compiler-errors:impl-span, r=cjgillot
Extend `impl`'s `def_span` to include its where clauses

Typically, we highlight the def-span of an impl in a diagnostic due to either:
1. coherence error
2. trait evaluation cycle
3. invalid implementation of built-in trait

I find that an impl's where clauses are very often required to understanding why these errors come about, which is unfortunate since where clauses may be located on different lines and don't show up in the error. This PR expands the def-span of impls to include these where clauses.

r? cjgillot since you've touched this code a while back to make some spans shorter, but you can also reassign to wg-diagnostics or compiler if you're busy or have no strong opinions.
2023-10-09 21:03:41 +00:00
Esteban Küber c30d57bb77 fix 2023-10-09 19:24:05 +00:00
Esteban Küber 5c17b8be61 Move some tests around 2023-10-09 19:24:05 +00:00
Esteban Küber daac011459 Suggest labeling block if `break` is in bare block
Fix #103982.
2023-10-09 19:24:05 +00:00
bors cdddcd3bea Auto merge of #116532 - onur-ozkan:enable-rustflags-bootstrap-on-bootstrap, r=albertlarsan68
Add RUSTFLAGS_BOOTSTRAP to RUSTFLAGS for bootstrap compilation

Adds `RUSTFLAGS_BOOTSTRAP` to `RUSTFLAGS` for bootstrap compilation when `RUSTFLAGS_BOOTSTRAP` exists in the environment. With this PR, `RUSTFLAGS_BOOTSTRAP` will affect every build(as we already do for rustc and std) compiled with stage0 compiler.

Resolves #94234
2023-10-09 17:14:17 +00:00
rustbot 7962b9641a Update books 2023-10-09 13:00:35 -04:00
bors 317783ad2c Auto merge of #116569 - matthiaskrgr:rollup-ni0jdd6, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #115882 (improve the suggestion of `generic_bound_failure`)
 - #116537 (Fix suggestion span involving wrongly placed generic arg on variant)
 - #116543 (In smir `find_crates` returns `Vec<Crate>` instead of `Option<Crate>`)
 - #116549 (Simplify some mir passes by using let chains)
 - #116556 (Sync rustc_codegen_cranelift)
 - #116561 (Add a test for fixed ICE)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-09 15:08:28 +00:00
Matthias Krüger 27a5146e7c
Rollup merge of #116561 - ouz-a:testfor_115517, r=compiler-errors
Add a test for fixed ICE

Addresses https://github.com/rust-lang/rust/issues/115517#issuecomment-1730164116

Closes #115517

r? ``@compiler-errors``
2023-10-09 16:26:03 +02:00
Matthias Krüger ea5cac02e8
Rollup merge of #116556 - bjorn3:sync_cg_clif-2023-10-09, r=bjorn3
Sync rustc_codegen_cranelift

The highlights this time are improved simd and inline asm support, `is_x86_feature_detected!()` returning the actual cpu features when inline asm support is enabled and a couple of bug fixes.

r? ```@ghost```

```@rustbot``` label +A-codegen +A-cranelift +T-compiler +subtree-sync
2023-10-09 16:26:02 +02:00
Matthias Krüger 148f5c1bdf
Rollup merge of #116549 - DaniPopes:miropts-let-chains, r=oli-obk
Simplify some mir passes by using let chains
2023-10-09 16:26:02 +02:00
Matthias Krüger 2266e79421
Rollup merge of #116543 - ouz-a:crate_return_vec, r=oli-obk
In smir `find_crates` returns `Vec<Crate>` instead of `Option<Crate>`

Addresses https://github.com/rust-lang/project-stable-mir/issues/40

r? `@oli-obk`
2023-10-09 16:26:01 +02:00
Matthias Krüger 374c885f4a
Rollup merge of #116537 - gurry:116473-ice-sugg-overlap, r=compiler-errors
Fix suggestion span involving wrongly placed generic arg on variant

Fixes #116473

The span computation was wrong. It went from the end of the variant to the end of the (wrongly placed) args. However, the variant lived in a different expansion and this resulted in a nonsensical span that overlaps with another and thereby leads to the ICE.

In the fix I've changed span computation to not be based on the location of the variant, but purely on the location of the args. I simply extend the start of the args span 2 positions to the left and that includes the `::` and that's all we need apparently.

This approach produces a correct span regardless of which macro/expansion the args reside in and where the variant is.
2023-10-09 16:26:01 +02:00
Matthias Krüger 389747c41d
Rollup merge of #115882 - aliemjay:diag-name-region-1, r=compiler-errors
improve the suggestion of `generic_bound_failure`

- Fixes #115375
- suggest the bound in the correct scope: trait or impl header vs assoc item. See `tests/ui/suggestions/lifetimes/type-param-bound-scope.rs`
- don't suggest a lifetime name that conflicts with the other late-bound regions of the function:
```rust
type Inv<'a> = *mut &'a ();
fn check_bound<'a, T: 'a>(_: T, _: Inv<'a>) {}
fn test<'a, T>(_: &'a str, t: T, lt: Inv<'_>) { // suggests a new name `'a`
    check_bound(t, lt); //~ ERROR
}
```
2023-10-09 16:26:00 +02:00
bors be581d9f82 Auto merge of #116142 - GuillaumeGomez:enum-variant-display, r=fmease
[rustdoc] Show enum discrimant if it is a C-like variant

Fixes https://github.com/rust-lang/rust/issues/101337.

We currently display values for associated constant items in traits:

![image](https://github.com/rust-lang/rust/assets/3050060/03e566ec-c670-47b4-8ca2-b982baa7a0f4)

And we also display constant values like [here](file:///home/imperio/rust/rust/build/x86_64-unknown-linux-gnu/doc/std/f32/consts/constant.E.html).

I think that for coherency, we should display values of C-like enum variants.

With this change, it looks like this:

![image](https://github.com/rust-lang/rust/assets/3050060/b53fbbe0-bdb1-4289-8537-f2dd4988e9ac)

As for the display of the constant value itself, I used what we already have to keep coherency.

We display the C-like variants value in the following scenario:
 1. It is a C-like variant with a value set => all the time
 2. It is a C-like variant without a value set: All other variants are C-like variants and at least one them has its value set.

Here is the result in code:

```rust
// Ax and Bx value will be displayed.
enum A {
    Ax = 12,
    Bx,
}

// Ax and Bx value will not be displayed
enum B {
    Ax,
    Bx,
}

// Bx value will not be displayed
enum C {
    Ax(u32),
    Bx,
}

// Bx value will not be displayed, Cx value will be displayed.
#[repr(u32)]
enum D {
    Ax(u32),
    Bx,
    Cx = 12,
}
```

r? `@notriddle`
2023-10-09 13:18:47 +00:00
Guillaume Gomez 1210aac1c0 Add more complex test cases for enum discriminant display 2023-10-09 14:33:04 +02:00
Guillaume Gomez 4b6fc8b70f Improve code 2023-10-09 14:26:52 +02:00
Michael Goulet 592163fb71 Extend impl's def_span to include where clauses 2023-10-09 11:47:02 +00:00
Oğuz Ağcayazı 2e000ebaa5 add test 2023-10-09 13:57:26 +03:00