Skip to content

Fix cross-crate inlining of static methods #4098

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
wants to merge 1 commit into from

Conversation

brson
Copy link
Contributor

@brson brson commented Dec 3, 2012

r? @pcwalton

This fixes translation of static methods with inline attributes, sourced from non-local crates. The problem is that maybe_instantiate_inline tries to look up the self type according to the self_did of the encoded inline method, and for static methods that did is just some random number unassociated with any type (afaict).

@graydon
Copy link
Contributor

graydon commented Dec 3, 2012

"some random number"? that's somewhat worrying. can we trap that condition?

@brson
Copy link
Contributor Author

brson commented Dec 3, 2012

Sorry, I didn't literally mean 'random', I just mean that all method AST nodes have a def_id for the 'self' parameter, even if they are static methods.

@graydon
Copy link
Contributor

graydon commented Dec 3, 2012

Huh. Ok. I guess I was asking whether that ought to be Option<def_id> or such, but it's not critical, just .. nice to have these things cause a moment of pause about missed cases: Option sometimes causes the programmer to pause to think "wait, when can this be None"?

But that's kinda janitorial and shouldn't block this. This looks fine for now.

@brson
Copy link
Contributor Author

brson commented Dec 3, 2012

It seems like it should, yes. I guess I should have asked plainly in the pull request whether I should make the proper refactoring. Since you are uncomfortable with it too, I'll keep at it and try to fix the AST.

@pcwalton pcwalton closed this Dec 4, 2012
RalfJung pushed a commit to RalfJung/rust that referenced this pull request Dec 21, 2024
add warning explaining the limitations of the native code mode
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

Successfully merging this pull request may close these issues.

4 participants