Skip to content

linkage errors with explicit named lifetimes parameters to a function #5243

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

Closed
ben0x539 opened this issue Mar 5, 2013 · 2 comments
Closed

Comments

@ben0x539
Copy link
Contributor

ben0x539 commented Mar 5, 2013

I don't really understand what's going on here. Offending code:

struct S<'self> {
    v: &int
}

fn f<'lt>(_s: &S<'lt>) {}

fn main() {
    f(& S { v: &42 });
}

Compiler output:

$ rustc bar.rs
Global is external, but doesn't have external or dllimport or weak linkage!
void ({}*, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)*, %"~struct S[#0]"*)* @_ZN1f17_12d56ae62635eef43_00E
invalid linkage type for function declaration
void ({}*, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)*, %"~struct S[#0]"*)* @_ZN1f17_12d56ae62635eef43_00E
Broken module found, compilation aborted!
Stack dump:
0.  Running pass 'Function Pass Manager' on module 'bar.rc'.
Aborted

Compiles if f is declared as fn f(...) rather than fn f<'lt>(). I'm not sure how explicit I'm supposed to be with lifetime parameters.

@nikomatsakis
Copy link
Contributor

I've seen these errors too. I have some ideas what could be the
problem, but haven't gotten around to tracking it down yet. I figured
I'd do so as part of the patch that makes such annotations mandatory...

@nikomatsakis
Copy link
Contributor

I think I have the fix.

bors added a commit that referenced this issue Mar 6, 2013
them to be non-monomorphic.  Merely having lifetime parameters
is not enough to qualify for that status.  Fixes #5243.

r?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants