Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"help: consider removing" yields an empty suggestion #94192

Closed
Patryk27 opened this issue Feb 20, 2022 · 3 comments · Fixed by #94788
Closed

"help: consider removing" yields an empty suggestion #94192

Patryk27 opened this issue Feb 20, 2022 · 3 comments · Fixed by #94788
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Patryk27
Copy link
Contributor

Patryk27 commented Feb 20, 2022

Hii! 👋

Given the following code:

struct Wrapper<T>(T);

fn foo<T>(foo: Wrapper<T>)
where
    T: ?Sized
{
    //
}

(playground link)

The current output is (there are more messages, but focusing on the only problematic one):

help: consider removing the `?Sized` bound to make the type parameter `Sized`
  |

  |

The suggestion works correctly when the bound is represented as fn foo<T: ?Sized>:

help: consider removing the `?Sized` bound to make the type parameter `Sized`
  |
3 - fn foo<T: ?Sized>(foo: Wrapper<T>) {
3 + fn foo<T>(foo: Wrapper<T>) {
  | 

Checked on current stable, beta & nightly.

@Patryk27 Patryk27 added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 20, 2022
@Patryk27
Copy link
Contributor Author

Whoopsie, I guess this should be marked as a bug, actually:

@rustbot label: +C-bug

@rustbot rustbot added the C-bug Category: This is a bug. label Feb 20, 2022
@compiler-errors
Copy link
Member

This reminds me of #92741

@estebank
Copy link
Contributor

estebank commented Mar 9, 2022

@TaKO8Ki sorry, didn't mean to take this over from you, I happened to be looking at this code. The error that @compiler-errors linked is still there and requires a medium-sized amount of refactoring to properly account for cases like the following:

fn yam<T>(foo: Wrapper<T>)
//~^ ERROR the size for values of type `T` cannot be known at compilation time
where
    T
    :
    ?
    Sized {
    //
}

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 10, 2022
…ochenkov

Account for suggestions for complete removal of lines

Fix  rust-lang#94192.
@bors bors closed this as completed in ac2afa0 Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants