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

Obligation caching allows for unsound coinductive matching #33344

Closed
arielb1 opened this issue May 2, 2016 · 2 comments
Closed

Obligation caching allows for unsound coinductive matching #33344

arielb1 opened this issue May 2, 2016 · 2 comments
Assignees
Labels
I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@arielb1
Copy link
Contributor

arielb1 commented May 2, 2016

STR

trait Tweedledum: IntoIterator {}
trait Tweedledee: IntoIterator {}

impl<T: Tweedledum> Tweedledee for T {}
impl<T: Tweedledee> Tweedledum for T {}

trait Combo: IntoIterator {}
impl<T: Tweedledee + Tweedledum> Combo for T {}

fn is_ee<T: Combo>(t: T) {
    t.into_iter();
}

fn main() {
    is_ee(4);
}

Expected Result

This should not compile, as adding where T: Tweedledum to is_ee demonstrates.

Actual Result

This typecks and fails on trans. A variant using : 'static compiles but is unsound.

Analysis

The current scheme for within-tree obligation caching checks in a very deliberate (and slow) way that obligations are not satisfied by their parents, but it allows sibling obligations to satisfy each-other.

@arielb1 arielb1 self-assigned this May 2, 2016
@arielb1 arielb1 added I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness labels May 2, 2016
@arielb1
Copy link
Contributor Author

arielb1 commented May 2, 2016

cc @nikomatsakis

I think the best way to fix this would be to move in-fulfillcx caching to the obligation forest and check for cycles in compress.

@nikomatsakis
Copy link
Contributor

triage: P-high

@rust-highfive rust-highfive added P-high High priority and removed I-nominated labels May 5, 2016
@bors bors closed this as completed in 5c39a2a May 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness P-high High priority 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

3 participants