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

Some ty::sty values are being inferred as ast::ty_ #2316

Closed
bleibig opened this issue Apr 27, 2012 · 4 comments
Closed

Some ty::sty values are being inferred as ast::ty_ #2316

bleibig opened this issue Apr 27, 2012 · 4 comments

Comments

@bleibig
Copy link
Contributor

bleibig commented Apr 27, 2012

Consider this program:

use rustc;
import rustc::middle::ty;
fn main() {
    let _t: ty::sty = ty::ty_nil;
}

It fails to compile with this error:

infer_err.rs:4:22: 4:32 error: mismatched types: expected `rustc::middle::ty::sty` but found `rustsyntax::ast::ty_` (enum rustc::middle::ty::sty vs enum rustsyntax::ast::ty_)
infer_err.rs:4     let _t: ty::sty = ty::ty_nil;
                                     ^~~~~~~~~~

This happens for other ty::sty variants such as ty::ty_nil and ty::ty_bool, but not for ty::ty_type and possibly some others. It's also worth noting that this might only happen outside the rustc crate, as I could not reproduce this error by doing similar things inside rustc.

@ghost ghost assigned catamorphism Apr 30, 2012
@catamorphism
Copy link
Contributor

I'm looking at this.

@catamorphism
Copy link
Contributor

Interestingly, I get the same type error if I change it to:

use rustc;
import rustc::middle::ty;
fn main() {
  let _t: ty::sty = rustc::middle::ty::ty_nil;
}

which rules out my first hypothesis that it was a resolve issue.

@catamorphism
Copy link
Contributor

A fine bug! Not in type inference, it turns out, but in resolve. You'll notice that middle::ty glob-imports syntax::ast::*; both middle::ty and syntax::ast define a value ty_nil, and it happened that in the export declaration export ty_nil in middle::ty, the name ty_nil was resolved to ast::ty_nil. Which is what caused the type error.

I have a fix, just waiting for make check.

@catamorphism
Copy link
Contributor

Fixed in 164039e

bors added a commit to rust-lang-ci/rust that referenced this issue Sep 22, 2022
Clarify the effect of the `-Zmiri-track-pointer-tag` flag in the README

Edit the README to explicitly say that the `-Zmiri-track-pointer-tag` flag also tracks the creation of tags, not just when they are popped/invalidated.

Related to rust-lang/miri#2308 / Manishearth/triomphe#38.
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