Commit graph

48896 commits

Author SHA1 Message Date
León Orell Valerian Liehr
58afb55adc
Less greedily parse [const] bounds
(cherry picked from commit f5dad62d4c)
2025-09-11 06:39:27 +02:00
Zachary S
40c7fe39b6 Only consider auto traits empty for the purposes of omitting vptrs from subtrait vtables
(cherry picked from commit 904e83c53f)
2025-09-08 14:26:08 -07:00
Rémy Rakic
052861f115 Revert "Detect method not being present that is present in other tuple types"
This reverts commit 585a40963e.

(cherry picked from commit 1f587e4d4f)
2025-09-08 14:26:03 -07:00
Wesley Wiser
161e29dc84 Revert "fix(debuginfo): disable overflow check for"
This reverts commit 49eda8edd5.
2025-08-28 21:55:20 -05:00
xizheyin
f0f182dcb7 Do not use effective_visibilities query for Adt types of a local trait while proving a where-clause
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
(cherry picked from commit 27e6726cb8)
2025-08-21 09:32:34 -07:00
Jake Goulding
fd942a5e01 Demote x86_64-apple-darwin to Tier 2 with host tools
Switch to only using aarch64 runners (implying we are now
cross-compiling) and stop running tests. In the future, we could
enable (some?) tests via Rosetta 2.

(cherry picked from commit c574c91e57)
2025-08-21 09:32:15 -07:00
León Orell Valerian Liehr
3c3c140d8a Gate const trait syntax
(cherry picked from commit 092c6f3a18)
2025-08-21 08:45:23 -07:00
bors
49fc0cc3e9 Auto merge of #145395 - lcnr:review-coroutine-witness, r=petrochenkov
[BETA] Revert "Remove the witness type from coroutine args"

fixes rust-lang/rust#145151 and rust-lang/rust#145288

we do not revert on nightly as its instead fixed by rust-lang/rust#145194 and rust-lang/rust#145338.

See the discussion in https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202025-08-14/near/534490313
2025-08-19 08:04:59 +00:00
Michael Goulet
2f85c80f9c Revert "Use DeepRejectCtxt in assemble_inherent_candidates_from_param"
This reverts commit ad59f0b6e6.
2025-08-14 15:06:18 +00:00
lcnr
82ed949d2c Revert "Remove the witness type from coroutine args"
This reverts commit e9765781b2.
2025-08-14 16:21:56 +02:00
Boxy
3c822d038a replace version placeholder 2025-08-04 10:52:21 +01: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
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
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
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
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
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
Michael Goulet
d525e79157 Stall coroutines based off of ty::Coroutine, not ty::CoroutineWitness 2025-07-31 17:31:51 +00: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
Jana Dönszelmann
5712d50648
Rollup merge of #144712 - nnethercote:dedup-num-types, r=fmease
Deduplicate `IntTy`/`UintTy`/`FloatTy`.

There are identical definitions in `rustc_type_ir` and `rustc_ast`. This commit removes them and places a single definition in `rustc_ast_ir`. This requires adding `rust_span` as a dependency of `rustc_ast_ir`, but means a bunch of silly conversion functions can be removed.

r? `@fmease`
2025-07-31 17:19:39 +02:00
Jana Dönszelmann
edd2574848
Rollup merge of #144711 - compiler-errors:op-span, r=petrochenkov
Consider operator's span when computing binop expr span

When computing the span of a binop consisting of `lhs` and `rhs`, we previously just took the spans of `lhs.span.to(rhs.span)`. In the case that both `lhs` and `rhs` are both arguments to a macro, this can produce a wildly incorrect span.

To fix this, first compute the span between `lhs` and the binary operator, which will cause `lhs` to possibly be adjusted to a relevant macro metavar, and then compute that span extended to `rhs`, which will cause it to also be adjusted to a relevant macro metavar.

This coincidentally fixes a FIXME in `tests/ui/lint/wide_pointer_comparisons.rs` and suppresses a nonsense suggestion.
2025-07-31 17:19:39 +02:00
Jana Dönszelmann
eec13cd273
Rollup merge of #144702 - compiler-errors:stall-const-arg-has-type, r=lcnr
stall `ConstArgHasType` in `compute_goal_fast_path`

I'm having major deja-vu about this; I thought that already implemented this but 🤷 maybe not.
2025-07-31 17:19:38 +02:00
Jana Dönszelmann
1fe488638b
Rollup merge of #144688 - Stypox:better-enter-trace-span, r=RalfJung
Uniform `enter_trace_span!` and add documentation

