Commit graph

301893 commits

Author SHA1 Message Date
Nicholas Nethercote
1698c8e322 Rename Printer variables.
Currently they are mostly named `cx`, which is a terrible name for a
type that impls `Printer`/`PrettyPrinter`, and is easy to confuse with
other types like `TyCtxt`. This commit changes them to `p`. A couple of
existing `p` variables had to be renamed to make way.
2025-08-03 19:58:00 +10:00
Nicholas Nethercote
e7d6a0776b Remove type_name::AbsolutePathPrinter::comma_sep.
It's equivalent to the default `PrettyPrinter::comma_sep`.
2025-08-03 19:58:00 +10:00
Nicholas Nethercote
bd0a308ca2 Inline and remove two FmtPrinter methods.
They each have a single call site.
2025-08-03 19:58:00 +10:00
Nicholas Nethercote
df524163be Mark Printer methods as unreachable where appropriate.
This helps me understand the structure of the code a lot.

If any of these are actually reachable, we can put the old code back,
add a new test case, and we will have improved our test coverage.
2025-08-03 19:58:00 +10:00
bors
da19b9d24c Auto merge of #144677 - nnethercote:bound-const-handling, r=lcnr
Improve bound const handling

A few changes to make const handling more similar to type handling.

r? `@compiler-errors` -errors
2025-08-03 05:26:43 +00:00
bors
5b9564a189 Auto merge of #144814 - samueltardieu:rollup-qyum1hj, r=samueltardieu
Rollup of 17 pull requests

Successful merges:

 - rust-lang/rust#132748 (get rid of some false negatives in rustdoc::broken_intra_doc_links)
 - rust-lang/rust#143360 (loop match: error on `#[const_continue]` outside `#[loop_match]`)
 - rust-lang/rust#143662 ([rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.)
 - rust-lang/rust#143771 (Constify some more `Result` functions)
 - rust-lang/rust#144185 (Document guarantees of poisoning)
 - rust-lang/rust#144395 (update fortanix tests)
 - rust-lang/rust#144478 (Improve formatting of doc code blocks)
 - rust-lang/rust#144614 (Fortify RemoveUnneededDrops test.)
 - rust-lang/rust#144703 ([test][AIX] ignore extern_weak linkage test)
 - rust-lang/rust#144747 (compiletest: Improve diagnostics for line annotation mismatches 2)
 - rust-lang/rust#144756 (detect infinite recursion with tail calls in ctfe)
 - rust-lang/rust#144766 (Add human readable name "Cygwin")
 - rust-lang/rust#144782 (Properly pass path to staged `rustc` to `compiletest` self-tests)
 - rust-lang/rust#144786 (Cleanup the definition of `group_type`)
 - rust-lang/rust#144796 (Add my previous commit name to .mailmap)
 - rust-lang/rust#144797 (Update safety comment for new_unchecked in niche_types)
 - rust-lang/rust#144803 (rustc-dev-guide subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-02 23:49:08 +00:00
bors
a65b04d7c9 Auto merge of #144774 - BoxyUwU:bump_1_91, r=BoxyUwU
Bump to 1.91

https://forge.rust-lang.org/release/process.html#bump-the-stable-version-number-friday-the-week-before

r? ghost
2025-08-02 20:44:34 +00:00
Samuel Tardieu
0fcfb8bee7
Rollup merge of #144803 - tshepang:rdg-sync, r=jieyouxu
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to 9287205099.

Created using https://github.com/rust-lang/josh-sync.

r? `@ghost`
2025-08-02 11:24:29 +02:00
Samuel Tardieu
5e1ea9cda4
Rollup merge of #144797 - nilehmann:safety-comment-niche, r=Noratrieb
Update safety comment for new_unchecked in niche_types

Change the safety comment on `new_unchecked` to mention the valid range instead of 0. I noticed this while working on https://github.com/model-checking/verify-rust-std
2025-08-02 11:24:29 +02:00
Samuel Tardieu
5bcc7c2872
Rollup merge of #144796 - scrabsha:push-lsnwwpwpnpxr, r=jdonszelmann
Add my previous commit name to .mailmap

r? ```@jdonszelmann```
2025-08-02 11:24:28 +02:00
Samuel Tardieu
c4b0fb79f0
Rollup merge of #144786 - JonathanBrouwer:cleanup-group-type, r=jdonszelmann
Cleanup the definition of `group_type`

r? ```@jdonszelmann```
2025-08-02 11:24:27 +02:00
Samuel Tardieu
7a64c130f3
Rollup merge of #144782 - jieyouxu:compiletest-selftests, r=Kobzol
Properly pass path to staged `rustc` to `compiletest` self-tests

Otherwise, this can do weird things like use a global rustc, or try to use stage 0 rustc. This must be properly configured, because `compiletest` is intended to only support one compiler target spec JSON format (of the in-tree compiler).

Historically, this was probably done so before `bootstrap` was really its own thing, and `compiletest` had to be runnable as a much more "self-standing" tool.

Follow-up to rust-lang/rust#144675, as I didn't realize this until Zalathar pointed it out in [#t-infra/bootstrap > Building vs testing `compiletest` @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Building.20vs.20testing.20.60compiletest.60/near/532040838).

r? ````@Kobzol````
2025-08-02 11:24:27 +02:00
Samuel Tardieu
5b8118495e
Rollup merge of #144766 - Berrysoft:patch-1, r=GuillaumeGomez
Add human readable name "Cygwin"

Closes rust-lang/rust#144680
2025-08-02 11:24:26 +02:00
Samuel Tardieu
179b4b6691
Rollup merge of #144756 - WaffleLapkin:inf-rec-etc-ctfe, r=lqd
detect infinite recursion with tail calls in ctfe

fixes rust-lang/rust#144753
2025-08-02 11:24:26 +02:00
Samuel Tardieu
7e8ef3a818
Rollup merge of #144747 - petrochenkov:annusexp2, r=RalfJung
compiletest: Improve diagnostics for line annotation mismatches 2

Follow up to https://github.com/rust-lang/rust/pull/140622 based on feedback from https://github.com/rust-lang/rust/issues/144590.
2025-08-02 11:24:25 +02:00
Samuel Tardieu
751ee2a8f6
Rollup merge of #144703 - daltenty:daltenty/extern-weak, r=Noratrieb
[test][AIX] ignore extern_weak linkage test

The AIX linkage model doesn't support ELF-style extern_weak semantics, so just skip this test, like other platforms that don't have it.
2025-08-02 11:24:25 +02:00
Samuel Tardieu
37ec45382d
Rollup merge of #144614 - cjgillot:fortify-unneeded, r=scottmcm
Fortify RemoveUnneededDrops test.

Test tweak that is useful in preparation for https://github.com/rust-lang/rust/pull/144561
2025-08-02 11:24:24 +02:00
Samuel Tardieu
d082ff4c04
Rollup merge of #144478 - joshtriplett:doc-code-formatting-prep, r=Amanieu
Improve formatting of doc code blocks

We don't currently apply automatic formatting to doc comment code blocks. As a
result, it has built up various idiosyncracies, which make such automatic
formatting difficult. Some of those idiosyncracies also make things harder for
human readers or other tools.

This PR makes a few improvements to doc code formatting, in the hopes of making
future automatic formatting easier, as well as in many cases providing net
readability improvements.

I would suggest reading each commit separately, as each commit contains one
class of changes.
2025-08-02 11:24:24 +02:00
Samuel Tardieu
cafd9fb2d3
Rollup merge of #144395 - folkertdev:fortanix-run-make-test, r=jieyouxu
update fortanix tests

Firstly, as far as I can tell, no CI job actually runs any of the fortanix tests? Maybe I'm missing the job that runs these tests though?

In any case, the `assembly` tests now use `minicore`, meaning that they will run regardless of the host architecture (specifically, they will run during a standard PR CI build).

