about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-12-13Reword prelude for AsyncFn stabilizationMichael Goulet-2/+3
2024-12-13Stabilize async closuresMichael Goulet-553/+311
2024-12-12Auto merge of #134223 - matthiaskrgr:rollup-qy69vqb, r=matthiaskrgrbors-248/+844
Rollup of 7 pull requests Successful merges: - #133122 (Add unpolished, experimental support for AFIDT (async fn in dyn trait)) - #133249 (ABI checks: add support for loongarch) - #134089 (Use newly added exceptions to non default branch warning) - #134188 (Bump Fuchsia) - #134204 (Fix our `llvm::Bool` typedef to be signed, to match `LLVMBool`) - #134207 (Revert "bootstrap: print{ln}! -> eprint{ln}! (take 2) #134040") - #134214 (rustdoc: fix self cmp) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-12Rollup merge of #134214 - klensy:rd-shadow, r=notriddleMatthias Krüger-1/+1
rustdoc: fix self cmp Looks like condition in `filter` currently always `true`, but intended to compare with `fqp` from `if let Some(&(ref fqp, item_type))`?
2024-12-12Rollup merge of #134207 - jieyouxu:revert-134040, r=lqdMatthias Krüger-210/+206
Revert "bootstrap: print{ln}! -> eprint{ln}! (take 2) #134040" Unfortunately, #134040 is proving to have caused more output interleaving problems that are tricky to diagnose and fix, and I think we probably should leave these untouched as bootstrap and compiletest has a bunch of interconnecting parts, and the commands and tools that they exercise do not consistently use stderr/stdout either. This causes hard-to-diagnose output interleaving bugs, which unfortunately degrades contributor experience. This PR reverts two PRs in order to cleanly revert #134040: 1. Revert #134123 which is a fix-forward after #134040. 2. Revert #134040 itself. I don't regret the initial effort `@clubby789,` and thank you for making the attempts, but I think we need to refrain from touching too many of these at once because some of the interleaving are very non-obvious and we don't have test coverage for. r? `@clubby789` cc `@Zalathar`
2024-12-12Rollup merge of #134204 - Zalathar:llvm-bool, r=SparrowLiiMatthias Krüger-1/+3
Fix our `llvm::Bool` typedef to be signed, to match `LLVMBool` In the LLVM-C API, boolean values are passed as `typedef int LLVMBool`, but our Rust-side typedef was using `c_uint` instead. Signed and unsigned integers have the same ABI on most platforms, but that isn't universally true, so we should prefer to be consistent with LLVM. https://github.com/rust-lang/llvm-project/blob/1268e87/llvm/include/llvm-c/Types.h#L28
2024-12-12Rollup merge of #134188 - steven807:master, r=lqdMatthias Krüger-1/+1
Bump Fuchsia try-job: x86_64-fuchsia
2024-12-12Rollup merge of #134089 - Urgau:triagebot-exceptions, r=ehussMatthias Krüger-1/+9
Use newly added exceptions to non default branch warning cc https://github.com/rust-lang/triagebot/pull/1860 cc `@cuviper` r? `@ehuss`
2024-12-12Rollup merge of #133249 - heiher:loong-abi-check, r=workingjubileeMatthias Krüger-1/+3
ABI checks: add support for loongarch LoongArch psABI[^1] specifies that LSX vector types are passed via general-purpose registers, while LASX vector types are passed indirectly through the stack. This patch addresses the following warnings: ``` warning: this function call uses a SIMD vector type that is not currently supported with the chosen ABI --> .../library/core/src/../../stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs:3695:5 | 3695 | __lsx_vreplgr2vr_b(a) | ^^^^^^^^^^^^^^^^^^^^^ function called here | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = note: `#[warn(abi_unsupported_vector_types)]` on by default ``` [^1]: https://github.com/loongson/la-abi-specs/blob/release/lapcs.adoc r? `@workingjubilee`
2024-12-12Rollup merge of #133122 - compiler-errors:afidt, r=oli-obkMatthias Krüger-33/+621
Add unpolished, experimental support for AFIDT (async fn in dyn trait) This allows us to begin messing around `async fn` in `dyn Trait`. Calling an async fn from a trait object always returns a `dyn* Future<Output = ...>`. To make it work, Implementations are currently required to return something that can be coerced to a `dyn* Future` (see the example in `tests/ui/async-await/dyn/works.rs`). If it's not the right size, then it'll raise an error at the coercion site (see the example in `tests/ui/async-await/dyn/wrong-size.rs`). Currently the only practical way of doing this is wrapping the body in `Box::pin(async move { .. })`. This PR does not implement a helper type like a "`Boxing`"[^boxing] adapter, and I'll probably follow-up with another PR to improve the error message for the `PointerLike` trait (something that explains in just normal prose what is happening here, rather than a trait error). [^boxing]: https://rust-lang.github.io/async-fundamentals-initiative/explainer/user_guide_future.html#the-boxing-adapter This PR also does not implement new trait solver support for AFIDT; I'll need to think how best to integrate it into candidate assembly, and that's a bit of a matter of taste, but I don't think it will be difficult to do. This could also be generalized: * To work on functions that are `-> impl Future` (soon). * To work on functions that are `-> impl Iterator` and other "dyn rpitit safe" traits. We still need to nail down exactly what is needed for this to be okay (not soon). Tracking: * https://github.com/rust-lang/rust/issues/133119
2024-12-12Auto merge of #132789 - matthiaskrgr:debug_tests, r=jieyouxubors-0/+146
add some debug-assertion crash tests r? ghost try-job: x86_64-gnu
2024-12-12fix self shadowed self compareklensy-1/+1
2024-12-12Auto merge of #134199 - RalfJung:gitmerge, r=oli-obkbors-4/+2
Revert "Stop git from merging generated files" This reverts https://github.com/rust-lang/rust/pull/133851. "-merge" makes git not even do merges if they are entirely conflict-free, which is not the behavior we want. We sometimes have conflict-free merges in generated files and it's much better if git can handle them automatically. r? `@oli-obk` Cc `@jieyouxu` `@Urgau`
2024-12-12Revert "Rollup merge of #134040 - clubby789:bootstrap-eprintln, r=jieyouxu"许杰友 Jieyou Xu (Joe)-211/+207
This reverts commit b282774aaf0aa05b4a9855d973b67e7e424c2136, reversing changes made to e0f3db0056288a06b1ae36cdd70741a4e0b3584a.
2024-12-12Revert "Rollup merge of #134123 - Zalathar:json-output, r=jieyouxu,clubby789"许杰友 Jieyou Xu (Joe)-1/+1
This reverts commit c42c248009747366e646a3ad1ce6e8f815ea7db2, reversing changes made to 0f1b827881d20ba08f72d692ccd3ff97a0e25851.
2024-12-12Fix our `llvm::Bool` typedef to be signed, to match `LLVMBool`Zalathar-1/+3
In the LLVM-C API, boolean values are passed as `typedef int LLVMBool`, but our Rust-side typedef was using `c_uint` instead. Signed and unsigned integers have the same ABI on most platforms, but that isn't universally true, so we should prefer to be consistent with LLVM.
2024-12-12Auto merge of #134201 - matthiaskrgr:rollup-22b721y, r=matthiaskrgrbors-190/+475
Rollup of 11 pull requests Successful merges: - #122003 (link libunwind dynamically and allow controlling it via `crt-static` on gnullvm targets) - #133859 (Move some alloc tests to the alloctests crate) - #134070 (Some asm! diagnostic adjustments and a papercut fix) - #134144 (Properly consider APITs for never type fallback ascription fix) - #134152 (Simplify `rustc_mir_dataflow::abs_domain`.) - #134154 (suppress field expr with generics error message if it's a method) - #134155 (Forbid `unsafe_op_in_unsafe_fn` for Hurd) - #134173 (allow `symbol_intern_string_literal` lint in test modules) - #134178 (Stabilize the Rust 2024 prelude) - #134179 (Remove outdated consteval note from `<*mut T>::align_offset` docs.) - #134187 (Remove `PErr`.) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-12Rollup merge of #134187 - nnethercote:rm-PErr, r=jieyouxuMatthias Krüger-12/+11
Remove `PErr`. It's just a synonym for `Diag` that adds no value and is only used in a few places. r? ``@spastorino``
2024-12-12Rollup merge of #134179 - zachs18:align_offset_mut_ptr_doc, r=workingjubileeMatthias Krüger-9/+0
Remove outdated consteval note from `<*mut T>::align_offset` docs.
2024-12-12Rollup merge of #134178 - ehuss:stabilize-2024-prelude, ↵Matthias Krüger-6/+15
r=amanieu,traviscross,tgross35 Stabilize the Rust 2024 prelude This stabilizes the `core::prelude::rust_2024` and `std::prelude::rust_2024` modules. I missed these in the #133349 stabilization.
2024-12-12Rollup merge of #134173 - onur-ozkan:allow-symbol-intern-string-literal, ↵Matthias Krüger-6/+13
r=jieyouxu allow `symbol_intern_string_literal` lint in test modules Since #133545, `x check compiler --stage 1` no longer works because compiler test modules trigger `symbol_intern_string_literal` lint errors. Bootstrap shouldn't control when to ignore or enable this lint in the compiler tree (using `Kind != Test` was ineffective for obvious reasons). Also, conditionally adding this rustflag invalidates the build cache between `x test` and other commands. This PR removes the `Kind` check from bootstrap and handles it directly in the compiler tree in a more natural way.
2024-12-12Rollup merge of #134155 - sthibaul:unsafe_op_in_unsafe_fn, r=tgross35Matthias Krüger-0/+1
Forbid `unsafe_op_in_unsafe_fn` for Hurd Tracking issue https://github.com/rust-lang/rust/issues/127747
2024-12-12Rollup merge of #134154 - dev-ardi:field-expr-generics, r=compiler-errorsMatthias Krüger-17/+18
suppress field expr with generics error message if it's a method Don't emit "field expressions may not have generic arguments" if it's a method call without `()` r? estebank Fixes #67680 Is this the best way to go? It's by far the simplest I could come up with.
2024-12-12Rollup merge of #134152 - ↵Matthias Krüger-37/+11
nnethercote:simplify-rustc_mir_dataflow-abs_domain, r=compiler-errors Simplify `rustc_mir_dataflow::abs_domain`. `rustc_mir_dataflow` has a typedef `AbstractElem` that is equal to `ProjectionElem<AbstractOperand, AbstractType>`. `AbstractOperand` and `AbstractType` are both unit types. There is also has a trait `Lift` to convert a `PlaceElem` to an `AbstractElem`. But `rustc_mir_middle` already has a typedef `ProjectionKind` that is equal to `ProjectionElem<(), ()>`, which is equivalent to `AbstractElem`. So this commit reuses `ProjectionKind` in `rustc_mir_dataflow`, removes `AbstractElem`, and simplifies the `Lift` trait. r? ``@pnkfelix``
2024-12-12Rollup merge of #134144 - compiler-errors:fallback-apit, r=WaffleLapkinMatthias Krüger-26/+142
Properly consider APITs for never type fallback ascription fix Fixes #133842
2024-12-12Rollup merge of #134070 - oli-obk:push-nquzymupzlsq, r=jieyouxuMatthias Krüger-44/+131
Some asm! diagnostic adjustments and a papercut fix Best reviewed commit by commit. We forgot a `normalize` call in intrinsic checking, causing us to allow literal integers, but not named constants containing that literal. This can in theory affect stable code, but only if libstd contains a stable SIMD type that has an array length that is a named constant. I'd assume we'd have noticed by now due to asm! rejecting those outright. The error message left me scratching my head for a bit, so I added some extra information to the diagnostic, too.
2024-12-12Rollup merge of #133859 - bjorn3:move_tests_to_alloctests, r=tgross35Matthias Krüger-27/+123
Move some alloc tests to the alloctests crate Unit tests directly inside of standard library crates require a very fragile way of building that is hard to reproduce outside of bootstrap.
2024-12-12Rollup merge of #122003 - mati865:gnullvm-build-libunwind, r=petrochenkovMatthias Krüger-6/+10
link libunwind dynamically and allow controlling it via `crt-static` on gnullvm targets Alternative to https://github.com/rust-lang/rust/pull/121794 ``` $ cargo b -r Finished `release` profile [optimized] target(s) in 0.38s $ ntldd target/release/hello.exe | rg unwind libunwind.dll => H:\msys64\clang64\bin\libunwind.dll (0x0000020c35df0000) $ RUSTFLAGS="-C target-feature=+crt-static" cargo b -r Finished `release` profile [optimized] target(s) in 0.23s $ ntldd target/release/hello.exe | rg unwind ```
2024-12-12Revert "Stop git from merging generated files"Ralf Jung-4/+2
This reverts commit 4cbb599edf5b0762caa36ee4cbba00c5c86c1f5e. "-merge" makes git not even do merges if they are entirely conflict-free, which is not the behavior we want.
2024-12-12Auto merge of #129181 - beetrees:asm-spans, r=pnkfelix,compiler-errorsbors-200/+1565
Pass end position of span through inline ASM cookie Before this PR, only the start position of the span was passed though the inline ASM cookie to diagnostics. LLVM 19 has full support for 64-bit inline ASM cookies; this PR uses that to pass the end position of the span in the upper 32 bits, meaning inline ASM diagnostics now point at the entire line the error occurred on, not just the first character of it.
2024-12-11Bump FuchsiaSteven Grady-1/+1
2024-12-12Properly consider APITs for never type fallback ascription fixMichael Goulet-26/+142
2024-12-12Remove `PErr`.Nicholas Nethercote-12/+11
It's just a synonym for `Diag` that adds no value and is only used in a few places.
2024-12-11Auto merge of #128004 - folkertdev:naked-fn-asm, r=Amanieubors-106/+635
codegen `#[naked]` functions using global asm tracking issue: https://github.com/rust-lang/rust/issues/90957 Fixes #124375 This implements the approach suggested in the tracking issue: use the existing global assembly infrastructure to emit the body of `#[naked]` functions. The main advantage is that we now have full control over what gets generated, and are no longer dependent on LLVM not sneakily messing with our output (inlining, adding extra instructions, etc). I discussed this approach with `@Amanieu` and while I think the general direction is correct, there is probably a bunch of stuff that needs to change or move around here. I'll leave some inline comments on things that I'm not sure about. Combined with https://github.com/rust-lang/rust/pull/127853, if both accepted, I think that resolves all steps from the tracking issue. r? `@Amanieu`
2024-12-11Stabilize the Rust 2024 preludeEric Huss-6/+15
2024-12-11Clarify why a type is rejected for asm!Oli Scherer-49/+83
2024-12-11Evaluate constants in SIMD vec lengths before rejecting themOli Scherer-11/+2
2024-12-11Auto merge of #134177 - matthiaskrgr:rollup-hgp8q60, r=matthiaskrgrbors-3145/+7930
Rollup of 6 pull requests Successful merges: - #132975 (De-duplicate and improve definition of core::ffi::c_char) - #133598 (Change `GetManyMutError` to match T-libs-api decision) - #134148 (add comments in check_expr_field) - #134163 (coverage: Rearrange the code for embedding per-function coverage metadata) - #134165 (wasm(32|64): update alignment string) - #134170 (Subtree update of `rust-analyzer`) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-11Rollup merge of #134170 - lnicola:sync-from-ra, r=lnicolaMatthias Krüger-2865/+7515
Subtree update of `rust-analyzer` r? `@ghost`
2024-12-11Rollup merge of #134165 - durin42:wasm-target-string, r=jieyouxuMatthias Krüger-7/+13
wasm(32|64): update alignment string See llvm/llvm-project@c5ab70c508457eaece5d7ff4ab79a2f90bc67f06 `@rustbot` label: +llvm-main
2024-12-11Rollup merge of #134163 - Zalathar:covfun, r=SparrowLii,jieyouxuMatthias Krüger-186/+265
coverage: Rearrange the code for embedding per-function coverage metadata This is a series of refactorings to the code that prepares and embeds per-function coverage metadata records (“covfun records”) in the `__llvm_covfun` linker section of the final binary. The `llvm-cov` tool reads this metadata from the binary when preparing a coverage report. Beyond general cleanup, a big motivation behind these changes is to pave the way for re-landing an updated version of #133418. --- There should be no change in compiler output, as demonstrated by the absence of (meaningful) changes to coverage tests. The first patch is just moving code around, so I suggest looking at the other patches to see the actual changes. --- try-job: x86_64-gnu try-job: x86_64-msvc try-job: aarch64-apple
2024-12-11Rollup merge of #134148 - dev-ardi:cleanup_check_field_expr, r=compiler-errorsMatthias Krüger-6/+23
add comments in check_expr_field Nothing special, just a few comments and a couple of small cleanups.
2024-12-11Rollup merge of #133598 - ChayimFriedman2:get-many-mut-detailed-err, r=scottmcmMatthias Krüger-28/+34
Change `GetManyMutError` to match T-libs-api decision That is, differentiate between out-of-bounds and overlapping indices, and remove the generic parameter `N`. I also exported `GetManyMutError` from `alloc` (and `std`), which was apparently forgotten. Changing the error to carry additional details means LLVM no longer generates separate short-circuiting branches for the checks, instead it generates one branch at the end. I therefore changed the code to use early returns to make LLVM generate jumps. Benchmark results between the approaches are somewhat mixed, but I chose this approach because it is significantly faster with ranges and also faster with `unwrap()`. Benchmark (`jumps` refer to short-circuiting, `acc` is not short-circuiting): ```rust use criterion::{black_box, criterion_group, criterion_main, Criterion}; use my_crate::{get_many_check_valid_acc, get_many_check_valid_jumps, GetManyMutError}; mod externs { #[unsafe(no_mangle)] fn foo() {} #[unsafe(no_mangle)] fn bar() {} #[unsafe(no_mangle)] fn baz() {} } unsafe extern "C" { safe fn foo(); safe fn bar(); safe fn baz(); } fn bench_method(c: &mut Criterion) { c.bench_function("jumps two usize", |b| { b.iter(|| get_many_check_valid_jumps(&[black_box(1), black_box(5)], black_box(10))) }); c.bench_function("jumps two usize unwrap", |b| { b.iter(|| get_many_check_valid_jumps(&[black_box(1), black_box(5)], black_box(10)).unwrap()) }); c.bench_function("jumps two usize ok", |b| { b.iter(|| get_many_check_valid_jumps(&[black_box(1), black_box(5)], black_box(10)).ok()) }); c.bench_function("jumps three usize", |b| { b.iter(|| { get_many_check_valid_jumps(&[black_box(1), black_box(5), black_box(7)], black_box(10)) }) }); c.bench_function("jumps three usize match", |b| { b.iter(|| { match get_many_check_valid_jumps( &[black_box(1), black_box(5), black_box(7)], black_box(10), ) { Err(GetManyMutError::IndexOutOfBounds) => foo(), Err(GetManyMutError::OverlappingIndices) => bar(), Ok(()) => baz(), } }) }); c.bench_function("jumps two Range", |b| { b.iter(|| { get_many_check_valid_jumps( &[black_box(1)..black_box(5), black_box(7)..black_box(8)], black_box(10), ) }) }); c.bench_function("jumps two RangeInclusive", |b| { b.iter(|| { get_many_check_valid_jumps( &[black_box(1)..=black_box(5), black_box(7)..=black_box(8)], black_box(10), ) }) }); c.bench_function("acc two usize", |b| { b.iter(|| get_many_check_valid_acc(&[black_box(1), black_box(5)], black_box(10))) }); c.bench_function("acc two usize unwrap", |b| { b.iter(|| get_many_check_valid_acc(&[black_box(1), black_box(5)], black_box(10)).unwrap()) }); c.bench_function("acc two usize ok", |b| { b.iter(|| get_many_check_valid_acc(&[black_box(1), black_box(5)], black_box(10)).ok()) }); c.bench_function("acc three usize", |b| { b.iter(|| { get_many_check_valid_acc(&[black_box(1), black_box(5), black_box(7)], black_box(10)) }) }); c.bench_function("acc three usize match", |b| { b.iter(|| { match get_many_check_valid_jumps( &[black_box(1), black_box(5), black_box(7)], black_box(10), ) { Err(GetManyMutError::IndexOutOfBounds) => foo(), Err(GetManyMutError::OverlappingIndices) => bar(), Ok(()) => baz(), } }) }); c.bench_function("acc two Range", |b| { b.iter(|| { get_many_check_valid_acc( &[black_box(1)..black_box(5), black_box(7)..black_box(8)], black_box(10), ) }) }); c.bench_function("acc two RangeInclusive", |b| { b.iter(|| { get_many_check_valid_acc( &[black_box(1)..=black_box(5), black_box(7)..=black_box(8)], black_box(10), ) }) }); } criterion_group!(benches, bench_method); criterion_main!(benches); ``` Benchmark results: ```none jumps two usize time: [586.44 ps 590.20 ps 594.50 ps] jumps two usize unwrap time: [390.44 ps 393.63 ps 397.44 ps] jumps two usize ok time: [585.52 ps 591.74 ps 599.38 ps] jumps three usize time: [976.51 ps 983.79 ps 991.51 ps] jumps three usize match time: [390.82 ps 393.80 ps 397.07 ps] jumps two Range time: [1.2583 ns 1.2640 ns 1.2695 ns] jumps two RangeInclusive time: [1.2673 ns 1.2770 ns 1.2877 ns] acc two usize time: [592.63 ps 596.44 ps 600.52 ps] acc two usize unwrap time: [582.65 ps 587.07 ps 591.90 ps] acc two usize ok time: [581.59 ps 587.82 ps 595.71 ps] acc three usize time: [894.69 ps 901.23 ps 908.24 ps] acc three usize match time: [392.68 ps 395.73 ps 399.17 ps] acc two Range time: [1.5531 ns 1.5617 ns 1.5711 ns] acc two RangeInclusive time: [1.5746 ns 1.5840 ns 1.5939 ns] ```
2024-12-11Rollup merge of #132975 - arichardson:ffi-c-char, r=tgross35Matthias Krüger-53/+80
De-duplicate and improve definition of core::ffi::c_char Instead of having a list of unsigned char targets for each OS, follow the logic Clang uses and instead set the value based on architecture with a special case for Darwin and Windows operating systems. This makes it easier to support new operating systems targeting Arm/AArch64 without having to modify this config statement for each new OS. The new list does not quite match Clang since I noticed a few bugs in the Clang implementation (https://github.com/llvm/llvm-project/issues/115957). Fixes https://github.com/rust-lang/rust/issues/129945 Closes https://github.com/rust-lang/rust/pull/131319
2024-12-11Remove consteval note from <*mut T>::align_offset docs.Zachary S-9/+0
2024-12-11remove `Kind` check for `symbol_intern_string_literal`onur-ozkan-6/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-12-11allow `symbol_intern_string_literal` lint in test modulesonur-ozkan-0/+12
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-12-11Add regression testsOli Scherer-0/+62
2024-12-11Auto merge of #134164 - jhpratt:rollup-s7z0vcc, r=jhprattbors-72/+174
Rollup of 8 pull requests Successful merges: - #134079 (Add a note saying that `{u8,i8}::from_{be,le,ne}_bytes` is meaningless) - #134105 (Validate self in host predicates correctly) - #134136 (Exercise const trait interaction with default fields) - #134139 ([AIX] keep profile-rt symbol alive) - #134141 (Remove more traces of anonymous ADTs) - #134142 (Rudimentary heuristic to insert parentheses when needed for RPIT overcaptures lint) - #134158 (Rename `projection_def_id` to `item_def_id`) - #134160 (Add vacation entry for myself in triagebot.toml) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-11Don't emit "field expressions may not have generic arguments" if it's a ↵Orion Gonzalez-17/+18
method call without ()