about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-01-05Auto merge of #135074 - wzssyqa:mips-mti, r=oli-obkbors-4/+10
Target: Add mips mti baremetal support Do the same thing as gcc, which use the vendor `mti` to mark the toolchain as MIPS32r2 default. We support both big endian and little endian flavor: mips-mti-none-elf mipsel-mti-none-elf
2025-01-05fix testsYunQiang Su-3/+3
2025-01-04Rollup merge of #135088 - maurer:force-asm, r=nikicJubilee-0/+4
Force code generation in assembly generation smoke-tests In llvm/llvm-project@7b23f413d1f76532825e470b523e971818d453ca , `.text` started being suppressed from LLVM assembly in cases where it wasn't strictly necessary. Currently, the sample functions in these two tests are frequently decided to be IR-only functions, resulting in no code generation, so LLVM drops the `.text` directive. Adding `#[no_mangle]` forces these tests back to their original intent - assembly code is generated, and so a `.text` directive is generated as well. `@rustbot` label: +llvm-main r? `@workingjubilee` I'll attach a buildbot link once it finishes consuming this PR
2025-01-04Rollup merge of #135061 - matthiaskrgr:crashes_jan, r=lqdJubilee-0/+184
crashes: add latest batch of tests try-job: aarch64-apple try-job: x86_64-msvc try-job: x86_64-gnu try-job: dist-i586-gnu-i586-i686-musl
2025-01-04Rollup merge of #135046 - RalfJung:rustc_box_intrinsic, r=compiler-errorsJubilee-124/+143
turn rustc_box into an intrinsic I am not entirely sure why this was made a special magic attribute, but an intrinsic seems like a more natural way to add magic expressions to the language.
2025-01-04crashes: add latest batch of testsMatthias Krüger-0/+184
2025-01-04Auto merge of #135031 - RalfJung:intrinsics-without-body, r=oli-obkbors-32/+29
rustc_intrinsic: support functions without body We synthesize a HIR body `loop {}` but such bodyless intrinsics. Most of the diff is due to turning `ItemKind::Fn` into a brace (named-field) enum variant, because it carries a `bool`-typed field now. This is to remember whether the function has a body. MIR building panics to avoid ever translating the fake `loop {}` body, and the intrinsic logic uses the lack of a body to implicitly mark that intrinsic as must-be-overridden. I first tried actually having no body rather than generating the fake body, but there's a *lot* of code that assumes that all function items have HIR and MIR, so this didn't work very well. Then I noticed that even `rustc_intrinsic_must_be_overridden` intrinsics have MIR generated (they are filled with an `Unreachable` terminator) so I guess I am not the first to discover this. ;) r? `@oli-obk`
2025-01-04rustc_intrinsic: support functions without body; they are implicitly marked ↵Ralf Jung-32/+29
as must-be-overridden
2025-01-04Rollup merge of #135084 - maurer:nuw, r=nikicMatthias Krüger-2/+2
Update carrying_mul_add test to tolerate `nuw` LLVM 20 adds nuw to GEP operations in this code, tolerate them. `@rustbot` label: +llvm-main r? `@durin42`
2025-01-04Rollup merge of #135064 - RalfJung:const-in-pat-partial-eq-not-const, ↵Matthias Krüger-0/+54
r=compiler-errors const-in-pattern: test that the PartialEq impl does not need to be const Fixes https://github.com/rust-lang/rust/issues/119398 by adding a test. `@compiler-errors` is there some place in the code where we could add a comment saying "as a backcompat hack, here we only require `PartialEq` and not `const PartialEq`"? r? `@compiler-errors`
2025-01-04Rollup merge of #135055 - compiler-errors:rpitit-infer-in-stricter-impl, ↵Matthias Krüger-54/+70
r=estebank Report impl method has stricter requirements even when RPITIT inference gets in the way See the comment I added in the code. Fixes #122506.
2025-01-04Rollup merge of #133964 - joboet:select_unpredictable, r=tgross35Matthias Krüger-0/+35
core: implement `bool::select_unpredictable` Tracking issue: #133962 ACP: https://github.com/rust-lang/libs-team/issues/468
2025-01-04Auto merge of #135057 - compiler-errors:project-unconstrained, r=oli-obkbors-223/+93
Project to `TyKind::Error` when there are unconstrained non-lifetime (ty/const) impl params It splits the `enforce_impl_params_are_constrained` function into lifetime/non-lifetime, and queryfies the latter. We can then use the result of the latter query (`Result<(), ErrorGuaranteed>`) to intercept projection and constrain the projected type to `TyKind::Error`, which ensures that we leak no ty or const vars to places that don't expect them, like `normalize_erasing_regions`. The reason we split `enforce_impl_params_are_constrained` into two parts is because we only error for *lifetimes* if the lifetime ends up showing up in any of the associated types of the impl (e.g. we allow `impl<'a> Foo { type Assoc = (); }`). However, in order to compute the `type_of` query for the anonymous associated type of an RPITIT, we need to do trait solving (in `query collect_return_position_impl_trait_in_trait_tys`). That would induce cycles. Luckily, it turns out for lifetimes we don't even care about if they're unconstrained, since they're erased in all contexts that we are trying to fix ICEs. So it's sufficient to keep this check separated out of the query. I think this is a bit less invasive of an approach compared to #127973. The major difference between this PR and that PR is that we queryify the check instead of merging it into the `explicit_predicates_of` query, and we use the result to taint just projection goals, rather than trait goals too. This doesn't require a lot of new tracking in `ItemCtxt` and `GenericPredicates`, and it also seems to not require any other changes to typeck like that PR did. Fixes #123141 Fixes #125874 Fixes #126942 Fixes #127804 Fixes #130967 r? oli-obk
2025-01-03Force code generation in assembly generation smoke-testsMatthew Maurer-0/+4
In llvm/llvm-project@7b23f413d1f76532825e470b523e971818d453ca , `.text` started being suppressed from LLVM assembly in cases where it wasn't strictly necessary. Currently, the sample functions in these two tests are frequently decided to be IR-only functions, resulting in no code generation, so LLVM drops the `.text` directive. Adding `#[no_mangle]` forces these tests back to their original intent - assembly code is generated, and so a `.text` directive is generated as well.
2025-01-03Rollup merge of #135044 - compiler-errors:better-infer-suggestions-in-const, ↵Matthias Krüger-249/+271
r=oli-obk Improve infer (`_`) suggestions in `const`s and `static`s Fixes https://github.com/rust-lang/rust/issues/135010. This PR does a few things to (imo) greatly improve the error message when users write something like `static FOO: [i32; _] = [1, 2, 3]`. Firstly, it adapts the recovery code for when we encounter `_` in a const/static to work a bit more like `fn foo() -> _`, and removes the somewhat redundant query `diagnostic_only_typeck`. Secondly, it changes the lowering for `[T; _]` to always lower under the `feature(generic_arg_infer)` logic to `ConstArgKind::Infer`. We still issue the feature error, so it's not doing anything *observable* on the good path, but it does mean that we no longer erroneously interpret `[T; _]`'s array length as a `_` **wildcard expression** (à la destructuring assignment, like `(_, y) = expr`). Lastly it makes the suggestions verbose and fixes (well, suppresses) a bug with stashing and suggestions. r? oli-obk
2025-01-03Rollup merge of #135043 - ↵Matthias Krüger-2/+15
notriddle:notriddle/allowed-through-unstable-modules-is-a-deprecation-flag, r=GuillaumeGomez rustdoc: treat `allowed_through_unstable_modules` as deprecation This ensures `std::intrinsics::transmute` is deemphasized in the search engine and other UI, by cleaning it into a deprecation without propagating it through reexports when the parent module is stable. Fixes #131676 Related to #135003 r? ``@GuillaumeGomez`` ``@RalfJung`` ``@workingjubilee``
2025-01-03Update carrying_mul_add test to tolerate `nuw`Matthew Maurer-2/+2
LLVM 20 adds nuw to GEP operations in this code, tolerate them.
2025-01-03add codegen test for `bool::select_unpredictable`joboet-0/+35
2025-01-03Auto merge of #135034 - Noratrieb:strip-correctly, r=jieyouxubors-0/+50
Pass objcopy args for stripping on OSX When `-Cstrip` was changed in #131405 to use the bundled rust-objcopy instead of /usr/bin/strip on OSX, strip-like arguments were preserved. But strip and objcopy are, while being the same binary, different, they have different defaults depending on which binary they are. Notably, strip strips everything by default, and objcopy doesn't strip anything by default. Additionally, `-S` actually means `--strip-all`, so debuginfo stripped everything and symbols didn't strip anything. We now correctly pass `--strip-debug` and `--strip-all`. fixes #135028 try-job: aarch64-apple try-job: dist-aarch64-apple
2025-01-03const-in-pattern: test that the PartialEq impl does not need to be constRalf Jung-0/+54
2025-01-03Target: Add mips mti baremetal supportYunQiang Su-1/+7
Do the same thing as gcc, which use the vendor `mti` to mark the toolchain as MIPS32r2 default. We support both big endian and little endian flavor: mips-mti-none-elf mipsel-mti-none-elf
2025-01-03turn rustc_box into an intrinsicRalf Jung-124/+143
2025-01-03Auto merge of #135059 - matthiaskrgr:rollup-0ka9o3h, r=matthiaskrgrbors-73/+170
Rollup of 4 pull requests Successful merges: - #131729 (Make the `test` cfg a userspace check-cfg) - #134241 (more concrete source url of std docs [V2]) - #135042 (taint fcx on selection errors during unsizing) - #135049 (Remove unused fields from RepeatElementCopy obligation) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-03Rollup merge of #135042 - lukas-code:taint-dyn-incompat, r=compiler-errorsMatthias Krüger-13/+113
taint fcx on selection errors during unsizing With `feature(dyn_compatible_for_dispatch)` we only check for dyn-compatibility by checking the `T: Unsize<dyn Trait>` predicate during the unsizing coercions checks. If the predicate doesn't hold, we emit an error, but pretend the coercion succeeded to prevent further errors. To prevent const eval from attempting to actually perform this coercion, we need to taint the fcx after reporting the trait errors in the coercion check. fixes https://github.com/rust-lang/rust/issues/135021 fixes https://github.com/rust-lang/rust/issues/130521
2025-01-03Rollup merge of #131729 - Urgau:check-cfg-test-userspace, r=petrochenkovMatthias Krüger-60/+57
Make the `test` cfg a userspace check-cfg This PR implements MCP https://github.com/rust-lang/compiler-team/issues/785, which makes the `test` cfg a "userspace" check-cfg, i.e. no longer included in the well known cfg list. Things to do: - [x] Accept the MCP (https://github.com/rust-lang/compiler-team/issues/785#issuecomment-2424121886) - [x] Mark `test` in Cargo (https://github.com/rust-lang/cargo/pull/14963) `@rustbot` labels +S-waiting-on-MCP +F-check_cfg r? `@petrochenkov`
2025-01-03Auto merge of #134692 - GrigorenkoPV:sync_poision, r=tgross35bors-10/+10
Move some things to `std::sync::poison` and reexport them in `std::sync` Tracking issue: #134646 r? `@tgross35` I've used `sync_poison_mod` feature flag instead, because `sync_poison` had already been used back in 1.2. try-job: x86_64-msvc
2025-01-03Also in the new solverMichael Goulet-2/+28
2025-01-03Do not project when there are unconstrained impl paramsMichael Goulet-223/+67
2025-01-03Report impl has stricter requirements even when RPITIT inference gets in the wayMichael Goulet-54/+70
2025-01-02Fix macro shenanigansMichael Goulet-6/+2
2025-01-02Make suggestion verbose and tweak error messageMichael Goulet-117/+176
2025-01-02Suppress type param suggestion if encountering invalid const inferMichael Goulet-5/+0
2025-01-02Unconditionally lower generic_arg_inferMichael Goulet-109/+70
2025-01-02More refined spans for placeholder error in const/staticMichael Goulet-44/+48
2025-01-02Remove diagnostic_only_typeck and fix placeholder suggestion for const/staticMichael Goulet-56/+63
2025-01-02Auto merge of #122565 - Zoxc:atomic-panic-msg, r=the8472bors-19/+78
Try to write the panic message with a single `write_all` call This writes the panic message to a buffer before writing to stderr. This allows it to be printed with a single `write_all` call, preventing it from being interleaved with other outputs. It also adds newlines before and after the message ensuring that only the panic message will have its own lines. Before: ``` thread 'thread 'thread 'thread 'thread '<unnamed>thread 'thread 'thread 'thread '<unnamed><unnamed>thread '<unnamed>' panicked at ' panicked at <unnamed><unnamed><unnamed><unnamed><unnamed>' panicked at <unnamed>' panicked at src\heap.rssrc\heap.rs' panicked at ' panicked at ' panicked at ' panicked at ' panicked at src\heap.rs' panicked at src\heap.rs::src\heap.rssrc\heap.rssrc\heap.rssrc\heap.rssrc\heap.rs:src\heap.rs:455455:::::455:455::455455455455455:455:99:::::9:9: : 999: 999: assertion failed: size <= (*queue).block_size: : assertion failed: size <= (*queue).block_size: assertion failed: size <= (*queue).block_size: : : assertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_size assertion failed: size <= (*queue).block_size assertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_sizeerror: process didn't exit successfully: `target\debug\direct_test.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN) ``` After: ``` thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size error: process didn't exit successfully: `target\debug\direct_test.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN) ``` --- try-jobs: x86_64-gnu-llvm-18
2025-01-02Pass objcopy args for stripping on OSXNoratrieb-0/+50
When `-Cstrip` was changed to use the bundled rust-objcopy instead of /usr/bin/strip on OSX, strip-like arguments were preserved. But strip and objcopy are, while being the same binary, different, they have different defaults depending on which binary they are. Notably, strip strips everything by default, and objcopy doesn't strip anything by default. Additionally, `-S` actually means `--strip-all`, so debuginfo stripped everything and symbols didn't strip anything. We now correctly pass `--strip-debug` and `--strip-all`.
2025-01-02rustdoc: treat `allowed_through_unstable_modules` as deprecationMichael Howell-2/+15
This ensures `std::intrinsics::transmute` is deemphasized in the search engine and other UI, by cleaning it into a deprecation without propagating it through reexports when the parent module is stable.
2025-01-02taint fcx on selection errors during unsizingLukas Markeffsky-13/+113
2025-01-02Make the `test` cfg a "userspace" check-cfgUrgau-60/+57
2025-01-02Move some things to `std::sync::poison` and reexport them in `std::sync`Pavel Grigorenko-10/+10
2025-01-01Rollup merge of #135000 - compiler-errors:opaque-captures-dupe, r=lqdMatthias Krüger-15/+36
Fix ICE when opaque captures a duplicated/invalid lifetime See description on test. Fixes #132766 Fixes #133693 Fixes #134780
2025-01-01Fix ICE when opaque captures a duplicated/invalid lifetimeMichael Goulet-15/+36
2025-01-01Try to write the panic message with a single `write_all` callJohn Kåre Alsaker-19/+78
2025-01-01Rollup merge of #134979 - estebank:default-lint-sugg, r=compiler-errorsStuart Cook-1/+4
Provide structured suggestion for `impl Default` of type where all fields have defaults ``` error: `Default` impl doesn't use the declared default field values --> $DIR/manual-default-impl-could-be-derived.rs:28:1 | LL | / impl Default for B { LL | | fn default() -> Self { LL | | B { LL | | x: s(), | | --- this field has a default value LL | | y: 0, | | - this field has a default value ... | LL | | } | |_^ | help: to avoid divergence in behavior between `Struct { .. }` and `<Struct as Default>::default()`, derive the `Default` | LL ~ #[derive(Default)] struct B { | ``` Note that above the structured suggestion also includes completely removing the manual `impl`, but the rendering doesn't.
2025-01-01Rollup merge of #134945 - compiler-errors:map-mutate-nits, r=estebankStuart Cook-14/+20
Some small nits to the borrowck suggestions for mutating a map through index 1. Suggesting users to either use `.insert` or `.get_mut` (which do totally different things) can be a bit of a footgun, so let's make that a bit more nuanced. 2. I find the suggestion of `.get_mut(|val| { *val = whatever; })` to be a bit awkward. I changed this to be an if-let instead. 3. Fix a bug which was suppressing the structured suggestion for some mutations via the index operator on `HashMap`/`BTreeMap`. r? estebank or reassign
2025-01-01Rollup merge of #134877 - DavisRayM:129966-format-string-help-message, ↵Stuart Cook-0/+85
r=estebank add suggestion for wrongly ordered format parameters Add suggestion for wrongly ordered format parameters like `?#`. Supersedes #131004 Fix #129966
2025-01-01Rollup merge of #133292 - dianne:e0277-suggest-deref, r=estebankStuart Cook-0/+121
E0277: suggest dereferencing function arguments in more cases This unifies and generalizes some of the logic in `TypeErrCtxt::suggest_dereferences` so that it will suggest dereferencing arguments to function/method calls in order to satisfy trait bounds in more cases. Previously it would only fire on reference types, and it had two separate cases (one specifically to get through custom `Deref` impls when passing by-reference, and one specifically to catch #87437). I've based the new checks loosely on what's done for `E0308` in `FnCtxt::suggest_deref_or_ref`: it will suggest dereferences to satisfy trait bounds whenever the referent is `Copy`, is boxed (& so can be moved out of the boxes), or is being passed by reference. This doesn't make the suggestion fire in contexts other than function arguments or binary operators (which are in a separate case that this doesn't touch), and doesn't make it suggest a combination of `&`-removal and dereferences. Those would require a bit more restructuring, so I figured just doing this would be a decent first step. Closes #90997
2024-12-31Rollup merge of #134971 - dxsullivan:fix-typo, r=lqdTrevor Gross-5/+5
chore: fix typos I hope my typo corrections will help you. Thank you for your work.
2024-12-31Rollup merge of #134861 - GuillaumeGomez:item-info-colors, r=fmeaseTrevor Gross-0/+23
Add GUI test for item info elements color Fixes https://github.com/rust-lang/rust/issues/98341. r? ``@fmease``