about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-09-25Revert "Auto merge of #144086 - clubby789:alloc-zeroed, r=nikic"Nikita Popov-20/+0
This reverts commit 040a98af70f0a7da03f3d5356531b28a2a7a77e4, reversing changes made to e8a792daf500b5ff8097896ddb6cc037abe92487.
2025-09-15Only run Cranelift dist test on nightlyJakub Beránek-0/+1
2025-09-14Update CURRENT_RUSTC_VERSION post-bumpMark Rousskov-1/+1
2025-09-13Rollup merge of #146521 - folkertdev:document-va-arg-safe, r=workingjubileeJacob Pratt-0/+109
document `core::ffi::VaArgSafe` tracking issue: https://github.com/rust-lang/rust/issues/44930 A modification of https://github.com/rust-lang/rust/pull/146454, keeping just the documentation changes, but not unsealing the trait. Although conceptually we'd want to unseal the trait, there are many edge cases to supporting arbitrary types. We'd need to exhaustively test that all targets/calling conventions support all types that rust might generate (or generate proper error messages for unsupported cases). At present, many of the `va_arg` implementations assume that the argument is a scalar, and has an alignment of at most 8. That is totally sufficient for an MVP (accepting all of the "standard" C types), but clearly does not cover all rust types. This PR also adds some various other tests for edge cases of c-variadic: - the `#[inline]` attribute in its various forms. At present, LLVM is unable to inline c-variadic functions, but the attribute should still be accepted. `#[rustc_force_inline]` already rejects c-variadic functions. - naked functions should accept and work with a C variable argument list. In the future we'd like to allow more ABIs with naked functions (basically, any ABI for which we accept defining foreign c-variadic functions), but for now only `"C"` and `"C-unwind` are supported - guaranteed tail calls: c-variadic functions cannot be tail-called. That was already rejected, but there was not test for it. r? `@workingjubilee`
2025-09-13Rollup merge of #146171 - scrabsha:push-wovnxxwltsun, r=WaffleLapkinJacob Pratt-2/+2
tidy: check that error messages don't start with a capitalized letter
2025-09-13c-variadic: check that inline attributes are accepted on c-variadic functionsFolkert de Vries-0/+47
they don't do anything, because LLVM is unable to inline c-variadic functions (on most targets, anyway)
2025-09-13c-variadic: check that c-variadic functions cannot be tail-calledFolkert de Vries-0/+22
as far as I can see this was not tested, though the error message was already implemented
2025-09-13c-variadic: test `...` with naked functionsFolkert de Vries-0/+40
2025-09-13Auto merge of #145186 - camsteffen:assoc-impl-kind, r=petrochenkovbors-18/+2
Make `AssocItem` aware of its impl kind The general goal is to have fewer query dependencies by making `AssocItem` aware of its parent impl kind (inherent vs. trait) without having to query the parent def_kind. See individual commits.
2025-09-13Auto merge of #146499 - jhpratt:rollup-ufflehe, r=jhprattbors-66/+188
Rollup of 5 pull requests Successful merges: - rust-lang/rust#144498 (Add --print target-spec-json-schema) - rust-lang/rust#145471 (Stabilize BTree{Map,Set}::extract_if) - rust-lang/rust#145896 (Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [rust-lang/rust#3 of Batch rust-lang/rust#2]) - rust-lang/rust#146450 (bootstrap: rustdoc-js tests can now be filtered by js files) - rust-lang/rust#146456 (Fix panic and incorrectly suggested examples in `format_args` macro.) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-13Rollup merge of #146456 - IoaNNUwU:issue-146446, r=estebankJacob Pratt-1/+77
Fix panic and incorrectly suggested examples in `format_args` macro. Follow up on rust-lang/rust#146123 Fixes: rust-lang/rust#146446 r? `@estebank`
2025-09-13Rollup merge of #145896 - Oneirical:uncountable-integer-10, r=jieyouxuJacob Pratt-57/+104
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#3 of Batch #2] Part of rust-lang/rust#133895 Methodology: 1. Refer to the previously written `tests/ui/SUMMARY.md` 2. Find an appropriate category for the test, using the original issue thread and the test contents. 3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers) 4. Rename the tests to make their purpose clearer Inspired by the methodology that `@Kivooeo` was using. r? `@jieyouxu`
2025-09-13Rollup merge of #145471 - rs-sac:extr, r=the8472Jacob Pratt-1/+0
Stabilize BTree{Map,Set}::extract_if Tracking issue: rust-lang/rust#70530 FCP completed: https://github.com/rust-lang/rust/issues/70530#issuecomment-3191454465 Closes: rust-lang/rust#70530
2025-09-13Rollup merge of #144498 - Noratrieb:rustc-json-schema, r=jieyouxu,davidtwcoJacob Pratt-7/+7
Add --print target-spec-json-schema This schema is helpful for people writing custom target spec JSON. It can provide autocomplete in the editor, and also serves as documentation when there are documentation comments on the structs, as `schemars` will put them in the schema. I was motivated to do this because I saw someone write their own version of this schema by hand, so demand for this clearly exists. It's not a lot of effort to implement, so I thought it would make sense. MCP: https://github.com/rust-lang/compiler-team/issues/905 I think it would also be useful to put this in the sysroot in `etc` so people can link it directly in their editors. I would have loved to add a test that validates the JSON schema against the spec JSON of every builtin target, but I don't want to do it as the JSON schema validation crates have incredible amounts of dependencies because JSON schema supports a ton of random features. I don't want to add that, even as a dev dependency.
2025-09-13Auto merge of #146394 - Enselic:debuginfo-level-tests-2, r=jieyouxubors-8/+16
ci: Increase `rust.debuginfo-level-tests` to `2` in `x86_64-gnu-debug` job Simply to increase the scope of the testing. Part of https://github.com/rust-lang/rust/issues/61117. cc rust-lang/rust#145967 and rust-lang/rust#146025 which prepared for this. And rust-lang/rust#144499 that set to level to `1` try-job: x86_64-gnu-debug
2025-09-13Rollup merge of #146403 - cyrgani:array-sugg-sorting, r=fee1-deadJana Dönszelmann-8/+8
sort array trait implementation suggestions correctly Fixes rust-lang/rust#135098. Previously tried in rust-lang/rust#137428.
2025-09-13Rollup merge of #146389 - jdonszelmann:no-std, r=oli-obkJana Dönszelmann-80/+200
Convert `no_std` and `no_core` to the new attribute infrastructure r? ```@oli-obk``` Also added a test for these, since we didn't have any and I was kind of surprised new diagnostics didn't break anything hehe
2025-09-12Split AssocContainer::{InherentImpl,TraitImpl}Cameron Steffen-18/+2
2025-09-12Add --print target-spec-json-schemaNoratrieb-7/+7
This schema is helpful for people writing custom target spec JSON. It can provide autocomplete in the editor, and also serves as documentation when there are documentation comments on the structs, as `schemars` will put them in the schema.
2025-09-12Add test batch 3Oneirical-57/+104
2025-09-12Auto merge of #144847 - Randl:const-ord, r=oli-obkbors-66/+7
Constify Eq, Ord, PartialOrd Adds `#[const_trait]` and impls for `Eq`, `Ord`, `PartialOrd`. Impl for some other traits (e.g., slices and arrays) are blocked mainly on const closures (https://github.com/rust-lang/rust/issues/106003). For TypeId Ord we need const pointer comparison (https://github.com/rust-lang/rust/issues/53020) Tracking issue https://github.com/rust-lang/rust/issues/143800
2025-09-12Auto merge of #146329 - lcnr:opaque-type-infer-alias-candidates, r=BoxyUwUbors-0/+283
consider item bounds for non-yet-defined opaque types Based on rust-lang/rust#140405. fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/182 fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/196 fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/205 there's some jank here, see https://github.com/rust-lang/trait-system-refactor-initiative/issues/229 ## Design If the self type is an inference variable which has been sub-unified with am opaque type, we need to incompletely guide inference to avoid breakage. In this case, we - look at the item bounds of all sub-unified opaque types, and - blanket impls which do not constrain the self type Even if there are applicable candidates, we always force their certainty to be `Maybe`, so they will always have to be reproven once we've constrained the inference variable. This is a bit iffy, see the added tests. r? `@BoxyUwU`
2025-09-12sort array trait implementation suggestions correctlycyrgani-8/+8
2025-09-12Rollup merge of #146455 - cuviper:no-rustc-version, r=jieyouxuStuart Cook-3/+2
test: remove an outdated normalization for rustc versions These "you are using $RUSTC_VERSION" help messages were removed in rust-lang/rust#142943, but rust-lang/rust#142681 started before that and merged later, so its normalization is vestigial.
2025-09-12Rollup merge of #146448 - GuillaumeGomez:fix-literal-search-paths, ↵Stuart Cook-0/+30
r=lolbinarycat [rustdoc] Correctly handle literal search on paths Fixes https://github.com/rust-lang/rust/issues/146129. cc ```@notriddle``` r? ```@lolbinarycat```
2025-09-12Rollup merge of #146413 - GuillaumeGomez:rustdoc-bare-urls, r=lolbinarycatStuart Cook-1/+97
Improve suggestion in case a bare URL is surrounded by brackets Fixes https://github.com/rust-lang/rust/issues/146162. With this change, output looks like this: ``` | 1 | //! [https://github.com] | ^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://github.com>` | = note: bare URLs are not automatically turned into clickable links = note: `#[warn(rustdoc::bare_urls)]` on by default ``` cc ```@fmease``` r? ```@lolbinarycat```
2025-09-12Rollup merge of #146308 - cyrgani:concat-integer-literals, r=jackh726Stuart Cook-23/+45
support integer literals in `${concat()}` Tracking issue: rust-lang/rust#124225 Adds support for using integer literals as arguments to `${concat()}` macro expressions. Integer formatting such as `1_000` is preserved by this.
2025-09-12Rollup merge of #144549 - folkertdev:va-arg-arm, r=saethlinStuart Cook-0/+47
match clang's `va_arg` assembly on arm targets tracking issue: https://github.com/rust-lang/rust/issues/44930 For this example ```rust #![feature(c_variadic)] #[unsafe(no_mangle)] unsafe extern "C" fn variadic(a: f64, mut args: ...) -> f64 { let b = args.arg::<f64>(); let c = args.arg::<f64>(); a + b + c } ``` We currently generate (via llvm): ```asm variadic: sub sp, sp, #12 stmib sp, {r2, r3} vmov d0, r0, r1 add r0, sp, #4 vldr d1, [sp, #4] add r0, r0, #15 bic r0, r0, #7 vadd.f64 d0, d0, d1 add r1, r0, #8 str r1, [sp] vldr d1, [r0] vadd.f64 d0, d0, d1 vmov r0, r1, d0 add sp, sp, #12 bx lr ``` LLVM is not doing a good job. In fact, it's well-known that LLVM's implementation of `va_arg` is kind of bad, and we implement it ourselves (based on clang) for many targets already. For arm, our own `emit_ptr_va_arg` saves 3 instructions. Next, it turns out it's important for LLVM to explicitly start and end the lifetime of the `va_list`. In https://github.com/rust-lang/rust/pull/146059 I already end the lifetime, but when looking at this again, I noticed that it is important to also start it, see https://godbolt.org/z/EGqvKTTsK: failing to explicitly start the lifetime uses an extra register. So, the combination of `emit_ptr_va_arg` with starting/ending the lifetime makes rustc emit exactly the instructions that clang generates:: ```asm variadic: sub sp, sp, #12 stmib sp, {r2, r3} vmov d16, r0, r1 vldr d17, [sp, #4] vadd.f64 d16, d16, d17 vldr d17, [sp, #12] vadd.f64 d16, d16, d17 vmov r0, r1, d16 add sp, sp, #12 bx lr ``` The arguments to `emit_ptr_va_arg` are based on [the clang implementation](https://github.com/llvm/llvm-project/blob/03dc2a41f3d9a500e47b513de5c5008c06860d65/clang/lib/CodeGen/Targets/ARM.cpp#L798-L844). r? ``@workingjubilee`` (I can re-roll if your queue is too full, but you do seem like the right person here) try-job: armhf-gnu
2025-09-12Constify Eq, Ord, PartialOrdEvgenii Zheltonozhskii-66/+7
2025-09-12ci: Increase `rust.debuginfo-level-tests` to `2` in `x86_64-gnu-debug` jobMartin Nordholts-8/+16
Simply to increase the scope of the testing. Force debuginfo=0 for a handful of tests so that we can have CI prevent regressing on more tests.
2025-09-11test: remove an outdated normalization for rustc versionsJosh Stone-3/+2
These "you are using $RUSTC_VERSION" help messages were removed in rust-lang/rust#142943, but rust-lang/rust#142681 started before that and merged later, so its normalization is vestigial.
2025-09-12Use raw fmt str in format macroIoaNNUwU-1/+77
2025-09-11Add regression test for literal search on pathsGuillaume Gomez-0/+30
2025-09-11incompletely prefer opaque type bounds when self type bottoms out in inferMichael Goulet-0/+283
2025-09-11Rollup merge of #146428 - jieyouxu:revert-assert-desugaring, r=estebank,jackh726Stuart Cook-62/+47
Revert `assert!` desugaring changes (#122661) Reverts rust-lang/rust#122661 to prevent rust-lang/rust#145770 slipping into beta. cc `@estebank` (FYI) ### Review remarks - Commit 1 is the MCVE reported in rust-lang/rust#145770 added as a regression test `tests/ui/macros/assert-desugaring-145770.rs`. Against `master`, this test fails. - Commit 2 reverts rust-lang/rust#122661 (with a merge conflict fixed). `tests/ui/macros/assert-desugaring-145770.rs` now passes.
2025-09-11Rollup merge of #146422 - fmease:less-greedy-maybe-const-bounds, r=estebankStuart Cook-97/+145
Less greedily parse `[const]` bounds > [!IMPORTANT] > If you're coming here from any beta backport nomination thread on Zulip, only the last commit is truly relevant (the first commit doesn't need to be backported, it only contains test modifications)! Don't consider `[` to start a bound, only consider `[const]` in its entirety to do so. This drastically reduces (but doesn't eliminate!) the chance of *real* breakages. Like `const`, `~const` and `async` before, `[const]` unavoidably brings along theoretical breakages, see preexisting tests: `macro-const-trait-bound-theoretical-regression.rs` and `macro-async-trait-bound-theoretical-regression.rs`. Side note: It's unfortunate that we have to do this but apart from the known fact that MBE hurts forward compatibility, the `[const]` syntax is simply a bit scuffed (also CC'ing https://github.com/rust-lang/rust/issues/146122, section (3)). Fixes [after beta backport] rust-lang/rust#146417. * 1st commit: Restore the original test intentions of several preexisting related tests that were unfortunately lost over time * I've added a bunch of SCREAMING comments to make it less likely to be lost again * CC PR rust-lang/rust#119099 which added most of these tests * CC [#144409 (comment)](https://github.com/rust-lang/rust/pull/144409#discussion_r2337587513) for further context (NB: It's not the only PR that negatively affected the test intention) * 2nd commit: Actually address the regression r? `@oli-obk` or anyone
2025-09-11Rollup merge of #146415 - RalfJung:s390x-softfloat, r=workingjubileeStuart Cook-31/+37
s390x: mark soft-float target feature as incompatible This provides a more informative warning when someone manually sets `+soft-float` on s390x.
2025-09-11Rollup merge of #146335 - arielb1:dont-dump-core, r=nnethercoteStuart Cook-1/+16
disable core dumps for panic-uninitialized-zeroed That test causes a large amount of crashes. If a system has a /proc/sys/kernel/core_pattern that uploads core dumps enabled, it will take a long time to complete. Set dumpable to 0 to avoid that. Before: ``` $ time ./panic-uninitialized-zeroed real 0m47.457s user 0m0.023s sys 0m0.021s ``` After: ``` $ ./panic-uninitialized-zeroed real 0m0.029s user 0m0.019s sys 0m0.010s ```
2025-09-11Revert "Rollup merge of #122661 - estebank:assert-macro-span, r=petrochenkov"Jieyou Xu-77/+26
This reverts commit 1eeb8e8b151d1da7daa73837a25dc5f7a1a7fa28, reversing changes made to 324bf2b9fd8bf9661e7045c8a93f5ff0ec1a8ca5. Unfortunately the assert desugaring change is not backwards compatible, see RUST-145770. Code such as ```rust #[derive(Debug)] struct F { data: bool } impl std::ops::Not for F { type Output = bool; fn not(self) -> Self::Output { !self.data } } fn main() { let f = F { data: true }; assert!(f); } ``` would be broken by the assert desugaring change. We may need to land the change over an edition boundary, or limit the editions that the desugaring change impacts.
2025-09-11Add regression test for assert desugaring changeJieyou Xu-0/+36
Using the MCVE reported in RUST-145770.
2025-09-10Less greedily parse `[const]` boundsLeón Orell Valerian Liehr-0/+25
2025-09-10Restore the test intention of several MBE trait bound modifier testsLeón Orell Valerian Liehr-97/+120
2025-09-10s390x: mark soft-float target feature as incompatibleRalf Jung-31/+37
2025-09-10tidy: check that error messages don't start with a capitalized letterSasha Pourcelot-2/+2
2025-09-10fixup no_{core,std} handling codeJana Dönszelmann-80/+200
2025-09-10Rollup merge of #146342 - folkertdev:c-variadic-errors-take-3, r=workingjubileeMatthias Krüger-115/+190
Improve C-variadic error messages: part 2 tracking issue: https://github.com/rust-lang/rust/issues/44930 a reimplementation of https://github.com/rust-lang/rust/pull/143546 that builds on https://github.com/rust-lang/rust/pull/146165. This PR - disallows coroutines (e.g. `async fn`) from having a `...` argument - disallows associated functions (both in traits and standard impl blocks) from having a `...` argument - splits up a generic "ill-formed C-variadic function" into specific errors about using an incorrect ABI, not specifying an ABI, or missing the unsafe keyword C-variadic coroutines probably don't make sense? C-variadic functions are for FFI purposes, combining that with async functions seems weird. For associated functions, we're just cutting scope. It's probably fine, but it's probably better to explicitly allow it. So for now, at least give a more targeted error message. Made to be reviewed commit-by-commit. cc `@workingjubilee` r? compiler
2025-09-10Rollup merge of #146340 - fmease:frontmatter-containment, r=fee1-dead,UrgauMatthias Krüger-20/+48
Strip frontmatter in fewer places * Stop stripping frontmatter in `proc_macro::Literal::from_str` (RUST-146132) * Stop stripping frontmatter in expr-ctxt (but not item-ctxt!) `include`s (RUST-145945) * Stop stripping shebang (!) in `proc_macro::Literal::from_str` * Not a breaking change because it did compare spans already to ensure there wasn't extra whitespace or comments (`Literal::from_str("#!\n0")` already yields `Err(_)` thankfully!) * Stop stripping frontmatter+shebang inside some rustdoc code where it doesn't make any observable difference (see self review comments) * (Stop stripping frontmatter+shebang inside internal test code) Fixes https://github.com/rust-lang/rust/issues/145945. Fixes https://github.com/rust-lang/rust/issues/146132. r? fee1-dead
2025-09-10Rollup merge of #146327 - Darksonn:pin-deref-tests, r=lcnrMatthias Krüger-0/+382
Add tests for deref on pin Tests split out from rust-lang/rust#145608. r? `@lcnr`
2025-09-10Rollup merge of #146123 - IoaNNUwU:issue-68293, r=estebankMatthias Krüger-0/+116
Suggest examples of format specifiers in error messages Format macro now suggests adding `{}` if no formatting specifiers are present. It also gives an example: ```rust LL | println!("Hello", "World"); | ------- ^^^^^^^ argument never used | | | formatting specifier missing | = note: format specifiers use curly braces: `{}` help: consider adding format specifier | LL | println!("Hello{}", "World"); | ++ ``` When one or more `{}` are present, it doesn't show 'format specifiers use curly braces: `{}`' and example, just small hint on how many you missing: ```rust LL | println!("list: {}", 1, 2, 3); | ---------- ^ ^ argument never used | | | | | argument never used | multiple missing formatting specifiers | = help: consider adding 2 format specifiers ``` Original issue: rust-lang/rust#68293 Based on discussion in this PR: rust-lang/rust#76443 Let me know if something is missing
2025-09-10Rollup merge of #145879 - Bryanskiy:supertraits-2, r=lcnrMatthias Krüger-202/+184
default auto traits: use default supertraits instead of `Self: Trait` bounds on associated items First commit: the motivation has been discussed [here](https://github.com/rust-lang/rust/pull/144679). Second commit: the only new places where new implicit `DefaultAutoTrait` bounds are generated are supertraits and trait object so `?Trait` syntax should be extended to these places only. r? `@lcnr`