Commit Graph

49486 Commits

Author SHA1 Message Date
Kivooeo
f87e829d6e update flags for consistency 2025-08-02 21:07:46 +05:00
Zalathar
d3e597a132 Return a struct with named fields from hash_owner_nodes 2025-08-02 23:11:53 +10:00
Zalathar
40f587aa0d Flatten hash_owner_nodes with an early-return 2025-08-02 23:07:45 +10:00
Noratrieb
870b58f4d0 Update E0562 to account for the new impl trait positions 2025-08-02 11:29:04 +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
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
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
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
Lukas Wirth
2f60cef412 Interner arg to EarlyBinder does not affect auto traits
Conceptually `EarlyBinder` does not contain an `Interner` so it shouldn't tell Rust it does via `PhantomData`.
This is necessary for rust-analyzer as it stores `EarlyBinder`s in query results which require `Sync`, placing restrictions on our interner setup.
2025-08-02 08:48:31 +02: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
Waffle Lapkin
d2e133d96a don't warn on explicit casts of never to any 2025-08-02 02:03:20 +02: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
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
bjorn3
ae2f8d9216 Remove the omit_gdb_pretty_printer_section attribute
Disabling loading of pretty printers in the debugger itself is more
reliable. Before this commit the .gdb_debug_scripts section couldn't be
included in dylibs or rlibs as otherwise there is no way to disable the
section anymore without recompiling the entire standard library.
2025-08-01 20:04:59 +00:00
zachs18
fe720181b5 Update compiler/rustc_const_eval/src/interpret/memory.rs
Replace commented-out code with link to context for change.

Co-authored-by: Ralf Jung <post@ralfj.de>
2025-08-01 11:06:13 -05: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
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
lcnr
fc463540de more strongly dissuade use of skip_binder 2025-08-01 10:46:01 +02: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
d9f794a158 Rollup merge of #144708 - Stypox:add-tracing-to-step, r=RalfJung
Add tracing to step.rs and friends

Adds tracing calls to functions in `step.rs` (01717ffecfd47eb51f4877da6ad867b329a1ddd5), to friend functions related to evaluation and stepping (cbfa7c4b96b2ea26c1db185da9b59506bf8c8e55), and adds a new trait method `EnteredTraceSpan::or_if_tracing_disabled` (f0d0d1f5ecdf174696c8a74a5bc98967a2751c93).

Adding `EnteredTraceSpan::or_if_tracing_disabled` is optional and is only useful to avoid having both `tracing::info!()` calls (that existed before) and `enter_trace_span!()` calls (that this PR adds) that would be redundant and would slow down the collection of traces. I say it is optional because it adds some cognitive complexity around `EnteredTraceSpan`, which is possibly not worth the reduced redundancy. Let me know if I should revert that commit.

The tracing calls added in this PR are meant to make it easier to understand what was being executing at a particular point when looking at a trace. But they are likely not useful for the purpose of understanding which components are fast/slow, hence why I used `tracing_separate_thread` for them. After opening a trace generated using the code in this PR in https://ui.perfetto.dev, and after executing the following query and then pressing on "Show debug track", you will see something like the following image in the timeline:

```sql
select slices.id, ts, dur, track_id, category, args.string_value as name, depth, stack_id, parent_stack_id, parent_id, slices.arg_set_id, thread_ts, thread_instruction_count, thread_instruction_delta, cat, slice_id from slices inner join args USING (arg_set_id) where args.key = "args." || slices.name and name = "step"
```

<img width="739" height="87" alt="image" src="https://github.com/user-attachments/assets/74ad9619-9a1f-40e5-9ef4-3db31e33d6e1" />
2025-08-01 09:59:04 +02:00
Ralf Jung
fce6771410 Rollup merge of #144410 - Gelbpunkt:musl-tier3-dynamic, r=jieyouxu
Make tier 3 musl targets link dynamically by default

Since we don't build std for these and don't provide any support for them, these can trivially be changed to link dynamically by default.
2025-08-01 09:59:03 +02:00
Ralf Jung
0cc4be268e add unsupported_calling_conventions to lint list 2025-08-01 09:47:47 +02:00
bors
e3ee7f7aea Auto merge of #144768 - jhpratt:rollup-otf1yfj, r=jhpratt
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#143849 (rustdoc: never link to unnamable items)
 - rust-lang/rust#144683 (Simplify library dependencies on `compiler-builtins`)
 - rust-lang/rust#144691 (Extend `is_case_difference` to handle digit-letter confusables)
 - rust-lang/rust#144700 (rustdoc-json: Move `#[macro_export]` from `Other` to it's own  variant)
 - rust-lang/rust#144751 (Add correct dynamic_lib_extension for aix)
 - rust-lang/rust#144757 (Ping Muscraft when emitter change)
 - rust-lang/rust#144759 (triagebot: Label `compiler-builtins` T-libs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-01 07:09:43 +00:00
