Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/rustc_hir_analysis/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ fn recover_infer_ret_ty<'tcx>(
// recursive function definition to leak out into the fn sig.
let mut recovered_ret_ty = None;
if let Some(suggestable_ret_ty) = ret_ty.make_suggestable(tcx, false, None) {
diag.span_suggestion(
diag.span_suggestion_verbose(
infer_ret_ty.span,
"replace with the correct return type",
suggestable_ret_ty,
Expand All @@ -1152,7 +1152,7 @@ fn recover_infer_ret_ty<'tcx>(
tcx.param_env(def_id),
ret_ty,
) {
diag.span_suggestion(
diag.span_suggestion_verbose(
infer_ret_ty.span,
"replace with an appropriate return type",
sugg,
Expand Down
36 changes: 23 additions & 13 deletions tests/ui/const-generics/generic_arg_infer/in-signature.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,39 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
--> $DIR/in-signature.rs:6:21
|
LL | fn arr_fn() -> [u8; _] {
| -----^-
| | |
| | not allowed in type signatures
| help: replace with the correct return type: `[u8; 3]`
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - fn arr_fn() -> [u8; _] {
LL + fn arr_fn() -> [u8; 3] {
|

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/in-signature.rs:11:24
|
LL | fn ty_fn() -> Bar<i32, _> {
| ---------^-
| | |
| | not allowed in type signatures
| help: replace with the correct return type: `Bar<i32, 3>`
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - fn ty_fn() -> Bar<i32, _> {
LL + fn ty_fn() -> Bar<i32, 3> {
|

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/in-signature.rs:16:25
|
LL | fn ty_fn_mixed() -> Bar<_, _> {
| ----^--^-
| | | |
| | | not allowed in type signatures
| | not allowed in type signatures
| help: replace with the correct return type: `Bar<i32, 3>`
| ^ ^ not allowed in type signatures
| |
| not allowed in type signatures
|
help: replace with the correct return type
|
LL - fn ty_fn_mixed() -> Bar<_, _> {
LL + fn ty_fn_mixed() -> Bar<i32, 3> {
|

error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
--> $DIR/in-signature.rs:21:20
Expand Down
11 changes: 7 additions & 4 deletions tests/ui/error-codes/E0121.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
--> $DIR/E0121.rs:1:13
|
LL | fn foo() -> _ { 5 }
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `i32`
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - fn foo() -> _ { 5 }
LL + fn foo() -> i32 { 5 }
|

error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables
--> $DIR/E0121.rs:3:13
Expand Down
21 changes: 13 additions & 8 deletions tests/ui/fn/issue-80179.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,26 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
--> $DIR/issue-80179.rs:10:24
|
LL | fn returns_fn_ptr() -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `fn() -> i32`
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - fn returns_fn_ptr() -> _ {
LL + fn returns_fn_ptr() -> fn() -> i32 {
|

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/issue-80179.rs:18:25
|
LL | fn returns_closure() -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with an appropriate return type: `impl Fn() -> i32`
| ^ not allowed in type signatures
|
= note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html
help: replace with an appropriate return type
|
LL - fn returns_closure() -> _ {
LL + fn returns_closure() -> impl Fn() -> i32 {
|

error: aborting due to 2 previous errors

Expand Down
30 changes: 18 additions & 12 deletions tests/ui/fn/suggest-return-closure.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,40 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
--> $DIR/suggest-return-closure.rs:1:17
|
LL | fn fn_once() -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with an appropriate return type: `impl FnOnce()`
| ^ not allowed in type signatures
|
= note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html
help: replace with an appropriate return type
|
LL - fn fn_once() -> _ {
LL + fn fn_once() -> impl FnOnce() {
|

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/suggest-return-closure.rs:13:16
|
LL | fn fn_mut() -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with an appropriate return type: `impl FnMut(char)`
| ^ not allowed in type signatures
|
= note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html
help: replace with an appropriate return type
|
LL - fn fn_mut() -> _ {
LL + fn fn_mut() -> impl FnMut(char) {
|

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/suggest-return-closure.rs:33:13
|
LL | fn fun() -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with an appropriate return type: `impl Fn() -> i32`
| ^ not allowed in type signatures
|
= note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html
help: replace with an appropriate return type
|
LL - fn fun() -> _ {
LL + fn fun() -> impl Fn() -> i32 {
|

error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/suggest-return-closure.rs:24:9
Expand Down
22 changes: 14 additions & 8 deletions tests/ui/fn/suggest-return-future.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
--> $DIR/suggest-return-future.rs:7:13
|
LL | fn foo() -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with an appropriate return type: `impl Future<Output = i32>`
| ^ not allowed in type signatures
|
help: replace with an appropriate return type
|
LL - fn foo() -> _ {
LL + fn foo() -> impl Future<Output = i32> {
|

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/suggest-return-future.rs:15:13
|
LL | fn bar() -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with an appropriate return type: `impl Future<Output = i32>`
| ^ not allowed in type signatures
|
help: replace with an appropriate return type
|
LL - fn bar() -> _ {
LL + fn bar() -> impl Future<Output = i32> {
|

error: aborting due to 2 previous errors

Expand Down
44 changes: 28 additions & 16 deletions tests/ui/return/infer-return-ty-for-fn-sig-issue-125488.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,49 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
--> $DIR/infer-return-ty-for-fn-sig-issue-125488.rs:8:24
|
LL | fn f1(s: S<'_>) -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `S<'_>`
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - fn f1(s: S<'_>) -> _ {
LL + fn f1(s: S<'_>) -> S<'_> {
|

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/infer-return-ty-for-fn-sig-issue-125488.rs:13:24
|
LL | fn f2(s: S<'_>) -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `S<'_>`
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - fn f2(s: S<'_>) -> _ {
LL + fn f2(s: S<'_>) -> S<'_> {
|

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/infer-return-ty-for-fn-sig-issue-125488.rs:23:24
|
LL | fn f3(s: S<'_>) -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `S<'_>`
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - fn f3(s: S<'_>) -> _ {
LL + fn f3(s: S<'_>) -> S<'_> {
|

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/infer-return-ty-for-fn-sig-issue-125488.rs:28:24
|
LL | fn f4(s: S<'_>) -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `S<'_>`
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - fn f4(s: S<'_>) -> _ {
LL + fn f4(s: S<'_>) -> S<'_> {
|

error: aborting due to 4 previous errors

Expand Down
11 changes: 7 additions & 4 deletions tests/ui/suggestions/return-cycle-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
--> $DIR/return-cycle-2.rs:6:34
|
LL | fn as_ref(_: i32, _: i32) -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `Token<&'static T>`
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - fn as_ref(_: i32, _: i32) -> _ {
LL + fn as_ref(_: i32, _: i32) -> Token<&'static T> {
|

error: aborting due to 1 previous error

Expand Down
11 changes: 7 additions & 4 deletions tests/ui/suggestions/return-cycle.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
--> $DIR/return-cycle.rs:6:17
|
LL | fn new() -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `Token<()>`
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - fn new() -> _ {
LL + fn new() -> Token<()> {
|

error: aborting due to 1 previous error

Expand Down
11 changes: 7 additions & 4 deletions tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
--> $DIR/suggest-fn-ptr-for-fn-item-in-fn-ret.rs:7:13
|
LL | fn bar() -> _ { Wrapper(foo) }
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `Wrapper<fn()>`
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - fn bar() -> _ { Wrapper(foo) }
LL + fn bar() -> Wrapper<fn()> { Wrapper(foo) }
|

error: aborting due to 1 previous error

Expand Down
11 changes: 7 additions & 4 deletions tests/ui/type-alias-impl-trait/issue-77179.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
--> $DIR/issue-77179.rs:8:22
|
LL | fn test() -> Pointer<_> {
| --------^-
| | |
| | not allowed in type signatures
| help: replace with the correct return type: `Pointer<i32>`
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - fn test() -> Pointer<_> {
LL + fn test() -> Pointer<i32> {
|

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
--> $DIR/issue-77179.rs:19:25
Expand Down
22 changes: 14 additions & 8 deletions tests/ui/typeck/issue-80779.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
--> $DIR/issue-80779.rs:10:28
|
LL | pub fn g(_: T<'static>) -> _ {}
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `()`
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - pub fn g(_: T<'static>) -> _ {}
LL + pub fn g(_: T<'static>) -> () {}
|

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/issue-80779.rs:5:29
|
LL | pub fn f<'a>(val: T<'a>) -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `()`
| ^ not allowed in type signatures
|
help: replace with the correct return type
|
LL - pub fn f<'a>(val: T<'a>) -> _ {
LL + pub fn f<'a>(val: T<'a>) -> () {
|

error: aborting due to 2 previous errors

Expand Down
Loading
Loading