Commit Graph

112 Commits

Author SHA1 Message Date
Jonathan Brouwer f3e57a2264 Rollup merge of #156145 - danieljofficial:move-tests-cast, r=jieyouxu
Move tests cast

Hi, I have moved some type casting tests into the correct directory. Please find time to review
2026-05-12 18:53:38 +02:00
danieljofficial 7a876ac418 add helpful comments to tests 2026-05-12 10:12:43 +01:00
danieljofficial 32a3612a2b add issue links and bless 2026-05-12 08:39:45 +01:00
Jaiden Magnan 0f5d89fea1 fix: CopyPriority addition 2026-05-05 17:34:50 -04:00
Jaiden Magnan 61743bf3b0 fix: adding more verbose error message 2026-05-05 16:19:41 -04:00
danieljofficial d2cb145659 move type casting related tests into its dedicated folder 2026-05-04 15:45:31 +01:00
Jaiden Magnan 9f43e6dafa feat: fixing PR feedback 2026-04-26 15:07:48 -04:00
Jaiden Magnan 53f0ce84b2 fix: add the HELP message 2026-04-26 15:05:51 -04:00
Jaiden Magnan da133533ed fix: more descriptive error message for enum to integer 2026-04-26 15:05:51 -04:00
Alan Egerton c43a33eec7 Feed ErrorGuaranteed from late lifetime resolution to RBV
If late lifetime resolution fails for whatever reason, forward to RBV
the guarantee that an error was emitted - thereby eliminating the need
for a "hack" to suppress subsequent/superfluous error diagnostics.
2026-02-13 16:24:39 +00:00
Yuki Okushi aa7c785e8a Add note for ?Sized params in int-ptr casts diag 2026-02-05 21:32:13 +09:00
delta17920 7ba1e3ec7d filename changes 2026-01-21 13:44:01 +00:00
tuturuu 2c7969a0cd add metadata and bless moved tests 2026-01-18 06:23:47 +01:00
tuturuu cf5a7da23f move some tests 2026-01-18 06:23:47 +01:00
Boxy Uwu 3d965bdc28 Convert static lifetime to an nll var 2026-01-07 13:27:12 +00:00
reddevilmidzy 93f8ad9950 cleaned up some tests
cleaned up cast-enum-const.rs

cleaned up ufcs-trait-object-format.rs

add comment to cast-to-box-arr.rs

add comment to shadow-primitives.rs

add comment to associated-type-const-nomalization.rs

add comment to fn-trait-explicit-call.rs

add comment to call-unit-struct-impl-fn-once.rs

add comment to cast-to-char-compare.rs

add comment to self-in-method-body-resolves.rs

add comment to derive-debug-newtype-unsized-slice.rs

add comment to tuple-ref-order-distinct-impls.rs

add comment to derive-debug-generic-with-lifetime.rs

add comment to recursive-trait-bound-on-type-param.rs

cleaned up const-static-ref-to-closure.rs

add comment to const-iter-no-conflict-for-loop.rs
2026-01-05 15:35:01 +09:00
reddevilmidzy 5c5c1ff6db moved some test
delete tests/ui/issues/issue-22426.rs duplicated of tests/ui/match/guards.rs
2026-01-05 10:04:46 +09:00
reddevilmidzy 4578082361 Cleaned up some tests
add comment to closure-move-use-after-move-diagnostic.rs

add comment to missing-operator-after-float.rs

add comment to closure-array-break-length.rs

add comment to box-lifetime-argument-not-allowed.rs

add comment to const-return-outside-fn.rs

add comment to drop-conflicting-impls.rs

add comment to unbalanced-doublequote-2.rs

add comment to borrow-immutable-deref-box.rs

add comment to for-in-const-eval.rs

add comment to borrowck-annotated-static-lifetime.rs

cleaned up cast-rfc0401.rs

add comment to nll-anon-to-static.rs

add comment to cast-to-dyn-any.rs

add comment to missing-associated-items.rs

