Commit Graph

249181 Commits

Author SHA1 Message Date
Matthias Krüger
2894585f7e
Rollup merge of #122223 - Jarcho:visit_fix, r=oli-obk
Fix typo in `VisitorResult`

r? ```@oli-obk```
2024-03-09 16:21:19 +01:00
Matthias Krüger
dc7a9f6c7f
Rollup merge of #122215 - Zoxc:cycle-detect-names, r=oli-obk
Some tweaks to the parallel query cycle handler

This renames `deadlock` to `break_query_cycles`. The abort logic is moved next to the thread spawning and gives the thread a name.

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

r? ```@oli-obk```
2024-03-09 16:21:18 +01:00
Matthias Krüger
a5adac0ea3
Rollup merge of #122209 - onur-ozkan:fix-tidy-path-resolution, r=compiler-errors
fix incorrect path resolution in tidy

Previously, reading the current path from the environment led to failure when invoking x from outside the source root. This change fixes this issue by passing the already resolved root path into `ui_tests::check`.

Fixes #122202
2024-03-09 16:21:18 +01:00
Matthias Krüger
9ac5cc86d7
Rollup merge of #122187 - bjorn3:merge_header_version_checks, r=petrochenkov
Move metadata header and version checks together

This will make it easier to report rustc versions for older metadata formats.

Split out of https://github.com/rust-lang/rust/pull/120855
2024-03-09 16:21:17 +01:00
Matthias Krüger
577632d4d4
Rollup merge of #122178 - cuviper:ci-llvm-18, r=Kobzol
ci: add a runner for vanilla LLVM 18

For CI cost, this can be seen as replacing the llvm-15 runner we dropped in #117947.

Also, I've set `IS_NOT_LATEST_LLVM` in the llvm-17 runner, since that's not the latest anymore.
2024-03-09 16:21:16 +01:00
Matthias Krüger
985befe036
Rollup merge of #122160 - jieyouxu:eager-translate-help-use-latest-edition, r=cjgillot
Eagerly translate `HelpUseLatestEdition` in parser diagnostics

Fixes #122130.

This makes me suspicious of these other two usage of  `add_to_diagnostic()`. Would they *also* crash? I haven't attempted to construct test cases for them.

```
compiler/rustc_parse/src/parser/expr.rs
3453:            errors::HelpUseLatestEdition::new().add_to_diagnostic(e);

compiler/rustc_hir_typeck/src/expr.rs
2603:            HelpUseLatestEdition::new().add_to_diagnostic(&mut err);
```

This also seems like a footgun?
2024-03-09 16:21:16 +01:00
Matthias Krüger
a979f971b4
Rollup merge of #121813 - Urgau:misc-non_local_defs-lint, r=cjgillot
Misc improvements to non local defs lint implementation

