about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-04-30Rollup merge of #140481 - dpaoliello:reqasan, r=wesleywiserMatthias Krüger-0/+2
Require sanitizers be enabled for asan_odr_windows.rs Issue Details: The `asan_odr_windows.rs` test is failing on AArch64 Windows, as sanitizers aren't supported on that platform. Fix Details: Apply the correct "need sanitizer" requirements to the test.
2025-04-30Rollup merge of #140476 - mejrs:test3, r=jieyouxuMatthias Krüger-61/+0
chore: delete unused ui/auxiliary crates It appears that all the tests that used it have been moved to tests/ui/editions/ (or elsewhere) already. r? `````@jieyouxu`````
2025-04-30Rollup merge of #140467 - BoxyUwU:no_fcw_assoc_consts, r=lcnrMatthias Krüger-0/+23
Don't FCW assoc consts in patterns Fixes #140447 See comment in added test. We could also check that the anon const is a const arg by looking at the HIR. I'm not sure that's necessary though :thinking: The only consts that are evaluated "for the type system" are const args (which *should* get FCWs) and const patterns (which cant be anon consts afaik).
2025-04-30Rollup merge of #140465 - mejrs:test2, r=jieyouxuMatthias Krüger-50/+39
chore: edit and move tests I deleted `ui/non-copyable-void.rs`: added in https://github.com/rust-lang/rust/commit/ab4105d9e8b7c0719343aa2e4edd15cae0b7c947 to test that "nonconstructable" enums are "noncopyable", but these properties are not correlated anymore. Second commit is kinda messy because I moved/edited/renamed some files at the same time, but I deleted nothing there.
2025-04-30Rollup merge of #140458 - azhogin:azhogin/async-drop-fix-dropped-tuple-ice, ↵Matthias Krüger-0/+11
r=oli-obk Fix for async drop ice with partly dropped tuple Fixes https://github.com/rust-lang/rust/issues/140427. Problem was with block data access with block id from new added blocks in patch.
2025-04-30Rollup merge of #140504 - tmiasko:answer-ensure-stack, r=jswrennMatthias Krüger-0/+70
transmutability: ensure_sufficient_stack when answering query Based on #140380. Fixes #118860. The compile time was addressed earlier, this merely addresses stack overflow part of the issue. r? `@jswrenn` `@joshlf`
2025-04-30Rollup merge of #140450 - petrochenkov:vistok, r=nnethercoteMatthias Krüger-2/+0
ast: Remove token visiting from AST visitor It's no longer necessary after the removal of nonterminal tokens in #124141. r? `@nnethercote`
2025-04-30Rollup merge of #140203 - Wyliodrin:error_for_no_mangle_weak_language_items, ↵Matthias Krüger-1/+56
r=bjorn3 Issue an error when using `no_mangle` on language items This pull requests adds the code to issue an error or a warning when using `no_mangle` on language items. This should detail why the `undefined symbol` error is issued for the code described in #139923. The pull request adds two ui tests, one testing the error and the other one the warning. I would love some feedback here, as I am not sure that the error and warning are issues using the right API.
2025-04-30Rollup merge of #140090 - Urgau:snake_case-fn-var, r=petrochenkovMatthias Krüger-1/+10
Check bare function idents for non snake-case name This PR adds the check required to lint on bare function idents for non snake-case name. Reported at #140089. cc `@theemathas`
2025-04-30Rollup merge of #139624 - m-ou-se:unconst-format-args, r=jhprattMatthias Krüger-1/+14
Don't allow flattened format_args in const. Fixes https://github.com/rust-lang/rust/issues/139136 Fixes https://github.com/rust-lang/rust/issues/139621 We allow `format_args!("a")` in const, but don't allow any format_args with arguments in const, such as `format_args!("{}", arg)`. However, we accidentally allow `format_args!("hello {}", "world")` in const, as it gets flattened to `format_args!("hello world")`. This also applies to panic in const. This wasn't supposed to happen. I added protection against this in the format args flattening code, ~~but I accidentally marked a function as const that shouldn't have been const~~ but this was removed in https://github.com/rust-lang/rust/pull/135139. This is a breaking change. The crater found no breakage, however. This breaks things like: ```rust const _: () = if false { panic!("a {}", "a") }; ``` and ```rust const F: std::fmt::Arguments<'static> = format_args!("a {}", "a"); ```
2025-04-30Auto merge of #140503 - matthiaskrgr:rollup-n7zigts, r=matthiaskrgrbors-127/+138
Rollup of 11 pull requests Successful merges: - #136160 (Remove backticks from `ShouldPanic::YesWithMessage`'s `TrFailedMsg`) - #139059 (uses_power_alignment: wording tweaks) - #139192 (mention provenance in the pointer::wrapping_offset docs) - #140312 (Improve pretty-printing of braces) - #140404 (rm `TypeVistable` impls for `Canonical`) - #140437 (enable msa feature for mips in codegen tests) - #140438 (Add `rust.debug-assertions-tools` option) - #140439 (miri: algebraic intrinsics: bring back float non-determinism) - #140445 (Treat ManuallyDrop as ~const Destruct) - #140446 (chore: fix some tests) - #140448 (Rename `rustc_query_append!` to `rustc_with_all_queries!`) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-30error when using no_mangle on language itemsAlexandru RADOVICI-1/+56
add suggestion on how to add a panic breakpoint Co-authored-by: Pat Pannuto <pat.pannuto@gmail.com> delete no_mangle from ui/panic-handler/panic-handler-wrong-location test issue an error for the usage of #[no_mangle] on internal language items delete the comments add newline rephrase note Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com> update error not to leak implementation details delete no_mangle_span Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com> delete commented code
2025-04-30Add test for format_args!("{}", 0) in const.Mara Bos-1/+14
2025-04-30Rollup merge of #140446 - mejrs:test1, r=jieyouxuMatthias Krüger-109/+53
chore: fix some tests
2025-04-30Rollup merge of #140445 - oli-obk:const-manually-drop, r=fee1-deadMatthias Krüger-0/+41
Treat ManuallyDrop as ~const Destruct cc https://github.com/rust-lang/rust/issues/133214#issuecomment-2838078133 r? ```@compiler-errors``` cc ```@fee1-dead```
2025-04-30Rollup merge of #140437 - husqvarnagroup:af/codegen-test-mips-msa, r=jieyouxuMatthias Krüger-2/+13
enable msa feature for mips in codegen tests Fix codegen unit tests for mips by enabling the msa target feature.
2025-04-30Rollup merge of #140312 - nnethercote:DelimArgs-spacing, r=petrochenkovMatthias Krüger-13/+28
Improve pretty-printing of braces r? ````@petrochenkov````
2025-04-30Rollup merge of #136160 - ShE3py:should-panic-backticks, r=thomccMatthias Krüger-3/+3
Remove backticks from `ShouldPanic::YesWithMessage`'s `TrFailedMsg` More legible imo ```rs #[test] #[should_panic = "love"] fn foo() { assert!(1 == 2); } ``` Before: ``` note: panic did not contain expected string panic message: `"assertion failed: 1 == 2"`, expected substring: `"love"` ``` After: ``` note: panic did not contain expected string panic message: "assertion failed: 1 == 2" expected substring: "love" ``` Also removed the comma as `assert_eq!` / `assert_ne!` don't use one. ``@rustbot`` label +A-libtest
2025-04-30compiletest: Make diagnostic kind mandatory on line annotationsVadim Petrochenkov-2059/+2346
2025-04-30ast: Remove token visiting from AST visitorVadim Petrochenkov-2/+0
It's no longer necessary after the removal of nonterminal tokens in #124141.
2025-04-30Auto merge of #140188 - nnethercote:streamline-format-macro, r=cuviperbors-8/+6
Streamline the `format` macro. Removing the unnecessary local variable speeds up compilation a little. r? `@cuviper`
2025-04-29transmutability: uninit transition matches unit byte onlyTomasz Miąsko-0/+70
The previous implementation was inconsistent about transitions that apply for an init byte. For example, when answering a query, an init byte could use corresponding init transition. Init byte could also use uninit transition, but only when the corresponding init transition was absent. This behaviour was incompatible with DFA union construction. Define an uninit transition to match an uninit byte only and update implementation accordingly. To describe that `Tree::uninit` is valid for any value, build an automaton that accepts any byte value. Additionally, represent byte ranges uniformly as a pair of integers to avoid special case for uninit byte.
2025-04-29Require sanitizers be enabled for asan_odr_windows.rsDaniel Paoliello-0/+2
2025-04-29Don't FCW assoc consts in patternsBoxy-0/+23
2025-04-29Delete unused ui/auxiliary cratesmejrs-61/+0
2025-04-29Rollup merge of #139909 - oli-obk:or-patterns, r=BoxyUwUTrevor Gross-0/+204
implement or-patterns for pattern types These are necessary to represent `NonZeroI32`, as the range for that is `..0 | 1..`. The `rustc_scalar_layout_range_*` attributes avoided this by just implementing wraparound and having a single `1..=-1` range effectively. See https://rust-lang.zulipchat.com/#narrow/channel/481660-t-lang.2Fpattern-types/topic/.60or.20pattern.60.20representation.20in.20type.20system/with/504217694 for some background discussion cc https://github.com/rust-lang/rust/issues/123646 r? `@BoxyUwU`
2025-04-29Move tests from /ui directorymejrs-31/+39
2025-04-29Fix for async drop ice with partly dropped tupleAndrew Zhogin-0/+11
2025-04-29Delete "nonconstructable" enums are "noncopyable" testmejrs-19/+0
2025-04-29Coalesce duplicate missing clone testsmejrs-97/+43
2025-04-29Treat `ManuallyDrop` as `~const Destruct`Oli Scherer-23/+1
2025-04-29Add testOli Scherer-0/+63
2025-04-29Fix comment describing what the test doesmejrs-6/+3
2025-04-29Move `on impl position` test to proper directorymejrs-6/+7
2025-04-29enable msa feature for mips in codegen testsAdrian Friedli-2/+13
2025-04-29Auto merge of #137940 - 1c3t3a:alignment-borrows-check, r=saethlinbors-0/+40
Extend the alignment check to borrows The current alignment check does not include checks for creating misaligned references from raw pointers, which is now added in this patch. When inserting the check we need to be careful with references to field projections (e.g. `&(*ptr).a`), in which case the resulting reference must be aligned according to the field type and not the type of the pointer. r? `@saethlin` cc `@RalfJung,` after our discussion in #134424
2025-04-29Improve pretty-printing of braces.Nicholas Nethercote-12/+11
Most notably, the `FIXME` for suboptimal printing of `use` groups in `tests/ui/macros/stringify.rs` is fixed. And all other test output changes result in pretty printed output being closer to the original formatting in the source code.
2025-04-29Add a few extra tests to `tests/ui/macros/stringify.rs`.Nicholas Nethercote-2/+18
2025-04-28Rollup merge of #140396 - ChrisDenton:gnu-threads, r=jieyouxuChris Denton-0/+6
Workaround for windows-gnu rust-lld test failure The test run-make/amdgpu-kd has an issue on windows-gnu where rust-lld will sometimes fail with error 0xc0000374 (`STATUS_HEAP_CORRUPTION`). This works around the issue by passing `--threads=1` to the linker as suggested [here](https://github.com/rust-lang/rust/issues/115985#issuecomment-1754112623). Note I don't know if this will help and it happens only sometimes in our CI so it's hard to test.
2025-04-28Rollup merge of #140323 - tgross35:cfg-unstable-float, r=UrgauChris Denton-0/+119
Implement the internal feature `cfg_target_has_reliable_f16_f128` Support for `f16` and `f128` is varied across targets, backends, and backend versions. Eventually we would like to reach a point where all backends support these approximately equally, but until then we have to work around some of these nuances of support being observable. Introduce the `cfg_target_has_reliable_f16_f128` internal feature, which provides the following new configuration gates: * `cfg(target_has_reliable_f16)` * `cfg(target_has_reliable_f16_math)` * `cfg(target_has_reliable_f128)` * `cfg(target_has_reliable_f128_math)` `reliable_f16` and `reliable_f128` indicate that basic arithmetic for the type works correctly. The `_math` versions indicate that anything relying on `libm` works correctly, since sometimes this hits a separate class of codegen bugs. These options match configuration set by the build script at [1]. The logic for LLVM support is duplicated as-is from the same script. There are a few possible updates that will come as a follow up. The config introduced here is not planned to ever become stable, it is only intended to replace the build scripts for `std` tests and `compiler-builtins` that don't have any way to configure based on the codegen backend. MCP: https://github.com/rust-lang/compiler-team/issues/866 Closes: https://github.com/rust-lang/compiler-team/issues/866 [1]: https://github.com/rust-lang/rust/blob/555e1d0386f024a8359645c3217f4b3eae9be042/library/std/build.rs#L84-L186 --- The second commit makes use of this config to replace `cfg_{f16,f128}{,_math}` in `library/`. I omitted providing a `cfg(bootstrap)` configuration to keep things simpler since the next beta branch is in two weeks. try-job: aarch64-gnu try-job: i686-msvc-1 try-job: test-various try-job: x86_64-gnu try-job: x86_64-msvc-ext2
2025-04-28Rollup merge of #140302 - compiler-errors:inline_asm-bug, r=lcnrChris Denton-0/+19
Move inline asm check to typeck, properly handle aliases Pull `InlineAsmCtxt` down to `rustc_hir_typeck`, and instead of using things like `Ty::is_copy`, use the `InferCtxt`-aware methods. To fix https://github.com/rust-lang/trait-system-refactor-initiative/issues/189, we also add a `try_structurally_resolve_*` call to `expr_ty`. r? lcnr
2025-04-28Rollup merge of #140276 - compiler-errors:typeof-less-eagerly, r=lcnrChris Denton-0/+71
Do not compute type_of for impl item if impl where clauses are unsatisfied Consider the following code: ```rust trait Foo { fn call(self) -> impl Send; } trait Nested {} impl<T> Foo for T where T: Nested, { fn call(self) -> impl Sized { NotSatisfied.call() } } struct NotSatisfied; impl Foo for NotSatisfied { fn call(self) -> impl Sized { todo!() } } ``` In `impl Foo for NotSatisfied`, we need to prove that the RPITIT is well formed. This requires proving the item bound `<NotSatisfied as Foo>::RPITIT: Send`. Normalizing `<NotSatisfied as Foo>::RPITIT: Send` assembles two impl candidates, via the `NotSatisfied` impl and the blanket `T` impl. We end up computing the `type_of` for the blanket impl even if `NotSatisfied: Nested` where clause does not hold. This type_of query ends up needing to prove that its own `impl Sized` RPIT satisfies `Send`, which ends up needing to compute the hidden type of the RPIT, which is equal to the return type of `NotSatisfied.call()`. That ends up in a query cycle, since we subsequently try normalizing that return type via the blanket impl again! In the old solver, we don't end up computing the `type_of` an impl candidate if its where clauses don't hold, since this select call would fail before confirming the projection candidate: https://github.com/rust-lang/rust/blob/d7ea436a02d5de4033fcf7fd4eb8ed965d0f574c/compiler/rustc_trait_selection/src/traits/project.rs#L882 This PR makes the new solver more consistent with the old solver by adding a call to `try_evaluate_added_goals` after regstering the impl predicates, which causes us to bail before computing the `type_of` for impls if the impl definitely doesn't apply. r? lcnr Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/185
2025-04-28Rollup merge of #140022 - dianne:box-deref-pats, r=NadrierilChris Denton-50/+151
allow deref patterns to move out of boxes This adds a case to lower deref patterns on boxes using a built-in deref instead of a `Deref::deref` or `DerefMut::deref_mut` call: if `deref!(inner): Box<T>` is matching on place `place`, the inner pattern `inner` now matches on `*place` rather than a temporary. No longer needing to call a method also means it won't borrow the scrutinee in match arms. This allows for bindings in `inner` to move out of `*place`. For comparison with box patterns, this uses the same MIR lowering but different THIR. Consequently, deref patterns on boxes are treated the same as any other deref patterns in match exhaustiveness analysis. Box patterns can't quite be implemented in terms of deref patterns until exhaustiveness checking for deref patterns is implemented (I'll open a PR for exhaustiveness soon!). Tracking issue: #87121 r? ``@Nadrieril``
2025-04-28Rollup merge of #139656 - scottmcm:stabilize-slice-as-chunks, r=dtolnayChris Denton-1/+0
Stabilize `slice_as_chunks` library feature ~~Draft as this needs #139163 to land first.~~ FCP: https://github.com/rust-lang/rust/issues/74985#issuecomment-2769963395 Methods being stabilized are: ```rust impl [T] { const fn as_chunks<const N: usize>(&self) -> (&[[T; N]], &[T]); const fn as_rchunks<const N: usize>(&self) -> (&[T], &[[T; N]]); const unsafe fn as_chunks_unchecked<const N: usize>(&self) -> &[[T; N]]; const fn as_chunks_mut<const N: usize>(&mut self) -> (&mut [[T; N]], &mut [T]); const fn as_rchunks_mut<const N: usize>(&mut self) -> (&mut [T], &mut [[T; N]]); const unsafe fn as_chunks_unchecked_mut<const N: usize>(&mut self) -> &mut [[T; N]]; } ``` ~~(FCP's not done quite yet, but will in another day if I'm counting right.)~~ FCP Complete: https://github.com/rust-lang/rust/issues/74985#issuecomment-2797951535
2025-04-28Rollup merge of #139308 - Shourya742:2025-03-29-add-autodiff-inline, r=ZuseZ4Chris Denton-0/+23
add autodiff inline closes: #138920 r? ```@ZuseZ4``` try-job: dist-aarch64-linux
2025-04-28Workaround for windows-gnu rust-lld test failureChris Denton-0/+6
The test run-make/amdgpu-kd has an issue where rust-lld will sometimes fail with error 0xc0000374 (STATUS_HEAP_CORRUPTION).
2025-04-28Remove backticks from `ShouldPanic::YesWithMessage`'s `TrFailedMsg`Lieselotte-3/+3
2025-04-28Auto merge of #140388 - GuillaumeGomez:rollup-aj9o3ch, r=GuillaumeGomezbors-119/+145
Rollup of 7 pull requests Successful merges: - #140056 (Fix a wrong error message in 2024 edition) - #140220 (Fix detection of main function if there are expressions around it) - #140249 (Remove `weak` alias terminology) - #140316 (Introduce `BoxMarker` to improve pretty-printing correctness) - #140347 (ci: clean more disk space in codebuild) - #140349 (ci: use aws codebuild for the `dist-x86_64-linux` job) - #140379 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-28Do not compute type_of for impl item if impl where clauses are unsatisfiedMichael Goulet-0/+71
2025-04-28remove noinline attribute and add alwaysinline after AD passbit-aloo-0/+23