Skip to content
New issue

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

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

Already on GitHub? # to your account

Warn for type parameter defaults on impl blocks #31543

Closed
bluss opened this issue Feb 10, 2016 · 3 comments · Fixed by #32817
Closed

Warn for type parameter defaults on impl blocks #31543

bluss opened this issue Feb 10, 2016 · 3 comments · Fixed by #32817
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@bluss
Copy link
Member

bluss commented Feb 10, 2016

If I understand correctly, type parameter defaults have no effect in the block impl<T = default> Foo<T> { }.

Just like in PR #30724, this should have a warning and then an error.

Example (playground)

use std::marker::PhantomData;

struct Foo<T> {
    x: PhantomData<T>,
}

impl<T = i32> Foo<T> {
    pub fn new() -> Self {
        Foo { x: PhantomData }
    }
}

fn main() {
    let x = Foo::new();  // error: unable to infer enough type information about `_`
}

cc @nikomatsakis

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Feb 15, 2016
@nikomatsakis
Copy link
Contributor

Argh, I guess I failed to cover those?

@nikomatsakis nikomatsakis added I-nominated T-lang Relevant to the language team, which will review and decide on the PR/issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 15, 2016
@nikomatsakis
Copy link
Contributor

Nominating for triage.

@nikomatsakis
Copy link
Contributor

triage: P-high

@nikomatsakis nikomatsakis self-assigned this Mar 17, 2016
@rust-highfive rust-highfive added P-high High priority and removed I-nominated labels Mar 17, 2016
bors added a commit that referenced this issue Apr 13, 2016
…akis

Warn for type parameter defaults on impl blocks

Warn for type parameter defaults on impl blocks (fixes #31543).
r? @nikomatsakis
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants