Commit Graph

124 Commits

Author SHA1 Message Date
Jana Dönszelmann
1dbe831e47 sort attribute targets for more consistent error messages 2025-10-08 08:32:03 +02:00
Karol Zwolak
cb06d91cd0 don't panic on extern with just multiple quotes in the name 2025-10-06 22:12:51 +02:00
Karol Zwolak
5234d36597 add test 2025-10-05 14:27:31 +02:00
dianqk
85b2f70693 mir-opt: Eliminate trivial unnecessary storage annotations 2025-10-02 14:55:51 +08:00
Guillaume Gomez
a535c7be54 Ignore more failing ui tests for GCC backend 2025-09-26 15:33:48 +02:00
Jana Dönszelmann
2158e2d4d7 refactor target checking, move out of context.rs and rename MaybeWarn to Policy 2025-08-21 13:15:30 +02:00
Jacob Pratt
1e6df58e77 Rollup merge of #140794 - karolzwolak:allow-unused-doc-65464, r=davidtwco
mention lint group in default level lint note

### Summary

This PR updates lint diagnostics so that default-level notes now mention the lint group they belong to, if any.
Fixes: rust-lang/rust#65464.

### Example

```rust
fn main() {
    let x = 5;
}
```

Before:

```
= note: `#[warn(unused_variables)]` on by default
```

After:

```
= note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
```

### Unchanged Cases

Messages remain the same when the lint level is explicitly set, e.g.:

* Attribute on the lint `#[warn(unused_variables)]`:

  ```
  note: the lint level is defined here
  LL | #[warn(unused_variables)]
     |        ^^^^^^^^^^^^^^^^
  ```
* Attribute on the group `#[warn(unused)]:`:

  ```
  = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]`
  ```
* CLI option `-W unused`:

  ```
  = note: `-W unused-variables` implied by `-W unused`
  = help: to override `-W unused` add `#[allow(unused_variables)]`
  ```
* CLI option `-W unused-variables`:

  ```
  = note: requested on the command line with `-W unused-variables`
  ```
2025-08-20 00:45:53 -04:00
Karol Zwolak
d14b83e378 bless tests with new lint messages 2025-08-19 21:27:10 +02:00
bors
05f5a58e84 Auto merge of #145600 - jieyouxu:rollup-jw0bpnt, r=jieyouxu
Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#145338 (actually provide the correct args to coroutine witnesses)
 - rust-lang/rust#145429 (Couple of codegen_fn_attrs improvements)
 - rust-lang/rust#145452 (Do not strip binaries in bootstrap everytime if they are unchanged)
 - rust-lang/rust#145464 (Stabilize `const_pathbuf_osstring_new` feature)
 - rust-lang/rust#145474 (Properly recover from parenthesized use-bounds (precise capturing lists) plus small cleanups)
 - rust-lang/rust#145486 (Fix `unicode_data.rs` mention message)
 - rust-lang/rust#145490 (Trace some basic I/O operations in bootstrap)
 - rust-lang/rust#145493 (remove `should_render` in `PrintAttribute` derive)
 - rust-lang/rust#145500 (Port must_use to the new target checking)
 - rust-lang/rust#145505 (Simplify span caches)
 - rust-lang/rust#145510 (Visit and print async_fut local for async drop.)
 - rust-lang/rust#145511 (Rust build fails on OpenBSD after using file_lock feature)
 - rust-lang/rust#145532 (resolve: debug for block module)
 - rust-lang/rust#145533 (Reorder `lto` options from most to least optimizing)
 - rust-lang/rust#145537 (Do not consider a `T: !Sized` candidate to satisfy a `T: !MetaSized` obligation.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-19 19:26:10 +00:00
Jonathan Brouwer
d5dc797dce Update uitests 2025-08-19 09:03:54 +02:00
Oneirical
75e0263af9 Rehome tests/ui/issues/ tests [5/?] 2025-08-17 13:01:02 -04:00
Jonathan Brouwer
4bb7bf64e0 Update uitests
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-14 18:18:42 +02: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
62b406d4b1 Rollup merge of #144403 - Kivooeo:issue4, r=jieyouxu
`tests/ui/issues/`: The Issues Strike Back [4/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-10 19:45:48 +10:00
Kivooeo
16765639b3 comments 2025-08-09 16:27:20 +05:00
Stuart Cook
412eb764f9 Rollup merge of #143929 - petrochenkov:depresolve, r=lcnr
Mark all deprecation lints in name resolution as deny-by-default and report-in-deps

This affects the next lints:
- `MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS` - https://github.com/rust-lang/rust/issues/144408
- `LEGACY_DERIVE_HELPERS` - https://github.com/rust-lang/rust/issues/79202
- `PRIVATE_MACRO_USE` - https://github.com/rust-lang/rust/issues/120192
- `OUT_OF_SCOPE_MACRO_CALLS` - https://github.com/rust-lang/rust/issues/144406
2025-08-07 20:49:42 +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
Vadim Petrochenkov
33cb4190a2 Mark all deprecation lints in name resolution as deny-by-default and report-in-deps 2025-08-05 15:28:49 +03:00
Ralf Jung
37ad0776ac Rollup merge of #144397 - Kivooeo:issue2, r=jieyouxu
`tests/ui/issues/`: The Issues Strike Back [2/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-01 09:59:03 +02:00
Kivooeo
a4a5bf5a71 comments 2025-07-31 21:25:49 +05:00
Matthias Krüger
a08ced3856 Rollup merge of #144151 - Kivooeo:issue1, r=jieyouxu
`tests/ui/issues/`: The Issues Strike Back [1/N]

I believe I’ve finally brought [my program](https://github.com/Kivooeo/test-manager) to life -- it now handles multiple test moves in one go: plain moves first, then a gentle touch on each file depends on given options. The process should be much smoother now.

Of course, I won’t rush through everything in a few days -- that would be unkind to `@Oneirical.` I’ll pace myself. And also I can't have more than one such PR because `issues.txt` will conflict with previous parts after merging them which is not fun as well.

This PR is just that: first commit - moves; second - regression comments and the occasional .stderr reblesses, also issue.txt and tidy changes. Nothing special, but progress nonetheless. This is for the purpose of preserving test file history during restructuring

Part of https://github.com/rust-lang/rust/issues/133895.

r? `@jieyouxu`
2025-07-28 08:36:51 +02:00
Camille GILLOT
7c6496145f Check statics' type in type_of. 2025-07-25 23:39:26 +00:00
Kivooeo
e9959aa74e comments 2025-07-25 20:38:54 +05:00
Kivooeo
9f38ca97ea move 28 tests 2025-07-25 20:38:54 +05:00
Kivooeo
90bb5cacb5 moved 34 tests to organized locations 2025-07-25 15:34:28 +05:00
Kivooeo
d636a6590c moved 35 tests to organized locations 2025-07-24 17:15:36 +05:00
Martin Nordholts
e1d4f2a0c2 tests: Require run-fail ui tests to have an exit code (SIGABRT not ok)
And introduce two new directives for ui tests:
* `run-crash`
* `run-fail-or-crash`

Normally a `run-fail` ui test like tests that panic shall not be
terminated by a signal like `SIGABRT`. So begin having that as a hard
requirement.

Some of our current tests do terminate by a signal/crash however.
Introduce and use `run-crash` for those tests. Note that Windows crashes
are not handled by signals but by certain high bits set on the process
exit code. Example exit code for crash on Windows: `0xc000001d`.
Because of this, we define "crash" on all platforms as "not exit with
success and not exit with a regular failure code in the range 1..=127".

Some tests behave differently on different targets:
* Targets without unwind support will abort (crash) instead of exit with
  failure code 101 after panicking. As a special case, allow crashes for
  `run-fail` tests for such targets.
* Different sanitizer implementations handle detected memory problems
  differently. Some abort (crash) the process while others exit with
  failure code 1. Introduce and use `run-fail-or-crash` for such tests.
2025-07-19 18:44:07 +02:00
David Wood
8d64937dc2 trait_sel: MetaSized always holds temporarily
As a temporary measure while a proper fix for
`tests/ui/sized-hierarchy/incomplete-inference-issue-143992.rs`
is implemented, make `MetaSized` obligations always hold. In effect,
temporarily reverting the `sized_hierarchy` feature. This is a small
change that can be backported.
2025-07-16 12:35:44 +00:00
Esteban Küber
7dfc3e9af4 Rework borrowing suggestions to use Expr instead of just Span
In the suggestion machinery for borrowing expressions and types, always use the available obligation `Span` to find the appropriate `Expr` to perform appropriateness checks no the `ExprKind` instead of on the textual snippet corresponding to the `Span`.

Unify the logic for the case where `&` *and* `&mut` are appropriate with the logic for only one of those cases.

Handle the case when `S::foo()` should have been `<&S>::foo()` (instead of suggesting the prior `&S::foo()`.
2025-07-10 17:23:29 +00:00
bors
71e4c005ca Auto merge of #143287 - GuillaumeGomez:rollup-fdjcti9, r=GuillaumeGomez
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#136801 (Implement `Random` for tuple)
 - rust-lang/rust#141867 (Describe Future invariants more precisely)
 - rust-lang/rust#142760 (docs(fs): Touch up grammar on lock api)
 - rust-lang/rust#143181 (Improve testing and error messages for malformed attributes)
 - rust-lang/rust#143210 (`tests/ui`: A New Order [19/N] )
 - rust-lang/rust#143212 (`tests/ui`: A New Order [20/N])
 - rust-lang/rust#143230 ([COMPILETEST-UNTANGLE 2/N] Make some compiletest errors/warnings/help more visually obvious)
 - rust-lang/rust#143240 (Port `#[rustc_object_lifetime_default]` to the new attribute parsing …)
 - rust-lang/rust#143255 (Do not enable LLD by default in the dist profile)
 - rust-lang/rust#143262 (mir: Mark `Statement` and `BasicBlockData` as `#[non_exhaustive]`)
 - rust-lang/rust#143269 (bootstrap: make comment more clear)
 - rust-lang/rust#143279 (Remove `ItemKind::descr` method)

