diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-11-11 20:51:38 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-11 20:51:38 +0530 |
| commit | bc9567fbf67977621663612450dc16a9fd4262a6 (patch) | |
| tree | 0ae4d6b662e806664ae1dc1fcc409a8a7e52a4a6 /src/test/ui | |
| parent | 978e7abeceed3c4d0d6c729c9e492890f478e8e1 (diff) | |
| parent | 449a4404f5216a085cc0aa89042b39a4bdff5b51 (diff) | |
| download | rust-bc9567fbf67977621663612450dc16a9fd4262a6.tar.gz rust-bc9567fbf67977621663612450dc16a9fd4262a6.zip | |
Rollup merge of #103445 - fmease:fix-50291, r=estebank
`#[test]`: Point at return type if `Termination` bound is unsatisfied Together with #103142 (already merged) this fully fixes #50291. I don't consider my current solution of changing a few spans “here and there” very clean since the failed obligation is a `FunctionArgumentObligation` and we point at a type instead of a function argument. If you agree with me on this point, I can offer to keep the spans of the existing nodes and instead inject `let _: AssertRetTyIsTermination<$ret_ty>;` (type to be defined in `libtest`) similar to `AssertParamIsEq` etc. used by some built-in derive-macros. I haven't tried that approach yet though and cannot promise that it would actually work out or be “cleaner” for that matter. ````@rustbot```` label A-libtest A-diagnostics r? ````@estebank````
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr index 6ee32314607..9577952119a 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr @@ -1,12 +1,10 @@ error[E0277]: the trait bound `f32: Termination` is not satisfied - --> $DIR/termination-trait-test-wrong-type.rs:6:1 + --> $DIR/termination-trait-test-wrong-type.rs:6:31 | -LL | #[test] - | ------- in this procedural macro expansion -LL | / fn can_parse_zero_as_f32() -> Result<f32, ParseFloatError> { -LL | | "0".parse() -LL | | } - | |_^ the trait `Termination` is not implemented for `f32` +LL | #[test] + | ------- in this procedural macro expansion +LL | fn can_parse_zero_as_f32() -> Result<f32, ParseFloatError> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Termination` is not implemented for `f32` | = note: required for `Result<f32, ParseFloatError>` to implement `Termination` note: required by a bound in `assert_test_result` |
