Commit Graph

47859 Commits

Author SHA1 Message Date
bors
fc6bfe09aa Auto merge of #140959 - oli-obk:no-unsafe-children, r=davidtwco
Invoke a query only when it doesn't return immediately anyway

This should cause less query key caching and less dep graph data, hopefully resulting in some perf improvements
2025-05-16 12:54:18 +00:00
yukang
5f8954bc41 Fix the issue of typo of comma in arm parsing 2025-05-16 12:40:04 +02:00
Ryan van Polen
4c2d3bc8bd Removed feature flag from compiler/rustc_driver_impl 2025-05-16 12:00:44 +02:00
bors
1b9efcd18f Auto merge of #141044 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`

Cargo.lock update due to Clippy version bump.
2025-05-16 08:54:55 +00:00
bors
c79bbfab78 Auto merge of #141066 - matthiaskrgr:rollup-e7tyrj5, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #140791 (std: explain prefer `TryInto` over `TryFrom` when specifying traits bounds on generic function)
 - #140834 (move (or remove) some impl Trait tests)
 - #140910 (Remove `stable` attribute from wasi fs (read_exact|write_all)_at)
 - #140984 (fix doc for UnixStream)
 - #140997 (Add negative test coverage for `-Clink-self-contained` and `-Zlinker-features`)
 - #141003 (Improve ternary operator recovery)
 - #141009 (Migrate to modern datetime API)
 - #141013 (Implement methods to set STARTUPINFO flags for Command API on Windows)
 - #141026 (rustc-dev-guide subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-16 05:45:37 +00:00
Matthias Krüger
e53b9f8fdd Rollup merge of #141003 - clubby789:ternary-improve, r=compiler-errors
Improve ternary operator recovery

This
- Improves the span of the error to not point at the next token
- Where possible, we use the span of the condition to further improve the span of the error to include the cond, and suggest a maybe-incorrect fix

Currently this works on free expressions, not let statements; some more refactoring would be needed to pass the span down, which I'm not sure is worth doing.

