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

downcast beta regression #44445

Closed
est31 opened this issue Sep 9, 2017 · 4 comments
Closed

downcast beta regression #44445

est31 opened this issue Sep 9, 2017 · 4 comments
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. relnotes Marks issues that should be documented in the release notes of the next release. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@est31
Copy link
Member

est31 commented Sep 9, 2017

The tests of the downcast crate version 0.9.0 fail on latest beta 1.21, while they work on stable. The error output (full log):

error[E0310]: the parameter type `X` may not live long enough
  --> examples/with_params.rs:11:1
   |
11 | downcast!(<X> Animal<X> where X: Debug);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider adding an explicit lifetime bound `X: 'static`...
note: ...so that the type `Animal<X> + 'static` will meet its required lifetime bounds
  --> examples/with_params.rs:11:1
   |
11 | downcast!(<X> Animal<X> where X: Debug);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: this error originates in a macro outside of the current crate

cc @fkoep

@retep998 retep998 added the regression-from-stable-to-beta Performance or correctness regression from stable to beta. label Sep 9, 2017
@est31
Copy link
Member Author

est31 commented Sep 9, 2017

Using bisect-rust I've bisected the regression to 426711d (#43786). @scalexm @nikomatsakis is this an expected regression?

@scalexm
Copy link
Member

scalexm commented Sep 9, 2017

@fkoep @est31 This is expected, the type parameter X indeed needs a 'static bound so that the trait object type Animal<X> is 'static (required by the StdAny trait). Before #43786, the bound was not checked.

However this code snippet revealed another compiler bug, which may alter the solution I'm proposing (adding a X: 'static where clause). Waiting for a confirmation by @nikomatsakis before we can close this issue.

@arielb1 arielb1 added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 11, 2017
@alexcrichton alexcrichton modified the milestones: 1.22, 1.21 Sep 13, 2017
@nikomatsakis nikomatsakis added the relnotes Marks issues that should be documented in the release notes of the next release. label Sep 14, 2017
@nikomatsakis
Copy link
Contributor

So, this change is indeed correcting a soundness violation (#43784), and the change doesn't appear to have caused widespread breakage. Therefore, we are going to leave the code as is. Tagging as relnotes.


@scalexm

However this code snippet revealed another compiler bug, which may alter the solution I'm proposing

I guess that you are referring to #44454 -- but I think the solution you are proposing is probably still correct, right?

@scalexm
Copy link
Member

scalexm commented Sep 14, 2017

@nikomatsakis yes, just forgot to get back on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. relnotes Marks issues that should be documented in the release notes of the next release. 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

6 participants