add comment to enum-discriminant-missing-variant.rs
2025-12-23 21:13:24 +09:00
reddevilmidzy 7ca2eb9c6f moved test 2025-12-23 20:33:37 +09:00
Boxy 85aeb4f259 Forbid object lifetime changing pointer casts 2025-12-10 09:38:56 +00:00
lcnr e1be0d2e2a MIR typeck: invariant ctxt fast path
This removes variance information from some diagnostics. However,
that variance information is not actually relevant here. Casting
`*const dyn Cat<'a>` to `*const S<dyn Cat<'static>>` is an error
regardless of whether `S` requires its argument to be invariant.
Wide-pointer casts always require the trait object arguments to be
invariant.
2025-12-04 15:43:05 +01:00
xonx4l 4b000cfacd Merge E0412 into E0425 2025-12-02 18:25:13 +00:00
Guillaume Gomez 725f4ad24b Allow function_casts_as_integer in non-related ui tests 2025-11-10 16:38:28 +01:00
Scott Schafer 9c6897bd07 test: Subtract code_offset from width for ui_testing 2025-10-02 05:45:16 -06:00
Matthias Krüger 47f1df5ca3 Rollup merge of #145676 - Oneirical:uncountable-integer-9, r=jieyouxu
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-29 12:37:30 +02:00
Oneirical 2dc4638c46 Add test batch 2 2025-08-27 15:06:05 -04:00
Oneirical 2e659f5894 Add test batch 1 2025-08-27 00:23:26 -04:00
Karol Zwolak d14b83e378 bless tests with new lint messages 2025-08-19 21:27:10 +02:00
Jacob Pratt 5bd4e832d3 Rollup merge of #144553 - Oneirical:uncountable-integer-4, r=jieyouxu
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-10 15:43:52 -04:00
Oneirical aa543963c6 Rehome tests/ui/issues/ tests [4/?] 2025-08-10 11:54:15 -04:00
Kivooeo b6e13e3591 comments 2025-08-05 19:34:46 +05:00
Kivooeo 62c92f30cf moved 35 tests to organized locations 2025-08-05 19:02:23 +05:00
Oneirical 807d3406c2 Rehome tests/ui/issues/ tests [2/?] 2025-08-02 15:29:16 -04:00
Oneirical a924d44115 Rehome tests/ui/issues/ tests [1/?] 2025-07-24 17:01:44 -04:00
León Orell Valerian Liehr fe420b05e3 Rollup merge of #143678 - Kivooeo:char-overflow, r=SparrowLii
Added error for invalid char cast

fixes rust-lang/rust#143597

not really sure if I did it right, but according to cast-char test -- it is right, also this code gave me false positive result

```
for _ in 0..(256 as u8) {}
```

so this is why I added this check `if lit_val <= 0xFF`

Also I believe that error message could be improved, but I'm not sure how exactly

cc ```@hkBst```

r? compiler
2025-07-17 03:58:31 +02:00
Kivooeo 98934707eb cleaned up some tests
Additionally, remove unused `tests/ui/auxiliary/svh-*` crates that are duplicates of `tests/ui/svh/auxiliary/svh-*`.
2025-07-13 00:03:31 +05:00
Kivooeo 47b8a32ca3 moved tests 2025-07-13 00:03:31 +05:00
Kivooeo 81a6f18940 added error for invalid char cast 2025-07-10 15:44:36 +05:00
Kivooeo da5c6395da cleaned up some tests 2025-07-01 15:16:56 +05:00
Kivooeo 4feb5de34c moved tests 2025-06-30 00:03:28 +05:00
Michael Goulet 250b5d204f Make missing lifetime suggestion verbose 2025-06-24 18:59:42 +00:00
Esteban Küber 3c049e21ca reword suggestion message 2025-06-06 20:52:34 +00:00
Esteban Küber 24dcfaf71f Make cast suggestions verbose
```
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-06 19:53:12 +00:00
xizheyin 17352e6937 Note ref expr being cast when encounter NonScalar cast error
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-31 12:19:55 +08:00
xizheyin 31ee840000 Add ui test func-pointer-issue-140491
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-24 16:33:02 +08:00
Michael Goulet 636a138cda Structurally resolve in check_ref_cast 2025-05-06 19:30:55 +00:00
Vadim Petrochenkov 20faf8532b compiletest: Make diagnostic kind mandatory on line annotations 2025-04-30 10:44:24 +03:00
Jacob Pratt 60c76b9dfd Rollup merge of #138962 - xizheyin:issue-138836, r=compiler-errors
Expect an array when expected and acutal types are both arrays during cast

Closes #138836
2025-04-13 17:37:52 -04:00
Vadim Petrochenkov 06dd9e2d20 compiletest: Trim the value of dont-require-annotations 2025-04-10 23:48:57 +03:00
Vadim Petrochenkov 0ca31277f3 compiletest: Make SUGGESTION annotations viral 2025-04-10 23:48:57 +03:00