-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language team
Description
pub const bar: u8 = 1;
fn foo(bar: bool) { }
gives me a type error, because it resolves bar
to the constant and then realizes it's the wrong type.
Resolving bar
to a constant isn't something that will ever work anyway, because if you write something like
pub const bar: bool = true;
fn foo(bar: bool) { }
it will move on to the "refutable pattern in function argument" error.
We should just not attempt constant resolution for irrefutable patterns.
This is technically a language change -- code that would previously not compile will now compile. cc @rust-lang/lang
Metadata
Metadata
Assignees
Labels
A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language team