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

Generic extern fns (former crust functions) cause an ICE #3171

Closed
pcwalton opened this issue Aug 9, 2012 · 10 comments
Closed

Generic extern fns (former crust functions) cause an ICE #3171

pcwalton opened this issue Aug 9, 2012 · 10 comments
Labels
A-codegen Area: Code generation A-typesystem Area: The type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@pcwalton
Copy link
Contributor

pcwalton commented Aug 9, 2012

This is because they're *u8, so trans sees no substs and it won't monomorphize it. Then it calls type_of on a ty param and ICEs.

I think maybe crust functions should have to have explicit type parameter substitutions.

@nikomatsakis
Copy link
Contributor

I expect this will work out fine once they have proper types.

@nikomatsakis
Copy link
Contributor

Not critical for 0.6; removing milestone

@catamorphism
Copy link
Contributor

Reproduced with 0252c30. Nominating for milestone 5, production-ready.

@graydon
Copy link
Contributor

graydon commented Jun 13, 2013

these are not foreign, they're callbacks-to-rust. title's wrong.

@graydon
Copy link
Contributor

graydon commented Jun 13, 2013

accepted for production-ready milestone

@emberian
Copy link
Member

emberian commented Aug 5, 2013

@pcwalton @catamorphism do you have a testcase?

@MicahChalmer
Copy link
Contributor

As requested by @jdm when he closed my dupe of this (sorry about that), here's a bit of code that reproduces the ICE on the current master:

fn with_type_params<T>() { }

extern fn foo<T>() {
    with_type_params::<T>();
}

fn main() {
    let _a:*u8 = foo;
}

Not that this should actually compile, since it's trying to the generic foo without its type parameter--but I'd expect a normal compiler error message rather than an ICE.

A question: if this bug gets fixed, is it expected that this code would work if let _a:*u8 = foo were replaced with, for instance, let _a:*u8 = foo::<int>? As of now, it still doesn't compile, though it doesn't ICE in that case--instead it complains that foo doesn't take type parameters, even though it does.

@brson
Copy link
Contributor

brson commented Jan 16, 2014

cc #10353

@pnkfelix
Copy link
Member

accepted for P-backcompat-lang (under assumption we will just disallow this construction).

@alexcrichton
Copy link
Member

Closed by 8f3f666

bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
normalize_doc_attributes: remove whitespace from the doc comment opener
saethlin pushed a commit to saethlin/rust that referenced this issue Nov 17, 2023
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Addresses the new `AggregateKind::RawPtr` added in
rust-lang#123840.

Resolves rust-lang#3161 

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.

---------

Co-authored-by: Kareem Khazem <karkhaz@amazon.com>
Co-authored-by: Michael Tautschnig <tautschn@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-typesystem Area: The type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

9 participants