Skip to content

Conversation

@RalfJung
Copy link
Member

'const fn' in trait are rejected in the AST:

self.check_trait_fn_not_const(sig.header.constness);

So this feature gate check is a NOP and we can just remove it.

The src/test/ui/feature-gates/feature-gate-min_const_fn.rs and src/test/ui/feature-gates/feature-gate-const_fn.rs tests ensure that we still reject const fn in trait

Cc #84510
r? @oli-obk

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 25, 2021
@oli-obk
Copy link
Contributor

oli-obk commented Apr 25, 2021

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Apr 25, 2021

📌 Commit 8a961a5 has been approved by oli-obk

@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 Apr 25, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 25, 2021
Always reject `const fn` in `trait` during parsing.

'const fn' in trait are rejected in the AST:
https://github.com/rust-lang/rust/blob/b78c0d8a4d5af91a4a55d029293e3ecb879ec142/compiler/rustc_ast_passes/src/ast_validation.rs#L1411
So this feature gate check is a NOP and we can just remove it.

The src/test/ui/feature-gates/feature-gate-min_const_fn.rs and src/test/ui/feature-gates/feature-gate-const_fn.rs tests ensure that we still reject `const fn` in `trait`

Cc rust-lang#84510
r? `@oli-obk`
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 25, 2021
Always reject `const fn` in `trait` during parsing.

'const fn' in trait are rejected in the AST:
https://github.com/rust-lang/rust/blob/b78c0d8a4d5af91a4a55d029293e3ecb879ec142/compiler/rustc_ast_passes/src/ast_validation.rs#L1411
So this feature gate check is a NOP and we can just remove it.

The src/test/ui/feature-gates/feature-gate-min_const_fn.rs and src/test/ui/feature-gates/feature-gate-const_fn.rs tests ensure that we still reject `const fn` in `trait`

Cc rust-lang#84510
r? ``@oli-obk``
@bors
Copy link
Collaborator

bors commented Apr 26, 2021

⌛ Testing commit 8a961a5 with merge ee8382f...

@bors
Copy link
Collaborator

bors commented Apr 26, 2021

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing ee8382f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 26, 2021
@bors bors merged commit ee8382f into rust-lang:master Apr 26, 2021
@rustbot rustbot added this to the 1.53.0 milestone Apr 26, 2021
@RalfJung RalfJung deleted the const_fn_in_trait branch April 26, 2021 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. 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.

5 participants