Skip to content

Don't throw away item attributes before trans_fn() for generic functions and others. #30661

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

Merged
merged 2 commits into from
Jan 4, 2016

Conversation

michaelwoerister
Copy link
Member

So far librustc::trans::base::trans_fn() and trans_closure() have been passed the list of attributes on the function being translated only if the function was local and non-generic. For generic functions, functions inlined from other crates, functions with foreign ABI and for closures, only an empty list of attributes was ever passed to trans_fn().
This led to the case that generic functions marked with #[rustc_mir] where not actually translated via MIR but via the legacy translation path.

This PR makes function/closure attributes always be passed to trans_fn() and disables the one test where this makes a difference.

If there is an actual reason why attributes were not passed along in these cases, let me know.

cc @rust-lang/compiler
cc @luqmana regarding the test case

@rust-highfive
Copy link
Contributor

r? @nrc

(rust_highfive has picked a reviewer for you, use r? to override)

@nagisa
Copy link
Member

nagisa commented Dec 31, 2015

Looks generally good to me, but I’d like a separate issue for that MIR thing filled (it is much easier to work when you can just pick an arbitrary issue with A-mir label to work on).

@michaelwoerister
Copy link
Member Author

@nagisa Good idea. I've created issue #30674 describing the problem.

@nrc
Copy link
Member

nrc commented Jan 4, 2016

@bors: r+

@bors
Copy link
Collaborator

bors commented Jan 4, 2016

📌 Commit ff93fc8 has been approved by nrc

@bors
Copy link
Collaborator

bors commented Jan 4, 2016

⌛ Testing commit ff93fc8 with merge 41611ba...

bors added a commit that referenced this pull request Jan 4, 2016
So far `librustc::trans::base::trans_fn()` and `trans_closure()` have been passed the list of attributes on the function being translated *only* if the function was local and non-generic. For generic functions, functions inlined from other crates, functions with foreign ABI and for closures, only an empty list of attributes was ever passed to `trans_fn()`.
This led to the case that generic functions marked with `#[rustc_mir]` where not actually translated via MIR but via the legacy translation path.

This PR makes function/closure attributes always be passed to `trans_fn()` and disables the one test where this makes a difference.

If there is an actual reason why attributes were not passed along in these cases, let me know.

cc @rust-lang/compiler
cc @luqmana regarding the test case
@bors bors merged commit ff93fc8 into rust-lang:master Jan 4, 2016
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.

5 participants