Commit Graph

486 Commits

Author SHA1 Message Date
Folkert de Vries 82ee8b21cb cfg_select!: emit parse errors in unused branches 2025-12-17 22:42:42 +01:00
Jonathan Brouwer f3fa567fdf Rollup merge of #150032 - Kivooeo:annotate-snippets-stable, r=Muscraft
Use annotate-snippet as default emitter on stable

This is implementation of https://github.com/rust-lang/rust/issues/149932

Now, after MCP was accepted, we can use annotate-snippet as default emitter for errors, that means that we not longer need of previous emitter, so this PR removed previous emitter and makes annotate-snippet new default one both on stable and nightly

(this PR does not remove a code of previous emitter it just removes a `Default` option of `HumanReadableErrorType` enum, and keeping only `HumanReadableErrorType::AnnotateSnippet` as it now uses by default)
2025-12-16 20:21:10 +01:00
Jonathan Brouwer f108cd7232 Rollup merge of #149767 - reddevilmidzy:t11, r=Kivooeo
Tidying up tests/ui/issues 33 tests [4/N]

> [!NOTE]
> Intermediate commits are intended to help review, but will be squashed add comment commit prior to merge.

part of rust-lang/rust#133895

`tests/ui/compile-flags` split it into `tests/ui/compile-flags/invalid/` and `tests/ui/compile-flags/run-pass/`

r? Kivooeo
2025-12-16 20:21:07 +01:00
Kivooeo 84f2854bc3 remove fixme & update stderr files 2025-12-16 13:23:48 +00:00
reddevilmidzy 1bd997a452 Cleaned up some tests
Split invalid-compile-flags into run-pass & invalid

Update tests/ui/README.md
2025-12-16 02:10:08 +09:00
Matthias Krüger b826d06771 Rollup merge of #149791 - clubby789:cfg-bool-lints, r=jdonszelmann
Remove uses of `cfg({any()/all()})`

~~This implements the followup warning suggested in https://github.com/rust-lang/rfcs/pull/3695~~
~~Lint against an empty `cfg(any/all)`, suggest the boolean literal equivalents.~~
https://github.com/rust-lang/rust/pull/149791#issuecomment-3638624348

Tracking issue: https://github.com/rust-lang/rust/issues/131204
2025-12-12 12:19:09 +01:00
Matthias Krüger 17940e27c8 Rollup merge of #149770 - GrigorenkoPV:tests/consts, r=WaffleLapkin
Rename some issue-* tests

Also fixes one incorrect issue number: https://github.com/rust-lang/rust/pull/100168#issuecomment-3622946835
2025-12-11 22:09:54 +01:00
Jamie Hill-Daniel c96ff2d429 Remove uses of cfg(any()/all()) 2025-12-10 23:41:19 +00:00
Pavel Grigorenko 96a7000101 Rename some issue-* tests 2025-12-10 20:31:10 +03:00
Matthias Krüger eab103688f Rollup merge of #149846 - jdonszelmann:links-for-all-fcws, r=wafflelapkin
Statically require links to an issue or the edition guide for all FCWs

r? `@wafflelapkin`
2025-12-10 17:16:50 +01:00
Jana Dönszelmann 1ef1ec13d8 bless the tests 2025-12-10 15:15:56 +01:00
Matthias Krüger 4da61b6d69 Rollup merge of #149816 - estebank:verbose-typo-suggestion, r=JonathanBrouwer,Kivooeo
Make typo in field and name suggestions verbose

Part of https://github.com/rust-lang/rust/issues/141973.
2025-12-10 07:54:21 +01:00
reddevilmidzy 92f21a806d moved tests 2025-12-10 09:23:50 +09:00
Esteban Küber 6cd44a472c Make typo in field and name suggestions verbose 2025-12-09 17:29:23 +00:00
Matthias Krüger 90dc2b6e2d Rollup merge of #146579 - estebank:issue-146325, r=jdonszelmann
Handle macro invocation in attribute during parse

