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

Comments

Projects
None yet
3 participants
@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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented May 5, 2016

triage: P-high

@rust-highfive rust-highfive added P-high and removed I-nominated labels May 5, 2016

arielb1 added a commit to arielb1/rust that referenced this issue May 7, 2016

arielb1 added a commit to arielb1/rust that referenced this issue May 10, 2016

arielb1 added a commit to arielb1/rust that referenced this issue May 11, 2016

arielb1 added a commit to arielb1/rust that referenced this issue May 14, 2016

@bors bors closed this in 5c39a2a May 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.