Commit graph

10681 commits

Author SHA1 Message Date
omahs
1caaa88700 Fix typos 2025-05-12 17:20:49 +00:00
bors
6812af9821 Auto merge of #140842 - tmiasko:print-mono-items, r=saethlin
Remove mono item collection strategy override from -Zprint-mono-items

Previously `-Zprint-mono-items` would override the mono item collection
strategy. When debugging one doesn't want to change the behaviour, so
this was counter productive. Additionally, the produced behaviour was
artificial and might never arise without using the option in the first
place (`-Zprint-mono-items=eager` without `-Clink-dead-code`).  Finally,
the option was incorrectly marked as `UNTRACKED`.

Resolve those issues, by turning `-Zprint-mono-items` into a boolean
flag that prints results of mono item collection without changing the
behaviour of mono item collection.

For codegen-units test incorporate `-Zprint-mono-items` flag directly
into compiletest tool.

Test changes are mechanical. `-Zprint-mono-items=lazy` was removed
without additional changes, and `-Zprint-mono-items=eager` was turned
into `-Clink-dead-code`.  Linking dead code disables internalization, so
tests have been updated accordingly.
2025-05-11 22:15:30 +00:00
León Orell Valerian Liehr
e5835d5f76
Rollup merge of #140882 - Dietr1ch:dev/duration_constructors_lite, r=BurntSushi
Split duration_constructors to get non-controversial constructors out

This implements #140881
2025-05-11 02:44:39 +02:00
Dietrich Daroch
ed799c2019 Split duration_constructors to get non-controversial bits out faster. 2025-05-09 22:52:39 -04:00
Matthias Krüger
ab1f382ca8
Rollup merge of #140852 - est31:edition_guide_let_chains, r=ehuss
Update the edition guide for let chains

Pull https://github.com/rust-lang/edition-guide/pull/337 into the rustc tree.
2025-05-09 21:50:09 +02:00
est31
577e82f71b Update the edition guide for let chains 2025-05-09 17:11:29 +02:00
Tomasz Miąsko
8c8225afe8 Remove mono item collection strategy override from -Zprint-mono-items
Previously `-Zprint-mono-items` would override the mono item collection
strategy. When debugging one doesn't want to change the behaviour, so
this was counter productive. Additionally, the produced behaviour was
artificial and might never arise without using the option in the first
place (`-Zprint-mono-items=eager` without `-Clink-dead-code`).  Finally,
the option was incorrectly marked as `UNTRACKED`.

Resolve those issues, by turning `-Zprint-mono-items` into a boolean
flag that prints results of mono item collection without changing the
behaviour of mono item collection.

For codegen-units test incorporate `-Zprint-mono-items` flag directly
into compiletest tool.

Test changes are mechanical. `-Zprint-mono-items=lazy` was removed
without additional changes, and `-Zprint-mono-items=eager` was turned
into `-Clink-dead-code`.  Linking dead code disables internalization, so
tests have been updated accordingly.
2025-05-09 12:19:09 +02:00
bors
50aa041807 Auto merge of #140786 - Kobzol:try-builds-no-deny-warnings, r=jieyouxu
Do not deny warnings in "fast" try builds

When we do the classic ``@bors` try` build without specifying `try-job` in the PR description, we want to get a compiler toolchain for perf./crater/local experimentation as fast as possible. We don't run any tests in that case, so it seems reasonable to also ignore warnings.

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

r? `@jieyouxu`

try-job: dist-x86_64-linux
2025-05-08 18:21:54 +00:00
Jakub Beránek
4f9bb8c735
Mention fast try builds in the rustc-dev-guide 2025-05-08 16:00:48 +02:00
Matthias Krüger
b330d04b2d
Rollup merge of #140764 - joshtriplett:style-nullary-functions, r=traviscross
style: Never break within a nullary function call `func()` or a unit literal `()`

Implements https://github.com/rust-lang/style-team/issues/210
2025-05-08 08:14:19 +02:00
bors
7e552b46af Auto merge of #140106 - dianne:deref-pat-usefulness, r=Nadrieril
allow deref patterns to participate in exhaustiveness analysis

Per [this proposal](https://hackmd.io/4qDDMcvyQ-GDB089IPcHGg#Exhaustiveness), this PR allows deref patterns to participate in exhaustiveness analysis. Currently all deref patterns enforce `DerefPure` bounds on their scrutinees, so this assumes all patterns it's analyzing are well-behaved. This also doesn't support [mixed exhaustiveness](https://hackmd.io/4qDDMcvyQ-GDB089IPcHGg#Mixed-exhaustiveness), and instead emits an error if deref patterns are used together with normal constructors. I think mixed exhaustiveness would be nice to have (especially if we eventually want to support arbitrary `Deref` impls[^1]), but it'd require more work to get reasonable diagnostics[^2].

Tracking issue for deref patterns: #87121

r? `@Nadrieril`

[^1]: Regardless of whether we support limited exhaustiveness checking for untrusted `Deref` or always require other arms to be exhaustive, I think it'd be useful to allow mixed matching for user-defined smart pointers. And it'd be strange if it worked there but not for `Cow`.

[^2]: I think listing out witnesses of non-exhaustiveness can be confusing when they're not necessarily disjoint, and when you only need to cover some of them, so we'd probably want special formatting and/or explanatory subdiagnostics. And if it's implemented similarly to unions, we'd probably also want some way of merging witnesses; the way witnesses for unions can appear duplicated is pretty unfortunate. I'm not sure yet how the diagnostics should look, especially for deeply nested patterns.
2025-05-08 02:16:45 +00:00
Josh Triplett
38e3fa61f6 style: Never break within a nullary function call func() or a unit literal () 2025-05-07 20:36:06 +01:00
Guillaume Gomez
2f0a19adf1
Rollup merge of #140741 - husqvarnagroup:af/armv5te-target-maintainer, r=jieyouxu
add armv5te-unknown-linux-gnueabi target maintainer

My employer is interested in having this target maintained and we already have some tests in our CI running for it.

armv5te-unknown-linux-gnueabi can be ticket off in #113739.
2025-05-07 18:19:08 +02:00
Guillaume Gomez
82c99c41c0
Rollup merge of #140234 - nnethercote:separate-Analysis-and-Results, r=davidtwco
Separate dataflow analysis and results

`Analysis` gets put into `Results` with `EntryStates`, by `iterate_to_fixpoint`. This has two problems:
- `Results` is passed various places where only `Analysis` is needed.
- `EntryStates` is passed around mutably everywhere even though it is immutable.

This commit mostly separates `Analysis` from `Results` and fixes these two problems.

r? `@davidtwco`
2025-05-07 18:19:04 +02:00
Adrian Friedli
4e26480c74 add armv5te-unknown-linux-gnueabi target maintainer 2025-05-07 16:01:39 +02:00
Guillaume Gomez
d396619af0
Rollup merge of #139518 - xizheyin:issue-138527, r=traviscross
Stabilize precise capture syntax in style guide

Closes #138527

r? `@jieyouxu`
2025-05-07 10:50:48 +02:00
dianne
b41d8bde00 let deref patterns participate in usefulness/exhaustiveness
This does not yet handle the case of mixed deref patterns with normal
constructors; it'll ICE in `Constructor::is_covered_by`. That'll be
fixed in a later commit.
2025-05-06 18:53:55 -07:00
Guillaume Gomez
ebd12fcc5e
Rollup merge of #140658 - dianne:lit-deref-pats-p2, r=oli-obk
`deref_patterns`: let string and byte string literal patterns peel references and smart pointers before matching

This follows up on #140028. Together, they allow using string and byte string literal patterns to match on smart pointers when `deref_patterns` is enabled. In particular, string literals can now match on `String`, subsuming the functionality of the `string_deref_patterns` feature.

More generally, this works by letting literals peel references (and smart pointers) before matching, similar to most other patterns, providing an answer to #44849. Though it's only partially implemented at this point: this doesn't yet let named const patterns peel before matching. The peeling logic is general enough to support named consts, but the typing rules for named const patterns would need adjustments to feel consistent (e.g. arrays would need rules to be usable as slices, and `const STR: &'static str` wouldn't be able to match on a `String` unless a rule was added to let it be used where a `str` is expected, similar to what #140028 did for literals).

This also allows string and byte string patterns to match on mutable references, following up on https://github.com/rust-lang/rust/pull/140028#discussion_r2053927512. Rather than forward the mutability of the scrutinee to literal patterns, I've opted to peel `&mut`s from the scrutinee. From a design point of view, this makes the behavior consistent with what would be expected from deref coercions using the methodology in the next paragraph. From a diagnostics point of view, this avoids labeling string and byte string patterns as "mutable references", which I think could be confusing. See [`byte-string-type-errors.rs`](https://github.com/rust-lang/rust/compare/master...dianne:rust:lit-deref-pats-p2?expand=1#diff-4a0dd9b164b67c706751f3c0b5762ddab08bcef05a91972beb0190c6c1cd3706) for how the diagnostics look.

At a high level, the peeling logic implemented here tries to mimic how deref coercions work for expressions: we peel references (and smart pointers) from the scrutinee until the pattern can match against it, and no more. This is primarily tested by [`const-pats-do-not-mislead-inference.rs`](https://github.com/rust-lang/rust/compare/master...dianne:rust:lit-deref-pats-p2?expand=1#diff-19afc05b8aae9a30fe4a3a8c0bc2ab2c56b58755a45cdf5c12be0d5e83c4739d). To illustrate the connection, I wasn't sure if this made sense to include in the test file, but I've translated those tests to make sure they give the same inference results as deref coercions: [(playground)](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=1869744cb9cdfed71a686990aadf9fe1). In each case, a reference to the scrutinee is coerced to have the type of the pattern (under a reference).

Tracking issue for deref patterns: #87121

r? `@oli-obk`
cc `@Nadrieril`
2025-05-06 14:50:46 +02:00
Stuart Cook
627873a078
Rollup merge of #140035 - fee1-dead-contrib:push-oszwkkvmpkks, r=jieyouxu,wesleywiser
Implement RFC 3503: frontmatters

Tracking issue: #136889

Supercedes #137193. This implements [RFC 3503](https://github.com/rust-lang/rfcs/blob/master/text/3503-frontmatter.md).

This might break rust-analyzer. Will look into how to fix that.

Suggestions welcome for how to improve diagnostics.
2025-05-06 16:28:39 +10:00
rustbot
872387195d Update books 2025-05-05 19:01:06 +02:00
Deadbeef
662182637e Implement RFC 3503: frontmatters
Supercedes #137193
2025-05-05 23:10:08 +08:00
dianne
7e4f6d3a30 update unstable book 2025-05-05 04:29:33 -07:00
Vadim Petrochenkov
56d6b4e427 compiletest: Support matching on non-json lines in compiler output
and migrate most of remaining `error-pattern`s to it.
2025-05-04 18:27:45 +03:00
Erik Kaneda
77876b5233 zkvm: remove schmerik from maintainers list 2025-05-02 11:45:09 -07:00
Tshepang Mbambo
bf06eaf7a2
Merge pull request #2367 from rust-lang/rustc-pull
Rustc pull update
2025-05-01 07:01:46 +02:00
Martin Ombura Jr.
9a3a212dae adds commas 2025-05-01 04:07:27 +00:00
The rustc-dev-guide Cronjob Bot
560de7e512 Merge from rustc 2025-05-01 04:05:49 +00:00
The rustc-dev-guide Cronjob Bot
27eb274233 Preparing for merge from rustc 2025-05-01 04:05:40 +00:00
Martin Ombura Jr.
3e0cbbb899 adds 'with' to help clarify how to build a new compiler 2025-05-01 04:01:42 +00:00
Matthias Krüger
dab33f9085
Rollup merge of #140506 - tshepang:patch-1, r=jieyouxu
unstable-book: fix capitalization
2025-04-30 17:28:01 +02:00
许杰友 Jieyou Xu (Joe)
b02178b1d4
Merge pull request #2352 from xizheyin/enable-behind-upstream 2025-04-30 18:42:23 +08:00
许杰友 Jieyou Xu (Joe)
b1c86935cd
Merge pull request #2359 from rust-lang/tshepang-repo-name 2025-04-30 18:41:49 +08:00
Tshepang Mbambo
0cb6f51a36
unstable-book: fix capitalization 2025-04-30 12:13:43 +02:00
Vadim Petrochenkov
20faf8532b compiletest: Make diagnostic kind mandatory on line annotations 2025-04-30 10:44:24 +03:00
Tshepang Mbambo
48bbf5a91b
for a more friendly output
Also, these are normal Rust things (crates/packages), so remove the word *normal*.
2025-04-29 23:39:06 +02:00
Tshepang Mbambo
029a2c4746
Merge pull request #2363 from smanilov/patch-1
Update compiler-src.md
2025-04-29 23:01:31 +02:00
Travis Cross
c7eeeb1263 Merge PR #2360: Add docs about stabilizing an edition 2025-04-29 19:09:46 +00:00
Boxy
7f1ae9b8c0 Fix footnotes 2025-04-29 19:35:26 +01:00
lcnr
fcec80ab24
Merge pull request #2266 from BoxyUwU/normalization
Introduce a normalization chapter
2025-04-29 20:19:27 +02:00
Boxy
e2fb99c97e Introduce a normalization chapter 2025-04-29 19:08:55 +01:00
Stan Manilov
c466cd01d8
Update compiler-src.md
Refactor the dependency structure from a nested unordered list to a single-level ordered list.

IMO, this is clearer, but happy to close this PR without merging, if the change is not desired.
2025-04-29 16:39:54 +03:00
Chris Denton
8dd26cb195
Rollup merge of #140022 - dianne:box-deref-pats, r=Nadrieril
allow deref patterns to move out of boxes

This adds a case to lower deref patterns on boxes using a built-in deref instead of a `Deref::deref` or `DerefMut::deref_mut` call: if `deref!(inner): Box<T>` is matching on place `place`, the inner pattern `inner` now matches on `*place` rather than a temporary. No longer needing to call a method also means it won't borrow the scrutinee in match arms. This allows for bindings in `inner` to move out of `*place`.

For comparison with box patterns, this uses the same MIR lowering but different THIR. Consequently, deref patterns on boxes are treated the same as any other deref patterns in match exhaustiveness analysis. Box patterns can't quite be implemented in terms of deref patterns until exhaustiveness checking for deref patterns is implemented (I'll open a PR for exhaustiveness soon!).

Tracking issue: #87121

r? ``@Nadrieril``
2025-04-28 23:29:15 +00:00
Eric Huss
50500376b3 Add documentation on how to stabilize the compiler edition
This adds documentation on how to stabilize the edition in the compiler.
2025-04-28 14:53:36 -07:00
Eric Huss
0aae3caf24 Update mdbook to 0.4.48
This updates to the latest version of mdbook which has had a variety
of fixes of new features since the last update.

Changelog: https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-0448
2025-04-28 11:41:17 -07:00
Eric Huss
b0e675bc52 Add documentation on how to migration the edition of the standard library
Based on lessons learned from 2024. There's probably still more details
to say here since it was a ton of work. These are the major points that
I remember.
2025-04-28 11:30:33 -07:00
Eric Huss
3d23917b2d Add an example of the example of an edition migration lint
It was observed that some people were missing the `edition20xx` rustdoc
attribute. Although this probably won't solve that problem, I'd still
like to highlight it as something to be aware of.
2025-04-28 11:29:42 -07:00
Guillaume Gomez
dd3ca71b4e
Rollup merge of #140379 - tshepang:rdg-push, r=jieyouxu
rustc-dev-guide subtree update
2025-04-28 13:30:47 +02:00
Tshepang Mbambo
451d73fbe2 use repo name in push pr title
I found "Rustc dev guide subtree update awkward"
2025-04-28 06:49:13 +02:00
The rustc-dev-guide Cronjob Bot
aa15830ee2 Merge from rustc 2025-04-28 04:02:54 +00:00
The rustc-dev-guide Cronjob Bot
de491f9b78 Preparing for merge from rustc 2025-04-28 04:02:47 +00:00