Skip to content

Add macro test for min-const-generics #78912

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

Merged
merged 1 commit into from
Nov 11, 2020
Merged

Conversation

JulianKnodt
Copy link
Contributor

Adds a test which uses a macro inside a block for a const-expression, as per #78433

r? @lcnr

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 9, 2020

let _ok = Example::<{ external_macro!() }>;

let _fail = Example::<external_macro!()>;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's interesting that this fails 🤔 cc @petrochenkov @varkor what would be needed to get this to work?
Might be good to open an separate issue for this.

Would this also need an GenericArg::Ambiguous variant in the AST?

Copy link
Member

@varkor varkor Nov 10, 2020

Choose a reason for hiding this comment

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

external_macro!() is not a literal or block expression, so it's being parsed as a type argument. This is behaving as expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but if the macro itself returns a block, it doesn't seem that that gets parsed as a const. It's fine if this is the intended behavior, just a bit surprising

@JulianKnodt JulianKnodt force-pushed the mcg_macro branch 2 times, most recently from c036a19 to 504f435 Compare November 10, 2020 00:15
@lcnr
Copy link
Contributor

lcnr commented Nov 10, 2020

thanks

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 10, 2020

📌 Commit 504f435df041c565847b6b0e4d06df48431fc9ad has been approved by lcnr

@bors
Copy link
Collaborator

bors commented Nov 10, 2020

🌲 The tree is currently closed for pull requests below priority 100, this pull request will be tested once the tree is reopened

@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-review Status: Awaiting review from the assignee but also interested parties. labels Nov 10, 2020
@lcnr
Copy link
Contributor

lcnr commented Nov 10, 2020

@bors r-

@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 10, 2020
@lcnr
Copy link
Contributor

lcnr commented Nov 10, 2020

👍

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 10, 2020

📌 Commit 857dd8b has been approved by lcnr

@bors
Copy link
Collaborator

bors commented Nov 10, 2020

🌲 The tree is currently closed for pull requests below priority 100, this pull request will be tested once the tree is reopened

@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 10, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 11, 2020
…as-schievink

Rollup of 14 pull requests

Successful merges:

 - rust-lang#76765 (Make it more clear what an about async fn's returns when referring to what it returns)
 - rust-lang#78574 (Use check-pass instead of build-pass in regions ui test suite)
 - rust-lang#78669 (Use check-pass instead of build-pass in some consts ui test suits)
 - rust-lang#78847 (Assert that a return place is not used for indexing during integration)
 - rust-lang#78854 (Workaround for "could not fully normalize" ICE )
 - rust-lang#78875 (rustc_target: Further cleanup use of target options)
 - rust-lang#78887 (Add comments to explain memory usage optimization)
 - rust-lang#78890 (comment attribution fix)
 - rust-lang#78896 (Clarified description of write! macro)
 - rust-lang#78897 (Add missing newline to error message of the default OOM hook)
 - rust-lang#78898 (add regression test for rust-lang#78892)
 - rust-lang#78908 ((rustdoc) [src] link for types defined by macros shows invocation, not defintion)
 - rust-lang#78910 (Fix links to stabilized versions of some intrinsics)
 - rust-lang#78912 (Add macro test for min-const-generics)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit fa4d0f2 into rust-lang:master Nov 11, 2020
@rustbot rustbot added this to the 1.49.0 milestone Nov 11, 2020
@lcnr lcnr added the F-const_generics `#![feature(const_generics)]` label Nov 14, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
F-const_generics `#![feature(const_generics)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants