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

using generic functions with a foreign ABI doesn't work #10353

Closed
thestinger opened this issue Nov 8, 2013 · 9 comments
Closed

using generic functions with a foreign ABI doesn't work #10353

thestinger opened this issue Nov 8, 2013 · 9 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority
Milestone

Comments

@thestinger
Copy link
Contributor

extern "C" fn foo<T>() {}

fn main() {
    let _ = foo::<int>;
}
task 'rustc' failed at 'assertion failed: f.abis.is_rust() || f.abis.is_intrinsic()', /build/rust-git/src/rust/src/librustc/middle/trans/monomorphize.rs:176

Use case, if you're curious: https://github.com/thestinger/rust-core/blob/master/core/thread.rs#L30

@emberian
Copy link
Member

emberian commented Nov 8, 2013

I'm wondering if that assertion can just be removed. Are there any fundamental problems with generics with foreign ABI? I can't think of any. (cc @pcwalton @nikomatsakis ?)

@brson
Copy link
Contributor

brson commented Nov 8, 2013

Generic functions will be called differently for every type, and that doesn't map to C except in some limited circumstances. This could rather be a proper compiler error - I'm kind of surprised this bug still exists.

@thestinger
Copy link
Contributor Author

@brson: It's useful to be able to write a generic function and obtain function pointers to specific monomorphized instances though. It should be possible to do this and ask that the function use the C ABI.

@thestinger
Copy link
Contributor Author

@cmr: it's definitely not as simple as removing the assertion

@brson
Copy link
Contributor

brson commented Jan 16, 2014

Nominating.

@pnkfelix
Copy link
Member

Current thinking is to put in a proper error message now (as in, don't add support in the short term for 1.0).

Then post 1.0 we can backward-compatibly extend rustc to add support for this.

Accepted for P-high for the error message.

@nrc
Copy link
Member

nrc commented Feb 17, 2014

taking, for the error message

@bors bors closed this as completed in 8f3f666 Feb 17, 2014
@emberian emberian reopened this Feb 23, 2014
@emberian
Copy link
Member

There's no ICE anymore, but this is still an issue.

@emberian
Copy link
Member

Eh, opening a new issue.

Jarcho pushed a commit to Jarcho/rust that referenced this issue Feb 26, 2023
Change unusual_byte_groupings to require byte groupings of equal size

Fixes issue rust-lang#6556

This lint required byte groupings of size 2 or 4 for `Radix::Binary` and `Radix::Hexadecimal`. Since there are good reasons for allowing groups of other sizes, this PR relaxes the restriction. This lint now requires that

- group sizes after the first group be of the same size and
- greater or equal in size to the first group.

---

changelog: [`unusual_byte_groupings`]: reduce false positives by relaxing restriction requiring groups of specific sizes.
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) ❄️ P-medium Medium priority
Projects
None yet
Development

No branches or pull requests

5 participants