1. The latest changes to `enter_trace_span!` were ported from Miri (see https://github.com/rust-lang/miri/pull/4452#discussion_r2204958019), so now both the `rustc_const_eval` and the Miri macro accept the same syntax. Furthermore, the Miri macro was changed to just call rustc_const_eval`'s, to avoid duplication.
2. I made the `layout_of` (& friends) calls use that new syntax, e.g. `enter_trace_span!(layouting::layout_of, ...)`
3. I made sure the macro specifies all types/traits/macros it refers to using `$crate::`, so the macro works anywhere independently of which types/traits/macros are imported in the context it is used in.
4. I added documentation, examples and tips to the macro's doc. To make the rustdoc compile I had to add some hidden lines (`#`), but now it acts as a compilation test which will avoid reintroducing issue 3. in the future. I will also create a documentation file with everything one needs to know about tracing at a later point, but I figured adding some of that info directly on the tracing macro makes it more discoverable.
5. In `stack.rs` I made it so that the `"frame"` span has a field named "frame" (instead of "message") with the data about the frame. This field used to be called "message" (tracing's default) since it was previously formatted using `"{}", instance`, and now I replaced it with `frame = %instance`.
2025-07-31 17:19:37 +02:00
Stypox
bb08a4dfc7
Make Miri's enter_trace_span! call const_eval's 2025-07-31 15:42:29 +02:00
Scott Schafer
935fdb6980
fix: Match width of ascii and unicode secondary file start 2025-07-31 07:26:39 -06:00
Jana Dönszelmann
e1d3ad89c7
remove rustc_attr_data_structures 2025-07-31 14:19:27 +02:00
bors
3fb1b53a9d Auto merge of #144731 - samueltardieu:rollup-36y30k2, r=samueltardieu
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#136840 (Fix linker-plugin-lto only doing thin lto)
 - rust-lang/rust#144053 (Remove install Rust script from CI)
 - rust-lang/rust#144297 (Make `libtest::ERROR_EXIT_CODE` const public to not redefine it in rustdoc)
 - rust-lang/rust#144721 (`std_detect`: Linux 6.16 support for RISC-V)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-31 12:04:04 +00:00
Samuel Tardieu
d8c09c10e5
Rollup merge of #136840 - Flakebi:linker-plugin-lto-fat, r=dianqk
Fix linker-plugin-lto only doing thin lto

When rust provides LLVM bitcode files to lld and the bitcode contains
function summaries as used for thin lto, lld defaults to using thin lto.
This prevents some optimizations that are only applied for fat lto.

We solve this by not creating function summaries when fat lto is
enabled. The bitcode for the module is just directly written out.

An alternative solution would be to set the `ThinLTO=0` module flag to
signal lld to do fat lto.
The code in clang that sets this flag is here:
560149b5e3/clang/lib/CodeGen/BackendUtil.cpp (L1150)
The code in LLVM that queries the flag and defaults to thin lto if not
set is here:
e258bca950/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp (L4441-L4446)

try-job: x86_64-gnu-debug
try-job: aarch64-gnu-debug
2025-07-31 13:12:45 +02:00
Nicholas Nethercote
066a973312 Overhaul Constraint.
This commit changes it to store a `Region` instead of a `RegionVid` for the `Var` cases:
- We avoid having to call `Region::new_var` to re-create `Region`s from
  `RegionVid`s in a few places, avoiding the interning process, giving a
  small perf win. (At the cost of the type allowing some invalid
  combinations of values.)
- All the cases now store two `Region`s, so the commit also separates
  the `ConstraintKind` (a new type) from the `sub` and `sup` arguments
  in `Constraint`.
2025-07-31 20:04:51 +10:00
Nicholas Nethercote
75a1f47750 Avoid vacuous Constraint::{VarSubVar,RegSubReg} constraints.
If the two regions are the same, we can skip it. This is a small perf win.
2025-07-31 20:04:51 +10:00
Nicholas Nethercote
704f2ca172 Tidy up Cargo.toml files.
- Add some missing `tidy-alphabetical-*` markers.
- Remove some unnecessary blank lines.
2025-07-31 19:58:04 +10:00
Nicholas Nethercote
1901dde97b Deduplicate IntTy/UintTy/FloatTy.
There are identical definitions in `rustc_type_ir` and `rustc_ast`. This
commit removes them and places a single definition in `rustc_ast_ir`.
This requires adding `rust_span` as a dependency of `rustc_ast_ir`, but
means a bunch of silly conversion functions can be removed.

The one annoying wrinkle is that the old version had differences in
their `Debug` impls, e.g. one printed `u32` while the other printed
`U32`. Some compiler error messages rely on the former (yuk), and some
clippy output depends on the latter. So the commit also changes clippy
to not rely on `Debug` and just implement what it needs itself.
2025-07-31 19:56:11 +10:00