The run-make test is actually broken, and I'd propose to make it just `cargo build` rather than `cargo run`. We can have a separate test for actually running the program, if desired.

Also this test is subject to https://github.com/rust-lang/rust/issues/128733, so I'd like to re-evaluate what parts of the C/C++ compilation are actually required or useful.

cc [``@jethrogb](https://github.com/jethrogb)`` [``@raoulstrackx](https://github.com/raoulstrackx)`` [``@aditijannu](https://github.com/aditijannu)``

r? ``@jieyouxu``
2025-08-02 11:24:23 +02:00
Samuel Tardieu
ce1961bbfc
Rollup merge of #144185 - purplesyringa:poisoning-wording, r=Amanieu
Document guarantees of poisoning

This mostly documents the current behavior of `Mutex` and `RwLock` (rust-lang/rust#143471) as imperfect. It's unlikely that the situation improves significantly in the future, and even if it does, the rules will probably be more complicated than "poisoning is completely reliable", so this is a conservative guarantee.

We also explicitly specify that `OnceLock` never poisons, even though it has an API similar to mutexes.

Fixes rust-lang/rust#143471 by improving documentation.

r? ``@Amanieu``
2025-08-02 11:24:22 +02:00
Samuel Tardieu
96b3b83299
Rollup merge of #143771 - Randl:const-result, r=tgross35
Constify some more `Result` functions
2025-08-02 11:24:22 +02:00
Samuel Tardieu
4eddebd42b
Rollup merge of #143662 - obi1kenobi:pg/unsafe-attribute-wrappers, r=t-rustdoc
[rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.

Use Rust 2024 edition representation for unsafe attributes in rustdoc HTML:
- `#[no_mangle]` -> `#[unsafe(no_mangle)]`
- `#[export_name = "foo"]` -> `#[unsafe(export_name = "foo")]`
- `#[link_section = ".text"]` -> `#[unsafe(link_section = ".text")]`

The 2024 edition representation is used regardless of the crate's own edition. This ensures that Rustaceans don't have to learn the rules of an outdated edition (e.g. that `unsafe()` wasn't always necessary) in order to understand a crate's documentation.

After some looking through the `T-rustdoc` issues, I was not able to find an existing issue for this. Apologies if I missed it.

r? ``````@aDotInTheVoid``````
2025-08-02 11:24:21 +02:00
Samuel Tardieu
93917ea97c
Rollup merge of #143360 - folkertdev:const-continue-outside-loop-match, r=WaffleLapkin
loop match: error on `#[const_continue]` outside `#[loop_match]`

tracking issue https://github.com/rust-lang/rust/issues/132306
fixes https://github.com/rust-lang/rust/issues/143119
fixes https://github.com/rust-lang/rust/issues/143165

Fixes several ICEs because a panic was reachable.

``````@rustbot`````` label +F-loop_match
2025-08-02 11:24:20 +02:00
Samuel Tardieu
fc4b3fa3f9
Rollup merge of #132748 - lolbinarycat:rustdoc-intra-doc-link-warn-more-54191, r=GuillaumeGomez
get rid of some false negatives in rustdoc::broken_intra_doc_links

rustdoc will not try to do intra-doc linking if the "path" of a link looks too much like a "real url".

however, only inline links (`[text](url)`) can actually contain a url, other types of links (reference links, shortcut links) contain a *reference* which is later resolved to an actual url.

the "path" in this case cannot be a url, and therefore it should not be skipped due to looking like a url.

fixes https://github.com/rust-lang/rust/issues/54191

to minimize the number of false positives that will be introduced, the following heuristic is used:

If there's no backticks, be lenient revert to old behavior.
This is to prevent churn by linting on stuff that isn't meant to be a link.
only shortcut links have simple enough syntax that they
are likely to be written accidentlly, collapsed and reference links
need 4 metachars, and reference links will not usually use
backticks in the reference name.
therefore, only shortcut syntax gets the lenient behavior.
here's a truth table for how link kinds that cannot be urls are handled:

|              |  is shortcut link  | not shortcut link |
|--------------|--------------------|-------------------|
| has backtick |    never ignore    |    never ignore   |
| no backtick  | ignore if url-like |    never ignore   |
2025-08-02 11:24:20 +02:00
bors
6d091b2baa Auto merge of #144554 - cjgillot:no-hir-eff-vis, r=petrochenkov
Use less HIR to compute effective visibility.

r? `@ghost`
2025-08-02 09:23:36 +00:00
bors
889701db1f Auto merge of #129183 - estebank:cfg-visitor, r=davidtwco
Detect more `cfg`d out items in resolution errors

Use a visitor to collect *all* items (including those nested) that were stripped behind a `cfg` condition.

```
error[E0425]: cannot find function `f` in this scope
  --> $DIR/nested-cfg-attrs.rs:4:13
   |
LL | fn main() { f() }
   |             ^ not found in this scope
   |
note: found an item that was configured out
  --> $DIR/nested-cfg-attrs.rs:2:4
   |
LL | fn f() {}
   |    ^
note: the item is gated here
  --> $DIR/nested-cfg-attrs.rs:1:35
   |
LL | #[cfg_attr(all(), cfg_attr(all(), cfg(FALSE)))]
   |                                   ^^^^^^^^^^
```
2025-08-02 05:09:31 +00:00
Camille GILLOT
63e1327ce9 Use less HIR to compute effective visibility. 2025-08-02 02:08:52 +00:00
bors
c23f07d8c5 Auto merge of #144479 - cjgillot:incr-privacy-mod, r=petrochenkov
Perform check_private_in_public by module.

Based on https://github.com/rust-lang/rust/pull/116316
2025-08-02 01:59:11 +00:00
Esteban Küber
4b24c4bf23 Tweak rendering of cfg'd out item
```
error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner`
  --> $DIR/diagnostics-cross-crate.rs:18:23
   |
LL |     cfged_out::inner::doesnt_exist::hello();
   |                       ^^^^^^^^^^^^ could not find `doesnt_exist` in `inner`
   |
note: found an item that was configured out
  --> $DIR/auxiliary/cfged_out.rs:6:13
   |
LL |     #[cfg(false)]
   |           ----- the item is gated here
LL |     pub mod doesnt_exist {
   |             ^^^^^^^^^^^^
```
2025-08-01 23:58:15 +00:00
Tshepang Mbambo
171c2478c0
Merge pull request #2526 from rust-lang/rustc-pull
Rustc pull update
2025-08-02 00:40:01 +02:00
Esteban Küber
77f75f91c5 tiny cleanup 2025-08-01 22:11:45 +00:00
Esteban Küber
4ba4559a9d remove recursive search for items 2025-08-01 22:02:52 +00:00
Esteban Küber
5210c501bc Limit how deep we visit items to find cfg'd out names 2025-08-01 21:51:05 +00:00
Esteban Küber
adcda6ca9a Detect more cfgd out items in resolution errors
Use a visitor to collect *all* items (including those nested) that were stripped behind a `cfg` condition.

```
error[E0425]: cannot find function `f` in this scope
  --> $DIR/nested-cfg-attrs.rs:4:13
   |
LL | fn main() { f() }
   |             ^ not found in this scope
   |
note: found an item that was configured out
  --> $DIR/nested-cfg-attrs.rs:2:4
   |
LL | fn f() {}
   |    ^
note: the item is gated here
  --> $DIR/nested-cfg-attrs.rs:1:35
   |
LL | #[cfg_attr(all(), cfg_attr(all(), cfg(FALSE)))]
   |                                   ^^^^^^^^^^
```
2025-08-01 21:50:36 +00:00
bors
63f6845e57 Auto merge of #144458 - compiler-errors:no-witness-mini, r=lcnr
Remove the witness type from coroutine *args* (without actually removing the type)

This does as much of rust-lang/rust#144157 as we can without having to break rust-lang/rust#143545 and/or introduce some better way of handling higher ranked assumptions.

Namely, it:
* Stalls coroutines based off of the *coroutine* type rather than the witness type.
* Reworks the dtorck constraint hack to not rely on the witness type.
* Removes the witness type from the args of the coroutine, eagerly creating the type for nested obligations when needed (auto/clone impls).

I'll experiment with actually removing the witness type in a follow-up.

r? lcnr
2025-08-01 21:07:49 +00:00
Nico Lehmann
4c7c9de8ac Fix safety comment for new_unchecked in niche_types 2025-08-01 14:00:56 -07:00
Sasha Pourcelot
21ab47e3cb Add my previous commit name to .mailmap 2025-08-01 21:59:56 +02:00
Jonathan Brouwer
32cf3d48b3
Cleanup the definition of group_type
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-01 17:08:02 +02:00
Vadim Petrochenkov
d5ffb061e1 compiletest: Improve diagnostics for line annotation mismatches 2 2025-08-01 17:34:53 +03:00
lcnr
219e4c141d
Merge pull request #2530 from lcnr/type-system-invariants
fix link
2025-08-01 15:50:18 +02:00
lcnr
ba57bbadc9 rarw 2025-08-01 15:49:36 +02:00
bors
4b55fe199c Auto merge of #144735 - weihanglo:update-cargo, r=weihanglo
Update cargo

3 commits in a7fcef21feb4d835d1fee83b3f93b4aef86d5545..840b83a10fb0e039a83f4d70ad032892c287570a
2025-07-13 02:25:52 +0000 to 2025-07-30 13:59:19 +0000
- chore: fix some minor issues in comments (rust-lang/cargo#15787)
- feat(schema): Expose `IndexPackage`, the description of a package within a Registry Index (rust-lang/cargo#15770)
- chore: update toml/toml_edit to latest (rust-lang/cargo#15779)

r? ghost
2025-08-01 13:43:55 +00:00
Jieyou Xu
bd7b8b3612
Properly pass path to staged rustc to compiletest self-tests
Otherwise, this can do weird things like use a global rustc, or try to
use stage 0 rustc. This must be properly configured, because
`compiletest` is intended to only support one compiler target spec JSON
format (of the in-tree compiler).
2025-08-01 21:29:05 +08:00
lcnr
c277f4e64d
Merge pull request #2529 from lcnr/type-system-invariants
add a chapter documenting candidate preference
2025-08-01 15:27:32 +02:00
lcnr
4f60c9097a rarw 2025-08-01 15:25:50 +02:00
bors
924a5a4b7f Auto merge of #144773 - RalfJung:rollup-uif2yyj, r=RalfJung
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#144397 (`tests/ui/issues/`: The Issues Strike Back [2/N])
 - rust-lang/rust#144410 (Make tier 3 musl targets link dynamically by default)
 - rust-lang/rust#144708 (Add tracing to step.rs and friends)
 - rust-lang/rust#144730 (Create a typed wrapper for codegen backends in bootstrap)
 - rust-lang/rust#144771 (Remove some noisy triagebot pings for myself)
 - rust-lang/rust#144772 (add unsupported_calling_conventions to lint list)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-01 10:20:07 +00:00
Boxy
54ade652c1 bump version 2025-08-01 09:04:01 +01:00
Ralf Jung
21140a5111
Rollup merge of #144772 - RalfJung:unsupported_calling_conventions, r=lqd
add unsupported_calling_conventions to lint list

Seems like you can emit lints without them being on the list, but users cannot control them then... *oops*.
2025-08-01 09:59:06 +02:00
Ralf Jung
feac604509
Rollup merge of #144771 - jieyouxu:noisy-ping, r=jieyouxu
Remove some noisy triagebot pings for myself

r? ghost
2025-08-01 09:59:05 +02:00
Ralf Jung
0ad0be9b20
Rollup merge of #144730 - Kobzol:bootstrap-cg-typed, r=jieyouxu
Create a typed wrapper for codegen backends in bootstrap

To avoid representing them just with strings.
2025-08-01 09:59:04 +02:00