Created
October 22, 2020 19:38
-
-
Save jplatte/12981cbdedf6cc824685aace41b8af42 to your computer and use it in GitHub Desktop.
Rust ICE could not fully normalize
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
use my_crate::{Const, Trait}; | |
fn main() { | |
let _ = Const::<1>::assoc_fn(); | |
} |
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
#![feature(const_generics, const_evaluatable_checked)] | |
#![allow(incomplete_features)] | |
pub struct Const<const U: u8>; | |
pub trait Trait { | |
type AssocTy; | |
fn assoc_fn() -> Self::AssocTy; | |
} | |
impl<const U: u8> Trait for Const<U> | |
where | |
Const<{ my_const_fn(U) }>: , | |
{ | |
type AssocTy = Const<{ my_const_fn(U) }>; | |
fn assoc_fn() -> Self::AssocTy { | |
Const | |
} | |
} | |
const fn my_const_fn(val: u8) -> u8 { | |
// body of this function doesn't matter | |
val | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment