about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-03-03Rollup merge of #137902 - nnethercote:ast-lexer-TokenKind, r=compiler-errorsMatthias Krüger-336/+366
Make `ast::TokenKind` more like `lexer::TokenKind` This is step 2 of https://github.com/rust-lang/compiler-team/issues/831. r? `@spastorino`
2025-03-03Rollup merge of #137894 - compiler-errors:no-scalar-pair-opt, r=oli-obkMatthias Krüger-73/+25
Revert "store ScalarPair via memset when one side is undef and the other side can be memset" cc #137892 reverts #135335 r? oli-obk
2025-03-03Rollup merge of #137863 - compiler-errors:unsafe-binder-render, r=oli-obkMatthias Krüger-42/+78
Fix pretty printing of unsafe binders We used to render `unsafe<> i32` as `i32`, and `unsafe<'a> &'a i32` as `for<'a> &'a i32`. r? oli-obk Review with whitespace b/c adding a new argument changes some the wrapping of some function calls.
2025-03-03Rollup merge of #137852 - moulins:layout-nonarray-simd-deadcode, ↵Matthias Krüger-78/+19
r=workingjubilee Remove layouting dead code for non-array SIMD types. These aren't supported anymore, and are already rejected in type checking.
2025-03-03Auto merge of #137914 - matthiaskrgr:rollup-phaxe6f, r=matthiaskrgrbors-12/+44
Rollup of 6 pull requests Successful merges: - #137103 ({json|html}docck: catch and error on deprecated syntax) - #137632 (rustdoc: when merging target features, keep the highest stability) - #137684 (Add rustdoc support for `--emit=dep-info[=path]`) - #137794 (make qnx pass a test) - #137801 (tests: Unignore target modifier tests on all platforms) - #137826 (test(codegen): add looping_over_ne_bytes test for #133528) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-03Remove i586-pc-windows-msvcNoratrieb-11/+9
See MCP 840. I left a specialized error message that should help users that hit this in the wild (for example, because they use it in their CI).
2025-03-03Provide more context on resolve error caused from incorrect RTNEsteban Küber-6/+53
When encountering a resolve E0575 error for an associated method (when a type was expected), see if it could have been an intended return type notation bound. ``` error[E0575]: expected associated type, found associated function `Trait::method` --> $DIR/bad-inputs-and-output.rs:31:36 | LL | fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type | help: you might have meant to use the return type notation syntax | LL - fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {} LL + fn foo_qualified<T: Trait>() where T::method(..): Send {} | ```
2025-03-03Apply dllimport in ThinLTOJohn Kåre Alsaker-6/+5
2025-03-03Rollup merge of #137862 - mtoner23:print-help, r=nnethercoteMatthias Krüger-30/+34
ensure we always print all --print options in help Closes #137853 Refactors the PRINT_KINDS map into a public const so we always print every option for print. the list is quite long now, and idk if long term we want to keep printing all these options from --help.
2025-03-03Rollup merge of #137741 - cuviper:const_str-raw_entry, r=Mark-SimulacrumMatthias Krüger-31/+25
Stop using `hash_raw_entry` in `CodegenCx::const_str` That unstable feature (#56167) completed fcp-close, so the compiler needs to be migrated away to allow its removal. In this case, `cg_llvm` and `cg_gcc` were using raw entries to optimize their `const_str_cache` lookup and insertion. We can change that to separate `get` and (on miss) `insert` calls, so we still have the fast path avoiding string allocation when the cache hits.
2025-03-03Rollup merge of #134900 - dtolnay:unoprange, r=compiler-errors,davidtwcoMatthias Krüger-1/+5
Fix parsing of ranges after unary operators Fixes https://github.com/rust-lang/rust/issues/134899. This PR aligns the parsing for unary `!` and `-` and `*` with how unary `&` is already parsed [here](https://github.com/rust-lang/rust/blob/5c0a6e68cfdad859615c2888de76505f13e6f01b/compiler/rustc_parse/src/parser/expr.rs#L848-L854).
2025-03-03Rollup merge of #132388 - frank-king:feature/where-cfg, r=petrochenkovMatthias Krüger-50/+232
Implement `#[cfg]` in `where` clauses This PR implements #115590, which supports `#[cfg]` attributes in `where` clauses. The biggest change is, that it adds `AttrsVec` and `NodeId` to the `ast::WherePredicate` and `HirId` to the `hir::WherePredicate`.
2025-03-03Tidy imports in `rustc_data_structures::sync`Zalathar-27/+30
2025-03-03Remove some unnecessary aliases from `rustc_data_structures::sync`Zalathar-35/+22
With the removal of `cfg(parallel_compiler)`, these are always shared references and `std::sync::OnceLock`.
2025-03-03After introducing the warning in 1.83, now also warn in depsTamme Dittrich-1/+1
This was left to only warn in the current crate to give users a chance to update their code. Now for 1.86 we also warn users depending on those crates.
2025-03-02Simplify `<Postorder as Iterator>::size_hint`Scott McMurray-11/+6
The current version is wrong (cc 137919); let's see if we can get away with a loose but trivially-correct one.
2025-03-03interpret/provenance_map: consistently use range_is_emptyRalf Jung-22/+22
2025-03-03Remove leading underscores from parameter names in `Sharded`Zalathar-8/+8
With the removal of `cfg(parallel_compiler)`, these parameters are never considered unused.
2025-03-03Do not recover missing lifetime with random in-scope lifetimeMichael Goulet-6/+0
2025-03-03Rollup merge of #137632 - RalfJung:rustdoc-target-features, r=workingjubileeMatthias Krüger-12/+44
rustdoc: when merging target features, keep the highest stability This addresses https://github.com/rust-lang/rust/issues/137366. (Not closing since we might consider a backport.) rustdoc wants to pretend that it runs for all targets at once and has all target features, so `tcx.rust_target_features()` will actually be all the target features. For target features that exist on multiple targets, the stability info for one of the targets will be picked (first or last in the list, I guess). All the code consuming that query has to be aware that the data is basically nonsense when running in rustdoc, but the logic checking for unstable or forbidden `#[target_feature]` attributes was not aware of that. This PR makes the `tcx.rust_target_features()` info in rustdoc slightly less nonsensical (and decidedly less random) by having the "most stable" target feature take precedent. That deals with #137366 (a conflict between a stable and a "forbidden" target feature of the same name for different targets), and also deals with the situation (that we did not seem to have yet) of a conflict between a stable and an unstable target feature of the same name. Note that if there are two unstable target features of the same name, rustdoc might still require the "wrong" nightly feature to be enabled -- but this can only possibly affect unstable code so I guess we can wait until that actually happens, and then someone will have to rewrite this entire thing to be less hacky.
2025-03-03Improve error message for AsyncFn trait failure for RPITMichael Goulet-54/+70
2025-03-03Auto merge of #137900 - matthiaskrgr:rollup-rvan5ao, r=matthiaskrgrbors-18/+33
Rollup of 10 pull requests Successful merges: - #137375 (Minor internal comments fix for `BufRead::read_line`) - #137641 (More precisely document `Global::deallocate()`'s safety.) - #137755 (doc: update Wasmtime flags) - #137851 (improve `simd_select` error message when used with invalid mask type) - #137860 (rustc_target: Add msync target feature and enable it on powerpcspe targets) - #137871 (fix `RangeBounds::is_empty` documentation) - #137873 (Disable `f16` on Aarch64 without `neon`) - #137876 (Adjust triagebot.toml entries for `rustc_mir_build/src/builder/`) - #137883 (edit mailmap) - #137886 (`name()` and `trimmed_name()` for `stable_mir::crate_def::DefId`) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-03Rename a bitMichael Goulet-20/+10
2025-03-03Fix pretty printing of unsafe bindersMichael Goulet-42/+88
2025-03-02Prevent ICE in autodiff validation by emitting user-friendly errorsSa4dUs-2/+8
2025-03-02Auto merge of #137704 - nnethercote:opt-empty-prov-range-checks, r=oli-obkbors-10/+60
Optimize empty provenance range checks. Currently it gets the pointers in the range and checks if the result is empty, but it can be done faster if you combine those two steps. r? `@oli-obk`
2025-03-03Rename `ast::TokenKind::Not` as `ast::TokenKind::Bang`.Nicholas Nethercote-45/+45
For consistency with `rustc_lexer::TokenKind::Bang`, and because other `ast::TokenKind` variants generally have syntactic names instead of semantic names (e.g. `Star` and `DotDot` instead of `Mul` and `Range`).
2025-03-03Replace `ast::TokenKind::BinOp{,Eq}` and remove `BinOpToken`.Nicholas Nethercote-295/+325
`BinOpToken` is badly named, because it only covers the assignable binary ops and excludes comparisons and `&&`/`||`. Its use in `ast::TokenKind` does allow a small amount of code sharing, but it's a clumsy factoring. This commit removes `ast::TokenKind::BinOp{,Eq}`, replacing each one with 10 individual variants. This makes `ast::TokenKind` more similar to `rustc_lexer::TokenKind`, which has individual variants for all operators. Although the number of lines of code increases, the number of chars decreases due to the frequent use of shorter names like `token::Plus` instead of `token::BinOp(BinOpToken::Plus)`.
2025-03-02Rollup merge of #137886 - NotLebedev:stable-mir-91, r=oli-obkMatthias Krüger-16/+27
`name()` and `trimmed_name()` for `stable_mir::crate_def::DefId` Resolves https://github.com/rust-lang/project-stable-mir/issues/91 * Added `stable_mir::crate_def::DefId::name()` and `stable_mir::crate_def::DefId::trimmed_name()` methods * Changed `CrateDef` and `DefId` `Debug` implementations to use new methods instead of copy-paste call to `Context::def_name` * Updated docs to avoid duplicating description of what `name` and `trimmed_name` do
2025-03-02Rollup merge of #137860 - taiki-e:powerpcspe-msync, r=workingjubileeMatthias Krüger-1/+3
rustc_target: Add msync target feature and enable it on powerpcspe targets Some older PowerPC processors do not have the `sync` (`sync 0`) and `lwsync` (`sync 1`) instructions, but instead have the `msync` instruction. (IIRC `msync` and `sync` will be assembled into the same bit-pattern, but `lwsync` will be SIGILL. See also https://gcc.gnu.org/legacy-ml/gcc-patches/2006-11/msg01238.html.) LLVM recognizes this as the [`msync` feature](https://github.com/llvm/llvm-project/blob/cc5d8a4b2fc765c3c432f1ad0b185dae518d41bd/llvm/lib/Target/PowerPC/PPC.td#L140) and enables for some cpus such as [e500](https://github.com/llvm/llvm-project/blob/cc5d8a4b2fc765c3c432f1ad0b185dae518d41bd/llvm/lib/Target/PowerPC/PPC.td#L644). powerpcspe is a target for CPUs such as e500 ([Debian Wiki](https://wiki.debian.org/PowerPCSPEPort)). However, the `msync` feature is currently not enabled except for vxworks, and at least since 2022-04, powerpc-unknown-linux-gnuspe was known to not work on real hardware without `-C target-cpu` (e.g., #96394, #117361). https://github.com/rust-lang/rust/blob/8c392966a013fd8a09e6b78b3c8d6e442bc278e1/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs#L28 Fixes #117361 cc `@BKPepe` ([powerpc-unknown-linux-muslspe target maintainer](https://doc.rust-lang.org/nightly/rustc/platform-support/powerpc-unknown-linux-muslspe.html#target-maintainers)) cc `@glaubitz` (who added powerpc-unknown-linux-gnuspe in https://github.com/rust-lang/rust/pull/48484) cc `@th0ma7` (who opened #117361) r? workingjubilee `@rustbot` label +O-PowerPC +A-target-feature
2025-03-02Rollup merge of #137851 - folkertdev:simd-intrinsic-mask-signed, ↵Matthias Krüger-1/+3
r=workingjubilee improve `simd_select` error message when used with invalid mask type followup to https://github.com/rust-lang/rust/pull/137828 This PR improves the error message for an invalid `simd_select` mask type, and adds testing for `simd_scatter` and `simd_gather` being used with invalid mask types. the `simd_masked_load` and `simd_masked_store` intrinsics already generated a better error message: https://github.com/rust-lang/rust/blob/0c72c0d11adeba449886089c6bd5d48363f7a2cd/tests/ui/simd/masked-load-store-build-fail.rs#L24-L37 r? `@workingjubilee`
2025-03-02Revert "Auto merge of #135335 - oli-obk:push-zxwssomxxtnq, r=saethlin"Michael Goulet-73/+25
This reverts commit a7a6c64a657f68113301c2ffe0745b49a16442d1, reversing changes made to ebbe63891f1fae21734cb97f2f863b08b1d44bf8.
2025-03-02update outdated doc with new exampleMu001999-2/+2
2025-03-02Remove layouting dead code for non-array SIMD types.Moulins-78/+19
These aren't supported anymore, and are already rejected in type checking.
2025-03-02Remove duplication in `name`/`trimmed_anem` docsNotLebedev-8/+3
Reference `DefId` in `CrateDef` docs to avoid duplicating long description of `trimmed_name`
2025-03-02Replace usages of `Context.def_name`NotLebedev-8/+3
Use `DefId.name` and `DefId.trimmed_name` instead
2025-03-02Add name and trimmed_name methods to DefIdNotLebedev-0/+21
2025-03-01Update `compiler-builtins` to 0.1.150Trevor Gross-2/+2
Includes a change to make a subset of math symbols available on all platforms [1], and disables `f16` on aarch64 without neon [2]. [1]: https://github.com/rust-lang/compiler-builtins/pull/763 [2]: https://github.com/rust-lang/compiler-builtins/pull/775
2025-03-01Check dyn flavor before registering upcast goal on wide pointer cast in MIR ↵Michael Goulet-2/+2
typeck
2025-03-01ensure we always print all --print options in helpMichael Toner-30/+34
2025-03-02rustc_target: Add msync target feature and enable it on powerpcspe targetsTaiki Endo-1/+3
2025-03-01Rollup merge of #137837 - fee1-dead-contrib:push-pvqvwuvrnwsy, r=compiler-errorsMatthias Krüger-7/+17
Update `const_conditions` and `explicit_implied_const_bounds` docs Move documentation to query definitions, and add docs to `explicit_implied_const_bounds`. r? project-const-traits
2025-03-01Rollup merge of #137830 - LuigiPiucco:incompatible-isa-fix, r=workingjubileeMatthias Krüger-1/+5
Fix link failure on AVR (incompatible ISA error) Fixes #137739. A reproducer of the issue is present there. I believe the root cause was introducing the avr-none target (which has no CPU by default) while also trying to get the ISA revision from the target spec. This commit uses the `target-cpu` option instead, which is already required to be present for the target. r? compiler cc ``@Patryk27``
2025-03-01Rollup merge of #137824 - estebank:rtn-sugg, r=compiler-errorsMatthias Krüger-32/+67
Tweak invalid RTN errors Make suggestions verbose. When encountering `method(type)` bound, suggest `method(..)` instead of `method()`. ``` error: argument types not allowed with return type notation --> $DIR/bad-inputs-and-output.rs:9:23 | LL | fn foo<T: Trait<method(i32): Send>>() {} | ^^^^^ | help: remove the input types | LL - fn foo<T: Trait<method(i32): Send>>() {} LL + fn foo<T: Trait<method(..): Send>>() {} | ``` When encountering both return type and arg list that isn't `..`, suggest replacing both. ``` error: return type not allowed with return type notation --> $DIR/bad-inputs-and-output.rs:12:25 | LL | fn bar<T: Trait<method() -> (): Send>>() {} | ^^^^^^ | help: use the right argument notation and remove the return type | LL - fn bar<T: Trait<method() -> (): Send>>() {} LL + fn bar<T: Trait<method(..): Send>>() {} | ``` When encountering a return type, suggest removing it including the leading whitespace. ``` error: return type not allowed with return type notation --> $DIR/bad-inputs-and-output.rs:24:45 | LL | fn bay_path<T: Trait>() where T::method(..) -> (): Send {} | ^^^^^ | help: remove the return type | LL - fn bay_path<T: Trait>() where T::method(..) -> (): Send {} LL + fn bay_path<T: Trait>() where T::method(..): Send {} | ``` r? ``@compiler-errors``
2025-03-01Rollup merge of #137822 - BoxyUwU:query_normalizer_docs, r=compiler-errorsMatthias Krüger-12/+9
Update query normalizer docs to not position it as the greatest pioneer in the space of normalization I don't think its true that we intend to replace all normalization with the query normalizer- its more likely that once the new solver is stable we can replace the query normalizer with normal normalization calls as the new solver caches much more than the old solver r? ``@compiler-errors``
2025-03-01Rollup merge of #137804 - RalfJung:backend-repr-simd-vector, r=workingjubileeMatthias Krüger-82/+91
rename BackendRepr::Vector → SimdVector For many Rustaceans, "vector" does not imply "SIMD", so let's be more clear in this type that is used pervasively in the compiler. r? `@workingjubilee`
2025-03-01also skip abi_required_features check in rustdocRalf Jung-6/+11
2025-03-01Implment `#[cfg]` and `#[cfg_attr]` in `where` clausesFrank King-50/+232
2025-03-01improve error message and testing of using an unsigned simd maskFolkert de Vries-1/+3
2025-03-01Auto merge of #137848 - matthiaskrgr:rollup-vxtrkis, r=matthiaskrgrbors-240/+251
Rollup of 8 pull requests Successful merges: - #136503 (Tweak output of const panic diagnostic) - #137390 (tests: fix up new test for nocapture -> capture(none) change) - #137617 (Introduce `feature(generic_const_parameter_types)`) - #137719 (Add missing case explanation for doc inlined re-export of doc hidden item) - #137763 (Use `mk_ty_from_kind` a bit less, clean up lifetime handling in borrowck) - #137769 (Do not yeet `unsafe<>` from type when formatting unsafe binder) - #137776 (Some `rustc_transmute` cleanups) - #137800 (Remove `ParamEnv::without_caller_bounds`) r? `@ghost` `@rustbot` modify labels: rollup