```
error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found macro `concat`
  --> $DIR/macro-in-attribute.rs:4:21
   |
LL | #[deprecated(note = concat!("a", "b"))]
   |                     ^^^^^^^^^^^^^^^^^ macros are not allowed here
```

Fix rust-lang/rust#146325.
2025-12-09 17:36:48 +01:00
Esteban Küber 761cb57aef fix test 2025-12-09 01:20:58 +00:00
Jonathan Brouwer e7df90412c Changes to uitests 2025-12-06 10:22:13 +01:00
Matthias Krüger 0c05bb5606 Rollup merge of #149630 - wafarm:fix-149604, r=JonathanBrouwer
Check identifiers defined in macros when suggesting identifiers hidden by hygiene

Fix rust-lang/rust#149604

r? `@JonathanBrouwer` (Since you reviewed the other one related to this)
2025-12-05 16:17:10 +01:00
Wafarm e513ce3fb4 Check identifiers defined in macros when suggesting identifiers hidden by hygiene 2025-12-04 14:58:46 +08:00
Jana Dönszelmann 8f8247812e address review comments 2025-12-03 17:01:49 +01:00
Jana Dönszelmann 97d4d2154f fixup name in diagnostics 2025-12-03 16:38:24 +01:00
Jana Dönszelmann 9dd3caeebe only discard items with #[test] on it when target is valid 2025-12-03 16:38:24 +01:00
Jana Dönszelmann 1864bf6a51 ICE when applying test to crate root 2025-12-03 16:38:22 +01:00
xonx4l 4b000cfacd Merge E0412 into E0425 2025-12-02 18:25:13 +00:00
reddevilmidzy bfc0c02043 Relocate macro_backtrace to macro and remove macro_backtrace 2025-11-28 13:12:15 +09:00
Christian Poveda 7ae2823bc6 Gate 2018 UI tests 2025-11-27 14:13:58 -05:00
Christian Poveda b2ab7cf980 Gate 2015 UI tests 2025-11-27 11:19:00 -05:00
Matthias Krüger 2cc5bf7b6a Rollup merge of #147421 - Kivooeo:ice-fix51621, r=chenyukang
Add check if span is from macro expansion

The same thing I did in https://github.com/rust-lang/rust/pull/147416, actually the same bug but in another place, I'm not really sure how this method is good for fixing such ICEs, but, it does work and not conflicting with any existing tests, so I guess, it's fine

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

r? compiler
2025-11-19 09:48:06 +01:00
Matthias Krüger 642300e339 Rollup merge of #148484 - JonathanBrouwer:wip_attr_style, r=jdonszelmann
Fix suggestion for the `cfg!` macro

r? `@jdonszelmann`
2025-11-18 16:52:11 +01:00
Kivooeo 47384f79fa add check for when span is from macro expansion 2025-11-12 13:19:52 +00:00
Jonathan Brouwer 90f36afc1b Port cfg_select! to the new attribute parsing system
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-11-09 16:09:34 +01:00
Jonathan Brouwer c111ccc45d Add more tests for cfg_select parsing
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-11-09 16:08:03 +01:00
Stuart Cook 99af1bc1b9 Rollup merge of #148612 - chenyukang:yukang-fix-148580-macro-hygiene-diagnostic, r=JonathanBrouwer
Add note for identifier with attempted hygiene violation

Fixes rust-lang/rust#148580

I changed the original test to make sure we are pointing to the right scope.
2025-11-09 13:22:31 +11:00
Jacob Pratt 7af1ee3556 Rollup merge of #147416 - Kivooeo:ice-fix23456, r=fmease
Early return if span is from expansion so we dont get empty span and ice later on

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

The problem original was from that stmt.span was from expansion and it span was bigger than right part which is block.span, so it causes empty span and panic later on, I decided to add checks for both of them to be on the safe side

r? `@fmease` (you were in discussion on this issue so I decided to assign you, feel free to reroll)
2025-11-07 00:21:18 -05:00
yukang 12cde3091a Add note for identifier with attempted hygiene violation 2025-11-07 08:27:23 +08:00
Kivooeo 62ccf14c14 add check if macro from expansion 2025-11-06 22:42:10 +00:00
Scott Schafer 9243928c6c feat: Use annotate-snippets by default on nightly 2025-11-05 09:01:07 -07:00
Jonathan Brouwer f6cdd7eab5 Fix suggestion for the cfg! macro
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-11-04 17:30:47 +01:00
Jonathan Brouwer a628e71edf Add ParsedDescription to the attribute parsers
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-11-03 18:27:06 +01:00
Jonathan Brouwer b78800fd5d Port cfg!() macro to the new attribute parsing system
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-11-03 18:23:41 +01:00
Jana Dönszelmann 1dbe831e47 sort attribute targets for more consistent error messages 2025-10-08 08:32:03 +02:00
Matthias Krüger ac7beab527 Rollup merge of #146535 - joshtriplett:mbe-unsafe-attr, r=petrochenkov
mbe: Implement `unsafe` attribute rules

This implements `unsafe attr` rules for declarative `macro_rules!` attributes, as specified in [RFC 3697](https://github.com/rust-lang/rfcs/pull/3697).

An invocation of an attribute that uses an `unsafe attr` rule requires the `unsafe(attr(...))` syntax.

An invocation of an attribute that uses an ordinary `attr` rule must *not* use the `unsafe(attr(...))` syntax.

`unsafe` is only supported on an `attr` rule, not any other kind of `macro_rules!` rule.

Tracking issue for `macro_rules!` attributes: https://github.com/rust-lang/rust/issues/143547
2025-10-02 10:27:49 +02:00
Matthias Krüger 92aac1bdf6 Rollup merge of #146281 - Jules-Bertholet:static-align-thread-local, r=Mark-Simulacrum
Support `#[rustc_align_static]` inside `thread_local!`

Tracking issue: rust-lang/rust#146177

```rust
thread_local! {
    #[rustc_align_static(64)]
    static SO_ALIGNED: u64 = const { 0 };
}
```

This increases the amount of recursion the macro performs (once per attribute in addition to the previous once per item), making it easier to hit the recursion limit. I’ve added workarounds to limit the impact in the case of long doc comments, but this still needs a crater run just in case.

r? libs

``@rustbot`` label A-attributes A-macros A-thread-locals F-static_align T-libs
2025-10-02 10:27:48 +02:00
Josh Triplett ea0e00c573 mbe: Add tests for unsafe attr invocation 2025-10-01 16:19:39 -07:00
Jules Bertholet 4d32b9a178 Hoist non-platform-specific code out of thread_local_inner! 2025-09-27 17:05:39 -04:00
Jana Dönszelmann b3631e1174 improve empty attribute diagnostic 2025-09-27 19:32:14 +02:00
Guillaume Gomez a535c7be54 Ignore more failing ui tests for GCC backend 2025-09-26 15:33:48 +02:00
León Orell Valerian Liehr 2e816736ef Move more early buffered lints to dyn lint diagnostics (1/N) 2025-09-14 12:38:11 +02:00
Stuart Cook 40520c6357 Rollup merge of #146308 - cyrgani:concat-integer-literals, r=jackh726
support integer literals in `${concat()}`

Tracking issue: rust-lang/rust#124225

Adds support for using integer literals as arguments to `${concat()}` macro expressions.
Integer formatting such as `1_000` is preserved by this.
2025-09-12 20:02:11 +10:00
Jieyou Xu b38a86f4d7 Revert "Rollup merge of #122661 - estebank:assert-macro-span, r=petrochenkov"
This reverts commit 1eeb8e8b15, reversing
changes made to 324bf2b9fd.

Unfortunately the assert desugaring change is not backwards compatible,
see RUST-145770.

Code such as

```rust
#[derive(Debug)]
struct F {
    data: bool
}

impl std::ops::Not for F {
  type Output = bool;
  fn not(self) -> Self::Output { !self.data }
}

fn main() {
  let f = F { data: true };

  assert!(f);
}
```

would be broken by the assert desugaring change. We may need to land
the change over an edition boundary, or limit the editions that the
desugaring change impacts.
2025-09-11 09:10:46 +08:00