Commit Graph

288920 Commits

Author SHA1 Message Date
lcnr
0be1ec1ccd CreateResult wrap more fields in Frozen 2025-05-03 02:52:37 +00:00
lcnr
27f83a5e05 TypeChecker take fields by ref 2025-05-03 02:49:15 +00:00
lcnr
ad3c35bea5 add ReverseSccGraph::compute 2025-05-03 02:47:14 +00:00
Nicholas Nethercote
9af08429f1 Avoid an indent for labelled loops. 2025-05-03 12:46:51 +10:00
Nicholas Nethercote
809e5b5ed1 Fix some hir pretty-printing over-indenting. 2025-05-03 12:46:51 +10:00
Nicholas Nethercote
e1a177bbba Improve hir pretty-printing of attributes. 2025-05-03 12:46:48 +10:00
bors
2ad5f8607d Auto merge of - osiewicz:collector-walk-less-fine-grained-locking, r=wesleywiser
mono collector: Reduce # of locking while walking the graph

While profiling Zed's dev build I've noticed that while most of the time `upstream_monomorphizations` takes a lot of time in monomorpization_collector, in some cases (e.g. build of `editor` itself) the rest of monomorphization_collector_graph_walk dominates it. Most of the time is spent in collect_items_rec.

This PR aims to reduce the number of locks taking place; instead of locking output MonoItems once per children of current node, we do so once per *current node*. We also get to reuse locks for mentioned and used items. While this commit does not reduce Wall time of Zed's build, it does shave off CPU time (measured with `cargo build -j1`) from 48s to 47s. I've also tested it with parallel frontend against Zed and ripgrep and found no regressions.
2025-05-03 00:24:14 +00:00
Nicholas Nethercote
aa7bb1c2f5 Enable BoxMarker drop checking.
All the box open/close issues have been fixed.
2025-05-03 09:14:27 +10:00
Nicholas Nethercote
760cf8d3af Fix hir pretty-printing of global_asm!.
One of the boxes isn't closed, and this causes everything after it to be
over-indented.
2025-05-03 09:14:27 +10:00
Nicholas Nethercote
3896ad0acd Remove opaque type printing.
As far as I can tell, this code is not actually reachable.
2025-05-03 09:14:00 +10:00
Nicholas Nethercote
882c74dfcf Remove fake BoxMarkers.
They don't appear to do anything -- no test output is affected -- and no
other pretty-printing code looks like this.
2025-05-03 09:13:28 +10:00
Lieselotte
415a73e3eb
docs: alias limit to Iterator::take, cite [u8]::utf8_chunks in Utf8Chunks 2025-05-02 23:41:52 +02:00
bors
2d5ffc513f Auto merge of - matthiaskrgr:rollup-s7tzr34, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 -  (Optimize the codegen for `Span::from_expansion`)
 -  (transmutability: merge contiguous runs with a common destination)
 -  (Use select in projection lookup in `report_projection_error`)
 -  (interpret: better error message for out-of-bounds pointer arithmetic and accesses)
 -  (Rename `*Guard::try_map` to `filter_map`.)
 -  (Stabilize `select_unpredictable`)
 -  (extend the list of registered dylibs on `test::prepare_cargo_test`)
 -  (Add useful comments on `ExprKind::If` variants.)
 -  (Add regression test for 133065)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-02 20:59:24 +00:00
Lukas Wirth
429027a40f
Merge pull request from ShoyuVanilla/issue-19724
fix: Implement mut to const ptr cast for method resolution
2025-05-02 20:48:24 +00:00
Lukas Wirth
4e3bdb96d9
Merge pull request from ShoyuVanilla/issue-19730
fix: Correct assoc ty bound var starting index
2025-05-02 20:46:54 +00:00
mejrs
4671081bdb Refactor rustc_on_unimplemented's filter parser 2025-05-02 22:08:35 +02:00
moxian
dcee18b3b8 Add a regression test
for 
2025-05-02 11:46:31 -07:00
Erik Kaneda
77876b5233 zkvm: remove schmerik from maintainers list 2025-05-02 11:45:09 -07:00
Shoyu Vanilla
d8a52dbbf8 fix: Implement mut to const ptr cast for method resolution 2025-05-03 03:01:40 +09:00
Xinglu Chen
45d4bb2541 Construct test so that it would fail for old code 2025-05-02 19:56:45 +02:00
Matthias Krüger
6f7f3cec4f
Rollup merge of - reddevilmidzy:add-test, r=compiler-errors
Add regression test for 133065

closes: 
2025-05-02 19:38:01 +02:00
Matthias Krüger
bcf2490c64
Rollup merge of - nnethercote:comment-ExprKind-If, r=compiler-errors
Add useful comments on `ExprKind::If` variants.

Things that aren't obvious and took me a while to work out.

r? `@BoxyUwU`
2025-05-02 19:38:00 +02:00
Matthias Krüger
bfb8f73933
Rollup merge of - onur-ozkan:extend-dylib-paths, r=jieyouxu
extend the list of registered dylibs on `test::prepare_cargo_test`

self-explanatory

Fixes 
2025-05-02 19:37:59 +02:00
Matthias Krüger
15f21f43b3
Rollup merge of - Amanieu:stabilize_select_unpredictable, r=workingjubilee
Stabilize `select_unpredictable`

FCP completed in tracking issue .
2025-05-02 19:37:59 +02:00
Matthias Krüger
06599db9c1
Rollup merge of - zachs18:mapped-guard-filter-map, r=Amanieu
Rename `*Guard::try_map` to `filter_map`.

Rename `std::sync::*Guard::try_map` to `filter_map`.

1. Analogous to `std::cell::Ref(Mut)::filter_map`.
2. Doesn't imply `Try` genericizability.

r? `@Amanieu` (or other T-libs-api)

Tracking issue for `mapped_lock_guards`: https://github.com/rust-lang/rust/issues/117108
2025-05-02 19:37:58 +02:00
Matthias Krüger
c796ef00f8
Rollup merge of - RalfJung:oob-error, r=saethlin
interpret: better error message for out-of-bounds pointer arithmetic and accesses

Fixes https://github.com/rust-lang/rust/issues/93881
r? `@saethlin`
2025-05-02 19:37:58 +02:00
Matthias Krüger
296733d5ac
Rollup merge of - compiler-errors:name-based-comparison, r=oli-obk
Use select in projection lookup in `report_projection_error`

Using `for_each_relevant_impl` doesn't actually select the correct impl; we can use `select` here to actually get the correct impl with certainty. Follow-up to https://github.com/rust-lang/rust/pull/140278.

r? oli-obk
2025-05-02 19:37:57 +02:00
Matthias Krüger
429341b445
Rollup merge of - tmiasko:merge-contiguous-ranges, r=jswrenn
transmutability: merge contiguous runs with a common destination

Based on .

r? `@jswrenn` `@joshlf`
2025-05-02 19:37:56 +02:00
Matthias Krüger
a2ae171b97
Rollup merge of - Jarcho:from_expansion_opt, r=petrochenkov
Optimize the codegen for `Span::from_expansion`

See https://godbolt.org/z/bq65Y6bc4 for the difference. the new version is less than half the number of instructions.

Also tried fully writing the function by hand:
```rust
sp.ctxt_or_parent_or_marker != 0
        && (
            sp.len_with_tag_or_marker == BASE_LEN_INTERNED_MARKER
            || sp.len_with_tag_or_marker & PARENT_TAG == 0
        )
```

But that was no better than this PR's current use of `match_span_kind`.
2025-05-02 19:37:56 +02:00
bors
4824c2bb74 Auto merge of - Urgau:autorefs-perf, r=nnethercote
perf: delay checking of `#[rustc_no_implicit_autorefs]` in autoref lint

Try to address the regression seen in https://github.com/rust-lang/rust/pull/123239#issuecomment-2835418470 by delaying the checking of `#[rustc_no_implicit_autorefs]` on method call.
2025-05-02 17:35:50 +00:00
binarycat
b7c933a495 doc(std): fix typo lchown -> lchmod 2025-05-02 12:13:40 -05:00
Xinglu Chen
8b3637635b Correctly handle interior mutable data in Box
Previously, the pointee type would be behind a `*const` pointer, so
`ty_is_freeze` would always be `true`, even if there was an
`UnsafeCell` in `Box`.
2025-05-02 18:30:24 +02:00
Jana Dönszelmann
5424e4f1db
remove an unused codepath 2025-05-02 18:09:31 +02:00
Jana Dönszelmann
3cc172074a
collateral damage in derive tests, improves errors by not refering to implementation details 2025-05-02 18:09:31 +02:00
Jana Dönszelmann
867b4c9e48
Test that names of variables in external macros are not shown on a borrow error 2025-05-02 18:09:25 +02:00
Lukas Wirth
372f3f3038
Merge pull request from Veykril/push-mmvowomkpwxy
refactor: Simplify macro call id construction
2025-05-02 15:38:17 +00:00
Shoyu Vanilla
9eb1e83a12 fix: Correct assoc ty bound var starting index 2025-05-03 00:31:33 +09:00
Lukas Wirth
a8fb9d0979 refactor: Simplify macro call id construction 2025-05-02 17:26:48 +02:00
bors
7c96085b64 Auto merge of - Zalathar:rollup-ig2jb9v, r=Zalathar
Rollup of 12 pull requests

Successful merges:

 -  (handle paren in macro expand for let-init-else expr)
 -  (pretty-print: Print shebang at the top of the output)
 -  (rustc_target: RISC-V `Zfinx` is incompatible with `{ILP32,LP64}[FD]` ABIs)
 -  (Improve `Lifetime::suggestion`)
 -  (std: use the address of `errno` to identify threads in `unique_thread_exit`)
 -  (Clarify `async` block behaviour)
 -  (Delegate to inner `vec::IntoIter` from `env::ArgsOs`)
 -  (Avoid redundant WTF-8 checks in `PathBuf`)
 -  (Document breaking out of a named code block)
 -  (Remove `avx512dq` and `avx512vl` implication for `avx512fp16`)
 -  (Improve test coverage of HIR pretty printing.)
 -  (rustc_target: RISC-V: feature addition batch 3)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-02 13:54:16 +00:00
John Kåre Alsaker
6a48217efc Move DisambiguatorState into intern_const_alloc_recursive 2025-05-02 15:51:26 +02:00
Vadim Petrochenkov
842858f765 linker: Quote symbol names in .def files
To support weird symbol names, including dots in particular.
2025-05-02 16:25:00 +03:00
Ralf Jung
023854875c
Merge pull request from Patrick-6/miri-genmc-prep
GenMC implementation initial changes
2025-05-02 13:14:36 +00:00
Vadim Petrochenkov
3eee3dad5c resolve: Support imports of associated types and glob imports from traits 2025-05-02 15:59:38 +03:00
Patrick-6
d940d0b758 Implement skeleton code for adding GenMC support to Miri (not yet functional).
- Add a cargo feature to enable GenMC support (off by default)
- Add support for GenMC datastructures to MiriMachine
- Adjust several functions where GenMC needs to be informed about relevant events (e.g., atomic accesses)
- Add skeleton code for parsing GenMC command line arguments
- Some cleanup
  - Finish sentences with a `.`
  - Fix some spelling errors/typos

Co-authored-by: Ralf Jung <post@ralfj.de>
2025-05-02 14:49:17 +02:00
Lukas Wirth
3686ed9f7c
Merge pull request from Veykril/push-uvyutolsqnun
Render more lifetimes
2025-05-02 12:47:03 +00:00
Lukas Wirth
f20e853e65 Render more lifetimes 2025-05-02 14:36:18 +02:00
Guillaume Gomez
fbfc329795 Update sysinfo to 0.35.0 in src/tools/opt-dist 2025-05-02 14:27:27 +02:00
Guillaume Gomez
ce4d395850 Update sysinfo version to 0.35.0 2025-05-02 14:25:27 +02:00
Stuart Cook
19c9b763ba
Rollup merge of - a4lg:riscv-feature-addition-batch-3, r=Amanieu
rustc_target: RISC-V: feature addition batch 3

This is the last batch (3 of 3) for RISC-V feature enhancements intended for the version 1.88 cycle.

The author's primary criteria are:

1.  The extension is ratified and unprivileged one.
2.  The extension is in the RVA23U64 profile (to be a baseline of the application-class RISC-V software ecosystem in the near future), either mandatory or optional.
3.  Either:
    1.  To be discoverable through a `riscv_hwprobe` system call on (currently unreleased) Linux 6.15 (as of rc4) or
    2.  Helps memory/atomics-related operations more efficient and/or more robust.

This is based on the specifications:

*   [The latest ratified ISA Manuals (version 20240411)](https://lf-riscv.atlassian.net/wiki/spaces/HOME/pages/16154769/RISC-V+Technical+Specifications)
*   [RVA23/RVB23 profiles](https://github.com/riscv/riscv-profiles/releases/tag/rva23-rvb23-ratified)
*   [RISC-V BF16 extensions](https://github.com/riscv/riscv-bfloat16/releases/tag/v183a3dac863d7c18187a739eb52b0c8f0d16854d)

LLVM Definitions:

*   [`Zicbop`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L82-87)
*   [`Zicbom`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L75-L80)
*   [`Zic64b`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L71-L73)
*   [`Ziccamoa`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L97-L99)
*   [`Ziccif`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L101-L103)
*   [`Zicclsm`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L105-L107)
*   [`Ziccrse`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L109-L111)
*   [`Zfbfmin`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L320-L325)
*   [`Zvfbfmin`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L697-L702)
*   [`Zvfbfwma`](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L704-L710)

The `Zicbop` extension (mandatory in RVA23U64) adds prefetch hints to prepare for subsequent memory operations (will be executed as no-op if the hardware does not support this extension).

The `Zicbom` extension (mandatory in RVA23U64) adds cache block-management instructions.  The author did not include this in the batch 2 (because of limited use cases compared to the `Zicboz` extension) but added because it will be discoverable from Linux (as of version 6.15-rc4).  Along with `Zicbop`, Rust now supports all CMO extensions.

The `Zic64b` extension (mandatory in RVA23U64) constraints the cache block to be naturally-aligned and exactly 64 bytes.  Along with CMO instructions, it can improve efficiency handling with memory (e.g. efficient memory zeroing using `Zicboz` + `Zic64b`).

The `Zicc*` extensions (mandatory in RVA23U64) add constraints to the main memory properties.  They are normally satisfied in the application environment with regular OSes but profiles like RVA23U64 ensures such properties are satisfied (through those *constraint* extensions).

The `Zfbf*` and `Zvfbf*` extensions (optional in RVA23U64) add instructions to handle BF16 (BFloat16) data.  Although stabilization of FP-related extensions are relatively far due to ABI-related issues, they are included in this batch because they will be discoverable from Linux (as of version 6.15-rc4).

The author also adds the extension implication: `Za64rs` → `Za128rs` (superset) which the author missed to include in .
2025-05-02 22:17:03 +10:00
Stuart Cook
01adc82111
Rollup merge of - nnethercote:hir-exhaustive, r=dtolnay
Improve test coverage of HIR pretty printing.

Details in individual commits.

r? `@dtolnay`

try-job: test-various
2025-05-02 22:17:02 +10:00