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

#[derive] generates unnecessary bound when field is associated type #50729

Closed
durka opened this issue May 14, 2018 · 1 comment
Closed

#[derive] generates unnecessary bound when field is associated type #50729

durka opened this issue May 14, 2018 · 1 comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@durka
Copy link
Contributor

durka commented May 14, 2018

With this struct:

#[derive(Debug)]
struct Foo<T: std::str::FromStr> {
    field: T::Err,
}

The only bound needed on the generated impl is where T::Err: Debug. However, the generated code contains where T: Debug, T::Err: Debug. Why is the first one necessary? The deriving code already scans the field types to find T::Err so it should be able to see that bare T is not mentioned.

cc #26925

@XAMPPRocky XAMPPRocky added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 2, 2018
@fmease
Copy link
Member

fmease commented Dec 21, 2024

This is simply an instance of #26925 (Ctrl+F for assoc, perfect deriving, T::, etc.) which you've already cc'ed. Closing as duplicate of it.

@fmease fmease closed this as completed Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-enhancement Category: An issue proposing an enhancement or a PR with one. 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

3 participants