Failed merges:

 - rust-lang/rust#143237 (Port `#[no_implicit_prelude]` to the new attribute parsing infrastructure)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-01 18:09:52 +00:00
Jonathan Brouwer
d22ce4c5eb Fix duplicate help on export_name and others
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:07 +02:00
Oli Scherer
362d4ddff4 Don't look at static items' HIR for wfcheck 2025-06-30 08:45:43 +00:00
Jonathan Brouwer
1249c14232 Port #[link_name] to the new attribute parsing infrastructure
Co-authored-by: Anne Stijns <anstijns@gmail.com>
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-28 13:53:37 +02:00
David Wood
607eb322a8 trait_sel: skip elaboration of sizedness supertrait
As a performance optimization, skip elaborating the supertraits of
`Sized`, and if a `MetaSized` obligation is being checked, then look for
a `Sized` predicate in the parameter environment. This makes the
`ParamEnv` smaller which should improve compiler performance as it avoids
all the iteration over the larger `ParamEnv`.
2025-06-16 23:04:36 +00:00
David Wood
183458263b tests: bless remaining tests
These tests just need blessing, they don't have any interesting behaviour
changes.

Some of these tests have new errors because `LegacyReceiver` cannot be
proven to be implemented now that it is also testing for `MetaSized` -
but this is just a consequence of the other errors in the test.
2025-06-16 23:04:35 +00:00
David Wood
3c3ba37ba5 tests: PointeeSized bounds with extern types
These tests necessarily need to change now that `?Sized` is not
sufficient to accept extern types and `PointeeSized` is now necessary. In
addition, the `size_of_val`/`align_of_val` test can now be changed to
expect an error.
2025-06-16 23:04:35 +00:00
mejrs
c0e02e26b3 Unimplement unsized_locals 2025-06-13 01:16:36 +02:00
Ralf Jung
17946c22b1 const-eval error: always say in which item the error occurred
also adjust the wording a little so that we don't say "the error occurred here" for two different spans
2025-06-07 13:42:30 +02:00
Oli Scherer
020216c31c Clarify why we are talking about a failed const eval at a random place 2025-06-02 15:37:15 +00:00
Oli Scherer
b331b8b96d Use the informative error as the main const eval error message 2025-06-02 15:37:15 +00:00
Nicholas Nethercote
1cc0e38fdc Avoid creating an empty identifer in Symbol::to_ident_string.
Because that causes an assertion failure in debug builds.

Fixes #140884.
2025-05-21 18:59:04 +10:00
Vadim Petrochenkov
b3f75353a2 UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
Bennet Bleßmann
7dd57f085c update/bless tests 2025-04-06 21:41:47 +02:00
Michael Goulet
e6004ccb50 Use def_path_str for def id arg in UnsupportedOpInfo 2025-03-20 03:22:46 +00:00
Michael Goulet
c566318a78 Tweak error code for sized checks of const/static 2025-03-03 23:09:42 +00:00
bors
b522e7c5ea Auto merge of #137225 - RalfJung:vectorcall, r=nnethercote
vectorcall ABI: require SSE2

According to the official docs at https://learn.microsoft.com/en-us/cpp/cpp/vectorcall, SSE2 is required for this ABI. Add a check that enforces this.

I put this together with the other checks ensuring the target features required for a function are present... however, since the ABI is known pre-monomorphization, it would be possible to do this check earlier, which would have the advantage of checking even in `cargo check`. It would have the disadvantage of spreading this code in yet more places.

The first commit just does a little refactoring of the mono-time ABI check to make it easier to add the new check.

Cc `@workingjubilee`

try-job: dist-i586-gnu-i586-i686-musl
2025-02-23 14:12:38 +00:00
Michael Goulet
0a7ab1d6df More sophisticated span trimming 2025-02-21 00:41:17 +00:00
Ralf Jung
83fd16f625 vectorcall ABI: error if sse2 is not available 2025-02-20 12:40:58 +01:00
Michael Goulet
6d71251cf9 Trim suggestion parts to the subset that is purely additive 2025-02-14 00:44:10 -08:00
Michael Goulet
b480a9214a Use underline suggestions for purely 'additive' replacements 2025-02-14 00:27:13 -08:00