### Old
![image](https://github.com/user-attachments/assets/5688cefc-e4ef-4135-a5ba-340ce05ae6f3)

### New
![image](https://github.com/user-attachments/assets/154f5380-e0c8-42c7-9bf8-0adb3d0433fa)
2025-05-16 07:19:41 +02:00
bors
7e19eef048 Auto merge of #140557 - compiler-errors:remove-wf-hack, r=lcnr
Remove manual WF hack

We do not need this hack anymore since we fixed the candidate selection problems with `Sized` bounds. We prefer built-in sized bounds now since #138176, which fixes the only regression this hack was intended to fix.

While this theoretically is broken for some code, for example, when there a param-env bound that shadows an impl or built-in trait, we don't see it in practice and IMO it's not worth the burden of having to maintain this wart in `compare_method_predicate_entailment`.

The code that regresses is, for example:

```rust
trait Bar<'a> {}

trait Foo<'a, T> {
    fn method(&self)
    where
        Self: Bar<'a>;
}

struct W<'a, T>(&'a T)
where
    Self: Bar<'a>;

impl<'a, 'b, T> Bar<'a> for W<'b, T> {}

impl<'a, 'b, T> Foo<'a, T> for W<'b, T> {
    fn method(&self) {}
}
```

Specifically, I don't believe this is really going to be encountered in practice. For this to fail, there must be a where clause in the *trait method* that would shadow an impl or built-in (non-`Sized`) candidate in the trait, and this shadowing would need to be encountered when solving a nested WF goal from the impl self type.

See #108544 for the original regression. Crater run is clean!

r? lcnr
2025-05-16 02:34:32 +00:00
Berrysoft
5e048e0786 Simplify current_dll_path for Cygwin 2025-05-16 09:41:52 +08:00
Samuel Tardieu
cf878d8f26 HIR: explain in comment why ExprKind::If "then" is an Expr
One could be tempted to replace the "then" `hir::Expr` with kind
`hir::ExprKind::Block` by a `hir::Block`. Explain why this would not be
a good idea.
2025-05-15 23:44:23 +02:00
Matthias Krüger
d0ea342440 Rollup merge of #140947 - compiler-errors:pending-norm, r=lcnr
Flush errors before deep normalize in `dropck_outlives`

Deep normalization doesn't allow the ocx to have pending obligations, so process them before deeply normalizing.

Fixes https://github.com/rust-lang/rust/issues/140931
Fixes https://github.com/rust-lang/rust/issues/140462
2025-05-15 22:28:51 +02:00
Matthias Krüger
f5fb0d3ea0 Rollup merge of #140768 - Urgau:improv_autorefs-lint, r=fmease
Improve `dangerous_implicit_aurorefs` diagnostic output

This PR *greatly* improves the `dangerous_implicit_aurorefs` lint diagnostic output.

Kind of related to #140721.

r? ```@jieyouxu``` (maybe)
2025-05-15 22:28:51 +02:00
Matthias Krüger
1f84e114f1 Rollup merge of #140712 - lcnr:normalization-gat-args, r=compiler-errors
normalization: avoid incompletely constraining GAT args

We need to copy the behavior of #125214 in the new solver. This fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/202 which seems to be the cause of the regression in `deptypes`.

r? ```@compiler-errors```
2025-05-15 22:28:50 +02:00
Daniel Paoliello
6128fca0b0 [win][arm64] Remove 'Arm64 Hazard' undocumented MSVC option and instead disable problematic test 2025-05-15 11:33:28 -07:00
Philipp Krones
60750ca0a1 tempfile dep bump fallout 2025-05-15 19:55:43 +02:00
王宇逸
49553be307 Experimental cygwin support in rustc
Co-authored-by: Ookiineko <chiisaineko@protonmail.com>
2025-05-15 23:34:11 +08:00
bors
c4e05e53d1 Auto merge of #136988 - compiler-errors:impossible_predicates, r=lcnr
Use the new solver in the `impossible_predicates`

The old solver is unsound for many reasons. One of which was weaponized by `@lcnr` in #140212, where the old solver was incompletely considering a dyn vtable method to be impossible and replacing its vtable entry with a null value. This null function could be called post-mono.

The new solver is expected to be less incomplete due to its correct handling of higher-ranked aliases in relate. This PR switches the `impossible_predicates` query to use the new solver, which patches this UB.

r? lcnr
2025-05-15 15:31:24 +00:00
Rémy Rakic
102cc2f883 move expensive layout sanity check to debug assertions 2025-05-15 14:05:02 +00:00
bendn
de8e8641ae dont handle bool transmute 2025-05-15 20:20:39 +07:00
Andrew Zhogin
7b2dcf2989 Async drop fix for dropee from another crate (#140858) 2025-05-15 20:05:07 +07:00
Jieyou Xu
734a5b1aa7 Revert "Fix linking statics on Arm64EC #140176"
Unfortunately, multiple people are reporting linker warnings related to
`__rust_no_alloc_shim_is_unstable` after this change. The solution isn't
quite clear yet, let's revert to green for now, and try a reland with a
determined solution for `__rust_no_alloc_shim_is_unstable`.

This reverts commit c8b7f32434, reversing
changes made to 667247db71.
2025-05-15 16:54:27 +08:00
Rémy Rakic
55ad9cd516 silence unexpected lld warning on old gccs 2025-05-15 08:50:01 +00:00
Urgau
9b3abe79d7 Use more subdiagnostics and reword the overloaded deref note 2025-05-14 23:53:40 +02:00
Urgau
ac1df15f86 Improve dangerous_implicit_aurorefs diagnostic output 2025-05-14 18:58:38 +02:00
Matthias Krüger
e39ab25bf4 Rollup merge of #140989 - xizheyin:issue-139631, r=compiler-errors
Suggest replace f with f: Box<f> when expr field is short hand

Fixes #139631

r? compiler
2025-05-14 18:43:40 +02:00
Matthias Krüger
a1b5841bcc Rollup merge of #140976 - samueltardieu:diag-ipaddr-v4v6, r=Urgau
Add `Ipv4Addr` and `Ipv6Addr` diagnostic items

They will be used in Clippy to detect runtime parsing of known-valid IP addresses.
2025-05-14 18:43:39 +02:00
Matthias Krüger
dcb808e48b Rollup merge of #140827 - compiler-errors:gather-locals-twice, r=oli-obk
Do not ICE when reassigning in GatherLocalsVisitor on the bad path

Fixes https://github.com/rust-lang/rust/issues/140785
Fixes https://github.com/rust-lang/rust/issues/140730

See comment in code.

r? oli-obk
2025-05-14 18:43:37 +02:00
Guillaume Gomez
7a47a6a9c7 Update gcc version used in rustc_codegen_version 2025-05-14 18:00:19 +02:00
Jamie
1267333ef1 Improve ternary operator recovery 2025-05-14 13:32:59 +01:00
Guillaume Gomez
1c4ab86955 Merge commit '6ba33f5e1189a5ae58fb96ce3546e76b13d090f5' into subtree-update_cg_gcc_2025-05-14 2025-05-14 13:51:02 +02:00
Oli Scherer
e011c43bcf Merge mir query analysis invocations
The reasons I'm doing it is that

* merging those blocks allows for more parallelism as you don't run parallel blocks in sequence
* merging blocks allows merging analysis queries shrinking the dep graph
* should allow us to do more early aborting in case of errors and/or moving query calls from the analysis query into others that allow early aborting the others (and doing more tainting and stuff)
2025-05-14 08:04:56 +00:00
Samuel Tardieu
7b1ba425e7 Add Ipv4Addr and Ipv6Addr diagnostic items
They will be used in Clippy to detect runtime parsing of known-valid
IP addresses.
2025-05-14 09:34:25 +02:00
xizheyin
32be459909 Suggest replace f with f: Box<f> when expr field is short hand
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-14 15:14:32 +08:00
ismailarilik
85efae7302 Handle rustc_query_system cases of rustc::potential_query_instability lint 2025-05-14 08:59:55 +03:00
David Wood
febb16a40f type_ir: add faster exit for types_may_unify 2025-05-13 16:47:10 +00:00
Stypox
f4bc4cd1fd Add TRACING_ENABLED to Machine trait 2025-05-13 18:15:02 +02:00
bors
4eca99a18e Auto merge of #140887 - pietroalbini:pa-bootstrap-update, r=compiler-errors
Stage0 bootstrap update

This PR [follows the release process](https://forge.rust-lang.org/release/process.html#master-bootstrap-update-tuesday) to update the stage0 compiler.

The only thing of note is 58651d1b31, which was flagged by clippy as a correctness fix. I think allowing that lint in our case makes sense, but it's worth to have a second pair of eyes on it.

r? `@Mark-Simulacrum`
2025-05-13 09:54:28 +00:00
Michael Goulet
a508011b1f Expect deep norm to fail if query norm failed 2025-05-13 09:18:17 +00:00
Oli Scherer
34976ac9fe Invoke a query only when it doesn't return immediately anyway 2025-05-13 08:55:32 +00:00
Oli Scherer
c86e33b771 Run rustc_attrs dumps after typeck 2025-05-13 08:46:10 +00:00
Oli Scherer
bd587005fb Some require_lang_item -> is_lang_item replacements 2025-05-13 08:46:10 +00:00
David Wood
a5e1dba0cd trait_sel: deep reject match_normalize_trait_ref
Spotted during an in-person review of unrelated changes,
`match_normalize_trait_ref` could be using `DeepRejectCtxt` to exit early
as an optimisation for prejection candidates, like is done in param
candidates.
2025-05-13 07:33:51 +00:00
bors
32d23857f1 Auto merge of #140935 - omahs:patch-5, r=jieyouxu
Fix typos

Fix typos
2025-05-13 03:33:22 +00:00
Michael Goulet
df1da673f7 Flush errors before deep normalize in dropck_outlives 2025-05-12 21:04:38 +00:00
bors
1a7f290a9a Auto merge of #140914 - Zalathar:asm-bindings, r=compiler-errors
cg_llvm: Clean up some inline assembly bindings

This PR combines a few loosely-related cleanups to LLVM bindings related to inline assembly. These include:
- Replacing `LLVMRustInlineAsm` with LLVM-C's `LLVMGetInlineAsm`
- Adjusting FFI declarations to avoid the need for explicit `as_c_char_ptr` conversions
- Flattening control flow in `inline_asm_call`

There should be no functional changes.
2025-05-12 17:39:21 +00:00
omahs
1caaa88700 Fix typos 2025-05-12 17:20:49 +00:00
Pietro Albini
2ce08ca5d6 update cfg(bootstrap) 2025-05-12 15:33:37 +02:00
Pietro Albini
a360940ac9 update version placeholders 2025-05-12 15:33:30 +02:00
tiif
41a2260bc7 Use unreachable instead of panic
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2025-05-12 09:23:30 +02:00
bors
718ddf660e Auto merge of #140923 - Zalathar:operand-bundle, r=lcnr
cg_llvm: Rename `OperandBundleOwned` to `OperandBundleBox`

As with `DIBuilderBox`, the "Box" suffix does a better job of communicating that this is an owning pointer to some borrowable resource.

This also renames the `raw` method to `as_ref`, which is what it would have been named originally if the `Deref` problem (#137603) had been known at the time.

No functional change.
2025-05-12 01:26:55 +00:00
bors
6812af9821 Auto merge of #140842 - tmiasko:print-mono-items, r=saethlin
Remove mono item collection strategy override from -Zprint-mono-items

Previously `-Zprint-mono-items` would override the mono item collection
strategy. When debugging one doesn't want to change the behaviour, so
this was counter productive. Additionally, the produced behaviour was
artificial and might never arise without using the option in the first
place (`-Zprint-mono-items=eager` without `-Clink-dead-code`).  Finally,
the option was incorrectly marked as `UNTRACKED`.

Resolve those issues, by turning `-Zprint-mono-items` into a boolean
flag that prints results of mono item collection without changing the
behaviour of mono item collection.

For codegen-units test incorporate `-Zprint-mono-items` flag directly
into compiletest tool.

Test changes are mechanical. `-Zprint-mono-items=lazy` was removed
without additional changes, and `-Zprint-mono-items=eager` was turned
into `-Clink-dead-code`.  Linking dead code disables internalization, so
tests have been updated accordingly.
2025-05-11 22:15:30 +00:00