about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-02-27use the right feature in codegen testsFolkert de Vries-2/+2
2025-02-27make `simd_insert` and `simd_extract` `const fn`sFolkert de Vries-26/+11
2025-02-27simplify some imports with `simd::*`Folkert de Vries-9/+2
2025-02-27remove most `simd_` intrinsic declaration in testsFolkert de Vries-1007/+482
instead, we can just import the intrinsics from core
2025-02-26Rollup merge of #137671 - meithecatte:discoverable-dump-mir, r=NadrierilLeón Orell Valerian Liehr-0/+1
Make -Z unpretty=mir suggest -Z dump-mir as well for discoverability While debugging something else, I got quite annoyed with `-Z unpretty=mir` showing me post-processed MIR instead of the one just after it is built. I ended up asking on Zulip and got pointed to `-Z dump-mir`. While this feature is documented in the rustc dev guide, I think it'd be good if the possibility of making use of it was staring you in the face while you need it.
2025-02-26Rollup merge of #137635 - compiler-errors:constrain-unstable, r=SparrowLiiLeón Orell Valerian Liehr-0/+29
Don't suggest constraining unstable associated types Fixes #137624 This could be made a bit more specific, considering the local crate's stability or nightly status or something, but I think in general we should not be suggesting associated type bounds on unstable associated items.
2025-02-26Rollup merge of #137631 - TaKO8Ki:issue-137508, r=compiler-errorsLeón Orell Valerian Liehr-0/+73
Avoid collecting associated types for undefined trait Fixes #137508 Fixes #137554
2025-02-26Rollup merge of #137201 - estebank:structured-errors-long-ty, r=oli-obkLeón Orell Valerian Liehr-9/+114
Teach structured errors to display short `Ty<'_>` Make it so that in every structured error annotated with `#[derive(Diagnostic)]` that has a field of type `Ty<'_>`, the printing of that value into a `String` will look at the thread-local storage `TyCtxt` in order to shorten to a length appropriate with the terminal width. When this happen, the resulting error will have a note with the file where the full type name was written to. ``` error[E0618]: expected function, found `((..., ..., ..., ...), ..., ..., ...)`` --> long.rs:7:5 | 6 | fn foo(x: D) { //~ `x` has type `(... | - `x` has type `((..., ..., ..., ...), ..., ..., ...)` 7 | x(); //~ ERROR expected function, found `(... | ^-- | | | call expression requires function | = note: the full name for the type has been written to 'long.long-type-14182675702747116984.txt' = note: consider using `--verbose` to print the full type name to the console ``` Follow up to and response to the comments on #136898. r? ``@oli-obk``
2025-02-26Make -Z unpretty=mir suggest -Z dump-mir as wellMaja Kądziołka-0/+1
2025-02-26Rollup merge of #137622 - jdonszelmann:fix-137589, r=compiler-errorsLeón Orell Valerian Liehr-0/+75
fix attribute-related ICE when parsing macro on the rhs of a name-value attribute r? ``@oli-obk`` Closes: #137589
2025-02-26Rollup merge of #137613 - davidtwco:const-traits-variances, r=compiler-errorsLeón Orell Valerian Liehr-0/+21
hir_analysis: skip self type of host effect preds in variances_of Discovered as part of an implementation of rust-lang/rfcs#3729 - w/out this then when introducing const trait bounds: many more interesting tests change with different output, missing errors, new errors, etc related to this but they all depend on feature flags and are much more complex than this test. r? ``@oli-obk``
2025-02-26Rollup merge of #137604 - davidtwco:host-effect-resolve-vars, r=compiler-errorsLeón Orell Valerian Liehr-0/+36
trait_sel: resolve vars in host effects In the standard library, the `Extend` impl for `Iterator` (specialised with `TrustedLen`) has a parameter which is constrained by a projection predicate. This projection predicate provides a value for an inference variable but - if the default bound is `const Sized` instead of `Sized` - host effect evaluation wasn't resolving variables first. Added a test that doesn't depend on a rust-lang/rfcs#3729 implementation. Adding the extra resolve can the number of errors in some tests when they gain host effect predicates, but this is not unexpected as calls to `resolve_vars_if_possible` can cause more error tainting to happen.
2025-02-26Rollup merge of #137559 - folkertdev:run-more-emscripten-tests, r=fmeaseLeón Orell Valerian Liehr-21/+9
run some tests on emscripten again these were ignored because of #45351, but that issue has long been fixed. Let's see if these pass, or if there is some issue lurking still I believe this is the try-job for emscripten? probably a good idea to run that first. ~~try-job: test-various~~ try-job: dist-various-1
2025-02-26Rollup merge of #137544 - petrochenkov:deritest, r=fmeaseLeón Orell Valerian Liehr-0/+172
tests: Add regression test for derive token invalidation (#81099) Closes https://github.com/rust-lang/rust/issues/81099.
2025-02-26Rollup merge of #137320 - tapanprakasht:fix-doc-version-stability, r=notriddleLeón Orell Valerian Liehr-0/+28
fix(rustdoc): Fixed stability version in rustdoc Tries to fix https://github.com/rust-lang/rust/issues/137141 Fixed by adding checks glob exports
2025-02-26fix #137508Takayuki Maeda-0/+73
rename ui tests check if res is trait def fix typo regression test for #137554
2025-02-25Don't suggest constraining unstable associated typesMichael Goulet-0/+29
2025-02-25Auto merge of #137608 - fmease:rollup-h4siso6, r=fmeasebors-201/+120
Rollup of 8 pull requests Successful merges: - #137370 (adjust_abi: make fallback logic for ABIs a bit easier to read) - #137444 (Improve behavior of `IF_LET_RESCOPE` around temporaries and place expressions) - #137464 (Fix invalid suggestion from type error for derive macro) - #137539 ( Add rustdoc-gui regression test for #137082 ) - #137576 (Don't doc-comment BTreeMap<K, SetValZST, A>) - #137595 (remove `simd_fpow` and `simd_fpowi`) - #137600 (type_ir: remove redundant part of comment) - #137602 (feature: fix typo in attribute description) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-25fix #137589Jana Dönszelmann-0/+75
2025-02-25Make E0609 a structured errorEsteban Küber-2/+5
2025-02-25Make E0614 a structured errorEsteban Küber-12/+15
``` error[E0614]: type `(..., ..., ..., ...)` cannot be dereferenced --> $DIR/long-E0614.rs:10:5 | LL | *x; | ^^ can't be dereferenced | = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' = note: consider using `--verbose` to print the full type name to the console ```
2025-02-25Make E0529 a structured errorEsteban Küber-4/+7
2025-02-25Add testsEsteban Küber-0/+67
2025-02-25Teach structured errors to display short `Ty`Esteban Küber-0/+29
Make it so that every structured error annotated with `#[derive(Diagnostic)]` that has a field of type `Ty<'_>`, the printing of that value into a `String` will look at the thread-local storage `TyCtxt` in order to shorten to a length appropriate with the terminal width. When this happen, the resulting error will have a note with the file where the full type name was written to. ``` error[E0618]: expected function, found `((..., ..., ..., ...), ..., ..., ...)`` --> long.rs:7:5 | 6 | fn foo(x: D) { //~ `x` has type `(... | - `x` has type `((..., ..., ..., ...), ..., ..., ...)` 7 | x(); //~ ERROR expected function, found `(... | ^-- | | | call expression requires function | = note: the full name for the type has been written to 'long.long-type-14182675702747116984.txt' = note: consider using `--verbose` to print the full type name to the console ```
2025-02-25Auto merge of #137611 - fmease:rollup-ln673ux, r=fmeasebors-19/+60
Rollup of 6 pull requests Successful merges: - #135480 (Don't require method impls for methods with `Self:Sized` bounds for impls for unsized types) - #137360 (Use `as_chunks` in `analyze_source_file_sse2`) - #137460 (downgrade bootstrap `cc`) - #137515 (Update `compiler-builtins` to 0.1.148) - #137522 (use stage 2 on cargo and clippy tests when possible) - #137597 (Revert accidental cargo submodule update) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-25Rollup merge of #137602 - davidtwco:force-inline-description, r=fmeaseLeón Orell Valerian Liehr-4/+4
feature: fix typo in attribute description The force inlining attribute isn't is never used with `#![..]` attribute syntax, only `#[..]` syntax.
2025-02-25Rollup merge of #137595 - folkertdev:remove-simd-pow-powi, r=RalfJungLeón Orell Valerian Liehr-194/+5
remove `simd_fpow` and `simd_fpowi` Discussed in https://github.com/rust-lang/rust/issues/137555 These functions are not exposed from `std::intrinsics::simd`, and not used anywhere outside of the compiler. They also don't lower to particularly good code at least on the major ISAs (I checked x86_64, aarch64, s390x, powerpc), where the vector is just spilled to the stack and scalar functions are used for the actual logic. r? `@RalfJung`
2025-02-25Rollup merge of #137539 - GuillaumeGomez:copy-content-tests, r=notriddleLeón Orell Valerian Liehr-2/+9
Add rustdoc-gui regression test for #137082 Fixes https://github.com/rust-lang/rust/issues/137082. Added new commands in `browser-ui-test` allowing us to add a regression test for #137082 and also another to copy code examples content. r? `@notriddle`
2025-02-25Rollup merge of #137464 - chenyukang:yukang-fix-136343, r=estebankLeón Orell Valerian Liehr-0/+35
Fix invalid suggestion from type error for derive macro Fixes #136343 r? `@estebank` I didn't use `from_expansion` to avoid it because of testcase `tests/ui/typeck/issue-110017-format-into-help-deletes-macro.rs`: https://github.com/chenyukang/rust/blob/11959a8b6e75d2c55500a703070a248342d29549/tests/ui/typeck/issue-110017-format-into-help-deletes-macro.rs#L34-L37 This type error could come up with a proper fix.
2025-02-25Rollup merge of #137444 - compiler-errors:drop-lint, r=oli-obkLeón Orell Valerian Liehr-1/+67
Improve behavior of `IF_LET_RESCOPE` around temporaries and place expressions Heavily reworks the `IF_LET_RESCOPE` to be more sensitive around 1. temporaries that get consumed/terminated and therefore should not trigger the lint, and 2. borrows of place expressions, which are not temporary values. Fixes #137411
2025-02-25Auto merge of #133832 - madsmtm:apple-symbols.o, r=DianQKbors-6/+62
Make `#[used]` work when linking with `ld64` To make `#[used]` work in static libraries, we use the `symbols.o` trick introduced in https://github.com/rust-lang/rust/pull/95604. However, the linker shipped with Xcode, ld64, works a bit differently from other linkers; in particular, [it completely ignores undefined symbols by themselves](https://github.com/apple-oss-distributions/ld64/blob/ld64-954.16/src/ld/parsers/macho_relocatable_file.cpp#L2455-L2468), and only consider them if they have relocations (something something atoms something fixups, I don't know the details). So to make the `symbols.o` file work on ld64, we need to actually insert a relocation. That's kinda cumbersome to do though, since the relocation must be valid, and hence must point to a valid piece of machine code, and is hence very architecture-specific. Fixes https://github.com/rust-lang/rust/issues/133491, see that for investigation. --- Another option would be to pass `-u _foo` to the final linker invocation. This has the problem that `-u` causes the linker to not be able to dead-strip the symbol, which is undesirable. (If we did this, we would possibly also want to do it by putting the arguments in a file by itself, and passing that file via ``@`,` e.g. ``@undefined_symbols.txt`,` similar to https://github.com/rust-lang/rust/issues/52699, though that [is only supported since Xcode 12](https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes#Linking), and I'm not sure we wanna bump that). Various other options that are probably all undesirable as they affect link time performance: - Pass `-all_load` to the linker. - Pass `-ObjC` to the linker (the Objective-C support in the linker has different code paths that load more of the binary), and instrument the binaries that contain `#[used]` symbols. - Pass `-force_load` to libraries that contain `#[used]` symbols. Failed attempt: Embed `-u _foo` in the object file with `LC_LINKER_OPTION`, akin to https://github.com/rust-lang/rust/issues/121293. Doesn't work, both because `ld64` doesn't read that from archive members unless it already has a reason to load the member (which is what this PR is trying to make it do), and because `ld64` only support the `-l`, `-needed-l`, `-framework` and `-needed_framework` flags in there. --- TODO: - [x] Support all Apple architectures. - [x] Ensure that this works regardless of the actual type of the symbol. - [x] Write up more docs. - [x] Wire up a few proper tests. `@rustbot` label O-apple
2025-02-25remove `simd_fpow` and `simd_fpowi`Folkert de Vries-194/+5
2025-02-25Don't require method impls for methods with `Self:Sized` bounds for impls ↵Oli Scherer-19/+60
for unsized types
2025-02-25Auto merge of #137573 - compiler-errors:rollup-noq9yhp, r=compiler-errorsbors-1000/+787
Rollup of 11 pull requests Successful merges: - #136522 (Remove `feature(dyn_compatible_for_dispatch)` from the compiler) - #137289 (Consolidate and improve error messaging for `CoerceUnsized` and `DispatchFromDyn`) - #137321 (Correct doc about `temp_dir()` behavior on Android) - #137417 (rustc_target: Add more RISC-V atomic-related features) - #137489 (remove `#[rustc_intrinsic_must_be_overridde]`) - #137530 (DWARF mixed versions with LTO on MIPS) - #137543 (std: Fix another new symlink test on Windows) - #137548 (Pass correct `TypingEnv` to `InlineAsmCtxt`) - #137550 (Don't immediately panic if dropck fails without returning errors) - #137552 (Update books) - #137556 (rename simd_shuffle_generic → simd_shuffle_const_generic) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-24Rollup merge of #137556 - RalfJung:simd_shuffle_const_generic, r=oli-obkMichael Goulet-45/+45
rename simd_shuffle_generic → simd_shuffle_const_generic I've been confused by this name one time too often. ;) r? `@oli-obk`
2025-02-24Rollup merge of #137550 - ↵Michael Goulet-0/+33
matthewjasper:panic-later-for-missing-dropck-error, r=compiler-errors Don't immediately panic if dropck fails without returning errors This span_bug was a little too optimistic. I've decided that matching on the ErrorGuaranteed is a little more sensible than a delay bug that will always be ignored. closes #137329 r? `@compiler-errors`
2025-02-24Rollup merge of #137548 - compiler-errors:asm-ty, r=oli-obkMichael Goulet-0/+49
Pass correct `TypingEnv` to `InlineAsmCtxt` Fixes #137512 r? oli-obk
2025-02-24Rollup merge of #137530 - LukasWoodtli:gardena/lw/mips_dwarf, r=jieyouxuMichael Goulet-3/+4
DWARF mixed versions with LTO on MIPS On MIPS the DWARF version is stored in 2 bytes with the `.2byte` assembler directive.
2025-02-24Rollup merge of #137489 - ↵Michael Goulet-48/+19
RalfJung:no-more-rustc_intrinsic_must_be_overridden, r=oli-obk remove `#[rustc_intrinsic_must_be_overridde]` In https://github.com/rust-lang/rust/pull/135031, we gained support for just leaving away the body. Now that the bootstrap compiler got bumped, stop using the old style and remove support for it. r? `@oli-obk` There are a few more mentions of this attribute in RA code that I didn't touch; Cc `@rust-lang/rust-analyzer`
2025-02-24Rollup merge of #137417 - taiki-e:riscv-atomic, r=AmanieuMichael Goulet-0/+5
rustc_target: Add more RISC-V atomic-related features This is a continuation of https://github.com/rust-lang/rust/pull/130877 and adds a few target features, including `zacas`, which was experimental in LLVM 19 and marked non-experimental in LLVM 20. This adds the following target features to unstable riscv_target_feature: - `za64rs` (Za64rs Extension 1.0): Reservation Set Size of at Most 64 Bytes ([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L227-L228), [available since LLVM 18](https://github.com/llvm/llvm-project/commit/8649328060b4e748502d1d859f9c9c1bd3c2bccc)) - `za128rs` (Za128rs Extension 1.0): Reservation Set Size of at Most 128 Bytes ([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L230-L231), [available since LLVM 18](https://github.com/llvm/llvm-project/commit/8649328060b4e748502d1d859f9c9c1bd3c2bccc)) - IIUC, `za*rs` can be referenced when implementing helpers to reduce contention in synchronization primitives, like [`crossbeam_utils::CachePadded`](https://docs.rs/crossbeam-utils/latest/crossbeam_utils/struct.CachePadded.html). (relevant discussion: https://github.com/riscv/riscv-profiles/issues/79) - `zacas` (Zacas Extension 1.0): Atomic Compare-And-Swap Instructions (`amocas.{w,d,q}{,.aq,.rl,.aqrl}` and `amocas.{b,h}{,.aq,.rl,.aqrl}` when `zabha` is also enabled) ([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L240-L243), [available as non-experimental since LLVM 20](https://github.com/llvm/llvm-project/commit/614aeda93b2225c6eb42b00ba189ba7ca2585c60)) - This implies `zaamo`. - This is used to optimize CAS in existing atomics and/or implement 64-bit/128-bit atomics on riscv32/riscv64 (e.g., https://github.com/taiki-e/portable-atomic/pull/173). - Note that [LLVM does not automatically use this instruction for 64-bit/128-bit atomics on riscv32/riscv64 even if this feature is enabled, because doing it changes the ABI](https://github.com/llvm/llvm-project/blob/876174ffd7533dc220f94721173bb767b659fa7f/llvm/docs/RISCVUsage.rst#riscv-zacas-note). (If the ability to do that is provided by LLVM in the future, it should probably be controlled by another ABI feature similar to `forced-atomics`.) - `zama16b` (Zama16b Extension 1.0): Atomic 16-byte misaligned loads, stores and AMOs ([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L255-L256), [available since LLVM 19](https://github.com/llvm/llvm-project/commit/b090569685699abe4a8031ad442a0f81e373146b)) - IIUC, unlike AArch64 FEAT_LSE2 which also makes 16-byte aligned ldp ({i,u}128 load) atomic, this extension only affects instructions that already considered atomic if they were naturally aligned. i.e., fld (f64 load) on riscv32 would not be atomic with or without this extension ([relevant QEMU code](https://github.com/qemu/qemu/blob/b69801dd6b1eb4d107f7c2f643adf0a4e3ec9124/target/riscv/insn_trans/trans_rvd.c.inc#L50-L62)). - `zawrs` (Zawrs Extension 1.0): Wait on Reservation Set (`wrs.nto` and `wrs.sto`) ([definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0-rc2/llvm/lib/Target/RISCV/RISCVFeatures.td#L258), [available as non-experimental since LLVM 17](https://github.com/llvm/llvm-project/commit/d41a73aa94cb8945dcd0f2906992c2fcea6ed001)) - This is used to optimize synchronization primitives (e.g., Linux uses this for spinlocks (https://github.com/torvalds/linux/commit/b8ddb0df30f9f6e70422f1e705b7416da115bd24)). Btw, the question of whether `zaamo` is implied by `zabha` or not, which was discussed in https://github.com/rust-lang/rust/pull/130877, has been resolved in LLVM 20, since LLVM now treats `zaamo` as implied by `zabha`/`zacas` (https://github.com/llvm/llvm-project/pull/115694), just like GCC and rustc. r? `@Amanieu` `@rustbot` label +O-riscv +A-target-feature
2025-02-24Rollup merge of #137289 - compiler-errors:coerce-unsized-errors, r=oli-obkMichael Goulet-57/+143
Consolidate and improve error messaging for `CoerceUnsized` and `DispatchFromDyn` Firstly, this PR consolidates and reworks the error diagnostics for `CoercePointee` and `DispatchFromDyn`. There was a ton of duplication for no reason -- this reworks both the errors and also the error codes, since they can be shared between both traits since they report the same thing. Secondly, when encountering a struct with multiple fields that must be coerced, point out the field spans, rather than mentioning the fields by name. This makes the error message clearer, but also means that we don't mention the `__S` dummy parameter for `derive(CoercePointee)`. Thirdly, emit a custom error message when we encounter a trait error that comes from the recursive field `CoerceUnsized`/`DispatchFromDyn` trait check. **Note:** This is the only one I'm not too satisfied with -- I think it could use some more refinement, but ideally it explains that the field must be an unsize-able pointer... Feedback welcome. Finally, don't emit `DispatchFromDyn` validity errors if we detect `CoerceUnsized` validity errors from an impl of the same ADT. This is best reviewed per commit. r? `@oli-obk` perhaps? cc `@dingxiangfei2009` -- sorry for making my own attempt at this PR, but I wanted to see if I could implement a fix for #136796 in a less complicated way, since communicating over github review comments can be a bit slow. I'll leave comments inline to explain my thinking about the diagnostics changes.
2025-02-24Auto merge of #135726 - jdonszelmann:attr-parsing, r=oli-obkbors-301/+232
New attribute parsing infrastructure Another step in the plan outlined in https://github.com/rust-lang/rust/issues/131229 introduces infrastructure for structured parsers for attributes, as well as converting a couple of complex attributes to have such structured parsers. This PR may prove too large to review. I left some of my own comments to guide it a little. Some general notes: - The first commit is basically standalone. It just preps some mostly unrelated sources for the rest of the PR to work. It might not have enormous merit on its own, but not negative merit either. Could be merged alone, but also doesn't make the review a whole lot easier. (but it's only +274 -209) - The second commit is the one that introduces new infrastructure. It's the important one to review. - The 3rd commit uses the new infrastructure showing how some of the more complex attributes can be parsed using it. Theoretically can be split up, though the parsers in this commit are the ones that really test the new infrastructure and show that it all works. - The 4th commit fixes up rustdoc and clippy. In the previous 2 they didn't compile yet while the compiler does. Separated them out to separate concerns and make the rest more palatable. - The 5th commit blesses some test outputs. Sometimes that's just because a diagnostic happens slightly earlier than before, which I'd say is acceptable. Sometimes a diagnostic is now only emitted once where it would've been twice before (yay! fixed some bugs). One test I actually moved from crashes to fixed, because it simply doesn't crash anymore. That's why this PR Closes #132391. I think most choices I made here are generally reasonable, but let me know if you disagree anywhere. - The 6th commit adds a derive to pretty print attributes - The 7th removes smir apis for attributes, for the time being. The api will at some point be replaced by one based on `rustc_ast_data_structures::AttributeKind` In general, a lot of the additions here are comments. I've found it very important to document new things in the 2nd commit well so other people can start using it. Closes #132391 Closes #136717
2025-02-24Deduplicate CoerceUnsized and DispatchFromDyn impl errorsMichael Goulet-46/+6
2025-02-24Simplify trait error message for CoercePointee validationMichael Goulet-3/+114
2025-02-24Consolidate and rework CoercePointee and DispatchFromDyn errorsMichael Goulet-54/+69
2025-02-24Remove dyn_compatible_for_dispatchMichael Goulet-847/+489
2025-02-24run some tests on emscripten againFolkert de Vries-21/+9
these were ignored because of #45351, but that issue has long been fixed. Let's see if these pass, or if there is some issue lurking still
2025-02-24Consider lvalues of field and index as possibly temporary placesMichael Goulet-1/+38
2025-02-24Improve behavior of IF_LET_RESCOPE around temporaries and place expressionsMichael Goulet-0/+29
2025-02-24rename simd_shuffle_generic → simd_shuffle_const_genericRalf Jung-45/+45