Commit Graph

239669 Commits

Author SHA1 Message Date
Nicholas Nethercote
4b90b26fd8 Move WasiExecModel.
All the other option enums are defined in `config.rs`.
2023-12-01 08:00:56 +11:00
Nicholas Nethercote
5f11d19be5 Reduce pub exposure. 2023-12-01 08:00:53 +11:00
Nicholas Nethercote
b6d0493388 Inline and remove select_debuginfo_compression.
It's trivial and has a single callsite.
2023-11-30 17:28:33 +11:00
Nicholas Nethercote
20046ceb40 Sort PRINT_KINDS.
Alphabetical order is nicer than random order.
2023-11-30 17:28:29 +11:00
Nicholas Nethercote
24d4fe4cd9 Improve integer interning in default_configuration.
We have `sym::integer` for interning integers. Using it lets us use
symbols directy, and not have to explicitly go through strings.
2023-11-30 17:05:56 +11:00
Nicholas Nethercote
dba94164e9 Move is_ascii_ident to where it's used. 2023-11-30 17:05:56 +11:00
Nicholas Nethercote
f8ce1864d3 Update a comment.
Save analysis was removed a while ago.
2023-11-30 17:05:56 +11:00
Nicholas Nethercote
c5408b6617 Remove unused FileMatch. 2023-11-30 17:05:56 +11:00
Nicholas Nethercote
99ac405b96 Move MetadataLoader{,Dyn} to rustc_metadata.
They're not used in `rustc_session`, and `rustc_metadata` is a more
obvious location.

`MetadataLoader` was originally put into `rustc_session` in #41565 to
avoid a dependency on LLVM, but things have changed a lot since then and
that's no longer relevant, e.g. `rustc_codegen_llvm` depends on
`rustc_metadata`.
2023-11-30 17:05:54 +11:00
Nicholas Nethercote
3521abde39 Reorder some use items. 2023-11-30 16:59:28 +11:00
Nicholas Nethercote
866aa2db66 Remove unused features. 2023-11-30 16:59:22 +11:00
bors
1bcbb7c93b Auto merge of #117697 - WaffleLapkin:non-null-convenience-ops, r=Amanieu
Non null convenience ops

Based on https://github.com/rust-lang/libs-team/issues/251.

I went through all of the methods on `*mut` and added every method, which does not require additional safety conditions, to `NonNull`. (exceptions: `guaranteed_eq`, `guaranteed_ne`, `with_metadata_of`, it's unclear if they are useful here...)

I'm also not sure what types should the "second pointer parameter" be. `*mut`/`*const` might be more permissible, but given that `NonNull` doesn't coerce to them, it might also be annoying. For now I chose the "use `NonNull` everywhere" path, but I'm not sure it's the correct one...

<sub>I'm eepy, so I probably messed up somewhere while copying...</sub>

cc `@scottmcm`
r? libs-api
2023-11-26 18:41:55 +00:00
bors
3bb0171999 Auto merge of #118319 - GuillaumeGomez:rollup-vte50yq, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #118296 (rustdoc: replace `elemIsInParent` with `Node.contains`)
 - #118302 (Clean dead codes)
 - #118311 (merge `DefKind::Coroutine` into `Defkind::Closure`)
 - #118318 (Remove myself from users on vacation)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-26 16:42:32 +00:00
Maybe Waffle
e1b4e8a257 Add is_aligned{,_to} convenience methods to NonNull 2023-11-26 16:01:31 +00:00
Maybe Waffle
2bcaa9760e Add align_offset convenience method to NonNull 2023-11-26 16:01:30 +00:00
Maybe Waffle
4cc46df98c Add replace and swap convenience methods to NonNull 2023-11-26 16:01:30 +00:00
Maybe Waffle
4bcdd3bd92 Add offset_from-ish convenience methods to NonNull 2023-11-26 16:01:30 +00:00
Maybe Waffle
ebdc79497f Add offset-ish convenience methods to NonNull 2023-11-26 16:01:30 +00:00
Maybe Waffle
36a587fb62 Add read/write/copy convenience methods to NonNull 2023-11-26 15:57:01 +00:00
Guillaume Gomez
cb04603af4
Rollup merge of #118318 - WaffleLapkin:unvacation-waffle, r=WaffleLapkin
Remove myself from users on vacation

I think I have some capacity for reviews now and recently there were a few PRs with explicit `r? `@WaffleLapkin`` which I'm actually capable to review, so
2023-11-26 15:44:55 +01:00
Guillaume Gomez
c6d20d70b4
Rollup merge of #118311 - bvanjoi:merge_coroutinue_into_closure, r=petrochenkov
merge `DefKind::Coroutine` into `Defkind::Closure`

Related to #118188

We no longer need to be concerned about the precise type whether it's `DefKind::Closure` or `DefKind::Coroutine`.

Furthermore, thanks for the great work done by `@petrochenkov` on investigating https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Why.20does.20it.20hang.20when.20querying.20.EF.BB.BF.60opt_def_kind.60.3F

r? `@petrochenkov`
2023-11-26 15:44:54 +01:00
Guillaume Gomez
c67613bef9
Rollup merge of #118302 - mu001999:dead_code/clean, r=cjgillot
Clean dead codes

Clean dead codes detected by #118257
2023-11-26 15:44:54 +01:00
Guillaume Gomez
bb5bbbf4ea
Rollup merge of #118296 - notriddle:notriddle/main-dom, r=GuillaumeGomez
rustdoc: replace `elemIsInParent` with `Node.contains`

According to [MDN], this function is compatible with:

* Chrome 16 and Edge 12
* Firefox 9
* Safari 1.1 and iOS Safari 1

These browsers are well within our [support matrix], which requires compatibility with Chrome 118, Firefox 115, Safari 17, and Edge 119.

[MDN]: https://developer.mozilla.org/en-US/docs/Web/API/Node/contains#browser_compatibility
[support matrix]: https://browsersl.ist/#q=last+2+Chrome+versions%2C+last+1+Firefox+version%2C+Firefox+ESR%2C+last+1+Safari+version%2C+last+1+iOS+version%2C+last+1+Edge+version%2C+last+1+UCAndroid+version
2023-11-26 15:44:53 +01:00
bors
3dbb4da042 Auto merge of #117301 - saethlin:finish-rmeta-encoding, r=WaffleLapkin
Call FileEncoder::finish in rmeta encoding

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

The bug here was that rmeta encoding never called FileEncoder::finish. Now it does. Most of the changes here are needed to support that, since rmeta encoding wants to finish _then_ access the File in the encoder, so finish can't move out.

I tried adding a `cfg(debug_assertions)` exploding Drop impl to FileEncoder that checked for finish being called before dropping, but fatal errors cause unwinding so this isn't really possible. If we encounter a fatal error with a dirty FileEncoder, the Drop impl ICEs even though the implementation is correct. If we try to paper over that by wrapping FileEncoder in ManuallyDrop then that just erases the fact that Drop automatically checks that we call finish on all paths.

I also changed the name of DepGraph::encode to DepGraph::finish_encoding, because that's what it does and it makes the fact that it is the path to FileEncoder::finish less confusing.

r? `@WaffleLapkin`
2023-11-26 14:43:02 +00:00
Waffle Maybe
4a22b1aa1c
Remove myself from users on vacation 2023-11-26 15:33:34 +01:00
bohan
f23befe6c1 merge DefKind::Coroutine into DefKind::Closure 2023-11-26 21:05:08 +08:00
bors
0b8a61b235 Auto merge of #118267 - compiler-errors:ambiguity-causes, r=spastorino
`AmbiguityCause` should not eagerly format strings

Minor tweak found when working on some coherence diagnostics stuff (towards `-Ztrait-solver=next-coherence` stabilization)
2023-11-26 12:44:38 +00:00
bors
3acb261e21 Auto merge of #118256 - petrochenkov:nohir, r=compiler-errors
rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` cleanup

Noticed this while working on https://github.com/rust-lang/rust/pull/118188.

The history here is that the method was moved from HIR map to tcx in https://github.com/rust-lang/rust/pull/93373 as a part of incremental compilation work, so it's unlikely to go back.
2023-11-26 10:43:41 +00:00
Vadim Petrochenkov
c697927f44 rustc: hir().local_def_id_to_hir_id() -> tcx.local_def_id_to_hir_id() cleanup 2023-11-26 12:41:21 +03:00
bors
274b5249eb Auto merge of #117880 - lqd:liveness-values, r=cjgillot
Refactor borrowck liveness values

This PR starts cleaning up `rustc_borrowck`, in particular around liveness values:
- refactors simple names that make no sense anymore: either referring to older structures using region elements, or to bitset containers and values.
- improves comments and fixes others
- removes unused return values and unneeded generic arguments

r? `@matthewjasper`
2023-11-26 08:44:28 +00: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
5c97719393 Auto merge of #118250 - petrochenkov:optdefkind, r=compiler-errors
rustc: Make `def_kind` mandatory for all `DefId`s

Prerequisite for https://github.com/rust-lang/rust/pull/118188.
2023-11-26 04:44:20 +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
r0cky
91aee2de15 Clean dead codes 2023-11-26 09:25:07 +08: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
Gary Guo
81cd49ddde Address review feedback 2023-11-25 23:58:51 +00:00
Gary Guo
97c1502066 Convert many assert_unsafe_precondition to debug_assert_nounwind 2023-11-25 23:58:51 +00:00
Gary Guo
4ccec4558f Add debug_assert_nounwind 2023-11-25 23:58:51 +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
58ab518e1d
Rollup merge of #118289 - compiler-errors:is_some_and_rustdoc, r=fmease
`is_{some,ok}_and` for rustdoc

slightly more fluent-reading code

r? fmease
2023-11-25 17:23:35 -05:00
Michael Goulet
8dd8db5073
Rollup merge of #118288 - compiler-errors:is_some_and, r=lqd,dtolnay
Use `is_{some,ok}_and` more in the compiler

slightly more fluent-reading code
2023-11-25 17:23:34 -05:00
Michael Goulet
f4b7f35c4d
Rollup merge of #118201 - compiler-errors:obligation-causes, r=cjgillot
Miscellaneous `ObligationCauseCode` cleanups

Remove some dead code/unused `ObligationCauseCode`s.
2023-11-25 17:23:34 -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
fcb9fcc28c
Rollup merge of #117968 - Urgau:stabilize-ptr-addr-eq, r=dtolnay
Stabilize `ptr::addr_eq`

This PR stabilize the `ptr_addr_eq` library feature, representing:

```rust
// core::ptr

pub fn addr_eq<T: ?Sized, U: ?Sized>(p: *const T, q: *const U) -> bool;
```

FCP has already started [on the tracking issue](https://github.com/rust-lang/rust/issues/116324#issuecomment-1813008697) and is waiting on the final period comment.

Note: stabilizing this feature is somewhat of requirement for a new T-lang lint, cf. https://github.com/rust-lang/rust/pull/117758#issuecomment-1813183686.
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
Michael Goulet
ca56739366 Remove 3 more unused ObligationCauseCodes 2023-11-25 22:10:52 +00:00
Michael Goulet
3e769c55b8 Remove some more unused codepaths in (region) error reporting 2023-11-25 22:10:38 +00:00
Michael Goulet
0f9ab6371d Remove some lifetime-only ObligationCauseCode notes 2023-11-25 22:10:38 +00:00