Jacob Pratt
c7ec9bcc6e Rollup merge of #144691 - xizheyin:suggest-confuse, r=estebank
Extend `is_case_difference` to handle digit-letter confusables

This PR extends `is_case_difference` to handle digit-letter confusables

Add support for detecting 0/O, 1/l, 5/S, 8/B, 9/g confusables in error suggestions.

r? `@estebank`
2025-08-01 00:38:20 -04:00
bors
6c02dd4eae Auto merge of #144446 - nnethercote:opt-region-constraints, r=lcnr
Optimize region constraints

r? `@lcnr`
2025-08-01 04:06:21 +00:00
Trevor Gross
24c770ba1c aarch64: Make outline-atomics a known target feature
This is a feature used by LLVM that is enabled for our `aarch64-linux`
targets, which we would like to configure on in `std`. Thus, mark
`outline-atomics` a known feature. It is left unstable for now.
2025-07-31 22:00:08 -05:00
Folkert de Vries
040f71e812 loop match: error on #[const_continue] outside #[loop_match] 2025-08-01 00:28:52 +02:00
Waffle Lapkin
5aec4379e3 detect infinite recursion with tail calls in ctfe 2025-07-31 23:59:55 +02:00
Urgau
8a3a7e625a Add lint against dangling pointers form local variables 2025-07-31 22:35:22 +02:00
Stypox
88c9a256a9 Add EnteredTraceSpan::or_if_tracing_disabled 2025-07-31 21:51:29 +02:00
Stypox
188f7367bf Add tracing to more functions related to step.rs 2025-07-31 21:51:29 +02:00
Stypox
4e806c8a34 Add tracing calls to eval_statement/terminator 2025-07-31 21:51:29 +02:00
Zachary S
f554c79ef8 Do not give function allocations alignment in consteval or miri. 2025-07-31 12:50:40 -05:00
Michael Goulet
e9765781b2 Remove the witness type from coroutine args 2025-07-31 17:38:28 +00:00
Michael Goulet
d05bb98d6b Extract borrowck coroutine drop-liveness hack 2025-07-31 17:38:28 +00:00
Vadim Petrochenkov
e58e6f857f resolve: Cleanup some uses of extern prelude in diagnostics 2025-07-31 20:35:14 +03:00
Michael Goulet
d525e79157 Stall coroutines based off of ty::Coroutine, not ty::CoroutineWitness 2025-07-31 17:31:51 +00:00
Vadim Petrochenkov
73096965fb resolve: Avoid double table lookup in extern_prelude_get
Do not write dummy bindings to extern prelude.
Use more precise `Used::Scope` while recording use and remove now redundant `introduced_by_item` check.
2025-07-31 20:13:13 +03:00
Vadim Petrochenkov
2f7a2fa00f resolve: Do not add erroneous names to extern prelude 2025-07-31 19:47:49 +03:00
Vadim Petrochenkov
cde0374d93 resolve: Clarify extern prelude insertion for extern crate items 2025-07-31 19:20:11 +03:00
Jana Dönszelmann
e2ae91b74a Rollup merge of #144733 - Muscraft:secondary-file-sigil, r=compiler-errors
fix: Match width of ascii and unicode secondary file start

The current [unicode secondary file start](64ca23b623/compiler/rustc_errors/src/emitter.rs (L2991)) is only three characters, whereas the ASCII variant and normal [file start](64ca23b623/compiler/rustc_errors/src/emitter.rs (L2983-L2984)) are four characters. This slight difference caused the paths following a Unicode secondary file start to not align with other structured elements.
2025-07-31 17:19:41 +02:00
Jana Dönszelmann
26c28ee2ef Rollup merge of #144726 - jdonszelmann:move-attr-data-structures, r=lcnr
merge rustc_attr_data_structures into rustc_hir

this move was discussed on zulip: [#t-compiler > attribute parsing rework @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/attribute.20parsing.20rework/near/528530091)

Many PRs in the attribute rework depend on this move.
2025-07-31 17:19:40 +02:00