about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-04-14Consistent with treating Ctor Call as Struct in liveness analysisxizheyin-39/+4
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-14Move `has_self` field to `hir::AssocKind::Fn`.Nicholas Nethercote-4/+4
`hir::AssocItem` currently has a boolean `fn_has_self_parameter` field, which is misplaced, because it's only relevant for associated fns, not for associated consts or types. This commit moves it (and renames it) to the `AssocKind::Fn` variant, where it belongs. This requires introducing a new C-style enum, `AssocTag`, which is like `AssocKind` but without the fields. This is because `AssocKind` values are passed to various functions like `find_by_ident_and_kind` to indicate what kind of associated item should be searched for, and having to specify `has_self` isn't relevant there. New methods: - Predicates `AssocItem::is_fn` and `AssocItem::is_method`. - `AssocItem::as_tag` which converts `AssocItem::kind` to `AssocTag`. Removed `find_by_name_and_kinds`, which is unused. `AssocItem::descr` can now distinguish between methods and associated functions, which slightly improves some error messages.
2025-04-14Add ui test unreachable-by-call-arguments-issue-139627.rsxizheyin-0/+51
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-13Rollup merge of #139760 - petrochenkov:noerrpat2, r=jieyouxuJacob Pratt-293/+321
UI tests: migrate remaining compile time `error-pattern`s to line annotations when possible There's a number of cases in which `error-pattern` is still necessary even for compile time checking. - It checks something that compiler writes directly into stderr as text, and not to the structured json output. This includes some stuff reported during compiler panics, and also diagnostics that happen very early, for example when parsing the command line. - It checks something that exists only in the full rendered diagnostic test, but not in its structured components, for example code fragments or output of `-Ztrack-diagnostics`. (The latter can probably be converted to structured form though.) This is continuation of https://github.com/rust-lang/rust/pull/139137. r? `@jieyouxu`
2025-04-13Rollup merge of #139718 - folkertdev:unsafe-attributes-earlier-editions, ↵Jacob Pratt-34/+62
r=fmease enforce unsafe attributes in pre-2024 editions by default New unsafe attributes should emit an error when used without the `unsafe(...)` in all editions. The `no_mangle`, `link_section` and `export_name` attributes are exceptions, and can still be used without an unsafe in earlier editions. The only attributes for which this change is relevant right now are `#[ffi_const]` and `#[ffi_pure]`. This change is required for making `#[unsafe(naked)]` sound in pre-2024 editions.
2025-04-13Rollup merge of #139699 - compiler-errors:coroutine-drop-phase, r=scottmcmJacob Pratt-0/+19
Proactively update coroutine drop shim's phase to account for later passes applied during shim query See comments in the pass and on test. Also see https://github.com/rust-lang/rust/pull/137264#issuecomment-2669706718. Fixes https://github.com/rust-lang/rust/issues/137243 Fixes https://github.com/rust-lang/rust/issues/139698 r? scottmcm
2025-04-13Rollup merge of #138336 - jyn514:crate-attr-diagnostics, r=compiler-errorsJacob Pratt-36/+56
Improve `-Z crate-attr` diagnostics - Show the `#![ ... ]` in the span (to make it clear that it should not be included in the CLI argument) - Show more detailed errors when the crate has valid token trees but invalid syntax. Previously, `crate-attr=feature(foo),feature(bar)` would just say "invalid crate attribute" and point at the comma. Now, it explicitly says that the comma was unexpected, which is useful when using `--error-format=short`. It also fixes the column to show the correct span. - Recover from parse errors. Previously we would abort immediately on syntax errors; now we go on to try and type-check the rest of the crate. The new diagnostic code also happens to be slightly shorter. r? diagnostics
2025-04-14Auto merge of #124141 - ↵bors-6/+6
nnethercote:rm-Nonterminal-and-TokenKind-Interpolated, r=petrochenkov Remove `Nonterminal` and `TokenKind::Interpolated` A third attempt at this; the first attempt was #96724 and the second was #114647. r? `@ghost`
2025-04-14Adjust test directivesxizheyin-33/+23
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-14Report span of test when should_panic test failedxizheyin-1/+102
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-14Auto merge of #139766 - jhpratt:rollup-afrfmnk, r=jhprattbors-121/+318
Rollup of 10 pull requests Successful merges: - #137043 (Initial `UnsafePinned` implementation [Part 1: Libs]) - #138962 (Expect an array when expected and acutal types are both arrays during cast) - #139001 (add `naked_functions_rustic_abi` feature gate) - #139379 (Use delayed bug for normalization errors in drop elaboration) - #139582 (Various coercion cleanups) - #139628 (Suggest remove redundant `$()?` around `vis`) - #139644 (Micro-optimize `InstSimplify`'s `simplify_primitive_clone`) - #139674 (In `rustc_mir_transform`, iterate over index newtypes instead of ints) - #139740 (Convert `tests/ui/lint/dead-code/self-assign.rs` to a known-bug test) - #139741 (fix smir's run! doc and import) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-14Remove rustc_on_unimplemented on impl testsmejrs-216/+0
2025-04-14Test that `Self` properly works in filtersmejrs-0/+29
2025-04-14Raise errors on bad rustc_on_unimplemented format strings againmejrs-10/+6
2025-04-14Disable usage on trait impls and aliasesmejrs-31/+55
2025-04-13Visit place in BackwardIncompatibleDropHint statementMichael Goulet-6/+0
2025-04-13Rollup merge of #139741 - os-checker:smir-run-macro, r=scottmcmJacob Pratt-21/+0
fix smir's run! doc and import This PR * adds missing `extern crate rustc_middle` in `rustc_smir::run!` docstring * adds missing `use rustc_smir::rustc_internal` in `run_driver!` scope * also adjust some tests that don't need to import rustc_internalany more
2025-04-13Rollup merge of #139740 - jieyouxu:known-bug, r=nnethercoteJacob Pratt-54/+20
Convert `tests/ui/lint/dead-code/self-assign.rs` to a known-bug test I did a survey pass over `tests/`, and this test seems like the only candidate suitable for conversion into a known-bug test. (Other tests had varying degrees of other issues that known-bug would not be suitable.) r? compiler
2025-04-13Rollup merge of #139628 - makai410:suggest-vis, r=compiler-errorsJacob Pratt-0/+72
Suggest remove redundant `$()?` around `vis` Resolves: #139480 .
2025-04-13Rollup merge of #139379 - matthewjasper:drop-elab-normalization, ↵Jacob Pratt-3/+66
r=compiler-errors Use delayed bug for normalization errors in drop elaboration Normalization can fail due to a lot of different earlier errors, so just use span_delayed_bug if normalization failed. Closes #137287 Closes #135668 r? compiler-errors
2025-04-13Rollup merge of #139001 - folkertdev:naked-function-rustic-abi, ↵Jacob Pratt-39/+113
r=traviscross,compiler-errors add `naked_functions_rustic_abi` feature gate tracking issue: https://github.com/rust-lang/rust/issues/138997 Because the details of the rust abi are unstable, and a naked function must match its stated ABI, this feature gate keeps naked functions with a rustic abi ("Rust", "rust-cold", "rust-call" and "rust-intrinsic") unstable. r? ````@traviscross````
2025-04-13Rollup merge of #138962 - xizheyin:issue-138836, r=compiler-errorsJacob Pratt-4/+18
Expect an array when expected and acutal types are both arrays during cast Closes #138836
2025-04-13Rollup merge of #137043 - Sky9x:unsafe-pinned-pt1-libs, ↵Jacob Pratt-0/+29
r=tgross35,RalfJung,WaffleLapkin Initial `UnsafePinned` implementation [Part 1: Libs] Initial libs changes necessary to unblock further work on [RFC 3467](https://rust-lang.github.io/rfcs/3467-unsafe-pinned.html). Tracking issue: #125735 This PR is split off from #136964, and includes just the libs changes: - `UnsafePinned` struct - private `UnsafeUnpin` structural auto trait - Lang items for both - Compiler changes necessary to block niches on `UnsafePinned` This PR does not change codegen, miri, the existing `!Unpin` hack, or anything else. That work is to be split into later PRs. --- cc ``@RalfJung`` ``@Noratrieb`` ``@rustbot`` label F-unsafe_pinned T-libs-api
2025-04-13Improve `-Z crate-attr` diagnosticsjyn-36/+56
- Show the `#![ ... ]` in the span (to make it clear that it should not be included in the CLI argument) - Show more detailed errors when the crate has valid token trees but invalid syntax. Previously, `crate-attr=feature(foo),feature(bar)` would just say "invalid crate attribute" and point at the comma. Now, it explicitly says that the comma was unexpected, which is useful when using `--error-format=short`. It also fixes the column to show the correct span. - Recover from parse errors. Previously we would abort immediately on syntax errors; now we go on to try and type-check the rest of the crate. The new diagnostic code also happens to be slightly shorter.
2025-04-13JumpThreading: Re-enable and fix Not ops on non-booleansclubby789-9/+109
2025-04-13UI tests: migrate remaining compile time `error-pattern`s to line annotationsVadim Petrochenkov-293/+321
when possible.
2025-04-13Auto merge of #139746 - ChrisDenton:rollup-eq08b2e, r=ChrisDentonbors-48/+64
Rollup of 10 pull requests Successful merges: - #138972 (std: Fix build for NuttX targets) - #139177 (Use -C target-cpu=z13 on s390x vector test) - #139511 (libtest: Pass the test's panic payload as Option instead of Result) - #139605 (update ```miniz_oxide``` to 0.8.8) - #139618 (compiletest: Make `SUGGESTION` annotations viral) - #139677 (Fix profiler_builtins build script to handle full path to profiler lib) - #139683 (Use `with_native_path` for Windows) - #139710 (Move `args` into `std::sys`) - #139721 (End all lines in src/stage0 with trailing newline) - #139726 (Move `select_unpredictable` to the `hint` module) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-13Rollup merge of #139726 - Amanieu:select_unpredictable_hint, r=dtolnayChris Denton-4/+4
Move `select_unpredictable` to the `hint` module There has been considerable discussion in both the ACP (rust-lang/libs-team#468) and tracking issue (#133962) about whether the `bool::select_unpredictable` method should be in `core::hint` instead. I believe this is the right move for the following reasons: - The documentation explicitly says that it is a hint, not a codegen guarantee. - `bool` doesn't have a corresponding `select` method, and I don't think we should be adding one. - This shouldn't be something that people reach for with auto-completion unless they specifically understand the interactions with branch prediction. Using conditional moves can easily make code *slower* by preventing the CPU from speculating past the condition due to the data dependency. - Although currently `core::hint` only contains no-ops, this isn't a hard rule (for example `unreachable_unchecked` is a bit of a gray area). The documentation only status that the module contains "hints to compiler that affects how code should be emitted or optimized". This is consistent with what `select_unpredictable` does.
2025-04-13Rollup merge of #139618 - petrochenkov:virsugg, r=jieyouxuChris Denton-43/+52
compiletest: Make `SUGGESTION` annotations viral If one of them is expected in a test file, then others should be annotated as well, in the same way as with `HELP`s and `NOTE`s. This doesn't require much of an additional annotation burden, but simplifies the rules. r? ```@jieyouxu```
2025-04-13Rollup merge of #139177 - fneddy:fix_s390x_codegen_bswap, r=Mark-SimulacrumChris Denton-1/+8
Use -C target-cpu=z13 on s390x vector test currently we see a regression in the `dont-shuffle-bswaps.rs` on s390x. This is due to, the default s390x cpu is set to z10 [here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs#L9) which does not have vector instructions implemented. To make the test pass we need to create an extra test revision and set target-cpu at least to `z13`.
2025-04-13Auto merge of #138881 - scottmcm:more-chaining-ord, r=Mark-Simulacrumbors-0/+55
Use the chaining methods on PartialOrd for slices too #138135 added these doc-hidden trait methods to improve the tuple codegen. This PR adds more implementations and callers so that the codegen for slice (and array) comparisons also improves.
2025-04-13import rustc_smir::rustc_internal in run_driver!zjp-21/+0
2025-04-13tests: convert `tests/ui/lint/dead-code/self-assign.rs` to known-bugJieyou Xu-54/+20
2025-04-13Auto merge of #139734 - ChrisDenton:rollup-28qn740, r=ChrisDentonbors-0/+39
Rollup of 6 pull requests Successful merges: - #139107 (std: make `cmath` functions safe) - #139607 (Add regression test for #127424) - #139691 (Document that `opt-dist` requires metrics to be enabled) - #139707 (Fix comment in bootstrap) - #139708 (Fix name of field in doc comment) - #139709 (bootstrap: fix typo in doc string) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-13Initial `UnsafePinned`/`UnsafeUnpin` impl [Part 1: Libs]Sky-0/+29
2025-04-12Extend the chaining logic to slices tooScott McMurray-6/+49
2025-04-13Rollup merge of #139607 - reddevilmidzy:add-regression-test, r=petrochenkovChris Denton-0/+39
Add regression test for #127424 Fixes: https://github.com/rust-lang/rust/issues/127424 This ICE no longer reproduces, so it appears to have already been fixed. This PR adds a regression test to ensure the issue doesn’t come back in the future. Please let me know if there's anything I should improve or revise!
2025-04-13Move `select_unpredictable` to the `hint` moduleAmanieu d'Antras-4/+4
2025-04-13error on unsafe attributes in pre-2024 editionsFolkert de Vries-34/+62
the `no_mangle`, `link_section` and `export_name` attributes are exceptions, and can still be used without an unsafe in earlier editions
2025-04-12Rollup merge of #139705 - jieyouxu:tests-precursor, r=compiler-errorsChris Denton-42/+7
Removed outdated ui test suite README, give reasons for disabled tests ### Changes - `tests/ui/README.md` is very outdated, test suite docs should consistently live in rustc-dev-guide. - Add reasons for `//@ ignore-test` tests that don't have one.[^query] This is a precursor change to make follow-up changes easier (possibly more specialized directives or converting some auxiliaries into the canonical `auxiliary/` form). [^query]: searched via `rg --no-ignore -F -e "ignore-test" tests/`.
2025-04-12Rollup merge of #139688 - rust-lang:notriddle/io-result-unbox, r=GuillaumeGomezChris Denton-0/+38
rustdoc-search: add unbox flag to Result aliases Fixes #139665
2025-04-12Proactively update coroutine drop shim's phase to account for later passes ↵Michael Goulet-0/+19
applied during shim query
2025-04-12Update weirdly failing ui testsGuillaume Gomez-6/+6
2025-04-12Auto merge of #139242 - jieyouxu:run-make-artifact-names-cross, r=Kobzolbors-6/+41
run-make-support: Calculate artifact names for target platform, not host platform This was implemented incorrectly during the porting process, where we relied on std consts. However, `run-make-support` is a host-only library, which meant that these artifact names were for the *host* and not the *target*. Helps with #138066. r? `@Kobzol` try-job: armhf-gnu try-job: test-various try-job: x86_64-msvc-1 try-job: i686-msvc-1 try-job: x86_64-mingw-1 try-job: aarch64-apple try-job: x86_64-apple-1
2025-04-12Add regression test for #127424reddevilmidzy-0/+39
2025-04-12tests: ensure disabled tests have a reasonJieyou Xu-7/+7
2025-04-12tests/ui: remove outdated READMEJieyou Xu-35/+0
We should consolidate our test suite docs in rustc-dev-guide, and this README is very outdated.
2025-04-12tests: produce target artifacts and/or require crate type / ignore cross-compileJieyou Xu-6/+41
Some tests fail on cross-compiled targets due to various linker problems on cross-compiled target, and having test coverage for these against cross-compiled targets is nice but not necessary.
2025-04-12add tests for merge_function handlingManuel Drehwald-0/+45
2025-04-11Auto merge of #139430 - scottmcm:polymorphic-array-into-iter, r=cuviperbors-3/+32
Polymorphize `array::IntoIter`'s iterator impl Today we emit all the iterator methods for every different array width. That's wasteful since the actual array length never even comes into it -- the indices used are from the separate `alive: IndexRange` field, not even the `N` const param. This PR switches things so that an `array::IntoIter<T, N>` stores a `PolymorphicIter<[MaybeUninit<T>; N]>`, which we *unsize* to `PolymorphicIter<[MaybeUninit<T>]>` and call methods on that non-`Sized` type for all the iterator methods. That also necessarily makes the layout consistent between the different lengths of arrays, because of the unsizing. Compare that to today <https://rust.godbolt.org/z/Prb4xMPrb>, where different widths can't even be deduped because the offset to the indices is different for different array widths.