about summary refs log tree commit diff
path: root/tests/ui/coercion
AgeCommit message (Collapse)AuthorLines
2025-09-25mark THIR use as candidate for constness checkDing Xiang Fei-0/+8
2025-09-25add test fixture for newly allowed const exprDing Xiang Fei-0/+8
Signed-off-by: Ding Xiang Fei <dingxiangfei2009@protonmail.ch> Co-authored-by: Theemathas Chirananthavat <theemathas@gmail.com>
2025-09-25do not materialise X in [X; 0] when X is unsizing a constDing Xiang Fei-0/+30
2025-09-16Suggest removing Box::newCameron Steffen-3/+27
2025-08-29Rollup merge of #145676 - Oneirical:uncountable-integer-9, r=jieyouxuMatthias Krüger-1/+1
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#2 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-08-27Add test batch 2Oneirical-1/+1
2025-08-23Account for impossible bounds making seemingly unsatisfyable dyn-to-dyn castsMichael Goulet-0/+16
2025-08-19bless tests with new lint messagesKarol Zwolak-4/+4
2025-08-17Rehome tests/ui/issues/ tests [5/?]Oneirical-0/+40
2025-08-10Rollup merge of #144553 - Oneirical:uncountable-integer-4, r=jieyouxuJacob Pratt-0/+33
Rehome 32 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` rust-lang/rust#143902 divided into smaller, easier to review chunks. 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-08-10Rehome tests/ui/issues/ tests [4/?]Oneirical-0/+33
2025-08-05commentsKivooeo-0/+14
2025-08-05moved 35 tests to organized locationsKivooeo-0/+17
2025-08-01Rollup merge of #144397 - Kivooeo:issue2, r=jieyouxuRalf Jung-0/+7
`tests/ui/issues/`: The Issues Strike Back [2/N] Some `tests/ui/issues/` housekeeping, to trim down number of tests directly under `tests/ui/issues/`. Part of https://github.com/rust-lang/rust/issues/133895. r? ``@jieyouxu``
2025-07-31commentsKivooeo-0/+7
2025-07-25commentsKivooeo-0/+86
2025-07-05cleaned up some testsKivooeo-20/+14
2025-07-01moved testsKivooeo-0/+90
2025-06-24Check CoerceUnsized impl validity before coercingMichael Goulet-0/+32
2025-06-06Make cast suggestions verboseEsteban Küber-6/+3
``` error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/E0604.rs:2:5 | LL | 1u32 as char; | ^^^^^^^^^^^^ invalid cast | help: try `char::from_u32` instead | LL - 1u32 as char; LL + char::from_u32(1u32); | ``` ``` error[E0620]: cast to unsized type: `&[u8]` as `[char]` --> $DIR/cast-to-slice.rs:6:5 | LL | arr as [char]; | ^^^^^^^^^^^^^ | help: try casting to a reference instead | LL | arr as &[char]; | + ``` ``` error[E0620]: cast to unsized type: `Box<{integer}>` as `dyn Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:3:5 | LL | Box::new(1) as dyn Send; | ^^^^^^^^^^^^^^^^^^^^^^^ | help: you can cast to a `Box` instead | LL | Box::new(1) as Box<dyn Send>; | ++++ + ```
2025-06-02Add missing `dyn` keywords to tests that do not test for themLukas Wirth-6/+6
This ensures that these tests can be run on editions other than 2015
2025-05-31Note ref expr being cast when encounter NonScalar cast errorxizheyin-0/+2
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-09Merge typeck loop with static/const item eval loopOli Scherer-15/+15
2025-04-30compiletest: Make diagnostic kind mandatory on line annotationsVadim Petrochenkov-9/+15
2025-04-24fix for issue 135412Kivooeo-1/+55
2025-04-14Normalize ADT fields in find_tails_for_unsizingMichael Goulet-0/+32
2025-04-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-2/+2
2025-03-21cleaned and organized 3 tests in `./tests/ui/issues`Spencer-0/+36
2025-02-24Consolidate and rework CoercePointee and DispatchFromDyn errorsMichael Goulet-4/+9
2025-01-31Rework "long type names" printing logicEsteban Küber-3/+3
Make it so more type-system types can be printed in a shortened version (like `Predicate`s). Centralize printing the information about the "full type name path". Make the "long type path" for the file where long types are written part of `Diag`, so that it becomes easier to keep track of it, and ensure it will always will be printed out last in the diagnostic by making its addition to the output implicit. Tweak the shortening of types in "expected/found" labels. Remove dead file `note.rs`.
2024-12-12Tweak multispan renderingEsteban Küber-2/+1
Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments.
2024-12-03Auto merge of #133321 - compiler-errors:const-checker, r=wesleywiserbors-69/+16
Get rid of HIR const checker As far as I can tell, the HIR const checker was implemented in https://github.com/rust-lang/rust/pull/66170 because we were not able to issue useful const error messages in the MIR const checker. This seems to have changed in the last 5 years, probably due to work like #90532. I've tweaked the diagnostics slightly and think the error messages have gotten *better* in fact. Thus I think the HIR const checker has reached the end of its usefulness, and we can retire it. cc `@RalfJung`
2024-11-26Rollup merge of #133470 - jieyouxu:ugly, r=compiler-errorsGuillaume Gomez-9/+1
Cleanup: delete `//@ pretty-expanded` directive This PR removes the `//@ pretty-expanded` directive support in compiletest and removes its usage inside ui tests because it does not actually do anything, and its existence is itself misleading. This PR is split into two commits: 1. The first commit just drops `pretty-expanded` directive support in compiletest. 2. The second commit is created by `sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs`[^1], reblessing, and slightly adjusting some leading whitespace in a few tests. We can tell this is fully removed because compiletest doesn't complain about unknown directive when running the `ui` test suite. cc #23616 ### History Originally, there was some effort to introduce more test coverage for `-Z unpretty=expanded` (in 2015 this was called `--pretty=expanded`). In [Make it an error to not declare used features #23598][pr-23598], there was a flip from `//@ no-pretty-expanded` (opt-out of `-Z unpretty=expanded` test) to `//@ pretty-expanded` (opt-in to `-Z unpretty=expanded` test). This was needed because back then the dedicated `tests/pretty` ("pretty") test suite did not existed, and the pretty tests were grouped together under `run-pass` tests (I believe the `ui` test suite didn't exist back then either). Unfortunately, in this process the replacement `//@ pretty-expanded` directives contained a `FIXME #23616` linking to [There are very few tests for `-Z unpretty` expansion #23616][issue-23616]. But this was arguably backwards and somewhat misleading, as noted in [#23616](https://github.com/rust-lang/rust/issues/23616#issuecomment-484999901): The attribute is off by default and things just work if you don't test it, people have not been adding the `pretty-expanded` annotation to new tests even if it would work. Which basically renders this useless. ### Current status As of Nov 2024, we have a dedicated `pretty` test suite, and some time over the years the split between `run-pass` into `ui` and `pretty` test suites caused all the `//@ pretty-expanded` in `ui` tests to do absolutely nothing: the compiletest logic for `pretty-expanded` only triggers in the *pretty* test suite, but none of the pretty tests use it. Oops. Nobody remembers this, nobody uses this, it's misleading in ui tests. Let's get rid of this directive altogether. [pr-23598]: https://github.com/rust-lang/rust/pull/23598 [issue-23616]: https://github.com/rust-lang/rust/issues/23616 ### Follow-ups - [x] Yeet this directive from rustc-dev-guide docs. https://github.com/rust-lang/rustc-dev-guide/pull/2147 [^1]: https://github.com/chmln/sd r? compiler
2024-11-26tests: remove `//@ pretty-expanded` usages许杰友 Jieyou Xu (Joe)-9/+1
Done with ```bash sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs ``` and ``` sd '//@pretty-expanded.*\n' '' tests/ui/**/*.rs ```
2024-11-25Tweak parameter mismatch explanation to not say unknownMichael Goulet-1/+1
2024-11-22Get rid of HIR const checkerMichael Goulet-69/+16
2024-11-12add parentheses when unboxing suggestion neededYihai Lin-0/+77
2024-09-26Check allow instantiating object trait binder when upcasting and in new solverMichael Goulet-0/+27
2024-09-16Relate receiver invariantly in method probe for Mode::PathMichael Goulet-15/+4
2024-08-31Inline expected_inputs_for_expected_output into ↵Michael Goulet-0/+5
check_argument_types/check_expr_struct_fields
2024-08-31Use equality when relating formal and expected type in arg checkingMichael Goulet-0/+19
2024-08-19Use subtyping for UnsafeFnPointer coercion, tooMichael Goulet-0/+14
2024-08-06diagnostics: `Box<dyn Trait>` suggestion with multiple matching implMichael Howell-0/+4
The two altered expectation messages both seem like improvements: - `coerce-expect-unsized-ascribed.stderr` says you can go `Box<char> -> Box<dyn Debug>`, which you can. - `upcast_soundness_bug.stderr` used to say that you could go `Box<dyn Trait<u8, u8>> -> Box<dyn Trait>`, which you can't, because the type parameters are missing in the destination and the only ones that work aren't what's needed.
2024-06-17Remove windows-specific copy of testOli Scherer-88/+10
2024-06-17Use subtyping instead of equality, since method resolution also uses subtypingOli Scherer-8/+20
2024-05-13Add test for dynamic dispatch + Pin::new soundnessAlice Ryhl-0/+28
2024-05-05Auto merge of #123125 - gurry:122561-bad-note-non-zero-loop-iters-2, r=estebankbors-0/+409
Remove suggestion about iteration count in coerce Fixes #122561 The iteration count-centric suggestion was implemented in PR #100094, but it was based on the wrong assumption that the type mismatch error depends on the number of times the loop iterates. As it turns out, that is not true (see this comment for details: https://github.com/rust-lang/rust/pull/122679#issuecomment-2017432531) This PR attempts to remedy the situation by changing the suggestion from the one centered on iteration count to a simple suggestion to add a return value. It should also fix #100285 by simply making it redundant.
2024-05-03We do not coerce &mut &mut T -> *mut mut TJubilee Young-0/+62
2024-04-30Remove note about iteration count in coerceGurinder Singh-0/+409
and replace it with a simple note suggesting returning a value. The type mismatch error was never due to how many times the loop iterates. It is more because of the peculiar structure of what the for loop desugars to. So the note talking about iteration count didn't make sense
2024-04-21Move some testsCaio-0/+126