Skip to content

Commit

Permalink
Add 79018
Browse files Browse the repository at this point in the history
  • Loading branch information
fanninpm committed Dec 17, 2020
1 parent 16608bb commit fe104cd
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions ices/79018.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

rustc - << 'EOF'
#![crate_type = "lib"]
#![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
}
EOF

rustc --extern my_crate=$(ls librust_out.*) - << 'EOF'
extern crate my_crate;
use my_crate::{Const, Trait};
fn main() {
let _ = Const::<1>::assoc_fn();
}
EOF

0 comments on commit fe104cd

Please sign in to comment.