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

wfcheck: pre-normalization implied bounds are not used. #105948

Open
aliemjay opened this issue Dec 20, 2022 · 1 comment
Open

wfcheck: pre-normalization implied bounds are not used. #105948

aliemjay opened this issue Dec 20, 2022 · 1 comment
Labels
A-implied-bounds Area: Implied bounds / inferred outlives-bounds C-bug Category: This is a bug. T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@aliemjay
Copy link
Member

Here is an inconsistency in behavior between wfcheck and borrowck:

trait Trait { type Ty; }
impl<T> Trait for T { type Ty = (); }

// borrowck is able to assume `T: 'static`:
fn pass<T>(_: <&'static T as Trait>::Ty) { None::<&'static T>; }

// ... while wfcheck can't:
fn fail<T>(_: <&'static T as Trait>::Ty) where &'static T: Sized, {}
//~^ ERROR the parameter type `T` may not live long enough

#100989 Introduced this. I think the intent was to restrict implied bounds from impl headers only, not fn signatures. Cc @lcnr.

@rustbot label C-bug T-types A-implied-bounds

@rustbot rustbot added A-implied-bounds Area: Implied bounds / inferred outlives-bounds C-bug Category: This is a bug. T-types Relevant to the types team, which will review and decide on the PR/issue. labels Dec 20, 2022
@lcnr
Copy link
Contributor

lcnr commented Dec 20, 2022

ah, luckily we only enabled the behavior in #99217 which was merged in the same cycle so it isn't a regression. But yeah, we could soundly consider unnormalized types from fn sigs during wf rn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-implied-bounds Area: Implied bounds / inferred outlives-bounds C-bug Category: This is a bug. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants