Commit Graph

239640 Commits

Author SHA1 Message Date
Caleb Zulawski
20413b1947 Add test using non-power-of-two vector 2023-12-02 10:53:19 -05:00
Caleb Zulawski
329412dad3 Implement repr(packed) for repr(simd) 2023-12-02 10:53:19 -05: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
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
Michael Goulet
54ee79b3b8 Remove unused ObligationCauseCode::ProjectionWf 2023-11-25 22:10:37 +00:00
Nicholas Nethercote
af3fbb3607 Remove unnecessary dependencies. 2023-11-26 08:38:42 +11: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
1a4219da43 Add a useful comment. 2023-11-26 08:38:02 +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
Nicholas Nethercote
df9f83987a Remove rustc_error_messages/messages.ftl.
It's empty, and it doesn't even make sense, because
`rustc_error_messages` is a lower-level crate than `rustc_errors`.
2023-11-26 08:37:27 +11:00
bors
f5dc2653fd Auto merge of #118275 - weihanglo:update-cargo, r=ehuss
Update cargo

7 commits in 71cd3a926f0cf41eeaf9f2a7f2194b2aff85b0f6..9b13310ca596020a737aaa47daa4ed9ff8898a2f
2023-11-20 15:30:57 +0000 to 2023-11-24 16:20:51 +0000
- feat: Add `CARGO_RUSTC_CURRENT_DIR` (unstable) (rust-lang/cargo#12996)
- Exited with hard error when custom build file no existence or not in package (rust-lang/cargo#12995)
- try running on windows (rust-lang/cargo#13042)
- refactor(toml): Better abstract inheritance details (rust-lang/cargo#13021)
- cargo-test-support: Add features to the default Cargo.toml file (rust-lang/cargo#12997)
- Migrate rustfix to the cargo repo (rust-lang/cargo#13005)
- typo: rusc -&gt; rustc (rust-lang/cargo#13019)

---

This also removes the check to ensure that `rustfix` between

* src/tools/cargo
* src/tools/compiletest

has the same version,
since `rust-lang/rustfix` has migrated to under `rust-lang/cargo`.

r? ghost
2023-11-25 21:03:30 +00: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
Guillaume Gomez
e698de96ea
Rollup merge of #118291 - notriddle:notriddle/search-dom, r=GuillaumeGomez
rustdoc-search: clean up some DOM code
2023-11-25 19:51:56 +01:00
Guillaume Gomez
9b1da03102
Rollup merge of #118272 - petrochenkov:macrodata, r=cjgillot
resolve: Avoid clones of `MacroData`

And move declarative macro compilation to an earlier point in def collector, which is required for #118188.
2023-11-25 19:51:56 +01:00
Guillaume Gomez
8fb68fc3b0
Rollup merge of #118199 - compiler-errors:qpath, r=lcnr
Remove `HirId` from `QPath::LangItem`

Remove `HirId` from `QPath::LangItem`, since there was only *one* use-case (`ObligationCauseCode::AwaitableExpr`), which we can instead recover by walking the HIR tree.
2023-11-25 19:51:55 +01:00
Guillaume Gomez
5d2b6b3556
Rollup merge of #118017 - tamird:better-safety, r=cjgillot
rustc_lint: address latent TODO

See individual commits.
2023-11-25 19:51:54 +01:00
Guillaume Gomez
9a59b059d5
Rollup merge of #117871 - klensy:unused-pub, r=cjgillot
remove unused pub fns

This removes some unused `pub fn`; also fixes few obsoleted fn names or added fixmes with reminders to update them.
2023-11-25 19:51:54 +01:00
Guillaume Gomez
6361989b6d
Rollup merge of #116446 - compiler-errors:yeet-mir-from_anon_const, r=b-naber
Yeet `mir::Const::from_anon_const`

Only had one callsite which was easily simplified.

Uplifted a comment that I think is much more useful living in `ty::Const` world.
2023-11-25 19:51:53 +01:00
Michael Goulet
079a2e865f is_{some,ok}_and 2023-11-25 18:47:16 +00:00
Michael Goulet
4e23448c49 Appease the clippy 2023-11-25 18:02:11 +00:00
Michael Goulet
fa7633dda1 Remove HirId from QPath::LangItem 2023-11-25 18:02:11 +00:00
Michael Goulet
8bf9c18914 Review comment 2023-11-25 18:00:35 +00:00
Michael Goulet
82f23d56b7 make sure we still eagerly emit errors 2023-11-25 18:00:35 +00:00
Michael Goulet
a992defc8b Remove mir::Const::from_anon_const 2023-11-25 17:52:43 +00:00
Michael Goulet
1279f70bf4 Don't ICE when encountering placeholders in implied bounds computation 2023-11-25 17:40:52 +00:00
Michael Howell
884679ff63 rustdoc-search: clean up some DOM code 2023-11-25 10:39:45 -07:00
Michael Goulet
63b2f55e83 is_{some,ok}_and for rustdoc 2023-11-25 17:18:33 +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
fe3038f263 Auto merge of #118284 - RalfJung:miri, r=RalfJung
Miri subtree update
2023-11-25 15:07:16 +00:00
bors
547598b67e Auto merge of #3191 - RalfJung:rustup, r=RalfJung
Rustup
2023-11-25 13:27:26 +00:00