Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

syntax: ABI-oblivious grammar #65884

Merged
merged 6 commits into from
Nov 7, 2019
Merged

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Oct 28, 2019

This PR has the following effects:

  1. extern $lit is now legal where $lit:literal and $lit is substituted for a string literal.

  2. extern "abi_that_does_not_exist" is now syntactically legal whereas before, the set of ABI strings was hard-coded into the grammar of the language. With this PR, the set of ABIs are instead validated and translated during lowering. That seems more appropriate.

  3. ast::FloatTy is now distinct from rustc_target::abi::FloatTy. The former is used substantially more and the translation between them is only necessary in a single place.

  4. As a result of 2-3, libsyntax no longer depends on librustc_target, which should improve pipe-lining somewhat.

cc @rust-lang/lang -- the points 1-2 slightly change the definition of the language but in a way which seems consistent with our general principles (in particular wrt. the discussions of turning things into semantic errors). I expect this to be uncontroversial but it's worth letting y'all know. :)

r? @varkor

@Centril Centril added T-lang Relevant to the language team, which will review and decide on the PR/issue. relnotes Marks issues that should be documented in the release notes of the next release. labels Oct 28, 2019
@Centril Centril added this to the 1.40 milestone Oct 28, 2019
@rust-highfive

This comment has been minimized.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 28, 2019
Abi::C |
Abi::System => {}
abi => {
self.parse_sess.span_diagnostic.delay_span_bug(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(The purpose of doing this is so that if we add a new ABI but forget to feature gate it, an ICE will occur and it won't pass CI.)

@petrochenkov
Copy link
Contributor

Assigning myself as well, I had some plans in this area.
cc #60493

@petrochenkov petrochenkov self-assigned this Oct 28, 2019
@rust-highfive

This comment has been minimized.

@Centril Centril force-pushed the non-hardcoded-abis branch 2 times, most recently from 07e5ff6 to f8a588b Compare October 28, 2019 05:34
@eddyb
Copy link
Member

eddyb commented Oct 28, 2019

I think @oli-obk moved FloatTy around, perhaps now we can have Primitive::{F32, F64} again instead of rustc_target::abi::FloatTy existing.

@rust-highfive

This comment has been minimized.

@nikomatsakis
Copy link
Contributor

the points 1-2 slightly change the definition of the language but in a way which seems consistent with our general principles (in particular wrt. the discussions of turning things into semantic errors). I expect this to be uncontroversial but it's worth letting y'all know. :)

👍 from me

@Centril
Copy link
Contributor Author

Centril commented Oct 28, 2019

I think @oli-obk moved FloatTy around, perhaps now we can have Primitive::{F32, F64} again instead of rustc_target::abi::FloatTy existing.

@eddyb I don't have an opinion on this other than to say that it could be done in a follow-up. :)

@eddyb
Copy link
Member

eddyb commented Oct 28, 2019

it could be done in a follow-up. :)

My argument would be that it's confusing to have two copies of the same type.
But I was also hoping for @oli-obk's opinion on this.

@@ -561,6 +561,7 @@ symbols! {
rust_2018_preview,
rust_begin_unwind,
rustc,
Rust,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦀

@Centril Centril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 28, 2019
@Centril Centril force-pushed the non-hardcoded-abis branch 2 times, most recently from f66f4a1 to 9a46580 Compare October 29, 2019 05:59
@Centril Centril added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 29, 2019
@bors

This comment has been minimized.

@petrochenkov
Copy link
Contributor

r=me after addressing the remaining comments, unless varkor wants to review as well.

@petrochenkov petrochenkov removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 29, 2019
@Centril Centril force-pushed the non-hardcoded-abis branch from 7e42b47 to 0997975 Compare November 6, 2019 10:06
@Centril
Copy link
Contributor Author

Centril commented Nov 6, 2019

@bors r=petrochenkov

@bors
Copy link
Contributor

bors commented Nov 6, 2019

📌 Commit 09979759ba46574d39d8ab0c4dc14566b918e949 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 6, 2019
@bors

This comment has been minimized.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 7, 2019
@Centril Centril force-pushed the non-hardcoded-abis branch from 0997975 to 55f76cd Compare November 7, 2019 04:26
@Centril
Copy link
Contributor Author

Centril commented Nov 7, 2019

@bors r=petrochenkov

@bors
Copy link
Contributor

bors commented Nov 7, 2019

📌 Commit 55f76cd has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 7, 2019
Centril added a commit to Centril/rust that referenced this pull request Nov 7, 2019
…chenkov

syntax: ABI-oblivious grammar

This PR has the following effects:

1. `extern $lit` is now legal where `$lit:literal` and `$lit` is substituted for a string literal.

2. `extern "abi_that_does_not_exist"` is now *syntactically* legal whereas before, the set of ABI strings was hard-coded into the grammar of the language. With this PR, the set of ABIs are instead validated and translated during lowering. That seems more appropriate.

3. `ast::FloatTy` is now distinct from `rustc_target::abi::FloatTy`. The former is used substantially more and the translation between them is only necessary in a single place.

4. As a result of 2-3, libsyntax no longer depends on librustc_target, which should improve pipe-lining somewhat.

cc @rust-lang/lang -- the points 1-2 slightly change the definition of the language but in a way which seems consistent with our general principles (in particular wrt. the discussions of turning things into semantic errors). I expect this to be uncontroversial but it's worth letting y'all know. :)

r? @varkor
bors added a commit that referenced this pull request Nov 7, 2019
Rollup of 5 pull requests

Successful merges:

 - #59789 (Revert two unapproved changes to rustc_typeck.)
 - #65752 (Use structured suggestions for missing associated items)
 - #65884 (syntax: ABI-oblivious grammar)
 - #65974 (A scheme for more macro-matcher friendly pre-expansion gating)
 - #66017 (Add future incompatibility lint for `array.into_iter()`)

Failed merges:

 - #66056 (rustc_metadata: Some reorganization of the module structure)

r? @ghost
@bors bors merged commit 55f76cd into rust-lang:master Nov 7, 2019
@Centril Centril deleted the non-hardcoded-abis branch November 7, 2019 11:39
flip1995 added a commit to Manishearth/rust-clippy that referenced this pull request Nov 7, 2019
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Nov 8, 2019
rustc_target: inline abi::FloatTy into abi::Primitive.

This effectively undoes a small part of @oli-obk's rust-lang#50967, now that the rest of the compiler doesn't use the `FloatTy` definition from `rustc_target`, post-rust-lang#65884.
@Centril Centril modified the milestones: 1.40, 1.41 Nov 13, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants