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

ICE: translating unsupported cast: () (cast_other) -> uint (cast_integral) #10991

Closed
klutzy opened this issue Dec 16, 2013 · 2 comments · Fixed by #14854
Closed

ICE: translating unsupported cast: () (cast_other) -> uint (cast_integral) #10991

klutzy opened this issue Dec 16, 2013 · 2 comments · Fixed by #14854
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@klutzy
Copy link
Contributor

klutzy commented Dec 16, 2013

fn f<T>(v: T) -> T {
    v
}
fn main() {
    let _ = f(()) as uint;
}
error: internal compiler error: translating unsupported cast: () (cast_other) -> uint (cast_integral)
@flaper87 flaper87 added the I-ICE label Apr 23, 2014
@flaper87
Copy link
Contributor

triage: still an issue.

@klutzy
Copy link
Contributor Author

klutzy commented Jun 9, 2014

Still an issue.

Smaller test case:

fn main() {
    let nil = ();
    let _t = nil as uint;
}

Cross-crate example:

a.rs:

#![crate_type = "lib"]

pub fn f<T>(_v: T) {
    let nil = ();
    let _t = nil as uint; // this should be an error here
}

b.rs:

extern crate a;

fn main() {
    a::f(1u8);
}

a.rs compiles without error, but calling a::f causes error.

matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Nov 16, 2022
…y, r=Veykril

fix: check visibility of each path segment

Upon path resolution, we have not been checking if every def pointed to by each segment of the path is visible from the original module. This leads to incorrect import resolutions, in particular when one uses glob imports and names collide.

There is decent amount of changes in this PR because:
- some of our tests were not correct in terms of visibility
  - I left several basic nameres tests as-is (with expect test updated) since I thought it would be nice to ensure we don't resolve defs that are not visible.
- `fix_visibility` assist relied on `Semantics::resolve_path()`, which uses the name resolution procedure I'm fixing and wouldn't be able to "see through" the items with strict visibility with this patch

The first commit is the gist of the fix itself.

Fixes rust-lang#10991
Fixes rust-lang#11473
Fixes rust-lang#13252
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants