Commit Graph

6150 Commits

Author SHA1 Message Date
Eduardo Sánchez Muñoz
51ba662d23 Print list of missing target features when calling a function with target features outside an unsafe block 2023-11-27 19:13:11 +01:00
bors
9529a5d265 Auto merge of #110303 - nbdd0121:master, r=Mark-Simulacrum
Add `debug_assert_nounwind` and convert `assert_unsafe_precondition`

`assert_unsafe_precondition` checks non-CTFE-evaluable conditions in runtime and performs no-op in compile time, while many of its current usage can be checked during const eval.
2023-11-26 06:44:03 +00:00
bors
33f6af8052 Auto merge of #118300 - compiler-errors:rollup-cm3i8fg, r=compiler-errors
Rollup of 7 pull requests

Successful merges:

 - #117651 (coverage: Simplify building coverage expressions based on sums)
 - #117968 (Stabilize `ptr::addr_eq`)
 - #118158 (Reduce fluent boilerplate)
 - #118201 (Miscellaneous `ObligationCauseCode` cleanups)
 - #118288 (Use `is_{some,ok}_and` more in the compiler)
 - #118289 (`is_{some,ok}_and` for rustdoc)
 - #118290 (Don't ICE when encountering placeholders in implied bounds computation)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-26 02:28:05 +00:00
Gary Guo
2c03f21d1f Bless MIR tests 2023-11-26 00:14:18 +00:00
bors
ee80c8d0a8 Auto merge of #117611 - Nadrieril:linear-pass-take-4, r=cjgillot
Rewrite exhaustiveness in one pass

This is at least my 4th attempt at this in as many years x) Previous attempts were all too complicated or too slow. But we're finally here!

The previous version of the exhaustiveness algorithm computed reachability for each arm then exhaustiveness of the whole match. Since each of these steps does roughly the same things, this rewrites the algorithm to do them all in one go. I also think this makes things much simpler.

I also rewrote the documentation of the algorithm in depth. Hopefully it's up-to-date and easier to follow now. Plz comment if anything's unclear.

r? `@oli-obk` I think you're one of the rare other people to understand the exhaustiveness algorithm?

cc `@varkor` I know you're not active anymore, but if you feel like having a look you might enjoy this :D

Fixes https://github.com/rust-lang/rust/issues/79307
2023-11-26 00:14:14 +00:00
Gary Guo
ece0d6e79a Fix tests 2023-11-25 23:58:52 +00:00
Michael Goulet
2eccebb84d
Rollup merge of #118290 - compiler-errors:placeholder-implied, r=aliemjay
Don't ICE when encountering placeholders in implied bounds computation

I *could* fix this the right way, though I don't really want to think about the implications of the change. This should have minimal side-effects.

r? `@aliemjay`

Fixes #118286
2023-11-25 17:23:35 -05:00
Michael Goulet
3b2f33ee28
Rollup merge of #118158 - nnethercote:reduce-fluent-boilerplate, r=compiler-errors
Reduce fluent boilerplate

Best reviewed one commit at a time.

r? `@davidtwco`
2023-11-25 17:23:33 -05:00
Michael Goulet
fd1a263fc7
Rollup merge of #117651 - Zalathar:fold-sums, r=cjgillot
coverage: Simplify building coverage expressions based on sums

This is a combination of some interlinked changes to the code that creates coverage counters/expressions for nodes and edges in the coverage graph:

- Some preparatory cleanups in `MakeBcbCounters::make_branch_counters`
- Use `BcbCounter` (instead of `CovTerm`) when building coverage expressions
  - This makes it easier to introduce a fold for building sums
- Simplify the creation of coverage expressions based on sums, by having `Iterator::fold` do much of the work
- Get rid of the awkward `BcbBranch` enum, and replace it with graph edges represented as `(from_bcb, to_bcb)`
  - This further simplifies the body of the fold
2023-11-25 17:23:32 -05:00
Nicholas Nethercote
57cd5e6551 Use rustc_fluent_macro::fluent_messages! directly.
Currently we always do this:
```
use rustc_fluent_macro::fluent_messages;
...
fluent_messages! { "./example.ftl" }
```
But there is no need, we can just do this everywhere:
```
rustc_fluent_macro::fluent_messages! { "./example.ftl" }
```
which is shorter.
2023-11-26 08:38:40 +11:00
Nicholas Nethercote
a733082be9 Avoid need for {D,Subd}iagnosticMessage imports.
The `fluent_messages!` macro produces uses of
`crate::{D,Subd}iagnosticMessage`, which means that every crate using
the macro must have this import:
```
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
```

This commit changes the macro to instead use
`rustc_errors::{D,Subd}iagnosticMessage`, which avoids the need for the
imports.
2023-11-26 08:38:00 +11:00
bors
ec1393f14e Auto merge of #118294 - GuillaumeGomez:rollup-ij2bzwt, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #116446 (Yeet `mir::Const::from_anon_const`)
 - #117871 (remove unused pub fns)
 - #118017 (rustc_lint: address latent TODO)
 - #118199 (Remove `HirId` from `QPath::LangItem`)
 - #118272 (resolve: Avoid clones of `MacroData`)
 - #118291 (rustdoc-search: clean up some DOM code)

Failed merges:

 - #118201 (Miscellaneous `ObligationCauseCode` cleanups)
 - #118256 (rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` cleanup)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-25 19:04:22 +00:00
Michael Goulet
82f23d56b7 make sure we still eagerly emit errors 2023-11-25 18:00:35 +00:00
Michael Goulet
1279f70bf4 Don't ICE when encountering placeholders in implied bounds computation 2023-11-25 17:40:52 +00:00
bors
16087eeea8 Auto merge of #118127 - RalfJung:unadjusted-abi, r=compiler-errors
the unadjusted ABI needs to pass aggregates by-value

Fixes https://github.com/rust-lang/rust/issues/118124, a regression introduced in https://github.com/rust-lang/rust/pull/117500
2023-11-25 17:06:22 +00:00
bors
3668a8af1b Auto merge of #118277 - fmease:rollup-itucldm, r=fmease
Rollup of 9 pull requests

Successful merges:

 - #118220 (general improvements/fixes on bootstrap)
 - #118251 (rustdoc-search: avoid infinite where clause unbox)
 - #118253 (Replace `option.map(cond) == Some(true)` with `option.is_some_and(cond)`)
 - #118255 (Request that rust-analyzer changes are sent upstream first if possible)
 - #118259 (Move EagerResolution to rustc_infer::infer::resolve)
 - #118262 (Relate Inherent Associated Types using eq)
 - #118266 (Move stuff around on `stable_mir` and `rustc_smir` crate)
 - #118271 (Separate `NaN`/`Inf` floats with `_`)
 - #118274 (Fix smir's `Ty::Ref` pretty printing)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-25 11:08:37 +00:00
León Orell Valerian Liehr
0304aac0f3
Rollup merge of #118251 - notriddle:notriddle/less-recursion, r=GuillaumeGomez
rustdoc-search: avoid infinite where clause unbox

Fixes #118242
2023-11-25 10:21:06 +01:00
bors
fad6bb80fa Auto merge of #118075 - tmiasko:validate-critical-call-edges, r=cjgillot
Validate there are no critical call edges in optimized MIR
2023-11-25 09:10:44 +00:00
Zalathar
a1e2c10b1f coverage: Simplify building coverage expressions based on sums
In some cases we need to prepare a coverage expression that is the sum of an
arbitrary number of other terms. This patch simplifies the code paths that
build those sums.

This causes some churn in the mappings, because the previous code was building
its sums in a somewhat idiosyncratic order.
2023-11-25 12:29:20 +11:00
bors
37b2813a7b Auto merge of #118138 - Nilstrieb:one-previous-error, r=WaffleLapkin
Fixes error count display is different when there's only one error left

Supersedes #114759

### What did I do?

I did the small change in `rustc_errors` by hand. Then I did the other changes in `/compiler` by hand, those were just find replace on `*.rs` in the workspace. The changes in run-make are find replace for `run-make` in the workspace.

All other changes are blessed using `x test TEST --bless`. I blessed the tests that were blessed in #114759.

### how to review this nightmare

ping bors with an `r+`. You should check that my logic is sound and maybe quickly scroll through the diff, but fully verifying it seems fairly hard to impossible. I did my best to do this correctly.

Thank you `@adrianEffe` for bringing this up and your initial implementation.

cc `@flip1995,` you said you want to do a subtree sync asap
cc `@RalfJung` maybe you want to do a quick subtree sync afterwards as well for Miri

r? `@WaffleLapkin`
2023-11-24 21:40:54 +00:00
Nilstrieb
c73d392a01 Bless ui-fulldeps
We have to ignore some tests in stage1.
2023-11-24 21:56:22 +01:00
Nilstrieb
9b80d85722 Manual find replace updates 2023-11-24 21:04:51 +01:00
Nilstrieb
0346765100 Bless run-make tests
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
Nilstrieb
87a354b15d Bless rustdoc-ui tests
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
Nilstrieb
41e8d152dc Show number in error message even for one error
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
Michael Howell
1b7b9540fe rustdoc-search: avoid infinite where clause unbox
Fixes #118242
2023-11-24 10:42:11 -07:00
bors
42ae1a7615 Auto merge of #118248 - compiler-errors:rollup-tye3vgj, r=compiler-errors
Rollup of 7 pull requests

Successful merges:

 - #118187 (Recompile LLVM when it changes in the git sources)
 - #118210 (intercrate ambiguity causes: ignore candidates which don't apply)
 - #118215 (Add common trait for crate definitions)
 - #118238 (memcpy assumptions: update GCC link)
 - #118243 (EvalCtxt::commit_if_ok don't inherit nested goals)
 - #118245 (Add `Span` to `TraitBoundModifier`)
 - #118246 (Remove a hack for effects)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-24 17:24:47 +00:00
Michael Goulet
b5d336ffae
Rollup merge of #118245 - fee1-dead-contrib:span-tilde-const, r=compiler-errors
Add `Span` to `TraitBoundModifier`

This improves diagnostics for the message "`~const` is not allowed here", and also fixes the span that we use when desugaring `~const Tr` into `Tr<host>` in effects desugaring.
2023-11-24 07:29:13 -08:00
Michael Goulet
8294352b2d
Rollup merge of #118215 - celinval:smir-def-paths, r=ouz-a
Add common trait for crate definitions

In stable mir, we specialize DefId, however some functionality is the same for every definition, such as def paths, and getting their crate. Use a trait to implement those.
2023-11-24 07:29:12 -08:00
Michael Goulet
ffacd5463a
Rollup merge of #118210 - lcnr:intercrate-ambiguity-causes-uwu, r=compiler-errors
intercrate ambiguity causes: ignore candidates which don't apply

r? `@compiler-errors`
2023-11-24 07:29:11 -08:00
bors
4fd68eb47b Auto merge of #117934 - Young-Flash:dev, r=petrochenkov
feat: make `let_binding_suggestion` more reasonable

This is my first PR for rustc, which trying to fix https://github.com/rust-lang/rust/issues/117894, I am not familiar with some internal api so maybe some modification here isn't the way to go, appreciated for any review suggestion.
2023-11-24 15:26:04 +00:00
Deadbeef
16040a1628 Add Span to TraitBoundModifier 2023-11-24 14:32:05 +00:00
Matthias Krüger
98bae8195d
Rollup merge of #118224 - dtolnay:rustdocsortunstable, r=fmease
Sort unstable items last in rustdoc, instead of first

As far as I can tell, this is a bug introduced inadvertently by https://github.com/rust-lang/rust/pull/77817 in Rust 1.49. Older toolchains used to sort unstable items last.

Notice how in the code before that PR, `(Unstable, Stable) => return Ordering::Greater` in src/librustdoc/html/render/mod.rs. Whereas after that PR, `(Unstable, Stable) => return Ordering::Less`.

Compare https://doc.rust-lang.org/1.48.0/std/marker/index.html vs https://doc.rust-lang.org/1.49.0/std/marker/index.html.
2023-11-24 08:23:54 +01:00
bors
eab8c7d5fd Auto merge of #118105 - notriddle:master, r=fmease
rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 4)

Follow up

* https://github.com/rust-lang/rust/pull/116214
* https://github.com/rust-lang/rust/pull/116432
* https://github.com/rust-lang/rust/pull/116824
2023-11-24 02:23:31 +00:00
David Tolnay
b77aa74a2d
Sort unstable items last in rustdoc, instead of first 2023-11-23 17:20:13 -08:00
David Tolnay
a994f46421
Add test of rustdoc sort order for stable vs unstable item 2023-11-23 17:20:13 -08:00
Michael Howell
4f64ff171b rustdoc: move doctest tests to folder 2023-11-23 14:56:03 -07:00
Michael Howell
fdde5c77a8 rustdoc: move ICE tests to ui 2023-11-23 14:54:19 -07:00
bors
a4a5c976fe Auto merge of #118192 - Kyuuhachi:issue-118180, r=fmease
Don't print "private fields" on empty tuple structs

