Skip to content

Fix cross-crate inlining of static methods#4098

Closed
brson wants to merge 1 commit into
rust-lang:incomingfrom
brson:xc-static-inline
Closed

Fix cross-crate inlining of static methods#4098
brson wants to merge 1 commit into
rust-lang:incomingfrom
brson:xc-static-inline

Conversation

@brson

@brson brson commented Dec 3, 2012

Copy link
Copy Markdown
Contributor

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

graydon commented Dec 3, 2012

Copy link
Copy Markdown
Contributor

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

@brson

brson commented Dec 3, 2012

Copy link
Copy Markdown
Contributor Author

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

graydon commented Dec 3, 2012

Copy link
Copy Markdown
Contributor

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

brson commented Dec 3, 2012

Copy link
Copy Markdown
Contributor Author

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