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

Add note for possible crate mismatches in type errors #28300

Merged
merged 6 commits into from
Sep 9, 2015

Conversation

Manishearth
Copy link
Member

Partially fixes #22750

I'll write a test for this when I figure out how to.

r? @eddyb

cc @steveklabnik

self.tcx.sess.note("errrr0");
report_path_match(exp_found.expected, exp_found.found);
},
_ => () // FIXME(Manishearth) handle traits and stuff
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC all FIXMEs should have an associated issue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, it's the same bug (since this is only a partial fix)

@steveklabnik
Copy link
Member

So excited for this patch to land!

The messages look good to me.

let report_path_match = |did1: DefId, did2: DefId| {
// Only external crates, if either is from a local
// module we could have false positives
if !(did1.is_local() || did2.is_local()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should check that the crates are different - for example:

fn main() {
    let _ = [{struct Foo; Foo}, {struct Foo; Foo}];
}

The error in the above code will see the path "main::Foo" for both of the two different types.

//~^^ NOTE Perhaps two different versions of crate `main`
a::try_bar(bar2); //~ ERROR mismatched types
//~^ HELP run
//~^^ NOTE Perhaps two different versions of crate `main`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll want to look up the crate names from the crate numbers in the DefIds (and/or find the subset of the path which refers to the extern crate item).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@eddyb
Copy link
Member

eddyb commented Sep 8, 2015

@bors r+

@bors
Copy link
Contributor

bors commented Sep 8, 2015

📌 Commit c65d338 has been approved by eddyb

@bors
Copy link
Contributor

bors commented Sep 9, 2015

⌛ Testing commit c65d338 with merge 7c8ae60...

bors added a commit that referenced this pull request Sep 9, 2015
Partially fixes #22750

I'll write a test for this when I figure out how to.

r? @eddyb

cc @steveklabnik
@bors bors merged commit c65d338 into rust-lang:master Sep 9, 2015
@bors bors mentioned this pull request Sep 9, 2015
@Manishearth Manishearth deleted the crate_err branch December 2, 2016 19:03
@jyn514 jyn514 added the D-crate-version-mismatch Diagnostics: Errors or lints caused be the use of two different crate versions. label Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D-crate-version-mismatch Diagnostics: Errors or lints caused be the use of two different crate versions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Two different versions of a crate interacting leads to unhelpful error messages
5 participants