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

Support phantom types inside a method body #1

Open
dtolnay opened this issue Dec 23, 2018 · 0 comments
Open

Support phantom types inside a method body #1

dtolnay opened this issue Dec 23, 2018 · 0 comments

Comments

@dtolnay
Copy link
Owner

dtolnay commented Dec 23, 2018

The poor interaction between method bodies and handling of relative paths in use statements in Rust makes this extremely challenging or (I currently believe) impossible to support. Doesn't hurt to have an issue though:

use ghost::phantom;

fn main() {
    #[phantom]
    struct MyPhantom<T>;
}
error[E0432]: unresolved import `super::MyPhantom`
 --> src/main.rs:5:12
  |
5 |     struct MyPhantom<T>;
  |            ^^^^^^^^^ maybe a missing `extern crate MyPhantom;`?

error[E0432]: unresolved import `self`
 --> src/main.rs:4:5
  |
4 |     #[phantom]
  |     ^^^^^^^^^^ maybe a missing `extern crate __value_MyPhantom;`?
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

1 participant