about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-08-29Rollup merge of #145387 - zachs18:remove-tmplayout, r=cjgillotStuart Cook-30/+9
Remove TmpLayout in layout_of_enum 09a3846 from <https://github.com/rust-lang/rust/pull/103693> made LayoutData be owned instead of interned in `Variants::Multiple::variants`[^1], so there's no need for `TmpLayout` in layout_of_enum anymore, and we can just store the variants' layouts directly in the prospective `LayoutData`s' `variants` fields. This should have no effect on semantics or layout. (written as part of rust-lang/rust#145337 but not related to the layout optimizations in that PR) [^1]: see line 1154 of `compiler/rustc_target/src/abi/mod.rs` in the linked commit; `Variants::Multiple::variants` effectively changed from `IndexVec<.., Layout<'tcx>>` to `IndexVec<.., LayoutData>` where the `LayoutData`s are not interned as `Layout`s (`LayoutData` was at the time called `LayoutS`)
2025-08-29Auto merge of #145377 - ChayimFriedman2:solver-def-id, r=lcnrbors-177/+233
Switch next solver to use a specific associated type for trait def id The compiler just puts `DefId` in there, but rust-analyzer uses different types for each kind of item. See [the Zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/185405-t-compiler.2Frust-analyzer/topic/Implmentating.20New.20Trait.20Solver/near/534329794). In short, it will be a tremendous help to r-a to use specific associated types, while for the solver and the compiler it's a small change. So I ported `TraitId`, as a proof of concept and it's also likely the most impactful. r? types
2025-08-29compiler: Add `{x86_64,aarch64,riscv64gc}-unknown-managarm-mlibc` targetsno92-0/+92
Co-authored-by: Dennis Bonke <dennis@managarm.org>
2025-08-28Auto merge of #145970 - GuillaumeGomez:rollup-pr11qds, r=GuillaumeGomezbors-126/+195
Rollup of 6 pull requests Successful merges: - rust-lang/rust#142472 (Add new `doc(attribute = "...")` attribute) - rust-lang/rust#145368 (CFI: Make `lto` and `linker-plugin-lto` work the same for `compiler_builtins`) - rust-lang/rust#145853 (Improve error messages around invalid literals in attribute arguments) - rust-lang/rust#145920 (bootstrap: Explicitly mark the end of a failed test's captured output) - rust-lang/rust#145937 (add doc-hidden to exports in attribute prelude) - rust-lang/rust#145965 (Move exporting of profiler and sanitizer symbols to the LLVM backend) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-28Rollup merge of #145965 - bjorn3:sanitize_symbol_export_improvements, r=lqdGuillaume Gomez-54/+33
Move exporting of profiler and sanitizer symbols to the LLVM backend Only the LLVM backend needs those specific symbols exported and it only needs them to be exported for LTO, not from cdylibs in general.
2025-08-28Rollup merge of #145937 - jdonszelmann:doc-hidden-prelude, r=fmeaseGuillaume Gomez-1/+11
add doc-hidden to exports in attribute prelude Seems to fix rust-lang/rust#145870, at least temporarily. The underlying problem of course is still there. r? `@fmease` <img width="653" height="167" alt="image" src="https://github.com/user-attachments/assets/b5a8094c-849e-4328-997d-b772f9aa4088" /> Fixes rust-lang/rust#145870
2025-08-28Rollup merge of #145853 - JonathanBrouwer:fix-lit-parsing, r=jdonszelmannGuillaume Gomez-35/+52
Improve error messages around invalid literals in attribute arguments r? `@jdonszelmann` This previously created two errors, which is a bit ugly and the second one didn't add any value Blocked on https://github.com/rust-lang/rust/pull/143193
2025-08-28Rollup merge of #145368 - rcvalle:rust-cfi-fix-142284, r=dianqkGuillaume Gomez-12/+1
CFI: Make `lto` and `linker-plugin-lto` work the same for `compiler_builtins` Fix rust-lang/rust#142284 by ensuring that `#![no_builtins]` crates can still emit bitcode when proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto) is used.
2025-08-28Rollup merge of #142472 - GuillaumeGomez:doc-attribute-attribute, r=fmeaseGuillaume Gomez-24/+98
Add new `doc(attribute = "...")` attribute Fixes rust-lang/rust#141123. The implementation and purpose of this new `#[doc(attribute = "...")]` attribute is very close to `#[doc(keyword = "...")]`. Which means that luckily for us, most of the code needed was already in place and `@Noratrieb` nicely wrote a first draft that helped me implement this new attribute very fast. Now with all this said, there is one thing I didn't do yet: adding a `rustdoc-js-std` test. I added GUI tests with search results for attributes so should be fine but I still plan on adding one for it once documentation for builtin attributes will be written into the core/std libs. You can test it [here](https://rustdoc.crud.net/imperio/doc-attribute-attribute/foo/index.html). cc `@Noratrieb` `@Veykril`
2025-08-28Move ___asan_globals_registered exportbjorn3-6/+4
All other sanitizer symbols are handled in prepare_lto already.
2025-08-28Only export the sanitizer symbols for LTO and move export code to cg_llvmbjorn3-48/+29
Don't export them from cdylibs. There is no need to do so and it complicates exported_non_generic_symbols. In addition the GCC backend likely uses different symbols and may potentially not even need us to explicitly tell it to export the symbols it needs.
2025-08-28fix(lexer): Don't require frontmatters to be escaped with indented fencesEd Page-21/+13
The RFC only limits hyphens at the beginning of lines and not if they are indented or embedded in other content. Sticking to that approach was confirmed by the T-lang liason at https://github.com/rust-lang/rust/issues/141367#issuecomment-3202217544 There is a regression in error message quality which I'm leaving for someone if they feel this needs improving.
2025-08-28compiler: Include span of too huge enum with -Cdebuginfo=2Martin Nordholts-6/+19
We have a ui test to ensure we emit an error if we encounter too big enums. Before this fix, compiling the test with `-Cdebuginfo=2` would not include the span of the instantiation site, because the error is then emitted from a different code path that does not include the span. Propagate the span to the error also in the debuginfo case, so the test passes regardless of debuginfo level.
2025-08-28Improve error messages around invalid literals in attribute argumentsJonathan Brouwer-35/+52
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-28Auto merge of #145807 - zachs18:only-consider-auto-traits-empty, ↵bors-1/+6
r=compiler-errors When determining if a trait has no entries for the purposes of omitting vptrs from subtrait vtables, consider its transitive supertraits' entries, instead of just its own entries. When determining if a non-first supertrait vptr can be omitted from a subtrait vtable, check if the supertrait or any of its (transitive) supertraits have methods, instead of only checking if the supertrait itself has methods. This fixes the soundness issue where a vptr would be omitted for a supertrait with no methods but that itself had a supertrait with methods, while still optimizing the case where the supertrait is "truly" empty (it has no own vtable entries, and none of its (transitive) supertraits have any own vtable entries). Fixes <https://github.com/rust-lang/rust/issues/145752> ----- Old description: ~~Treat all non-auto traits as non-empty (possibly having methods) for purposes of determining if we need to emit a vptr for a non-direct supertrait (and for new "sibling" entries after a direct or non-direct supertrait).~~ This fixes (I believe) the soundness issue, ~~but regresses vtable sizes and possibly upcasting perf in some cases when using trait hierarchies with empty non-auto traits (see `tests/ui/traits/vtable/multiple-markers.stderr`) since we use vptrs in some cases where we could re-use the vtable.~~ Fixes <https://github.com/rust-lang/rust/issues/145752> Re-opens (not anymore) <https://github.com/rust-lang/rust/issues/114942> Should not affect <https://github.com/rust-lang/rust/issues/131813> (i.e. the soundness issue is still fixed, ~~though the relevant vtables in the `trait Evil` example will be larger now~~) cc implementation history <https://github.com/rust-lang/rust/pull/131864> <https://github.com/rust-lang/rust/pull/113856> ----- ~~It should be possible to check if a trait has any methods from itself *or* supertraits (instead of just from itself), but to fix the immediate soundness issue, just assume any non-auto trait could have methods. A more optimistic check can be implemented later (or if someone does it soon it could just supercede this PR :smile:).~~ Done in latest push `@rustbot` label A-dyn-trait F-trait_upcasting
2025-08-28Add ui test for unsupported `doc(attribute = "...")` case for attributes ↵Guillaume Gomez-0/+1
with namespace
2025-08-28Create new `Item::is_fake_item` method as equivalent to check for ↵Guillaume Gomez-21/+45
`is_primitive`, `is_keyword` and `is_attribute` methods
2025-08-28Add new `doc(attribute = "...")` attributeGuillaume Gomez-22/+71
2025-08-28Rollup merge of #145953 - robertbastian:master, r=ManishearthStuart Cook-251/+138
Update `icu_list` to 2.0 This updates the `icu_list` crate, which is used for error formatting, from 1.5 to 2.0.
2025-08-28Rollup merge of #145941 - Urgau:int_to_ptr_transmutes-unsized, r=lcnrStuart Cook-13/+19
Disable `integer_to_ptr_transmutes` suggestion for unsized types This PR disables the machine-applicable `integer_to_ptr_transmutes` lint suggestion for unsized types, as [`std::ptr::with_exposed_provenance`](https://doc.rust-lang.org/std/ptr/fn.with_exposed_provenance.html) requires sized types. We should probably mention [`std::ptr::from_raw_parts`](https://doc.rust-lang.org/std/ptr/fn.from_raw_parts.html) when it becomes stable. Related to https://github.com/rust-lang/rust/issues/145935
2025-08-28Rollup merge of #144864 - Muscraft:no-source-fixes, r=jieyouxuStuart Cook-24/+65
No source fixes This PR started as a fix for a rendering bug that [got noticed in #143661](https://github.com/rust-lang/rust/pull/143661#discussion_r2199109530), but turned into a fix for any rendering bugs related to files with no source. - Don't add an end column separator after a file with no source - Add column separator before secondary messages with no source - Render continuation between no source labels Before ``` error[E0423]: expected function, tuple struct or tuple variant, found struct `std::collections::HashMap` ╭▸ $DIR/multi-suggestion.rs:17:13 │ LL │ let _ = std::collections::HashMap(); │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━ ╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL │ ╰ note: `std::collections::HashMap` defined here ╰╴ note: constructor is not visible here due to private fields ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL │ ╰ note: private field │ ╰ note: private field ``` After ``` error[E0423]: expected function, tuple struct or tuple variant, found struct `std::collections::HashMap` ╭▸ $DIR/multi-suggestion.rs:17:13 │ LL │ let _ = std::collections::HashMap(); │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━ ╰╴ ╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL │ ╰ note: `std::collections::HashMap` defined here note: constructor is not visible here due to private fields ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL │ ├ note: private field │ ╰ note: private field ``` Note: This PR also makes it so `rustc` and `annotate-snippets` match in these cases
2025-08-28Rollup merge of #143193 - JonathanBrouwer:link_rework, r=jdonszelmannStuart Cook-713/+757
Port `#[link]` to the new attribute parsing infrastructure Ports `link` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197
2025-08-28Add `rustc-demangle` to `[workspace.dependencies]`.Nicholas Nethercote-2/+2
2025-08-28Add `polonius-engine` to `[workspace.dependencies]`.Nicholas Nethercote-3/+3
2025-08-28Add `odht` to `[workspace.dependencies]`.Nicholas Nethercote-2/+2
2025-08-28Add `scoped-tls` to `[workspace.dependencies]`.Nicholas Nethercote-3/+3
2025-08-28Add `measureme` to `[workspace.dependencies]`.Nicholas Nethercote-3/+3
2025-08-28Add `derive-where` to `[workspace.dependencies]`.Nicholas Nethercote-3/+3
2025-08-28Add `rustc-hash` to `[workspace.dependencies]`.Nicholas Nethercote-3/+3
2025-08-28Add `indexmap` to `[workspace.dependencies]`.Nicholas Nethercote-5/+5
2025-08-28Add `tempfile` to `[workspace.dependencies]`.Nicholas Nethercote-5/+5
2025-08-28Add `rustc_apfloat` to `[workspace.dependencies]`.Nicholas Nethercote-4/+4
2025-08-28Add `proc-macro2` and `quote` to `[workspace.dependencies]`.Nicholas Nethercote-8/+8
2025-08-28Add `either` to `[workspace.dependencies]`.Nicholas Nethercote-5/+5
2025-08-28Add `serde_json` to `[workspace.dependencies]`.Nicholas Nethercote-7/+7
2025-08-28Add `libc` to `[workspace.dependencies]`.Nicholas Nethercote-10/+8
2025-08-28Add an overlooked `tracing` to `[workspace.dependencies]`.Nicholas Nethercote-1/+1
2025-08-28Use default locale fallback dataRobert Bastian-202/+22
2025-08-28Bump icu_list to 2.0Robert Bastian-248/+315
2025-08-28Auto merge of #145949 - jhpratt:rollup-smzd7tr, r=jhprattbors-45/+25
Rollup of 5 pull requests Successful merges: - rust-lang/rust#145382 (Add assembly test for `-Zreg-struct-return` option) - rust-lang/rust#145746 (Fix STD build failing for target_os = "espidf") - rust-lang/rust#145826 (Use AcceptContext in AttribueParser::check_target) - rust-lang/rust#145894 (Ensure the coordinator thread terminates before its channels drop) - rust-lang/rust#145946 (Remove unnecessary `[dependencies.unicode-properties]` entries.) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-27Rollup merge of #145946 - nnethercote:cargo-style, r=jdonszelmannJacob Pratt-14/+3
Remove unnecessary `[dependencies.unicode-properties]` entries. The Cargo style guide says to put dependencies on a single line if they fit. r? `@jdonszelmann`
2025-08-27Rollup merge of #145894 - zetanumbers:issue-142949, r=WaffleLapkinJacob Pratt-2/+5
Ensure the coordinator thread terminates before its channels drop Fixes rust-lang/rust#142949 Explanation: https://github.com/rust-lang/rust/issues/142949#issuecomment-3224573185
2025-08-27Rollup merge of #145826 - scrabsha:push-vrpwttmzqwpt, r=jdonszelmannJacob Pratt-29/+17
Use AcceptContext in AttribueParser::check_target
2025-08-28Auto merge of #145877 - nikic:capture-address, r=tmiaskobors-18/+15
Use captures(address) instead of captures(none) for indirect args While provenance cannot be captured through these arguments, the address / object identity can. Fixes https://github.com/rust-lang/rust/issues/137668. r? `@ghost`
2025-08-28Remove unnecessary `[dependencies.unicode-properties]` entries.Nicholas Nethercote-14/+3
The Cargo style guide says to put dependencies on a single line if they fit.
2025-08-27fix target-pointer-width in testsWaffle Lapkin-2/+2
2025-08-27turn pointer width into an integer in target.jsonWaffle Lapkin-9/+6
2025-08-27allow using `target_val!` with a renameWaffle Lapkin-10/+8
2025-08-27Auto merge of #145851 - lolbinarycat:rustdoc-optimize, r=GuillaumeGomezbors-2/+7
rustdoc: a few micro-optimizations targeted at build_impl Unsure if these will be anything substantial, but the first one at least should git rid of quite a few branches, second one unsure if it's worth it. r? `@GuillaumeGomez`
2025-08-27Disable `int_to_ptr_transmutes` suggestion for unsized typesUrgau-13/+19