Skip to content

Instantly share code, notes, and snippets.

@jplatte
Created October 22, 2020 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jplatte/12981cbdedf6cc824685aace41b8af42 to your computer and use it in GitHub Desktop.
Save jplatte/12981cbdedf6cc824685aace41b8af42 to your computer and use it in GitHub Desktop.
Rust ICE could not fully normalize
use my_crate::{Const, Trait};
fn main() {
let _ = Const::<1>::assoc_fn();
}
#![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