forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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 rust-lang#100336 - fee1-dead-contrib:fix-wf-const-tra…
…it, r=oli-obk Fix two const_trait_impl issues r? `@oli-obk` Fixes rust-lang#100222. Fixes rust-lang#100543.
- Loading branch information
Showing
2 changed files
with
39 additions
and
2 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
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 @@ | ||
// revisions: nn ny yn yy | ||
// check-pass | ||
#![feature(const_trait_impl, associated_type_defaults, const_mut_refs)] | ||
|
||
#[cfg_attr(any(yn, yy), const_trait)] | ||
pub trait Index { | ||
type Output; | ||
} | ||
|
||
#[cfg_attr(any(ny, yy), const_trait)] | ||
pub trait IndexMut where Self: Index { | ||
const C: <Self as Index>::Output; | ||
type Assoc = <Self as Index>::Output; | ||
fn foo(&mut self, x: <Self as Index>::Output) -> <Self as Index>::Output; | ||
} | ||
|
||
impl Index for () { type Output = (); } | ||
|
||
impl const IndexMut for <() as Index>::Output { | ||
const C: <Self as Index>::Output = (); | ||
type Assoc = <Self as Index>::Output; | ||
fn foo(&mut self, x: <Self as Index>::Output) -> <Self as Index>::Output | ||
where <Self as Index>::Output:, | ||
{} | ||
} | ||
|
||
const C: <() as Index>::Output = (); | ||
|
||
fn main() {} |