Commit graph

23498 commits

Author SHA1 Message Date
Adwin White
20c46d647f report unconstrained region in hidden types lazily 2026-02-13 11:38:53 +08:00
bors
be4794c78b Auto merge of #152321 - Zalathar:rollup-ezxwhfJ, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#150443 (Support long diff conflict markers)
 - rust-lang/rust#151887 (Remove some unnecessary `try`-related type annotations)
 - rust-lang/rust#152037 (Suppress unused_mut lint if mutation fails due to borrowck error)
 - rust-lang/rust#152067 (Weaken `assert_dep_node_not_yet_allocated_in_current_session` for multiple threads)
 - rust-lang/rust#151227 (Document `-Zcache-proc-macros`)
2026-02-08 08:12:38 +00:00
Stuart Cook
8e16ea8749
Rollup merge of #152037 - eggyal:unused-mut-due-to-borrowck-error, r=jackh726
Suppress unused_mut lint if mutation fails due to borrowck error

Remedying the borrowck error will likely result in the mut becoming used, and therefore the lint is likely incorrect.

Fixes rust-lang/rust#152024
r? compiler
2026-02-08 16:58:24 +11:00
Stuart Cook
55277add61
Rollup merge of #150443 - estebank:long-diff-markers, r=jackh726
Support long diff conflict markers

git can be configured to use more than 7 characters for conflict markers, and jj automatically uses longer conflict markers when the text contains any char sequence that could be confused with conflict markers. Ensure that we only point at markers that are consistent with the start marker's length.

Ensure that we only consider char sequences at the beginning of a line as a diff marker.

Fix https://github.com/rust-lang/rust/issues/150352.
2026-02-08 16:58:23 +11:00
bors
13c38730d9 Auto merge of #150485 - dianqk:gvn-ssa-borrow, r=cjgillot
GVN: Only propagate borrows from SSA locals

Fixes https://github.com/rust-lang/rust/issues/141313. This is a more principled fix than https://github.com/rust-lang/rust/pull/147886.

Using a reference that is not a borrowing of an SSA local at a new location may be UB.

The PR has two major changes.

The first one, when introducing a new dereference at a new location, is that the reference must point to an SSA local or be an immutable argument. `dereference_address` has handled SSA locals.

The second one, if we cannot guard to the reference point to an SSA local in `visit_assign`, we have to rewrite the value to opaque. This avoids unifying the following dereferences that also are references:

```rust
let b: &T = *a;
// ... `a` is allowed to be modified. `c` and `b` have different borrowing lifetime.
// Unifying them will extend the lifetime of `b`.
let c: &T = *a; 
```

See also https://github.com/rust-lang/rust/issues/130853.

This still allows unifying non-reference dereferences:

```rust
let a: &T = ...;
let b: T = *a;
// ... a is NOT allowed to be modified.
let c: T = *a; 
```

r? @cjgillot
2026-02-08 05:03:48 +00:00
Stuart Cook
1992e7111d
Rollup merge of #152284 - Zalathar:bogus-thir-let, r=nnethercote
Avoid a bogus THIR span for `let x = offset_of!(..)`

The code that creates spans for THIR `let` statements was doing span endpoint manipulation without checking for inclusion/context, resulting in bogus spans observed in https://github.com/rust-lang/rust/pull/151693.

The incorrect spans are easiest to observe with `-Zunpretty=thir-tree`, but they also cause strange user-facing diagnostics for irrefutable let-else.
2026-02-08 12:54:00 +11:00
Jonathan Brouwer
580c8d3c20
Update remaining session-diagnostics tests 2026-02-07 19:34:21 +01:00
Jonathan Brouwer
3837431516
Remove ui-fulldeps tests for slugs 2026-02-07 19:34:21 +01:00
bors
c7f5f3e0d5 Auto merge of #152294 - JonathanBrouwer:rollup-ygNTxe8, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#149960 (add `unreachable_cfg_select_predicates` lint)
 - rust-lang/rust#152168 (Port `rustc_intrinsic_const_stable_indirect` and `rustc_intrinsic` to the new attribute parser)
 - rust-lang/rust#152289 (Also duplicate `#[expect]` attribute in `#[derive]`-ed code)
2026-02-07 15:20:28 +00:00
Jonathan Brouwer
fced23053c
Rollup merge of #152289 - Urgau:expect-in-derive-150553, r=jdonszelmann
Also duplicate `#[expect]` attribute in `#[derive]`-ed code

This PR updates our derive logic to also duplicate any `#[expect]` attribute in the `#[derive]`-ed code, as we already do for all the other lint attribute (`#[allow]`, `#[warn]`, `#[deny]`, ...).

The original and duplicated attribute share the same attribute id, which due to the way [`check_expectations`](56aaf58ec0/compiler/rustc_lint/src/expect.rs (L28-L46)) is implemented makes the expectation fulfilled if the lint is either trigger in the original code or the derived code.

This was discussed by T-lang in https://github.com/rust-lang/rust/issues/150553#issuecomment-3780810363.

cc @rust-lang/lang-ops (in case you want to do an FCP)
Fixes rust-lang/rust#150553
2026-02-07 16:04:41 +01:00
Jonathan Brouwer
972a53167c
Rollup merge of #149960 - folkertdev:cfg-select-unreachable-lint, r=JonathanBrouwer
add `unreachable_cfg_select_predicates` lint

tracking issue: https://github.com/rust-lang/rust/issues/115585

Split out from https://github.com/rust-lang/rust/pull/149783. This lint is emitted on branches of a `cfg_select!` that are statically known to be unreachable. The lint is only emitted when the feature is enabled, so this change specifically does not need an FCP, and the lint will be stabilized alongside the feature (see https://github.com/rust-lang/rust/pull/149783#issuecomment-3648000286).
2026-02-07 16:04:40 +01:00
Urgau
2407f47903 Also duplicate #[expect] attribute in #[derive]-ed code 2026-02-07 14:29:40 +01:00
Zalathar
cc3fdc637a Avoid a bogus THIR span for let x = offset_of!(..) 2026-02-07 23:41:24 +11:00
Zalathar
fb5a4dca32 Regression test for let x = offset_of!(..) else { .. } span 2026-02-07 23:41:23 +11:00
Folkert de Vries
bad1a450c0
use test instead of unix to be platform-independent 2026-02-07 13:33:25 +01:00
Jonathan Brouwer
3391e4ca2f
Rollup merge of #152010 - workingjubilee:what-does-the-scouter-say-about-the-lldb-version-level, r=Noratrieb
Ignore all debuginfo tests for LLDB that we do not run in CI

We only run LLDB 1500 in CI. Any test with a min-lldb-version above that is currently ignored. It's not clear any of these tests actually work with that LLDB version, and they definitely don't work on LLDB ~2100. So, ignore them until we fix debuginfo testing.

Fixes rust-lang/rust#151966
2026-02-07 13:06:36 +01:00
Jonathan Brouwer
27d6b3c9b7
Rollup merge of #151576 - tgross35:stabilize-cold-path, r=jhpratt
Stabilize `core::hint::cold_path`

`cold_path` has been around unstably for a while and is a rather useful tool to have. It does what it is supposed to and there are no known remaining issues, so stabilize it here (including const).

Newly stable API:

```rust
// in core::hint
pub const fn cold_path();
```

I have opted to exclude `likely` and `unlikely` for now since they have had some concerns about ease of use that `cold_path` doesn't suffer from. `cold_path` is also significantly more flexible; in addition to working with boolean `if` conditions, it can be used in `match` arms, `if let`, closures, and other control flow blocks. `likely` and `unlikely` are also possible to implement in user code via `cold_path`, if desired.

Closes: https://github.com/rust-lang/rust/issues/136873 (tracking issue)

---

There has been some design and implementation work for making `#[cold]` function in more places, such as `if` arms, `match` arms, and closure bodies. Considering a stable `cold_path` will cover all of these usecases, it does not seem worth pursuing a more powerful `#[cold]` as an alternative way to do the same thing. If the lang team agrees, then:

Closes: https://github.com/rust-lang/rust/issues/26179
Closes: https://github.com/rust-lang/rust/pull/120193
2026-02-07 13:06:35 +01:00
Jonathan Brouwer
828b9c2cdf
Rollup merge of #152235 - JonathanBrouwer:convert_parse, r=JonathanBrouwer
Convert to inline diagnostics in `rustc_parse`

This was the most annoying one by far, had to make a few changes to the representation of two errors (no user-facing changes tho), these changes are in separate commits for clarity :)

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-07 13:06:34 +01:00
Jonathan Brouwer
29079e41a7
Rollup merge of #150522 - pitaj:stabilize-new-rangeinclusive, r=tgross35
Stabilize new inclusive range type and iterator type

Part 1 of stabilizing the new range types for rust-lang/rust#125687

stabilizes `core::range::RangeInclusive` and `core::range::RangeInclusiveIter`. Newly stable API:

```rust
// in core and std
pub mod range;

// in core::range

pub struct RangeInclusive<Idx> {
    pub start: Idx,
    pub last: Idx,
}

impl<Idx: fmt::Debug> fmt::Debug for RangeInclusive<Idx> { /* ... */ }

impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
    pub const fn contains<U>(&self, item: &U) -> bool
    where
        Idx: [const] PartialOrd<U>,
        U: ?Sized + [const] PartialOrd<Idx>;

    pub const fn is_empty(&self) -> bool
    where
        Idx: [const] PartialOrd;
}

impl<Idx: Step> RangeInclusive<Idx> {
    pub fn iter(&self) -> RangeInclusiveIter<Idx>;
}

impl<T> const RangeBounds<T> for RangeInclusive<T> { /* ... */ }
impl<T> const RangeBounds<T> for RangeInclusive<&T> { /* ... */ }

impl<T> const From<RangeInclusive<T>> for legacy::RangeInclusive<T> { /* ... */ }
impl<T> const From<legacy::RangeInclusive<T>> for RangeInclusive<T> { /* ... */ }

pub struct RangeInclusiveIter<A>(/* ... */);

impl<A: Step> RangeInclusiveIter<A> {
    pub fn remainder(self) -> Option<RangeInclusive<A>>;
}

impl<A: Step> Iterator for RangeInclusiveIter<A> {
    type Item = A;
    /* ... */
}

impl<A: Step> DoubleEndedIterator for RangeInclusiveIter<A> { /* ... */ }
impl<A: Step> FusedIterator for RangeInclusiveIter<A> { }
impl<A: Step> IntoIterator for RangeInclusive<A> {
    type Item = A;
    type IntoIter = RangeInclusiveIter<A>;
    /* ... */
}

impl ExactSizeIterator for RangeInclusiveIter<u8> { }
impl ExactSizeIterator for RangeInclusiveIter<i8> { }

unsafe impl<T> const SliceIndex<[T]> for range::RangeInclusive<usize> {
    type Output = [T];
    /* ... */
}
unsafe impl const SliceIndex<str> for range::RangeInclusive<usize> {
    type Output = str;
    /* ... */
}
```

I've removed the re-exports temporarily because from what I can tell, there's no way to make re-exports of stable items unstable. They will be added back and stabilized in a separate PR.
2026-02-07 13:06:34 +01:00
Jonathan Brouwer
6fe0999ad6
Rollup merge of #148590 - GrigorenkoPV:atomic_try_update, r=jhpratt
Stabilize `atomic_try_update`and deprecate `fetch_update` starting 1.99.0

Tracking issue: rust-lang/rust#135894
FCP completed: https://github.com/rust-lang/rust/issues/135894#issuecomment-3685449783

~1.96.0 was chosen because I don't think the remaining month until 1.93.0 becomes beta is enough for the FCP to finish and this to get merged, so 1.94.0 + a couple of versions of leeway: https://github.com/rust-lang/rust/issues/135894#issuecomment-3491707614~

1.99 suggested in https://github.com/rust-lang/rust/pull/148590#discussion_r2730000452

Closes rust-lang/rust#135894
2026-02-07 13:06:33 +01:00
Jonathan Brouwer
0ef518c946
Disable the run-make/translation test for now 2026-02-07 10:30:42 +01:00
Jonathan Brouwer
9a114c686f
Convert to inline diagnostics in rustc_parse 2026-02-07 10:30:40 +01:00
Jonathan Brouwer
723eb92a31
Rollup merge of #152252 - JonathanBrouwer:port-tidy-checks, r=jdonszelmann
Convert diagnostic style checks

For https://github.com/rust-lang/rust/issues/151366

r? @jdonszelmann
2026-02-07 09:41:07 +01:00
Jonathan Brouwer
d7c812cb57
Rollup merge of #146900 - taiki-e:avr-target-feature, r=workingjubilee
Add avr_target_feature

This adds the following unstable target features (tracking issue: https://github.com/rust-lang/rust/issues/146889):

- The following two are particularly important for properly supporting inline assembly:
  - `tinyencoding`: AVR has devices that reduce the number of registers, similar to RISC-V's RV32E. This feature is necessary to support inline assembly in such devices. (see also https://github.com/rust-lang/rust/pull/146901)
  - `lowbytefirst`: AVR's memory access is per 8-bit, and when writing 16-bit ports, the bytes must be written in a specific order. This order depends on devices, making this feature necessary to write proper inline assembly for such use cases. (see also 2a528760bf)
- The followings help recognizing whether specific instructions are available:
  - `addsubiw`
  - `break`
  - `eijmpcall`
  - `elpm`
  - `elpmx`
  - `ijmpcall`
  - `jmpcall`
  - `lpm`
  - `lpmx`
  - `movw`
  - `mul`
  - `rmw`
  - `spm`
  - `spmx`

  Of these, all except `addsubiw`, `break`, `ijmpcall`, `lpm`, `rmw`, `spm`, and `spmx` have [corresponding conditional codes in avr-libc](https://github.com/search?q=repo%3Aavrdudes%2Favr-libc+%2F__AVR_HAVE_%2F&type=code&p=1). LLVM also has `des` feature, but I excluded it from this PR because [DES](https://en.wikipedia.org/wiki/Data_Encryption_Standard) is insecure.

- Report future-incompatible warning (https://github.com/rust-lang/rust/issues/116344) for -C target-feature=-sram and -C target-cpu=<device_without_sram> cases because SRAM is minimum requirement for non-assembly language in both avr-gcc and LLVM.
  - See https://github.com/rust-lang/rust/pull/146900#issuecomment-3323558005 for details.

LLVM also has `smallstack`, `wrappingrjmp`, and `memmappedregs` features, but I skipped them because they didn't seem to belong to either of the above categories, but I might have missed something.

(The feature names are match with [definitions in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-21.1.0/llvm/lib/Target/AVR/AVRDevices.td).)

cc @Patryk27 @Rahix
r? workingjubilee

@rustbot label +O-AVR +A-target-feature
2026-02-07 09:41:06 +01:00
Jonathan Brouwer
c1091da34c
Fix existing messages in stderrs 2026-02-07 09:13:42 +01:00
Peter Jaszkowiak
d2020fbf7c stabilize new inclusive range type and iter
stabilizes `core::range::RangeInclusive`
and `core::range::RangeInclusiveIter`
and the `core::range` module
2026-02-06 21:36:15 -07:00
Folkert de Vries
a6bd7cc54e
make the lint more sophisticated 2026-02-07 02:19:43 +01:00
Folkert de Vries
8aea4b1775
add unreachable_cfg_select_predicates lint
This is emitted on branches of a `cfg_select!` that are statically known
to be unreachable.
2026-02-07 02:19:42 +01:00
Jonathan Brouwer
a66d0f8598
Rollup merge of #152186 - GuillaumeGomez:inline-diag-rustc_const_eval, r=JonathanBrouwer
Convert to inline diagnostics in `rustc_const_eval`

Part of rust-lang/rust#151366.

r? @JonathanBrouwer
2026-02-07 01:18:53 +01:00
Guillaume Gomez
c6829020b0 Convert to inline diagnostics in rustc_const_eval 2026-02-06 22:55:58 +01:00
bors
efc9e1b50c Auto merge of #152239 - JonathanBrouwer:rollup-2BolGX5, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#152129 (MGCA: require #[type_const] on free consts too)
 - rust-lang/rust#152139 (mGCA: Support directly represented negated literals)
 - rust-lang/rust#152189 (Convert to inline diagnostics in `rustc_passes`)
2026-02-06 18:42:38 +00:00
Jonathan Brouwer
30bbeae0a5
Rollup merge of #152139 - khyperia:mgca-negative-literals, r=BoxyUwU
mGCA: Support directly represented negated literals

fixes rust-lang/rust#152123

PatExprKind already awkwardly tacks on a `negated: bool` for the same purpose:

8bccf1224d/compiler/rustc_hir/src/hir.rs (L1954-L1959)

perhaps one day we should indeed do that FIXME...

r? @BoxyUwU
2026-02-06 18:04:40 +01:00
khyperia
e6f5b97152 MGCA: require #[type_const] on free consts too 2026-02-06 15:35:18 +01:00
Jonathan Brouwer
a9b4c7cfc9
Rollup merge of #152000 - lapla-cogito:ice_151027, r=BoxyUwU
Fix ICE in normalizing inherent associated consts with `#[type_const]`

Fixes rust-lang/rust#151027
Fixes rust-lang/rust#138089
Fixes rust-lang/rust#138226
Fixes rust-lang/rust#150960

When an inherent associated const is marked with `#[type_const]`, its generics expect args in the format `[Self, own_params...]`, similar to inherent associated types. However, HIR typeck's `instantiate_value_path` was constructing args in the regular associated const format `[impl_params..., own_params...]`. This mismatch caused ICEs when the `args` were later used in contexts expecting the IAC format, such as user type annotations and `borrowck`'s type ascription.
2026-02-06 15:33:40 +01:00
Jonathan Brouwer
9f0eba2a06
Rollup merge of #151590 - folkertdev:cmse-unwrap-transparent, r=davidtwco
cmse: don't use `BackendRepr` when checking return type

tracking issue: https://github.com/rust-lang/rust/issues/81391
tracking issue: https://github.com/rust-lang/rust/issues/75835

r? davidtwco
cc @RalfJung

context: https://github.com/rust-lang/rfcs/pull/3884#discussion_r2715791429

I believe this is more reliable, and no longer relies on `BackendRepr`. I also added a test specifically for using `repr(Rust)`.
2026-02-06 15:33:38 +01:00
khyperia
54a9be469a mGCA: Support directly represented negated literals 2026-02-06 14:04:55 +01:00
Jonathan Brouwer
0cc62c81e5
Rollup merge of #152184 - Ozzy1423:attrs3, r=jdonszelmann
Port rustc_abi to the attribute parser

Tracking issue: https://github.com/rust-lang/rust/issues/131229

This attribute either dumps the abi info for functions (debug arg)
or if you put it on a pair of fn ptr's it checks they match (assert_eq arg)

r? @JonathanBrouwer
2026-02-06 10:06:47 +01:00
Jonathan Brouwer
d96d73fd86
Rollup merge of #152140 - bjorn3:driver_fixed_error_codes, r=jdonszelmann
Hard code the error code registry for custom drivers

And do some cleanups enabled by this.
2026-02-06 10:06:45 +01:00
lapla
22885d2526
Reorganize tests that no longer crash 2026-02-06 14:44:04 +09:00
lapla
d5957f582b
Add test for inherent type_const normalization 2026-02-06 14:44:03 +09:00
许杰友 Jieyou Xu (Joe)
7afff45d57
Rollup merge of #152194 - JonathanBrouwer:fix-rustdoc-gui, r=jieyouxu
Remove the 4 failing tests from rustdoc-gui

These are the 4 tests that @Bryntet got to fail locally
See [#t-infra > CI failure because &#96;tests/rustdoc-gui/search-filter.goml&#96;](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/CI.20failure.20because.20.60tests.2Frustdoc-gui.2Fsearch-filter.2Egoml.60/with/572271674)

r? @ghost
2026-02-06 10:25:44 +08:00
许杰友 Jieyou Xu (Joe)
4a1e87c598
Rollup merge of #151955 - usamoi:escape, r=davidtwco
escape symbol names in global asm

copied from https://github.com/llvm/llvm-project/blob/main/llvm/lib/MC/MCSymbol.cpp

closes https://github.com/rust-lang/rust/issues/151950
2026-02-06 10:25:44 +08:00
许杰友 Jieyou Xu (Joe)
7b821d1752
Rollup merge of #151278 - estebank:issue-108894, r=davidtwco
Provide more context on trait bounds being unmet due to imperfect derive

When encountering a value that has a borrow checker error where the type was previously moved, when suggesting cloning verify that it is not already being derived. If it is, explain why the `derive(Clone)` doesn't apply:

```
note: if `TypedAddress<T>` implemented `Clone`, you could clone the value
  --> $DIR/derive-clone-implicit-bound.rs:6:1
   |
LL | #[derive(Clone, Copy)]
   |          ----- derived `Clone` adds implicit bounds on type parameters
LL | pub struct TypedAddress<T>{
   | ^^^^^^^^^^^^^^^^^^^^^^^^-^
   | |                       |
   | |                       introduces an implicit `T: Clone` bound
   | consider manually implementing `Clone` for this type
...
LL |         let old = self.return_value(offset);
   |                                     ------ you could clone this value
```

When encountering a bound coming from a derive macro, suggest manual impl of the trait.

Use the span for the specific param when adding bounds in builtin derive macros, so the diagnostic will point at them as well as the derive macro itself.

```
note: required for `Id<SomeNode>` to implement `PartialEq`
  --> $DIR/derive-implicit-bound.rs:5:10
   |
LL | #[derive(PartialEq, Eq)]
   |          ^^^^^^^^^
LL | pub struct Id<T>(PhantomData<T>);
   |               - unsatisfied trait bound introduced in this `derive` macro
   = help: consider manually implementing `PartialEq` to avoid undesired bounds
```

Mention that the trait could be manually implemented in E0599.

Fix rust-lang/rust#108894. Address rust-lang/rust#143714. Address #rust-lang/rust#146515 (but ideally would also suggest constraining the fn bound correctly as well).
2026-02-06 10:25:43 +08:00
Taiki Endo
895ea0c2f5 Require sram target feature on AVR 2026-02-06 09:29:24 +09:00
Jonathan Brouwer
bce8c00e2f
Remove the 4 failing tests from rustdoc-gui 2026-02-06 01:13:41 +01:00
Oscar Bray
a2f9dec29c Parse #[rustc_abi(..)] 2026-02-05 19:07:50 +00:00
Folkert de Vries
df0bdea545
cmse: additional argument passing tests 2026-02-05 19:32:21 +01:00
Folkert de Vries
43ee28aa16
cmse: don't use BackendRepr when checking return type 2026-02-05 19:32:20 +01:00
Taiki Endo
8cbc623c3a Add avr_target_feature 2026-02-05 19:58:41 +09:00
Jonathan Brouwer
f163864627
Rollup merge of #152128 - zmodem:matches-logical-or-141497, r=nikic
Adopt matches-logical-or-141497.rs to LLVM HEAD

After http://github.com/llvm/llvm-project/pull/178977, the and + icmp are folded to trunc.
2026-02-05 08:32:57 +01:00