-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #119705 - fmease:tilde-const-assoc-fns-trait-impls, r…
…=compiler-errors Support `~const` in associated functions in trait impls Fixes #119700.
- Loading branch information
Showing
4 changed files
with
65 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 20 additions & 17 deletions
37
tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-assoc-fn-in-trait-impl.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Regression test for issue #119700. | ||
// check-pass | ||
|
||
#![feature(const_trait_impl, effects)] | ||
|
||
#[const_trait] | ||
trait Main { | ||
fn compute<T: ~const Aux>() -> u32; | ||
} | ||
|
||
impl const Main for () { | ||
fn compute<T: ~const Aux>() -> u32 { | ||
T::generate() | ||
} | ||
} | ||
|
||
#[const_trait] | ||
trait Aux { | ||
fn generate() -> u32; | ||
} | ||
|
||
impl const Aux for () { | ||
fn generate() -> u32 { 1024 } | ||
} | ||
|
||
fn main() { | ||
const _: u32 = <()>::compute::<()>(); | ||
let _ = <()>::compute::<()>(); | ||
} |
File renamed without changes.