about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-05-20Rollup merge of #141261 - RalfJung:current_dll_path, r=NoratriebStuart Cook-1/+1
current_dll_path: fix mistake in assertion message Follow-up to https://github.com/rust-lang/rust/pull/141239 r? `@Noratrieb`
2025-05-19current_dll_path: fix mistake in assertion messageRalf Jung-1/+1
2025-05-19Auto merge of #141255 - matthiaskrgr:rollup-ravsgen, r=matthiaskrgrbors-50/+122
Rollup of 6 pull requests Successful merges: - #131200 (Handle `rustc_query_system` cases of `rustc::potential_query_instability` lint) - #141244 (windows: document that we rely on an undocumented property of GetUserProfileDirectoryW) - #141247 (skip compiler tools sanity checks on certain commands) - #141248 (fix data race in ReentrantLock fallback for targets without 64bit atomics) - #141249 (introduce common macro for `MutVisitor` and `Visitor` to dedup code) - #141253 (Warning added when dependency crate has async drop types, and the feature is disabled) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-19Rollup merge of #141253 - ↵Matthias Krüger-0/+40
azhogin:azhogin/async-drop-feature-inconsistency-warning, r=oli-obk Warning added when dependency crate has async drop types, and the feature is disabled In continue of https://github.com/rust-lang/rust/pull/141031. When dependency crate has non-empty `adt_async_destructor` table in metadata, and `async_drop` feature is disabled for local crate, warning will be emitted. Test `dependency-dropped` has two revisions - with and without feature enabled. With feature enabled, async drop for dropee is executed ("Async drop" printed). Without the feature enabled, sync drop is executed ("Sync drop" printed) and warning is emitted. Warning example: ``` warning: found async drop types in dependecy `async_drop_dep`, but async_drop feature is disabled for `dependency_dropped` --> $DIR/dependency-dropped.rs:7:1 | LL | #![cfg_attr(with_feature, feature(async_drop))] | ^ | = help: if async drop type will be dropped in a crate without `feature(async_drop)`, sync Drop will be used ```
2025-05-19Rollup merge of #141249 - fee1-dead-contrib:push-mwxxsvrsotvs, r=oli-obkMatthias Krüger-49/+73
introduce common macro for `MutVisitor` and `Visitor` to dedup code helps with #127615. I can do everything in one go but I figured it might be worth it to open a PR first for vibeck. r? oli-obk
2025-05-19Rollup merge of #131200 - ↵Matthias Krüger-1/+9
ismailarilik:handle-potential-query-instability-lint-for-rustc-query_system, r=fee1-dead Handle `rustc_query_system` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`compiler/rustc_query_system/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_query_system/src/lib.rs#L2) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: https://github.com/rust-lang/rust/issues/84447 r? `@compiler-errors`
2025-05-19Warning added when dependency crate has async drop types, and the feature is ↵Andrew Zhogin-0/+40
disabled
2025-05-19introduce common macro for `MutVisitor` and `Visitor` to dedup codeDeadbeef-49/+73
2025-05-19Rollup merge of #141239 - RalfJung:dladdr-fname, r=NoratriebStuart Cook-3/+1
dladdr cannot leave dli_fname to be null There are two places in the repo calling `dladdr`, and they are inconsistent wrt their assumption of whether the `dli_fname` field can be null. Let's make them consistent. I see nothing in the docs that allows it to be null, but just to be on the safe side let's make this an assertion so hopefully we get a report if that ever happens.
2025-05-19Rollup merge of #140847 - Zalathar:unused-local-file, r=SparrowLiiStuart Cook-42/+108
coverage: Detect unused local file IDs to avoid an LLVM assertion Each function's coverage metadata contains a *local file table* that maps local file IDs (used by the function's mapping regions) to global file IDs (shared by all functions in the same CGU). LLVM requires all local file IDs to have at least one mapping region, and has an assertion that will fail if it detects a local file ID with no regions. To make sure that assertion doesn't fire, we need to detect and skip functions whose metadata would trigger it. (This can't actually happen yet, because currently all of a function's spans must belong to the same file and expansion. But this will be an important edge case when adding expansion region support.)
2025-05-19dladdr cannot leave dli_fname to be nullRalf Jung-3/+1
2025-05-19Rollup merge of #140874 - mejrs:rads, r=WaffleLapkinStuart Cook-88/+94
make `rustc_attr_parsing` less dominant in the rustc crate graph It has/had a glob re-export of `rustc_attr_data_structures`, which is a crate much lower in the graph, and a lot of crates were using it *just* (or *mostly*) for that re-export, while they can rely on `rustc_attr_data_structures` directly. Previous graph: ![graph_1](https://github.com/user-attachments/assets/f4a5f13c-4222-4903-b56d-28c83511fcbd) Graph with this PR: ![graph_2](https://github.com/user-attachments/assets/1e053d9c-75cc-402b-84df-86229c98277a) The first commit keeps the re-export, and just changes the dependency if possible. The second commit is the "breaking change" which removes the re-export, and "explicitly" adds the `rustc_attr_data_structures` dependency where needed. It also switches over some src/tools/*. The second commit is actually a lot more involved than I expected. Please let me know if it's a better idea to back it out and just keep the first commit.
2025-05-19Rollup merge of #140049 - haenoe:fix-autodiff-generics, r=ZuseZ4Stuart Cook-11/+62
fix autodiff macro on generic functions heloo there! This short PR allows applying the `autodiff` macro to generic functions like this one. It only touches the frontend part, since the `rustc_autodiff` macro can already handle generics. ```rust #[autodiff(d_square, Reverse, Duplicated, Active)] fn square<T: std::ops::Mul<Output = T> + Copy>(x: &T) -> T { *x * *x } ``` Thanks to Manuel for creating an issue on this. For more information on this see #140032 r? `@ZuseZ4` As always: thanks for any piece of feedback!! Fixes: #140032 Tracking issue for autodiff: https://github.com/rust-lang/rust/issues/124509
2025-05-18Auto merge of #140154 - Berrysoft:cygwin-host, r=jieyouxubors-4/+11
Cygwin support in rustc This PR builds host rustc targeting cygwin. - [x] https://github.com/rust-lang/stacker/pull/122 - [x] https://github.com/nagisa/rust_libloading/pull/173 - [x] https://github.com/Detegr/rust-ctrlc/pull/131 - [x] https://github.com/rust-random/getrandom/pull/654 - [x] https://github.com/msys2/MSYS2-packages/issues/5350 - [x] https://github.com/rust-lang/rust/pull/140886 - [x] https://github.com/rust-lang/rust/pull/140921 - [x] https://github.com/rust-lang/rust/pull/140973 Currently supported: * rustc * rustdoc * rustfmt * clippy Blocking: * cargo: blocked by https://github.com/rust-lang/socket2/pull/568 * rust-analyzer: needs `cargo update`, fixed upstream ``` $ rustc --version --verbose rustc 1.88.0-dev binary: rustc commit-hash: unknown commit-date: unknown host: x86_64-pc-cygwin release: 1.88.0-dev LLVM version: 20.1.4 ```
2025-05-18Rollup merge of #141218 - dianqk:gvn-overlapping, r=oli-obkLeón Orell Valerian Liehr-6/+13
gvn: avoid creating overlapping assignments Quick fix #141038, as I couldn't find a way to avoid in-place modification. I'm considering handling all `ravlue` modifications within the `visit_statement` function. r? mir-opt
2025-05-18Rollup merge of #141127 - klensy:windows-bump-61, r=albertlarsan68,jieyouxuLeón Orell Valerian Liehr-5/+5
bump windows crate for compiler,bootstrap and tools This dedupes crate versions. For `x86_64-pc-windows-msvc` stage1 cuts few kb from `rustc_driver.dll`, nice.
2025-05-18Rollup merge of #140926 - ↵León Orell Valerian Liehr-14/+25
azhogin:azhogin/async-drop-coroutine-layout-returns-layout-error, r=oli-obk Return value of coroutine_layout fn changed to Result with LayoutError Continue of https://github.com/rust-lang/rust/pull/140902: `coroutine_layout` fn is now returns `Result` with `LayoutError` to have consistent error with `layout_of_uncached`. `async_drop_coroutine_layout` fn is now return `LayoutError::TooGeneric` in case of not-fully-specialized `async_drop_in_place<T>::{closure}` coroutine.
2025-05-18Rollup merge of #140746 - dianne:guard-pat-res, r=oli-obkLeón Orell Valerian Liehr-35/+100
name resolution for guard patterns This PR provides an initial implementation of name resolution for guard patterns [(RFC 3637)](https://github.com/rust-lang/rfcs/blob/master/text/3637-guard-patterns.md). This does not change the requirement that the bindings on either side of an or-pattern must be the same [(proposal here)](https://github.com/rust-lang/rfcs/blob/master/text/3637-guard-patterns.md#allowing-mismatching-bindings-when-possible); the code that handles that is separate from what this PR touches, so I'm saving it for a follow-up. On a technical level, this separates "collecting the bindings in a pattern" (which was already done for or-patterns) from "introducing those bindings into scope". I believe the approach used here can be extended straightforwardly in the future to work with `if let` guard patterns, but I haven't tried it myself since we don't allow those yet. Tracking issue for guard patterns: #129967 cc ``@Nadrieril``
2025-05-18Rollup merge of #140490 - folkertdev:asm-parser-changes, r=Amanieu,traviscrossLeón Orell Valerian Liehr-220/+296
split `asm!` parsing and validation This PR splits `asm!` parsing and validation into two separate steps. The parser constructs a `Vec<RawAsmArg>`, with each element corresponding to an argument to one of the `asm!` macros. The validation then checks things like ordering of arguments or that options are not provided twice. The motivation is https://github.com/rust-lang/rust/issues/140279, which wants to add `#[cfg(...)]` support to these arguments. This support can now be added in a straightforward way by adding an `attributes: ast::AttrVec` field to `RawAsmArg`. An extra reason for this split is that `rustfmt` probably wants to format the assembly at some point (currently that appears to be stubbed out, and the formatting is unstable https://github.com/rust-lang/style-team/issues/152). r? ``@ghost`` (just want to look at CI for now) cc ``@ytmimi`` we discussed asm formatting a little while ago in https://github.com/rust-lang/rustfmt/issues/6526. Am I correct in assuming that `AsmArgs` does not give enough information for formatting, but that `RawAsmArgs` would (it e.g. does not join information from multiple lines). This must have been an issue before? try-job: aarch64-apple
2025-05-18Rollup merge of #138940 - sayantn:stabilize-avx512, r=Amanieu,traviscrossLeón Orell Valerian Liehr-23/+24
Stabilize the avx512 target features This PR stabilizes the AVX512 target features - see [this comment](https://github.com/rust-lang/rust/issues/111137#issuecomment-2745821279). Tracking Issue - #44839 The target feature UI tests have been changed to `x87` (chosen because this is very unlikely to stablize ever, please comment if some other feature will be better) related: #111137
2025-05-18Remove rustc_attr_data_structures re-export from rustc_attr_parsingmejrs-34/+42
2025-05-18Auto merge of #141216 - fmease:rollup-pa5mvx3, r=fmeasebors-8/+2
Rollup of 8 pull requests Successful merges: - #140113 (Add per page TOC in the `rustc` book) - #140511 (Stabilize `#![feature(non_null_from_ref)]`) - #140924 (Make some `f32`/`f64` tests also run in const-context) - #140966 (Remove #![feature(let_chains)] from library and src/librustdoc) - #141045 ([win][arm64] Remove 'Arm64 Hazard' undocumented MSVC option and instead disable problematic test) - #141071 (Enable [behind-upstream] triagebot option for rust-lang/rust) - #141132 (Use `crate::` prefix for root macro suggestions) - #141139 (Fix Rust for Linux ping group label) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-18name resolution for guard patternsdianne-3/+35
2025-05-18gvn: avoid creating overlapping assignmentsdianqk-6/+13
2025-05-18add `AsmOptions` with some named fieldsFolkert de Vries-19/+31
2025-05-18rename to get rid of the 'raw' conceptFolkert de Vries-63/+64
2025-05-18delay error for unsupported optionsFolkert de Vries-14/+2
2025-05-18attempt to have rustfmt use the new logicFolkert de Vries-17/+8
apparently it doesn't really use the asm parsing at present, so this may work?
2025-05-18a new parser generating the exact same error messagesFolkert de Vries-150/+226
Co-authored-by: Travis Cross <tc@traviscross.com>
2025-05-18Rollup merge of #141132 - bvanjoi:issue-141082, r=fmeaseLeón Orell Valerian Liehr-1/+1
Use `crate::` prefix for root macro suggestions Fixes #141082 I've changed the prefix to `crate` directly, since it's compatible across all editions.
2025-05-18Rollup merge of #141045 - dpaoliello:noarmhazard, r=jieyouxuLeón Orell Valerian Liehr-6/+1
[win][arm64] Remove 'Arm64 Hazard' undocumented MSVC option and instead disable problematic test PR #140758 added the undocumented `/arm64hazardfree` MSVC linker flag to work around a test failure where LLVM generated code that would trip a hazard in an outdated ARM processor. Adding this flag caused issues with LLD, as it doesn't recognize it. Rethinking the issue, using the undocumented flag seems like the incorrect solution: there's no guarantee that the flag won't be removed in the future, or change its meaning. Instead, I've disabled the problematic test for Arm64 Windows and have filed a bug with the MSVC team to have the check removed: <https://developercommunity.microsoft.com/t/Remove-checking-for-and-fixing-Cortex-A/10905134> This PR supersedes #140977 r? ```@jieyouxu```
2025-05-18Rollup merge of #140966 - est31:let_chains_library, r=tgross35León Orell Valerian Liehr-1/+0
Remove #![feature(let_chains)] from library and src/librustdoc PR https://github.com/rust-lang/rust/pull/132833 has stabilized the `let_chains` feature. This PR removes the last occurences from the library, the compiler, and librustdoc (also because #140887 missed the conditional in one of the crates as it was behind the "rustc" feature). We keep `core` as exercise for the future as updating it is non-trivial (see PR thread).
2025-05-18Auto merge of #141129 - compiler-errors:register-region-obl, r=oli-obkbors-0/+8
Fast path for `register_region_obligation` If a type has no params, infer, placeholder, or non-`'static` free regions, then we can skip registering outlives obligations since the type has no components which affect lifetime checking in an interesting way.
2025-05-18Stabilize `avx512_target_feature`sayantn-23/+24
2025-05-18Auto merge of #141039 - lqd:expensive-sanity, r=compiler-errorsbors-9/+13
move expensive layout sanity check to debug assertions It is [hard to fix](https://github.com/rust-lang/rust/issues/141006#issuecomment-2883415000) the slowness in the uninhabitedness computation for very big types but we can fix the very specific case of them being called during the layout sanity checks, as described in #140944. So this PR moves this uninhabitedness check to the other expensive layout sanity checks that are ran under `debug_assertions`. It makes building the `lemmy_api_routes` crate's self-profile `layout_of` query go from ``` +--------------------------------------------------------+-----------+-----------------+----------+------------+---------------------------------+ | Item | Self time | % of total time | Time | Item count | Incremental result hashing time | +--------------------------------------------------------+-----------+-----------------+----------+------------+---------------------------------+ | layout_of | 63.02s | 41.895 | 244.26s | 123703 | 50.30ms | +--------------------------------------------------------+-----------+-----------------+----------+------------+---------------------------------+ ``` on master (2m17s total), to ``` | layout_of | 330.21ms | 0.372 | 26.90s | 123703 | 53.19ms | ``` with this PR (1m15s total). (Note that the [perf run results](https://github.com/rust-lang/rust/pull/141039#issuecomment-2884688756) below look a bit better than [an earlier run](https://perf.rust-lang.org/compare.html?start=4eca99a18eab3d4e28ed1ce3ee620d442955a470&end=c4a00993f8ee02c7565e7be652608817ea2fb97d&stat=instructions:u) I did in another PR. There may be some positive noise there, or post-merge results could differ a bit) Since we discussed this today, r? `@compiler-errors` — and cc `@lcnr` and `@RalfJung.`
2025-05-17Auto merge of #140856 - oli-obk:merge-queries2, r=nnethercotebors-24/+16
Merge mir query analysis invocations r? `@ghost` same thing as https://github.com/rust-lang/rust/pull/140854 just a different set of queries Doing this in general has some bad cache coherence issues because the query caches are laid out in Vec<QueryResult> lists per query where each index refers to a DefId in the same order as we're iterating. Iterating two or more lists at the same time does have cache issues, so I want to poke a bit at it to see if we can't merge just a few of them at a time.
2025-05-17extract operand parserFolkert de Vries-83/+93
2025-05-17determine later whether an explicit reg was usedFolkert de Vries-11/+9
2025-05-17Fast path for register_region_obligationMichael Goulet-0/+8
2025-05-17Use `crate::` prefix for root macro suggestionsbohan-1/+1
2025-05-17Rollup merge of #141125 - lcnr:coroutine_obligations_use_borrowck, ↵Matthias Krüger-7/+13
r=compiler-errors check coroutines with `TypingMode::Borrowck` to avoid cyclic reasoning MIR borrowck taints its output if an obligation fails. This could then cause `check_coroutine_obligations` to silence its error, causing us to not emit and actual error and ICE. Fixes the ICE in https://github.com/rust-lang/trait-system-refactor-initiative/issues/199. It is unfortunately still a regression. r? compiler-errors
2025-05-17Rollup merge of #141121 - compiler-errors:ambig-is-not-err, r=lcnrMatthias Krüger-2/+8
Only select true errors in `impossible_predicates` See description in test. Fixes #141119 r? lcnr
2025-05-17Rollup merge of #141118 - Veykril:lw-ymmtxytkrrqs, r=compiler-errorsMatthias Krüger-0/+14
Enable rust-analyzer to go from query definition to the corresponding provider field r? `@compiler-errors`
2025-05-17Rollup merge of #141035 - lqd:lld-warn, r=Mark-SimulacrumMatthias Krüger-1/+1
turn lld warning on old gccs into info log As discussed in #140964 and IRL, this PR switches the spammy warning shown unconditionally when an old gcc doesn't support `-fuse-ld=lld` and we retry linking without it, to an info debug log so we don't lose it. r? `@Mark-Simulacrum` Fixes #140964
2025-05-17Rollup merge of #135808 - tiif:conv_display, r=workingjubileeMatthias Krüger-2/+34
Implement Display for ``rustc_target::callconv::Conv`` Follow up of https://github.com/rust-lang/rust/pull/133103#discussion_r1885552854
2025-05-17check coroutines with TypingMode::Borrowck to avoid cyclic reasoninglcnr-7/+13
MIR borrowck taints its output if an obligation fails. This could then cause `check_coroutine_obligations` to silence its error, causing us to not emit and actual error and ICE.
2025-05-17compiler & tools: bump windows crate to dedupe versionsklensy-5/+5
2025-05-17Only select true errors in impossible_predicatesMichael Goulet-2/+8
2025-05-17Enable rust-analyzer to go from query definition to the corresponding ↵Lukas Wirth-0/+14
provider field
2025-05-17Auto merge of #141113 - matthiaskrgr:rollup-k7izuh8, r=matthiaskrgrbors-10/+12
Rollup of 8 pull requests Successful merges: - #140208 (Make well-formedness predicates no longer coinductive) - #140957 (Add `#[must_use]` to Array::map) - #141031 (Async drop fix for dropee from another crate (#140858)) - #141036 (ci: split the dist-ohos job) - #141051 (Remove some unnecessary erases) - #141056 (Lowercase git url for rust-lang/enzyme.git) - #141059 (HIR: explain in comment why `ExprKind::If` "then" is an `Expr`) - #141070 (Do not emit help when shorthand from macro when suggest `?` or `expect`) r? `@ghost` `@rustbot` modify labels: rollup