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

we still sometimes permit coercion into ! #50350

Closed
nikomatsakis opened this issue Apr 30, 2018 · 3 comments
Closed

we still sometimes permit coercion into ! #50350

nikomatsakis opened this issue Apr 30, 2018 · 3 comments
Assignees
Labels
T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Apr 30, 2018

While looking into the precise behavior around ! for #47291, we realized that we still sometimes permit coercion into !, in the coerce_lub code:

// Any expression that produces a value of type `!` must have diverged
if ty.is_never() {
self.diverges.set(self.diverges.get() | Diverges::Always);
}

@arielb1 tried to remove that earlier #45880 but we missed this case.

@nikomatsakis nikomatsakis added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 30, 2018
@nikomatsakis
Copy link
Contributor Author

cc #35121

@nikomatsakis
Copy link
Contributor Author

It'd be nice to remove this paragraph from the comment on the diverges field, too:

    /// - To permit assignment into a local variable or other place
    ///   (including the "return slot") of type `!`.  This is allowed
    ///   if **either** the type of value being assigned is `!`, which
    ///   means the current code is dead, **or** the expression's
    ///   diverging flag is true, which means that a diverging value was
    ///   wrapped (e.g., `let x: ! = foo(return)`).

@nikomatsakis
Copy link
Contributor Author

cc @varkor -- who may do this =)

@varkor varkor self-assigned this Apr 30, 2018
bors added a commit that referenced this issue May 1, 2018
Remove vestigial diverging !-coercion

Such conversions are no longer permitted. Fixes #50350.

r? @nikomatsakis
bors added a commit that referenced this issue May 15, 2018
Remove vestigial diverging !-coercion

Such conversions are no longer permitted. Fixes #50350.

r? @nikomatsakis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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