-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Internal compiler error: meth::trans_trait_callee given non-bare-rust-fn #26049
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
changing |
@Aatch noted on IRC that this is caused by the |
Minimal test case: #![crate_type="lib"]
trait Foo {
extern fn read_word(&mut self) -> u8;
}
fn do_foo(f: &mut Box<Foo>) -> u8 {
f.read_word()
} |
Interestingly, it seems that this only affects virtual calls, not regular method calls. So doing |
Trying to call methods with a non-Rust ABI on a trait object results in an ICE. While we could try to translate them, it makes more sense to just reject non-Rust ABIs in type-check. This is technically a [breaking-change] due to that fact that we didn't ICE when statically dispatching these method calls. Fixes rust-lang#26049
Bah, my fix causes another test-case to fail. For some reason we allowed extern methods, even though that doesn't really make much sense. Question for the language subteam (@rust-lang/language): Should we not allow these extern methods, even though they're a breaking change, make them trigger object-safety violations or support them in trait objects? |
This no longer ICEs on last night's nightly. |
Compiler ICE
I tried this code:
I expected to see this happen: A syntax error some something, as this seems like dodgy code.
Instead, this happened: Internal Compiler Error
Meta
rustc --version --verbose
:rustc 1.2.0-nightly (613e57b44 2015-06-01) (built 2015-06-01) binary: rustc commit-hash: 613e57b448c88591b6076a8cea9799f1f3876687 commit-date: 2015-06-01 build-date: 2015-06-01 host: x86_64-apple-darwin release: 1.2.0-nightly
Backtrace:
error: internal compiler error: meth::trans_trait_callee given non-bare-rust-fn note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports thread 'rustc' panicked at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:249
Thanks!
cc @rust-lang/compiler
The text was updated successfully, but these errors were encountered: