rust-lang / lang-team

Home of the Rust lang team
http://lang-team.rust-lang.org/
Apache License 2.0
202 stars 48 forks source link

MCP: Rust-style `#[inline]` attribute. #56

Closed crlf0710 closed 4 years ago

crlf0710 commented 4 years ago

Proposal

Summary and problem statement

Change the semantics of #[inline] attribute.

Motivation, use-cases, and solution sketches

Prioritization

Links and related work

Initial people involved

TBD

What happens now?

This issue is part of the experimental MCP process described in RFC 2936. Once this issue is filed, a Zulip topic will be opened for discussion, and the lang-team will review open MCPs in its weekly triage meetings. You should receive feedback within a week or two.

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.


EDIT:

rustbot commented 4 years ago

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

scottmcm commented 4 years ago

Procedurally, I think this needs some tweaks. From a lang perspective, #[inline] is just a hint (an implementation can completely ignore it) and thus even when used has no impact on observable behaviour.

I would thus say that "we should run a MIR inliner" is entirely a compiler question -- whether or not you do, vs getting LLVM to do it, should be semantically invisible and thus not need lang approval.

So I think the only thing left under lang preview in the proposal is whether to lint on #[inline(always)] that doesn't? (Or potentially stronger alternatives, like some attribute that would guarantee a particular semantic by giving hard errors if it doesn't happen.) If so, I would suggest focusing down to that.


A specific thing to clarify: "N/A -> heuristically determine whether to inline or not, left to compiler internals" appears to have been the case at least as far back as Rust 1.4.0. So it's unclear to me what this issue is proposing to change in that specific bullet.

crlf0710 commented 4 years ago

@scottmcm Thanks! I've got the text updated according to the initial feedback here and on zulip.

nikomatsakis commented 4 years ago

Update from 2020-09-21:

Some summary of Zulip thread:

Consensus from the meeting:

Based on the above, we are going to recommend this MCP be closed because the next steps are all implementation and no RFC is required. Entering final comment period, let us know if you disagree or see a problem with that.

joshtriplett commented 4 years ago

Closing per previous summary.