Commit Graph

258 Commits

Author SHA1 Message Date
Matthias Krüger
a91918f96b Rollup merge of #147058 - GuillaumeGomez:ignore-more-ui-tests, r=Kobzol
Ignore more failing ui tests for GCC backend

Needed for https://github.com/rust-lang/rust/pull/146414.

r? ``@Kobzol``
2025-09-26 18:11:15 +02:00
Guillaume Gomez
a535c7be54 Ignore more failing ui tests for GCC backend 2025-09-26 15:33:48 +02:00
Vadim Petrochenkov
f89660e4aa resolve: Do not finalize shadowed bindings
I.e. do not mark them as used, or non-speculative loaded, or similar.
Previously they were sometimes finalized during early resolution, causing issues like https://github.com/rust-lang/rust/pull/144793#issuecomment-3168108005.
2025-09-25 20:36:14 +03:00
Jacob Pratt
82bb6d523b Rollup merge of #145896 - Oneirical:uncountable-integer-10, r=jieyouxu
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#3 of Batch #2]

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that `@Kivooeo` was using.

r? `@jieyouxu`
2025-09-13 03:26:02 -04:00
Oneirical
957fa10d50 Add test batch 3 2025-09-12 14:45:12 -04:00
Stuart Cook
3a6ae1167f Rollup merge of #145827 - estebank:issue-51976, r=jackh726
On unused binding or binding not present in all patterns, suggest potential typo of unit struct/variant or const

When encountering an or-pattern with a binding not available in all patterns, look for consts and unit struct/variants that have similar names as the binding to detect typos.

```
error[E0408]: variable `Ban` is not bound in all patterns
  --> $DIR/binding-typo.rs:22:9
   |
LL |         (Foo, _) | (Ban, Foo) => {}
   |         ^^^^^^^^    --- variable not in all patterns
   |         |
   |         pattern doesn't bind `Ban`
   |
help: you might have meant to use the similarly named unit variant `Bar`
   |
LL -         (Foo, _) | (Ban, Foo) => {}
LL +         (Foo, _) | (Bar, Foo) => {}
   |
```

For items that are not in the immedate scope, suggest the full path for them:

```
error[E0408]: variable `Non` is not bound in all patterns
  --> $DIR/binding-typo-2.rs:51:16
   |
LL |         (Non | Some(_))=> {}
   |          ---   ^^^^^^^ pattern doesn't bind `Non`
   |          |
   |          variable not in all patterns
   |
help: you might have meant to use the similarly named unit variant `None`
   |
LL -         (Non | Some(_))=> {}
LL +         (core::option::Option::None | Some(_))=> {}
   |
```

When encountering a typo in a pattern that gets interpreted as an unused binding, look for unit struct/variant of the same type as the binding:

```
error: unused variable: `Non`
  --> $DIR/binding-typo-2.rs:36:9
   |
LL |         Non => {}
   |         ^^^
   |
help: if this is intentional, prefix it with an underscore
   |
LL |         _Non => {}
   |         +
help: you might have meant to pattern match on the similarly named variant `None`
   |
LL -         Non => {}
LL +         std::prelude::v1::None => {}
   |
```

 Suggest constant on unused binding in a pattern

```
error: unused variable: `Batery`
  --> $DIR/binding-typo-2.rs:110:9
   |
LL |         Batery => {}
   |         ^^^^^^
   |
help: if this is intentional, prefix it with an underscore
   |
LL |         _Batery => {}
   |         +
help: you might have meant to pattern match on the similarly named constant `Battery`
   |
LL |         Battery => {}
   |            +
```

Fix rust-lang/rust#51976.
2025-09-04 10:01:54 +10:00
Esteban Küber
86085b4f65 Avoid unnecessary suggestion in or-pattern 2025-08-30 17:44:23 +00:00
Matthias Krüger
47f1df5ca3 Rollup merge of #145676 - Oneirical:uncountable-integer-9, r=jieyouxu
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#2 of Batch #2]

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that `@Kivooeo` was using.

r? `@jieyouxu`
2025-08-29 12:37:30 +02:00
Matthias Krüger
e15744e7a4 Rollup merge of #145675 - Oneirical:uncountable-integer-8, r=jieyouxu
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#1 of Batch #2]

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that `@Kivooeo` was using.

r? `@jieyouxu`
2025-08-29 12:37:30 +02:00
Oneirical
2dc4638c46 Add test batch 2 2025-08-27 15:06:05 -04:00
Oneirical
2e659f5894 Add test batch 1 2025-08-27 00:23:26 -04:00
Scott Schafer
93d16c5100 fix: Add col separator before secondary messages with no source 2025-08-26 15:15:17 -06:00
Guillaume Gomez
9bb7d17d9a Rollup merge of #144373 - hkBst:remove-deprecated-1, r=jhpratt
remove deprecated Error::description in impls

[libs-api permission](https://github.com/rust-lang/libs-team/issues/615#issuecomment-3074045829)

r? `@cuviper`
or `@jhpratt`
2025-08-26 16:34:09 +02:00
Marijn Schouten
845311a065 remove deprecated Error::description in impls 2025-08-26 06:36:53 +00:00
Esteban Küber
8dbdb1760b On binding not present in all patterns, suggest potential typo
```
error[E0408]: variable `Ban` is not bound in all patterns
 --> f12.rs:9:9
  |
9 |         (Foo,Bar)|(Ban,Foo) => {}
  |         ^^^^^^^^^  --- variable not in all patterns
  |         |
  |         pattern doesn't bind `Ban`
  |
help: you might have meant to use the similarly named previously used binding `Bar`
  |
9 -         (Foo,Bar)|(Ban,Foo) => {}
9 +         (Foo,Bar)|(Bar,Foo) => {}
  |
```
2025-08-25 15:16:25 +00:00
Jana Dönszelmann
48a4e2d2dd fix ICE on stable related to attrs on macros 2025-08-24 09:20:57 +02:00
Jonathan Brouwer
ec5b2cce8e Updated uitests for new parser 2025-08-22 08:58:45 +02:00
许杰友 Jieyou Xu (Joe)
2d05870897 Rollup merge of #144983 - Oneirical:uncountable-integer, r=jieyouxu
Rehome 37 `tests/ui/issues/` tests to other subdirectories under `tests/ui/`

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that ``@Kivooeo`` was using.

r? ``@jieyouxu``
2025-08-19 19:42:06 +08:00
Oneirical
75e0263af9 Rehome tests/ui/issues/ tests [5/?] 2025-08-17 13:01:02 -04:00
Jana Dönszelmann
70e26c1b7b take attr style into account in attr diagnostics 2025-08-16 10:51:09 +02:00
Stuart Cook
14e2886028 Rollup merge of #145322 - LorrensP-2158466:early-prelude-processing, r=petrochenkov
Resolve the prelude import in `build_reduced_graph`

This pr tries to resolve the prelude import at the `build_reduced_graph` stage.
Part of batched import resolution in rust-lang/rust#145108 (cherry picked commit) and maybe needed for rust-lang/rust#139493.

r? petrochenkov
2025-08-15 16:16:39 +10:00
Vadim Petrochenkov
f369e066e6 resolve: Add one more test case for "binding is available in a different scope" help 2025-08-14 18:50:58 +03:00
LorrensP-2158466
ff560d3c9a resolve prelude import at build_reduced_graph phase 2025-08-14 15:28:35 +02:00
Vadim Petrochenkov
772493d51d resolve: Split extern prelude into two scopes
One for `--extern` options and another for `extern crate` items.
2025-08-13 17:45:40 +03:00
Esteban Küber
32ee26c625 Add more docs to templates for attrs with incorrect arguments 2025-08-11 17:02:32 +00:00
Stuart Cook
cb271d055e Rollup merge of #144400 - Kivooeo:issue3, r=jieyouxu
`tests/ui/issues/`: The Issues Strike Back [3/N]

Some `tests/ui/issues/` housekeeping, to trim down number of tests directly under `tests/ui/issues/`. Part of https://github.com/rust-lang/rust/issues/133895.

r? ```@jieyouxu```
2025-08-08 12:52:49 +10:00
Trevor Gross
289fe36d37 Print thread ID in panic message if thread name is unknown
`panic!` does not print any identifying information for threads that are
unnamed. However, in many cases, the thread ID can be determined.

This changes the panic message from something like this:

    thread '<unnamed>' panicked at src/main.rs:3:5:
    explicit panic

To something like this:

    thread '<unnamed>' (0xff9bf) panicked at src/main.rs:3:5:
    explicit panic

Stack overflow messages are updated as well.

This change applies to both named and unnamed threads. The ID printed is
the OS integer thread ID rather than the Rust thread ID, which should
also be what debuggers print.
2025-08-06 23:59:47 +00:00
Jakub Beránek
e89ae47b97 Rollup merge of #144552 - Oneirical:uncountable-integer-3, r=jieyouxu
Rehome 33 `tests/ui/issues/` tests to other subdirectories under `tests/ui/`

rust-lang/rust#143902 divided into smaller, easier to review chunks.

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that ``@Kivooeo`` was using.

r? ``@jieyouxu``
2025-08-06 15:55:42 +02:00
Kivooeo
b6e13e3591 comments 2025-08-05 19:34:46 +05:00
Oneirical
7196d8cd66 Rehome tests/ui/issues/ tests [3/?] 2025-08-04 16:43:53 -04:00
Kivooeo
a4a5bf5a71 comments 2025-07-31 21:25:49 +05:00
Rémy Rakic
8f77d5463a add non-regression test for issue 144168 2025-07-19 21:43:50 +00:00
Trevor Gross
a71dbcd679 Rollup merge of #143177 - xizheyin:143134, r=lcnr
Remove false label when `self` resolve failure does not relate to macro

Fixes rust-lang/rust#143134

In the first commit, I did some code-clean, moving `suggest*` to `suggestions/` dir.
In the second, commit, I added ui test.
In the third, I change the code, and present the test result.

r? compiler
2025-07-08 22:50:26 -05:00
Jonathan Brouwer
244d64e60b Port #[path] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 22:19:16 +02:00
Jubilee
f10725218d Rollup merge of #143202 - Kivooeo:tf18, r=tgross35
`tests/ui`: A New Order [18/N]

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

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? `@tgross35`
2025-07-04 23:26:21 -07:00
xizheyin
236b392904 Return early when self resolve failure because of let self = ...
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-03 23:47:19 +08:00
xizheyin
000f038e99 Add ui test resolve/false-self-in-macro-issue-143134.rs
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-03 23:11:57 +08:00
xizheyin
25ab022f29 move tests/ui/resolve/suggest* to tests/ui/resolve/suggestions/
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-03 23:11:57 +08:00
Kivooeo
f12120d2bd cleaned up some tests 2025-07-01 15:29:29 +05:00
Kivooeo
6ca9b43ea9 moved test files 2025-07-01 15:22:16 +05:00
Scott Schafer
c8fac7779e fix: Emit suggestion filename if primary diagnostic span is dummy 2025-06-30 19:24:22 -06:00
Kivooeo
580bc12844 cleaned up some tests 2025-06-30 11:16:18 +05:00
Trevor Gross
74657a4a1a Move some UI tests to more apropriate directories
Prepare for rework done in the rest of [PR143118].

[PR143118]: https://www.github.com/rust-lang/rust/pull/143118

Co-authored-by: Kivooeo <Kivooeo123@gmail.com>
2025-06-28 19:07:29 -05:00
Matthias Krüger
e2e201fd6b Rollup merge of #142219 - Kivooeo:tf11, r=wesleywiser
`tests/ui`: A New Order [11/N]

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? `@jieyouxu`
2025-06-12 03:14:52 +02:00
Matthias Krüger
c557695fe1 Rollup merge of #142217 - Kivooeo:tf10, r=jieyouxu
`tests/ui`: A New Order [10/N]

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? `@jieyouxu`
2025-06-12 03:14:51 +02:00
Kivooeo
c6c55cc0cb cleaned up some tests 2025-06-11 20:51:49 +05:00
Kivooeo
09940635d5 cleaned up some tests 2025-06-11 17:49:03 +05:00
Lukas Wirth
1d7c1b1b4f Add more missing 2015 edition directives 2025-06-05 09:20:19 +02:00
Lukas Wirth
46326e159f Use non-2015 edition paths in tests that do not test for their resolution 2025-06-05 09:19:31 +02:00
yukang
7167e7ce06 Fix false positive lint error from no_implicit_prelude attr 2025-06-02 17:49:01 +08:00