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

Unstable Fn<Args> syntax shouldn't be suggested on T: Fn #136407

Open
cyrgani opened this issue Feb 1, 2025 · 0 comments
Open

Unstable Fn<Args> syntax shouldn't be suggested on T: Fn #136407

cyrgani opened this issue Feb 1, 2025 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@cyrgani
Copy link
Contributor

cyrgani commented Feb 1, 2025

Code

pub fn f<T: Fn>() {}

Current output

error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change
 --> src/lib.rs:1:13
  |
1 | pub fn f<T: Fn>() {}
  |             ^^ help: use parenthetical notation instead: `Fn() -> ()`
  |
  = note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
  = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
  = note: this compiler was built on 2025-01-31; consider upgrading it if it is out of date

error[E0107]: missing generics for trait `Fn`
  --> src/lib.rs:1:13
   |
1  | pub fn f<T: Fn>() {}
   |             ^^ expected 1 generic argument
   |
note: trait defined here, with 1 generic parameter: `Args`
  --> /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:76:11
   |
76 | pub trait Fn<Args: Tuple>: FnMut<Args> {
   |           ^^ ----
help: add missing generic argument
   |
1  | pub fn f<T: Fn<Args>>() {}
   |               ++++++

Desired output

The unstable syntax shouldn't be mentioned.

Rationale and extra context

No response

Other cases

Rust Version

1.86.0-nightly

(2025-01-31 854f22563c8daf92709f)

Anything else?

No response

@cyrgani cyrgani 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 1, 2025
@fmease fmease added the A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` label Feb 2, 2025
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 A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants