Closed
Description
associated constants should support references to outer type parameters
Here is an example, adapted from the Zeroable
trait from core::non_zero
(playpen):
#![feature(associated_consts)]
trait Zble { const Z: Self; }
impl Zble for i32 { const Z: i32 = 0; }
impl<T> Zble for *const T { const Z: *const T = ::std::ptr::null(); }
fn main() { }
An attempt to compile this yields the error:
<anon>:5:45: 5:46 error: cannot use an outer type parameter in this context [E0402]
<anon>:5 impl<T> Zble for *const T { const Z: *const T = ::std::ptr::null(); }
^
<anon>:5:45: 5:46 error: use of undeclared type name `T` [E0412]
<anon>:5 impl<T> Zble for *const T { const Z: *const T = ::std::ptr::null(); }
^