about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-05-01rustc_target: Adjust RISC-V feature implication (Za64rs and Za128rs)Tsukasa OI-1/+1
The Za64rs extension (reservation set -- a primitive memory unit of LR/SC atomic operations -- is naturally aligned and *at most* 64 bytes) is a superset of the Za128rs extension (*at most* 128 bytes; note that smaller the reservation set is, more fine grained control over atomics). This commit handles this as a feature implication.
2025-04-30Rollup merge of #140494 - ehuss:document-restrictions, r=traviscross,SparrowLiiMatthias Krüger-0/+49
Parser: Document restrictions I had trouble easily understanding what these various flags do. This is my attempt to try to explain what these do.
2025-04-30Rollup merge of #140468 - BoxyUwU:normalization_confusings2, r=lcnrMatthias Krüger-52/+56
Minor tweaks to make some normalization (adjacent) code less confusing r? lcnr sorry for double ping lol
2025-04-30Rollup merge of #140467 - BoxyUwU:no_fcw_assoc_consts, r=lcnrMatthias Krüger-9/+10
Don't FCW assoc consts in patterns Fixes #140447 See comment in added test. We could also check that the anon const is a const arg by looking at the HIR. I'm not sure that's necessary though :thinking: The only consts that are evaluated "for the type system" are const args (which *should* get FCWs) and const patterns (which cant be anon consts afaik).
2025-04-30Rollup merge of #140458 - azhogin:azhogin/async-drop-fix-dropped-tuple-ice, ↵Matthias Krüger-9/+15
r=oli-obk Fix for async drop ice with partly dropped tuple Fixes https://github.com/rust-lang/rust/issues/140427. Problem was with block data access with block id from new added blocks in patch.
2025-04-30Rollup merge of #140516 - rperier:type-ir-to-type-middle, r=lcnrMatthias Krüger-26/+21
Replace use of rustc_type_ir by rustc_middle cc #138449 I want to help on this issue. I have replaced all the rustc_type_ir uses by the equivalent type in rustc_middle. DelayedSet is also re-exposed by rustc_middle.
2025-04-30Rollup merge of #140504 - tmiasko:answer-ensure-stack, r=jswrennMatthias Krüger-455/+284
transmutability: ensure_sufficient_stack when answering query Based on #140380. Fixes #118860. The compile time was addressed earlier, this merely addresses stack overflow part of the issue. r? `@jswrenn` `@joshlf`
2025-04-30Rollup merge of #140498 - compiler-errors:check-fn-tweaks, r=oli-obkMatthias Krüger-139/+91
Misc tweaks to HIR typeck (mostly w.r.t. checking calls) Just some cleanups. r? oli-obk
2025-04-30Rollup merge of #140450 - petrochenkov:vistok, r=nnethercoteMatthias Krüger-214/+32
ast: Remove token visiting from AST visitor It's no longer necessary after the removal of nonterminal tokens in #124141. r? `@nnethercote`
2025-04-30Rollup merge of #140203 - Wyliodrin:error_for_no_mangle_weak_language_items, ↵Matthias Krüger-0/+30
r=bjorn3 Issue an error when using `no_mangle` on language items This pull requests adds the code to issue an error or a warning when using `no_mangle` on language items. This should detail why the `undefined symbol` error is issued for the code described in #139923. The pull request adds two ui tests, one testing the error and the other one the warning. I would love some feedback here, as I am not sure that the error and warning are issues using the right API.
2025-04-30Rollup merge of #140090 - Urgau:snake_case-fn-var, r=petrochenkovMatthias Krüger-0/+10
Check bare function idents for non snake-case name This PR adds the check required to lint on bare function idents for non snake-case name. Reported at #140089. cc `@theemathas`
2025-04-30Rollup merge of #134232 - bjorn3:naked_asm_improvements, r=wesleywiserMatthias Krüger-397/+333
Share the naked asm impl between cg_ssa and cg_clif This was introduced in https://github.com/rust-lang/rust/pull/128004.
2025-04-30Use less rustc_type_ir in the compiler codebaseRomain Perier-26/+21
This commit does the following: - Replaces use of rustc_type_ir by rustc_middle - Removes the rustc_type_ir dependency - The DelayedSet type is exposed by rustc_middle so everything can be accessed through rustc_middle in a coherent manner.
2025-04-30Fix naked asm symbol name for cg_clif on macOSbjorn3-1/+2
2025-04-30error when using no_mangle on language itemsAlexandru RADOVICI-0/+30
add suggestion on how to add a panic breakpoint Co-authored-by: Pat Pannuto <pat.pannuto@gmail.com> delete no_mangle from ui/panic-handler/panic-handler-wrong-location test issue an error for the usage of #[no_mangle] on internal language items delete the comments add newline rephrase note Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com> update error not to leak implementation details delete no_mangle_span Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com> delete commented code
2025-04-30transmutability: ensure_sufficient_stack when answering queryTomasz Miąsko-117/+125
2025-04-30Rollup merge of #140448 - Zalathar:query-append, r=compiler-errorsMatthias Krüger-13/+36
Rename `rustc_query_append!` to `rustc_with_all_queries!` Whenever I'm trying to make sense of the query system internals, I always get tripped up on this unhelpfully-named macro. The fact that it's a higher-order proc macro is already mind-melting enough on its own. This new name, `rustc_with_all_queries!`, forms a much more intuitive combination with the helper macros that it invokes. And only one of the call sites was even making use of the “append” part of its old name. This PR also reformats the parameters matched by the helper macros, to make the actual argument syntax a bit easier to see. --- Renaming and reformatting only; no functional changes.
2025-04-30Rollup merge of #140445 - oli-obk:const-manually-drop, r=fee1-deadMatthias Krüger-0/+6
Treat ManuallyDrop as ~const Destruct cc https://github.com/rust-lang/rust/issues/133214#issuecomment-2838078133 r? ```@compiler-errors``` cc ```@fee1-dead```
2025-04-30Rollup merge of #140439 - RalfJung:miri-algebraic-float-nondet, r=oli-obkMatthias Krüger-2/+9
miri: algebraic intrinsics: bring back float non-determinism Fixes https://github.com/rust-lang/miri/issues/4289 Cc ```@bjoernager``` r? ```@oli-obk```
2025-04-30Rollup merge of #140404 - lcnr:canonical-no-type-foldable, r=compiler-errorsMatthias Krüger-26/+4
rm `TypeVistable` impls for `Canonical` similar to `EarlyBinder`, you generally do not want to fold a canonical value directly without first instantiating it. In places where you do want to look into the `Canonical`, it's likely better to do so manually. r? ```@compiler-errors```
2025-04-30Rollup merge of #140312 - nnethercote:DelimArgs-spacing, r=petrochenkovMatthias Krüger-17/+35
Improve pretty-printing of braces r? ````@petrochenkov````
2025-04-30Rollup merge of #139059 - RalfJung:uses_power_alignment, r=nagisaMatthias Krüger-21/+14
uses_power_alignment: wording tweaks Slightly improves the wording introduced with https://github.com/rust-lang/rust/pull/135552.
2025-04-30ast: Remove token visiting from AST visitorVadim Petrochenkov-214/+32
It's no longer necessary after the removal of nonterminal tokens in #124141.
2025-04-30Inline check_method_argument_types and remove error_reported special casing ↵Michael Goulet-62/+36
(unnecessary)
2025-04-30Inline check_method_argument_types to get rid of TupleArgumentsFlag argMichael Goulet-23/+13
2025-04-30Move the error handling out of confirm_builtin_callMichael Goulet-31/+25
2025-04-30Rename lookup_method_in_trait and consolidate a Ident::with_dummy_span callMichael Goulet-26/+20
2025-04-29Parser: Document restrictionsEric Huss-0/+49
I had trouble easily understanding what these various flags do. This is my attempt to try to explain what these do.
2025-04-30Auto merge of #127516 - nnethercote:simplify-LazyAttrTokenStream, r=petrochenkovbors-378/+399
Simplify `LazyAttrTokenStream` `LazyAttrTokenStream` is an unpleasant type: `Lrc<Box<dyn ToAttrTokenStream>>`. Why does it look like that? - There are two `ToAttrTokenStream` impls, one for the lazy case, and one for the case where we already have an `AttrTokenStream`. - The lazy case (`LazyAttrTokenStreamImpl`) is implemented in `rustc_parse`, but `LazyAttrTokenStream` is defined in `rustc_ast`, which does not depend on `rustc_parse`. The use of the trait lets `rustc_ast` implicitly depend on `rustc_parse`. This explains the `dyn`. - `LazyAttrTokenStream` must have a `size_of` as small as possible, because it's used in many AST nodes. This explains the `Lrc<Box<_>>`, which keeps it to one word. (It's required `Lrc<dyn _>` would be a fat pointer.) This PR moves `LazyAttrTokenStreamImpl` (and a few other token stream things) from `rustc_parse` to `rustc_ast`. This lets us replace the `ToAttrTokenStream` trait with a two-variant enum and also remove the `Box`, changing `LazyAttrTokenStream` to `Lrc<LazyAttrTokenStreamInner>`. Plus it does a few cleanups. r? `@petrochenkov`
2025-04-29canonical no type foldable :<lcnr-26/+4
2025-04-30Use `ThinVec` to shrink `LazyAttrTokenStreamInner`.Nicholas Nethercote-5/+7
2025-04-30Simplify `LazyAttrTokenStream`.Nicholas Nethercote-118/+138
This commit does the following. - Changes it from `Lrc<Box<dyn ToAttrTokenStream>>` to `Lrc<LazyAttrTokenStreamInner>`. - Reworks `LazyAttrTokenStreamImpl` as `LazyAttrTokenStreamInner`, which is a two-variant enum. - Removes the `ToAttrTokenStream` trait and the two impls of it. The recursion limit must be increased in some crates otherwise rustdoc aborts.
2025-04-29Auto merge of #140023 - cjgillot:arena-try-alloc, r=BoxyUwUbors-33/+47
Introduce Arena::try_alloc_from_iter. `alloc_from_iter` already collects the iterator for reentrancy. So adding an early exit for a fallible iterator integrates naturally into the code. This avoids the other solution to allocate and dump the allocation.
2025-04-29transmutability: uninit transition matches unit byte onlyTomasz Miąsko-352/+173
The previous implementation was inconsistent about transitions that apply for an init byte. For example, when answering a query, an init byte could use corresponding init transition. Init byte could also use uninit transition, but only when the corresponding init transition was absent. This behaviour was incompatible with DFA union construction. Define an uninit transition to match an uninit byte only and update implementation accordingly. To describe that `Tree::uninit` is valid for any value, build an automaton that accepts any byte value. Additionally, represent byte ranges uniformly as a pair of integers to avoid special case for uninit byte.
2025-04-29confusingsBoxy-52/+56
2025-04-29Don't FCW assoc consts in patternsBoxy-9/+10
2025-04-29Rollup merge of #140433 - BjoernLange:master, r=nnethercoteTrevor Gross-0/+2
Replace the \01__gnu_mcount_nc to LLVM intrinsic for additional ARM targets This is an extension to #113814 which seems to have missed two targets which also need this patch for instrumentation with `-Z instrument-mcount` to work correctly. For anyone who might stumble over this issue again in the future: As a workaround one can dump the current target configuration using ``` rustc +nightly -Z unstable-options --target armv7-unknown-linux-gnueabihf --print target-spec-json ``` (assuming `armv7-unknown-linux-gnueabihf` is the target to build for) add the line ``` "llvm-mcount-intrinsic": "llvm.arm.gnu.eabi.mcount", ``` and compile with ``` RUSTFLAGS="-Z instrument-mcount -C passes=ee-instrument<post-inline>" cargo +nightly build -Z build-std --target <path to directory with modified target config>/armv7-unknown-linux-gnueabihf.json ``` It might be necessary to set the compiler for cross compiling using something like ``` export TARGET_CC=arm-linux-gnueabihf-gcc ```
2025-04-29Rollup merge of #140432 - tgross35:target-config-docs-update, r=jieyouxuTrevor Gross-5/+4
Update documentation for `fn target_config` This was missed as part of [1]. [1]: https://github.com/rust-lang/rust/pull/140323
2025-04-29Rollup merge of #140400 - durin42:llvm-21-getguid, r=cuviperTrevor Gross-4/+9
PassWrapper: adapt for llvm/llvm-project@d3d856ad8469 LLVM 21 moves to making it more explicit what this function call is doing, but nothing has changed behaviorally, so for now we just adjust to using the new name of the function. `@rustbot` label llvm-main
2025-04-29Rollup merge of #139909 - oli-obk:or-patterns, r=BoxyUwUTrevor Gross-122/+440
implement or-patterns for pattern types These are necessary to represent `NonZeroI32`, as the range for that is `..0 | 1..`. The `rustc_scalar_layout_range_*` attributes avoided this by just implementing wraparound and having a single `1..=-1` range effectively. See https://rust-lang.zulipchat.com/#narrow/channel/481660-t-lang.2Fpattern-types/topic/.60or.20pattern.60.20representation.20in.20type.20system/with/504217694 for some background discussion cc https://github.com/rust-lang/rust/issues/123646 r? `@BoxyUwU`
2025-04-29Rollup merge of #138344 - tgross35:x86-f16-math, r=AmanieuTrevor Gross-7/+3
Enable `reliable_f16_math` on x86 This has been disabled due to an LLVM misoptimization with `powi.f16` [1]. This was fixed upstream and the fix is included in LLVM20, so tests no longer need to be disabled. `f16` still remains disabled on MinGW due to the ABI issue. [1]: https://github.com/llvm/llvm-project/issues/98665 try-job: x86_64-gnu try-job: x86_64-gnu-llvm-19-1 try-job: x86_64-gnu-llvm-20-1
2025-04-29Fix for async drop ice with partly dropped tupleAndrew Zhogin-9/+15
2025-04-29Reformat parameters to macros used by with-all-queriesZalathar-6/+15
2025-04-29Rename `rustc_query_append!` to `rustc_with_all_queries!`Zalathar-7/+21
2025-04-29Treat `ManuallyDrop` as `~const Destruct`Oli Scherer-0/+6
2025-04-29miri: algebraic intrinsics: bring back float non-determinismRalf Jung-2/+9
2025-04-29Replace the \01__gnu_mcount_nc to LLVM intrinsic for additional ARM targetsBjörn Barwinski-0/+2
2025-04-29Update documentation for `fn target_config`Trevor Gross-5/+4
This was missed as part of [1]. [1]: https://github.com/rust-lang/rust/pull/140323
2025-04-29Enable `target_has_reliable_f16_math` on x86Trevor Gross-7/+3
This has been disabled due to an LLVM misoptimization with `powi.f16` [1]. This was fixed upstream and the fix is included in LLVM20, so tests no longer need to be disabled. `f16` still remains disabled on MinGW due to the ABI issue. [1]: https://github.com/llvm/llvm-project/issues/98665
2025-04-29Auto merge of #137940 - 1c3t3a:alignment-borrows-check, r=saethlinbors-32/+48
Extend the alignment check to borrows The current alignment check does not include checks for creating misaligned references from raw pointers, which is now added in this patch. When inserting the check we need to be careful with references to field projections (e.g. `&(*ptr).a`), in which case the resulting reference must be aligned according to the field type and not the type of the pointer. r? `@saethlin` cc `@RalfJung,` after our discussion in #134424