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

A deref obligation #105

Closed
leoyvens opened this issue Mar 27, 2018 · 1 comment
Closed

A deref obligation #105

leoyvens opened this issue Mar 27, 2018 · 1 comment

Comments

@leoyvens
Copy link
Contributor

Deref is not well integrated into typeck, all derefs must be eagerly checked causing problems even in a simpe program such as:

use std::sync::Arc;

fn main() {
    let mut a = Default::default();
    // Works if the lines are swapped.
    let b = *a;
    a = Arc::new(0);
}

The type of a will not be inferred because derefs error if they find a type variable. There are probably good reasons of why this difficult to support, but hopefully chalk has a better chance at supporting derefs as obligations. I'll start by implementing Deref as domain goal.

@nikomatsakis
Copy link
Contributor

Closing this for now. I think handling coercions is probably pretty squarely future work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants