73 Commits
Author SHA1 Message Date
Marijn Schouten 5d8a096afe change non-canonical clone impl to {*self}, fix some doc comments 2025-12-20 13:46:22 +00:00
Nadrieril 2bb00741d4 pattern_analysis: add option to get a full set of witnesses 2025-07-20 18:27:30 +02:00
dianne bb64315978 only check for mixed deref/normal constructors when needed 2025-07-04 23:47:31 -07:00
dianne 50061f3b11 always check for mixed deref pattern and normal constructors
This makes it work for box patterns and in rust-analyzer.
2025-07-04 23:47:31 -07:00
est31 258e880861 Remove #![feature(let_chains)] from library and src/librustdoc 2025-05-16 16:14:24 +02:00
est31 7493e1cdf6 Make #![feature(let_chains)] bootstrap conditional in compiler/ 2025-04-23 16:40:30 +02:00
Nicholas Nethercote 8121958fda Use -Wunused_crate_dependencies for compiler crates.
It's very useful. There are some false positives involving integration
tests in `rustc_pattern_analysis` and `rustc_serialize`. There is also a
false positive involving `rustc_driver_impl`'s
`rustc_randomized_layouts` feature. And I removed a `rustc_span` mention
in a doc comment in `rustc_log` because it wasn't integral to the
comment but caused a dev-dependency.
2025-03-20 08:59:43 +11:00
Nicholas Nethercote ff0a5fe975 Remove #![warn(unreachable_pub)] from all compiler/ crates.
It's no longer necessary now that `-Wunreachable_pub` is being passed.
2025-03-11 13:14:21 +11:00
许杰友 Jieyou Xu (Joe) 063ef18fdc Revert "Use workspace lints for crates in compiler/ #138084"
Revert <https://github.com/rust-lang/rust/pull/138084> to buy time to
consider options that avoids breaking downstream usages of cargo on
distributed `rustc-src` artifacts, where such cargo invocations fail due
to inability to inherit `lints` from workspace root manifest's
`workspace.lints` (this is only valid for the source rust-lang/rust
workspace, but not really the distributed `rustc-src` artifacts).

This breakage was reported in
<https://github.com/rust-lang/rust/issues/138304>.

This reverts commit 48caf81484, reversing
changes made to c6662879b2.
2025-03-10 18:12:47 +08:00
Nicholas Nethercote 8a3e03392e Remove #![warn(unreachable_pub)] from all compiler/ crates.
(Except for `rustc_codegen_cranelift`.)

It's no longer necessary now that `unreachable_pub` is in the workspace
lints.
2025-03-08 08:41:43 +11:00
Michael Goulet 12e3911d81 Greatly simplify lifetime captures in edition 2024 2025-02-22 22:24:52 +00:00
Nicholas Nethercote 653ee7bc3a Add warn(unreachable_pub) to rustc_pattern_analysis. 2024-08-29 20:18:44 +10:00
Matthias Krüger 853255e28d Rollup merge of #128536 - Zalathar:print-cleanup, r=Nadrieril
Preliminary cleanup of `WitnessPat` hoisting/printing

Follow-up to #128430.

The eventual goal is to remove `print::Pat` entirely, but in the course of working towards that I made so many small improvements that it seems wise to let those be reviewed/merged on their own first.

Best reviewed commit-by-commit, most of which should be pretty simple and straightforward.

r? ``@Nadrieril``
2024-08-11 07:51:50 +02:00
Nadrieril cd40769c02 Stabilize min_exhaustive_patterns 2024-08-10 12:07:17 +02:00
Zalathar a245bfa617 Simplify hoisting of array/slice patterns
We can replace some tricky iterator-mutation code with a much simpler version
that uses `while let` to shrink a slice.

We also check whether a subpattern would be a wildcard _before_ hoisting it,
which will be very useful when trying to get rid of `print::PatKind` later.
2024-08-07 21:44:52 +10:00
Nadrieril bab8ede761 Move rustc-specific entrypoint to the rustc module 2024-07-24 08:02:55 +02:00
Nicholas Nethercote 75b6ec9800 Avoid comments that describe multiple use items.
There are some comments describing multiple subsequent `use` items. When
the big `use` reformatting happens some of these `use` items will be
reordered, possibly moving them away from the comment. With this
additional level of formatting it's not really feasible to have comments
of this type. This commit removes them in various ways:

- merging separate `use` items when appropriate;

- inserting blank lines between the comment and the first `use` item;

- outright deletion (for comments that are relatively low-value);

- adding a separate "top-level" comment.

We also entirely skip formatting for four library files that contain
nothing but `pub use` re-exports, where reordering would be painful.
2024-07-17 08:02:46 +10:00
Nicholas Nethercote 75b164d836 Use tidy to sort crate attributes for all compiler crates.
We already do this for a number of crates, e.g. `rustc_middle`,
`rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`.

For the ones we don't, in many cases the attributes are a mess.
- There is no consistency about order of attribute kinds (e.g.
  `allow`/`deny`/`feature`).
- Within attribute kind groups (e.g. the `feature` attributes),
  sometimes the order is alphabetical, and sometimes there is no
  particular order.
- Sometimes the attributes of a particular kind aren't even grouped
  all together, e.g. there might be a `feature`, then an `allow`, then
  another `feature`.

This commit extends the existing sorting to all compiler crates,
increasing consistency. If any new attribute line is added there is now
only one place it can go -- no need for arbitrary decisions.

Exceptions:
- `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`,
  because they have no crate attributes.
- `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's
  ignored in `rustfmt.toml`).
2024-06-12 15:49:10 +10:00
Nicholas Nethercote 6341935a13 Remove extern crate tracing from numerous crates. 2024-04-30 16:47:49 +10:00
Nicholas Nethercote 99e036bd21 Remove extern crate rustc_middle from numerous crates. 2024-04-29 14:50:45 +10:00
Nadrieril e1b8441899 Require enum indices to be contiguous 2024-03-30 16:22:43 +01:00
Nadrieril d697dd44d1 Add a crate-custom test harness 2024-03-19 02:22:43 +01:00
Nadrieril e4487ad391 Improve the WitnessPat: Debug impl 2024-03-19 02:22:43 +01:00
Nadrieril f27540697e Rename RustcMatchCheckCtxt -> RustcPatCtxt 2024-03-13 14:07:44 +01:00
Nadrieril 4fc35c46ff Rename TypeCx -> PatCx 2024-03-13 13:56:38 +01:00