ghost icon indicating copy to clipboard operation
ghost copied to clipboard

Support phantom types inside a method body

Open dtolnay opened this issue 6 years ago • 0 comments

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;`?

dtolnay avatar Dec 23 '18 22:12 dtolnay