This PR is a collection of small improvements I found when I [needlessly tried](https://www.github.com/rust-lang/rust/pull/120393#issuecomment-1971787475) to fix a "perf-regression" in the lint implementation.

I recommend looking at each commit individually.
2024-03-09 16:21:15 +01:00
Matthias Krüger
a1f6191e0e
Rollup merge of #121358 - GnomedDev:lower-align-typeid, r=Mark-Simulacrum
Reduce alignment of TypeId to u64 alignment

Closes #115620
2024-03-09 16:21:14 +01:00
Nadrieril
594cf1de61 review 2024-03-09 15:28:26 +01:00
Deadbeef
7e1969ac13 Remove Ord from ClosureKind
Using `Ord` to accomplish a meaning of subset relationship
can be hard to read. The existing uses for that are easily
replaced with a `match`, and in my opinion, more readable
without needing to resorting to comments to explain the
intention.
2024-03-09 21:16:43 +08:00
Ralf Jung
e632e3f9a5 miri: do not apply aliasing restrictions to Box with custom allocator 2024-03-09 13:08:55 +01:00
bors
b054da8155 Auto merge of #122150 - ShoyuVanilla:replace-typewalker, r=lcnr
Replace `TypeWalker` usage with `TypeVisitor` in `wf.rs`

Resolves #121693
2024-03-09 12:02:25 +00:00
bors
0ebb78fb7b Auto merge of #3367 - rust-lang:rustup-2024-03-09, r=RalfJung
Automatic Rustup
2024-03-09 11:34:34 +00:00
Ralf Jung
862f918fa4 fix clippy lints 2024-03-09 12:33:17 +01:00
Ralf Jung
1082c36a4c fn is_align_to: move some comments closer to the cast they refer to 2024-03-09 11:54:27 +01:00
Ralf Jung
6aff1ca68c fix warning when building libcore for Miri 2024-03-09 11:11:10 +01:00
bors
574e23ec50 Auto merge of #16794 - HKalbasi:test-explorer, r=lnicola
Some minor changes in the test explorer lsp extension

followup #16662

cc `@nemethf` `@ShuiRuTian`
2024-03-09 10:01:41 +00:00
bors
9d272a1b05 Auto merge of #122102 - Urgau:optimize-symbol-integer, r=cjgillot
Optimize `Symbol::integer` by utilizing in-place formatting

This PR optimize `Symbol::integer` by utilizing `itoa` in-place formatting instead of going through a dynamically allocated `String` and the format machinery.

<details>

For some context: I was profiling `rustc --check-cfg` with callgrind and due to the way we currently setup all the targets and we end-up calling `Symbol::integer` multiple times for all the targets. Using `itoa` reduced the number of instructions.

</details>
2024-03-09 08:47:57 +00:00
bors
b0fad9accb Auto merge of #3368 - RalfJung:ui, r=RalfJung
rename tests/compiletest → tests/ui

This hasn't been `compiletest` in a while.
2024-03-09 08:16:15 +00:00
Ralf Jung
00be3525bf rename tests/compiletest → tests/ui 2024-03-09 09:13:50 +01:00
bors
cabac98df8 Auto merge of #3366 - RalfJung:tempdir, r=oli-obk
compiletest: create fresh tempdir for tests to use

Fixes https://github.com/rust-lang/miri/issues/3364
2024-03-09 07:11:10 +00:00
Gurinder Singh
b1f4657fe9 Add missing regression tests
for a couple of issues
2024-03-09 12:01:19 +05:30
bors
8f08bbe637 Auto merge of #16795 - mu001999:master, r=Veykril
remove unused struct Snap in lsif

Detected by #121752, see https://github.com/rust-lang/rust/pull/121752#issuecomment-1986378328
2024-03-09 06:30:07 +00:00
bors
48a15aa2c4 Auto merge of #122095 - lukas-code:windows-shutdown-test, r=ChrisDenton
fix `close_read_wakes_up` test

On windows, `shutdown` does not interrupt `read`, even though we document that it does (see https://github.com/rust-lang/rust/issues/121594).

The `close_read_wakes_up` test has a race condition and only passes on windows if the `shutdown` happens before the `read`. This PR ignores the test on windows adds a sleep to make it more likely that the `read` happens before the `shutdown` and the test actually tests what it is supposed to test on other platforms.

I'm submitting this before any docs changes, so that we can find out on what platforms `shutdown` actually works as documented.

r? `@ChrisDenton`
2024-03-09 06:23:18 +00:00
onur-ozkan
7c13421dc0 fix incorrect path resolution in tidy
Previously, reading the current path from the environment led to failure when invoking
x from outside the source root. This change fixes this issue by passing the already
resolved root path into `ui_tests::check`.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-03-09 08:53:26 +03:00
The Miri Cronjob Bot
91644dd389 fmt 2024-03-09 05:02:53 +00:00
The Miri Cronjob Bot
e720147bf5 Merge from rustc 2024-03-09 05:01:38 +00:00
The Miri Cronjob Bot
52db5f6cdc Preparing for merge from rustc 2024-03-09 04:54:42 +00:00
Jason Newcomb
564837e23d Fix typo in VisitorResult 2024-03-08 23:20:29 -05:00
bors
1b427b3bf7 Auto merge of #118879 - Nadrieril:lint-range-gap, r=estebank
Lint singleton gaps after exclusive ranges

In the discussion to stabilize exclusive range patterns (https://github.com/rust-lang/rust/issues/37854), it has often come up that they're likely to cause off-by-one mistakes. We already have the `overlapping_range_endpoints` lint, so I [proposed](https://github.com/rust-lang/rust/issues/37854#issuecomment-1845580712) a lint to catch the complementary mistake.

This PR adds a new `non_contiguous_range_endpoints` lint that catches likely off-by-one errors with exclusive range patterns. Here's the idea (see the test file for more examples):
```rust
match x {
    0..10 => ..., // WARN: this range doesn't match `10_u8` because `..` is an exclusive range
    11..20 => ..., // this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them
    _ => ...,
}
// help: use an inclusive range instead: `0_u8..=10_u8`
```

More precisely: for any exclusive range `lo..hi`, if `hi+1` is matched by another range but `hi` isn't, we suggest writing an inclusive range `lo..=hi` instead. We also catch `lo..T::MAX`.
2024-03-09 03:49:01 +00:00
Nadrieril
7843e46f17 Factor out non-branch-related pattern data 2024-03-09 03:51:30 +01:00
bors
4d4bb491b6 Auto merge of #122010 - oli-obk:intrinsics3.0, r=pnkfelix
Avoid invoking the `intrinsic` query for DefKinds other than `Fn` or `AssocFn`

fixes the perf regression from https://github.com/rust-lang/rust/pull/120675 by only invoking (and thus inserting into the dep graph) the `intrinsic` query if the `DefKind` matches items that can actually be intrinsics
2024-03-09 01:18:13 +00:00
r0cky
79508d909a remove unused struct Snap in lsif 2024-03-09 09:09:27 +08:00
Nadrieril
8ac9a04257 Lint small gaps between ranges 2024-03-09 01:14:22 +01:00
Nadrieril
f783043ebf Allow lint where we don't care 2024-03-09 01:13:42 +01:00
Nadrieril
77f679430c Declare new lint 2024-03-09 01:13:42 +01:00
Nadrieril
a047284b5a Make MaybeInfiniteInt::plus_one/minus_one fallible 2024-03-09 01:13:42 +01:00
Ben Kimock
5a93a59fd5 Distinguish between library and lang UB in assert_unsafe_precondition 2024-03-08 18:53:58 -05:00
Ralf Jung
4235ec5baa compiletest: create fresh tempdir for tests to use 2024-03-09 00:36:26 +01:00
John Kåre Alsaker
87ab9e8c6e Some tweaks to the parallel query cycle handler 2024-03-09 00:24:14 +01:00
bors
01d73d4041 Auto merge of #122208 - bjorn3:sync_cg_clif-2024-03-08, r=bjorn3
Subtree sync for rustc_codegen_cranelift

The main highlight this time is a bunch of new vendor intrinsics. Cranelift has also been updated to 0.105. And there were a bunch of big-endian fixes.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2024-03-08 22:49:31 +00:00
David Carlier
ffdd97f791 further changes from feedback 2024-03-08 22:39:20 +00:00
hkalbasi
dc99ad912a Some minor changes in the test explorer lsp extension 2024-03-09 01:21:27 +03:30
bjorn3
8960fe05ad Remove exception for deleted file from rustfmt.toml 2024-03-08 20:46:33 +00:00
bjorn3
8fb8b08716 Merge commit '54cbb6e7531f95e086d5c3dd0d5e73bfbe3545ba' into sync_cg_clif-2024-03-08 2024-03-08 20:41:29 +00:00
bors
46b180ec24 Auto merge of #122206 - matthiaskrgr:rollup-4txx9wx, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #121201 (align_offset, align_to: no longer allow implementations to spuriously fail to align)
 - #122076 (Tweak the way we protect in-place function arguments in interpreters)
 - #122100 (Better comment for implicit captures in RPITIT)
 - #122157 (Add the new description field to Target::to_json, and add descriptions for some MSVC targets)
 - #122164 (Fix misaligned loads when loading UEFI arg pointers)
 - #122171 (Add some new solver tests)
 - #122172 (Don't ICE if we collect no RPITITs unless there are no unification errors)
 - #122197 (inspect formatter: add braces)
 - #122198 (Remove handling for previously dropped LLVM version)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-08 20:34:52 +00:00
bjorn3
54cbb6e753 Use sqrt clif instruction for sqrt rust intrinsics 2024-03-08 20:20:45 +00:00
Matthias Krüger
b61edb9544
Rollup merge of #122198 - beetrees:no-llvm-14, r=cuviper
Remove handling for previously dropped LLVM version

LLVM 14 support was dropped in #114148, so this LLVM version check is no longer required.
2024-03-08 21:02:04 +01:00
Matthias Krüger
bf939fcb99
Rollup merge of #122197 - lcnr:proof-tree-braces, r=BoxyUwU
inspect formatter: add braces

This makes it easier to hide subtrees when looking through proof trees. Looking at the proof tree for `usize: Clone`:

nightly:
```
ROOT GOAL: Goal { predicate: Binder { value: TraitPredicate(<usize as std::clone::Clone>, polarity:Positive), bound_vars: [] }, param_env: ParamEnv { caller_bounds: [], reveal: UserFacing } }
    GOAL: Canonical { value: QueryInput { goal: Goal { predicate: Binder { value: TraitPredicate(<usize as std::clone::Clone>, polarity:Positive), bound_vars: [] }, param_env: ParamEnv { caller_bounds: [], reveal: UserFacing } }, anchor: Bind(DefId(0:5 ~ main[8e4b]::main)), predefined_opaques_in_body: PredefinedOpaques(PredefinedOpaquesData { opaque_types: [] }) }, max_universe: U0, variables: [] }
    REVISION 0
        INSTANTIATED: QueryInput { goal: Goal { predicate: Binder { value: TraitPredicate(<usize as std::clone::Clone>, polarity:Positive), bound_vars: [] }, param_env: ParamEnv { caller_bounds: [], reveal: UserFacing } }, anchor: Bind(DefId(0:5 ~ main[8e4b]::main)), predefined_opaques_in_body: PredefinedOpaques(PredefinedOpaquesData { opaque_types: [] }) }
        ROOT RESULT: Ok(Canonical { value: Response { certainty: Yes, var_values: CanonicalVarValues { var_values: [] }, external_constraints: ExternalConstraints(ExternalConstraintsData { region_constraints: QueryRegionConstraints { outlives: [], member_constraints: [] }, opaque_types: [] }) }, max_universe: U0, variables: [] })
            CANDIDATE Impl(DefId(2:30665 ~ core[a9f5]::clone::impls::{impl#5})): Ok(Canonical { value: Response { certainty: Yes, var_values: CanonicalVarValues { var_values: [] }, external_constraints: ExternalConstraints(ExternalConstraintsData { region_constraints: QueryRegionConstraints { outlives: [], member_constraints: [] }, opaque_types: [] }) }, max_universe: U0, variables: [] })
                TRY_EVALUATE_ADDED_GOALS: Ok(Yes)
                ITERATION 0
            CANDIDATE constituent tys: Err(NoSolution)
            NORMALIZING SELF TY FOR ASSEMBLY:
            NORMALIZING SELF TY FOR ASSEMBLY:
    RESULT: Ok(Canonical { value: Response { certainty: Yes, var_values: CanonicalVarValues { var_values: [] }, external_constraints: ExternalConstraints(ExternalConstraintsData { region_constraints: QueryRegionConstraints { outlives: [], member_constraints: [] }, opaque_types: [] }) }, max_universe: U0, variables: [] })
```

with this PR:
```
ROOT GOAL: Goal { predicate: Binder { value: TraitPredicate(<usize as std::clone::Clone>, polarity:Positive), bound_vars: [] }, param_env: ParamEnv { caller_bounds: [], reveal: UserFacing } } {
    GOAL: Canonical { value: QueryInput { goal: Goal { predicate: Binder { value: TraitPredicate(<usize as std::clone::Clone>, polarity:Positive), bound_vars: [] }, param_env: ParamEnv { caller_bounds: [], reveal: UserFacing } }, anchor: Bind(DefId(0:5 ~ main[4f74]::main)), predefined_opaques_in_body: PredefinedOpaques(PredefinedOpaquesData { opaque_types: [] }) }, max_universe: U0, variables: [] }
    REVISION 0: {
        INSTANTIATED: QueryInput { goal: Goal { predicate: Binder { value: TraitPredicate(<usize as std::clone::Clone>, polarity:Positive), bound_vars: [] }, param_env: ParamEnv { caller_bounds: [], reveal: UserFacing } }, anchor: Bind(DefId(0:5 ~ main[4f74]::main)), predefined_opaques_in_body: PredefinedOpaques(PredefinedOpaquesData { opaque_types: [] }) }
        ROOT RESULT: Ok(Canonical { value: Response { certainty: Yes, var_values: CanonicalVarValues { var_values: [] }, external_constraints: ExternalConstraints(ExternalConstraintsData { region_constraints: QueryRegionConstraints { outlives: [], member_constraints: [] }, opaque_types: [] }) }, max_universe: U0, variables: [] }) {
            CANDIDATE Impl(DefId(2:30468 ~ core[d1d7]::clone::impls::{impl#5})): Ok(Canonical { value: Response { certainty: Yes, var_values: CanonicalVarValues { var_values: [] }, external_constraints: ExternalConstraints(ExternalConstraintsData { region_constraints: QueryRegionConstraints { outlives: [], member_constraints: [] }, opaque_types: [] }) }, max_universe: U0, variables: [] }) {
                TRY_EVALUATE_ADDED_GOALS: Ok(Yes)
                ITERATION 0 {}
            }
            CANDIDATE constituent tys: Err(NoSolution) {}
            NORMALIZING SELF TY FOR ASSEMBLY: {}
            NORMALIZING SELF TY FOR ASSEMBLY: {}
        }
    }
    RESULT: Ok(Canonical { value: Response { certainty: Yes, var_values: CanonicalVarValues { var_values: [] }, external_constraints: ExternalConstraints(ExternalConstraintsData { region_constraints: QueryRegionConstraints { outlives: [], member_constraints: [] }, opaque_types: [] }) }, max_universe: U0, variables: [] })
}
```

r? `@BoxyUwU`
2024-03-08 21:02:03 +01:00
Matthias Krüger
02b89d1676
Rollup merge of #122172 - compiler-errors:rpitit-collect-ice, r=fmease
Don't ICE if we collect no RPITITs unless there are no unification errors

Move an assertion in `collect_return_position_impl_trait_in_trait_tys` to after the `ObligationCtxt::eq` calls, so that we only assert and ICE if we have unification errors.

Fixes #121468
2024-03-08 21:02:03 +01:00