Closes #118180.

While working on this I also noticed that empty struct variants are also rendered rather awkwardly. I'll make another issue for that, since I don't know what the correct rendering would be.
2023-11-23 17:41:46 +00:00
Kyuuhachi
a21d7713db Don't print "private fields" on empty tuple structs
Test for presence rather than absence

Remove redundant tests

Issues in those parts will likely be caught by other parts of the test suite.
2023-11-23 16:04:10 +01:00
Vadim Petrochenkov
edf6c9c223 Add an experimental feature gate for function delegation
In accordance with the [process](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md).

Detailed description of the feature can be found in the RFC repo - https://github.com/rust-lang/rfcs/pull/3530.
2023-11-23 17:27:31 +03:00
lcnr
d51ef5c1af fix intercrate ambiguity causes 2023-11-23 12:25:41 +00:00
Young-Flash
c710db8ea7 feat: make let_binding_suggestion more reasonable 2023-11-23 20:22:17 +08:00
Matthias Krüger
add423bcf7
Rollup merge of #118146 - compiler-errors:deref-into-dyn-regions, r=lcnr
Rework supertrait lint once again

I accidentally pushed the wrong commits because I totally didn't check I was on the right computer when updating #118026.
Sorry, this should address all the nits in #118026.

r? lcnr
2023-11-23 07:06:30 +01:00
Matthias Krüger
82538b72c0
Rollup merge of #118131 - lukas-code:multi-default, r=wesleywiser
improve tool-only help for multiple `#[default]` variants

When defining an enum with multiple `#[default]` variants, we emit a tool-only suggestion for every `#[default]`ed variant to remove all other `#[default]`s. This PR improves the suggestion to correctly handle the cases where one variant has multiple `#[default]`s and where different `#[default]`s have the same span due to macro expansions.

fixes https://github.com/rust-lang/rust/issues/118119
2023-11-23 07:06:30 +01:00
bors
360bafad68 Auto merge of #118065 - estebank:core-not-found-404, r=TaKO8Ki
When failing to import `core`, suggest `std`
2023-11-23 02:26:52 +00:00
Michael Goulet
15fbcc3636 Rework supertrait lint once again 2023-11-22 21:51:39 +00:00
Esteban Küber
ec50f1c90b When failing to import core, suggest std 2023-11-22 19:30:47 +00:00
bors
06d1afe518 Auto merge of #118178 - compiler-errors:rollup-0i11w85, r=compiler-errors
Rollup of 6 pull requests

Successful merges:

 - #118012 (Add support for global allocation in smir)
 - #118013 (Enable Rust to use the EHCont security feature of Windows)
 - #118100 (Enable profiler in dist-powerpc64-linux)
 - #118142 (Tighten up link attributes for llvm-wrapper bindings)
 - #118147 (Fix some unnecessary casts)
 - #118161 (Allow defining opaques in `check_coroutine_obligations`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-22 18:49:51 +00:00
Michael Goulet
4ec548afbe
Rollup merge of #118161 - compiler-errors:coroutine-obligation-opaques, r=lcnr
Allow defining opaques in `check_coroutine_obligations`

In the new trait solver, when an obligation stalls on an unresolved coroutine witness, we will stash away the *root* obligation, even if the stalled obligation is only a distant descendent of the root obligation, since the new solver is purely recursive.

This means that we may need to reprocess alias-relate obligations (and others) which may define opaque types in the new solver. Currently, we use the coroutine's def id as the defining anchor in `check_coroutine_obligations`, which will allow defining no opaque types, resulting in errors like:

```
error[E0271]: type mismatch resolving `{coroutine@<source>:6:5: 6:17} <: impl Clone`
 --> <source>:6:5
  |
6 | /     move |_: ()| {
7 | |         let () = yield ();
8 | |     }
  | |_____^ types differ
```

So this PR fixes the defining anchor and does the same trick as `check_opaque_well_formed`, where we manually compare opaques that were defined against their hidden types to make sure they weren't defined differently when processing these stalled coroutine obligations.

r? `@lcnr` cc `@cjgillot`
2023-11-22 09:28:52 -08:00