about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2024-07-13Merge commit '659243d85c7489412bd0faa1c068d904a6042941' into ↵bjorn3-77/+94
sync_cg_clif-2024-07-13
2024-07-13Rollup merge of #127654 - nikic:llvm-ndebug-fix, r=cuviperJacob Pratt-14/+8
Fix incorrect NDEBUG handling in LLVM bindings We currently compile our LLVM bindings using `-DNDEBUG` if debuginfo for LLVM is disabled. However, `NDEBUG` doesn't have any relation to debuginfo, it controls whether assertions are enabled. Split the LLVM_NDEBUG environment variable into two, so that assertions and debuginfo are controlled independently. After this change, `LLVMRustDIBuilderInsertDeclareAtEnd` triggers an assertion failure on LLVM 19 due to an incorrect cast. Fix it by removing the unused return value entirely. r? `@cuviper`
2024-07-12Auto merge of #127665 - workingjubilee:rollup-g90yr21, r=workingjubileebors-129/+353
Rollup of 11 pull requests Successful merges: - #126502 (Ignore allocation bytes in some mir-opt tests) - #126922 (add lint for inline asm labels that look like binary) - #127209 (Added the `xop` target-feature and the `xop_target_feature` feature gate) - #127310 (Fix import suggestion ice) - #127338 (Migrate `extra-filename-with-temp-outputs` and `issue-85019-moved-src-dir` `run-make` tests to rmake) - #127381 (Migrate `issue-83045`, `rustc-macro-dep-files` and `env-dep-info` `run-make` tests to rmake) - #127535 (Fire unsafe_code lint on unsafe extern blocks) - #127619 (Suggest using precise capturing for hidden type that captures region) - #127631 (Remove `fully_normalize`) - #127632 (Implement `precise_capturing` support for rustdoc) - #127660 (Rename the internal `const_strlen` to just `strlen`) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-12Rollup merge of #127632 - compiler-errors:precise-capturing-rustdoc, r=fmeaseJubilee-0/+7
Implement `precise_capturing` support for rustdoc Implements rustdoc (+json) support for local (i.e. non-cross-crate-inlined) RPITs with `use<...>` precise capturing syntax. Tests kinda suck. They're really hard to write 😰 r? `@fmease` or re-roll if you're too busy! also cc `@aDotInTheVoid` for the json side Tracking: * https://github.com/rust-lang/rust/issues/127228#issuecomment-2201443216 (not fully fixed for cross-crate-inlined opaques) * https://github.com/rust-lang/rust/issues/123432
2024-07-12Rollup merge of #127631 - compiler-errors:yeet-fully-norm, r=lcnrJubilee-74/+36
Remove `fully_normalize` Yeet this function and replace it w/ some `ObligationCtxt` instead. It wasn't called very often anyways. r? lcnr
2024-07-12Rollup merge of #127619 - compiler-errors:precise-capturing-better-sugg, ↵Jubilee-12/+142
r=oli-obk Suggest using precise capturing for hidden type that captures region Adjusts the "add `+ '_`" suggestion for opaques to instead suggest adding or reusing the `+ use<>` in the opaque. r? oli-obk or please re-roll if you're busy!
2024-07-12Rollup merge of #127535 - spastorino:unsafe_code-unsafe_extern_blocks, r=oli-obkJubilee-0/+10
Fire unsafe_code lint on unsafe extern blocks Fixes #126738
2024-07-12Rollup merge of #127310 - chenyukang:yukang-fix-suggest-import-ice, r=estebankJubilee-5/+5
Fix import suggestion ice Fixes #127302 #127302 only crash in edition 2015 #120074 can only reproduced in edition 2021 so I added revisions in test file.
2024-07-12Rollup merge of #127209 - sayantn:xop, r=AmanieuJubilee-0/+5
Added the `xop` target-feature and the `xop_target_feature` feature gate This is an effort towards #127208. This adds the `xop` target feature gated by `xop_target_feature`.
2024-07-12Rollup merge of #126922 - asquared31415:asm_binary_label, r=estebankJubilee-38/+142
add lint for inline asm labels that look like binary fixes #94426 Due to a bug/feature in LLVM, labels composed of only the digits `0` and `1` can sometimes be confused with binary literals, even if a binary literal would not be valid in that position. This PR adds detection for such labels and also as a drive-by change, adds a note to cases such as `asm!(include_str!("file"))` that the label that it found came from an expansion of a macro, it wasn't found in the source code. I expect this PR to upset some people that were using labels `0:` or `1:` without issue because they never hit the case where LLVM got it wrong, but adding a heuristic to the lint to prevent this is not feasible - it would involve writing a whole assembly parser for every target that we have assembly support for. [zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-06-20/near/445870628) r? ``@estebank``
2024-07-12Rollup merge of #126502 - cuviper:dump-mir-exclude-alloc-bytes, r=estebankJubilee-0/+6
Ignore allocation bytes in some mir-opt tests This adds `rustc -Zdump-mir-exclude-alloc-bytes` to skip writing allocation bytes in MIR dumps, and applies it to tests that were failing on s390x due to its big-endian byte order. Fixes #126261
2024-07-12Auto merge of #123351 - beetrees:x86-ret-snan-rust, r=nikic,workingjubileebors-0/+34
Ensure floats are returned losslessly by the Rust ABI on 32-bit x86 Solves #115567 for the (default) `"Rust"` ABI. When compiling for 32-bit x86, this PR changes the `"Rust"` ABI to return floats indirectly instead of in x87 registers (with the exception of single `f32`s, which this PR returns in general purpose registers as they are small enough to fit in one). No change is made to the `"C"` ABI as that ABI requires x87 register usage and therefore will need a different solution.
2024-07-12Remove LLVMRustDIBuilderInsertDeclareAtEnd return valueNikita Popov-12/+7
The return value changed from an Instruction to a DbgRecord in LLVM 19. As we don't actually use the result, drop the return value entirely to support both.
2024-07-12Fix incorrect NDEBUG handling in LLVM bindingsNikita Popov-2/+1
We currently compile our LLVM bindings using `-DNDEBUG` if debuginfo for LLVM is disabled. However, `NDEBUG` doesn't have any relation to debuginfo, it controls whether assertions are enabled. Rename the environment variable to `LLVM_ASSERTIONS` and drive it using the `llvm_assertions` option. Also drop the explicit `debug(false)` call, as cc already sets this up using the cargo `DEBUG` environment variable.
2024-07-12Added the `xop` target feature and `xop_target_feature` gatesayantn-0/+5
2024-07-12Auto merge of #127636 - nnethercote:fix-Parser-look_ahead, r=oli-obkbors-30/+147
Fix `Parser::look_ahead` `Parser::look_ahead` has a slow but simple general case, and a fast special case that is hit most of the time. But the special case is buggy and behaves differently to the general case. There are also no unit tests. This PR fixes all of this, resulting in a `Parser::look_ahead` that is equally fast, slightly simpler, more correct, and better tested. r? `@davidtwco`
2024-07-12Auto merge of #127653 - matthiaskrgr:rollup-72bqgvp, r=matthiaskrgrbors-757/+991
Rollup of 8 pull requests Successful merges: - #124980 (Generalize `fn allocator` for Rc/Arc.) - #126639 (Add AMX target-features and `x86_amx_intrinsics` feature flag) - #126827 (Use pidfd_spawn for faster process spawning when a PidFd is requested) - #127433 (Stabilize const_cstr_from_ptr (CStr::from_ptr, CStr::count_bytes)) - #127552 (remove unnecessary `git` usages) - #127613 (Update dist-riscv64-linux to binutils 2.40) - #127627 (generalize search graph to enable fuzzing) - #127648 (Lower timeout of CI jobs to 4 hours) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-12Rollup merge of #127627 - lcnr:rustc_search_graph, r=compiler-errorsMatthias Krüger-757/+982
generalize search graph to enable fuzzing I do not believe it to be feasible to correctly implement the search graph without fuzzing. This PR enables this by requiring a fuzzer to only implement three new traits: - `Cx`: implemented by all `I: Interner` - `ProofTreeBuilder`: implemented by `struct ProofTreeBuilder<D>` for all `D: SolverDelegate` - `Delegate`: implemented for a new `struct SearchGraphDelegate<D>` for all `D: SolverDelegate` It also moves the evaluation cache implementation into `rustc_type_ir`, requiring `Interner` to provide methods to create and access arbitrary `WithDepNode<T>` and to provide mutable access to a given `GlobalCache`. It otherwise does not change the API surface for users of the shared library. This change should not impact behavior in any way. r? ``@compiler-errors``
2024-07-12Rollup merge of #126639 - sayantn:amx, r=AmanieuMatthias Krüger-0/+9
Add AMX target-features and `x86_amx_intrinsics` feature flag This is an effort towards #126622. This adds support for all 5 target-features for `AMX`, and introduces the feature flag `x86_amx_intrinsics`, which would gate these target-features and the yet-to-be-implemented amx intrinsics in stdarch.
2024-07-12Auto merge of #127479 - Urgau:rustc-stable-hash, r=michaelwoeristerbors-1049/+22
Use rustc-stable-hash in the compiler Following https://github.com/rust-lang/compiler-team/issues/755 and the release of the crate on crates.io, let's now use it in the compiler and remove the old implementation. cc `@michaelwoerister` r? ghost
2024-07-12enable fuzzing of `SearchGraph`lcnr-757/+982
fully move it into `rustc_type_ir` and make it independent of `Interner`.
2024-07-12Add rustdoc support for use<> in (local) RPITsMichael Goulet-0/+7
2024-07-12Auto merge of #127635 - matthiaskrgr:rollup-foopajr, r=matthiaskrgrbors-207/+196
Rollup of 6 pull requests Successful merges: - #127164 (match lowering: Clarify the main loop of the algorithm) - #127422 (as_simd: fix doc comment to be in line with align_to) - #127596 (More suggestion for converting `Option<&Vec<T>>` to `Option<&[T]>`) - #127607 (compiletest: Better error message for bad `normalize-*` headers) - #127622 (Mark `builtin_syntax` as internal) - #127625 (Revert accidental comment deletion) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-12Add a new special case to `Parser::look_ahead`.Nicholas Nethercote-0/+29
This new special case is simpler than the old special case because it only is used when `dist == 1`. But that's still enough to cover ~98% of cases. This results in equivalent performance to the old special case, and identical behaviour as the general case.
2024-07-12Remove the bogus special case from `Parser::look_ahead`.Nicholas Nethercote-56/+28
The general case at the bottom of `look_ahead` is slow, because it clones the token cursor. Above it there is a special case for performance that is hit most of the time and avoids the cloning. Unfortunately, its behaviour differs from the general case in two ways. - When within a pair of delimiters, if you look any distance past the closing delimiter you get the closing delimiter instead of what comes after the closing delimiter. - It uses `tree_cursor.look_ahead(dist - 1)` which totally confuses tokens with token trees. This means that only the first token in a token tree will be seen. E.g. in a sequence like `{ a }` the `a` and `}` will be skipped over. Bad! It's likely that these differences weren't noticed before now because the use of `look_ahead` in the parser is limited to small distances and relatively few contexts. Removing the special case causes slowdowns up of to 2% on a range of benchmarks. The next commit will add a new, correct special case to regain that lost performance.
2024-07-12Add unit tests for `Parser::look_ahead`.Nicholas Nethercote-0/+116
It's currently buggy, so some of the test results are surprising, as described in the `FIXME` comments. The bugs will be fixed in subsequent commits.
2024-07-11Add the feature gate and target-featuressayantn-0/+9
2024-07-12Rollup merge of #127625 - SkiFire13:revert-comment-deletion, r=workingjubileeMatthias Krüger-0/+2
Revert accidental comment deletion This reverts an accidental comment deletion made in #113128 See also https://github.com/rust-lang/rust/pull/113128#discussion_r1674614882
2024-07-12Rollup merge of #127622 - compiler-errors:builtin-internal, r=lqdMatthias Krüger-2/+2
Mark `builtin_syntax` as internal Tracking issue literally says: > There will never be a general stabilization. cc #110680 `@est31`
2024-07-12Rollup merge of #127596 - tesuji:help-unwrap-or, r=compiler-errorsMatthias Krüger-15/+37
More suggestion for converting `Option<&Vec<T>>` to `Option<&[T]>` Please review commit-by-commit.
2024-07-12Rollup merge of #127164 - Nadrieril:clean-lowering-loop, r=matthewjasperMatthias Krüger-190/+155
match lowering: Clarify the main loop of the algorithm Now that we expand or-patterns in a single place in the algorithm, we can move it (back) to the main part of the loop. This makes the call-graph of the main loop rather simple: `match_candidates` has three branches that each call back to `match_candidates`. The remaining tricky part is `finalize_or_candidate`. I also factored out the whole "process a prefix of the candidates then process the rest" thing which I think helps legibility. The first two commits are a fix for an indexing mistake I introduced in https://github.com/rust-lang/rust/pull/126553, already sumitted in https://github.com/rust-lang/rust/pull/127028 but feel free to merge this first. r? `@matthewjasper`
2024-07-12Auto merge of #127382 - estebank:const-let, r=compiler-errorsbors-26/+56
Use verbose style when suggesting changing `const` with `let`
2024-07-11Remove fully_normalizeMichael Goulet-74/+36
2024-07-11Auto merge of #127614 - matthiaskrgr:rollup-8geziwi, r=matthiaskrgrbors-81/+125
Rollup of 8 pull requests Successful merges: - #124599 (Suggest borrowing on fn argument that is `impl AsRef`) - #127572 (Don't mark `DEBUG_EVENT` struct as `repr(packed)`) - #127588 (core: Limit remaining f16 doctests to x86_64 linux) - #127591 (Make sure that labels are defined after the primary span in diagnostics) - #127598 (Allows `#[diagnostic::do_not_recommend]` to supress trait impls in suggestions as well) - #127599 (Rename `lazy_cell_consume` to `lazy_cell_into_inner`) - #127601 (check is_ident before parse_ident) - #127605 (Remove extern "wasm" ABI) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-11Add doc for deconstruct_option_or_resultLzu Tao-0/+3
2024-07-11Add suggestion for `Option<&Vec<T>> -> Option<&[T]`Lzu Tao-15/+34
2024-07-11Account for `let foo = expr`; to suggest `const foo: Ty = expr;`Esteban Küber-22/+51
2024-07-11Use verbose style when suggesting changing `const` with `let`Esteban Küber-5/+6
2024-07-11Revert accidental comment deletionGiacomo Stevanato-0/+2
2024-07-11Mark builtin syntax as internalMichael Goulet-2/+2
2024-07-11Make it translatable tooMichael Goulet-13/+43
2024-07-11Suggest using precise capturing for hidden type that captures regionMichael Goulet-12/+112
2024-07-11Rollup merge of #127605 - nikic:remove-extern-wasm, r=oli-obkMatthias Krüger-59/+24
Remove extern "wasm" ABI Remove the unstable `extern "wasm"` ABI (`wasm_abi` feature tracked in #83788). As discussed in https://github.com/rust-lang/rust/pull/127513#issuecomment-2220410679 and following, this ABI is a failed experiment that did not end up being used for anything. Keeping support for this ABI in LLVM 19 would require us to switch wasm targets to the `experimental-mv` ABI, which we do not want to do. It should be noted that `Abi::Wasm` was internally used for two things: The `-Z wasm-c-abi=legacy` ABI that is still used by default on some wasm targets, and the `extern "wasm"` ABI. Despite both being `Abi::Wasm` internally, they were not the same. An explicit `extern "wasm"` additionally enabled the `+multivalue` feature. I've opted to remove `Abi::Wasm` in this patch entirely, instead of keeping it as an ABI with only internal usage. Both `-Z wasm-c-abi` variants are now treated as part of the normal C ABI, just with different different treatment in adjust_for_foreign_abi.
2024-07-11Rollup merge of #127601 - trevyn:issue-127600, r=compiler-errorsMatthias Krüger-2/+2
check is_ident before parse_ident Closes #127600
2024-07-11Rollup merge of #127598 - ↵Matthias Krüger-0/+19
weiznich:diagnostic_do_not_recommend_also_skips_help, r=compiler-errors Allows `#[diagnostic::do_not_recommend]` to supress trait impls in suggestions as well This commit changes the error reporting mechanism for not implemented traits to skip impl marked as `#[diagnostic::do_not_recommend]` in the help part of the error message ("the following other types implement trait `Foo`:"). The main use case here is to allow crate authors to skip non-meaningful confusing suggestions. A common example for this are fully generic impls on tuples. Related to https://github.com/rust-lang/rust/issues/51992 r? `@compiler-errors`
2024-07-11Rollup merge of #127591 - compiler-errors:label-after-primary, r=lcnrMatthias Krüger-1/+10
Make sure that labels are defined after the primary span in diagnostics Putting a `#[label]` before a `#[primary_span]` results in that label being overwritten, due to the semantics of `Diagnostic::span` and the fact that labels are stored in the `MultiSpan` of the diagnostic. This isn't possible to fix in general, since a lot of code actually *relies* in this overwriting behavior (e.g. `rustc_on_unimplemented`). However, it's useful to enforce this for derive-diagnostics, since this is certainly never what you intend to do in a derived diagnostic, where all the fields are meaningful parts of the diagnostic being rendered. This only matters for `#[label]`, since those are the ones stored in the `MultiSpan` of the error. We could also make this "just work" by sorting the attrs or processing the primary span attr first, however I think it's kinda pointless to do. There was 1 case where this mattered, but we literally didn't have a test exercising that diagnostic 🙃
2024-07-11Rollup merge of #124599 - estebank:issue-41708, r=wesleywiserMatthias Krüger-19/+70
Suggest borrowing on fn argument that is `impl AsRef` When encountering a move conflict, on an expression that is `!Copy` passed as an argument to an `fn` that is `impl AsRef`, suggest borrowing the expression. ``` error[E0382]: use of moved value: `bar` --> f204.rs:14:15 | 12 | let bar = Bar; | --- move occurs because `bar` has type `Bar`, which does not implement the `Copy` trait 13 | foo(bar); | --- value moved here 14 | let baa = bar; | ^^^ value used here after move | help: borrow the value to avoid moving it | 13 | foo(&bar); | + ``` Fix #41708
2024-07-11Use uplifted `rustc-stable-hash` crate in `rustc_data_structures`Urgau-1049/+22
2024-07-11Auto merge of #127487 - tgross35:f16-f128-simd, r=Amanieubors-0/+2
Add `f16` and `f128` as simd types in LLVM `@sayantn` is working on adding SIMD for `f16` and hitting the `FloatingPointVector` error. This should fix it and unblock adding support for `simd_fma` and `simd_fabs` in stdarch.
2024-07-11solve -> solve/modlcnr-0/+0