Description
Since only core
& std
are allowed to define functions and constants on function pointer types (like fn()
or for<'a> fn(&'a ()) -> bool
) and since they maybe never will, this issue is of low priority. For other primitive types like !
, ()
, bool
etc., inherent associated functions and constants are correctly resolved.
#![feature(rustc_attrs)]
#![rustc_coherence_is_core]
impl fn() {
const X: () = ();
}
fn user() {
<fn()>::X; //~ ERROR no associated item named `X` found for fn pointer `fn()` in the current scope
}
Note that the perma-unstable attribute #![rustc_coherence_is_core]
is used in the reproducer which doesn't come with any language or stability guarantees. However, this issue is not about it but about the fact that core
which uses this attribute internally and std
(which can use #[rustc_allow_incoherent_impl]
) would not be able to properly define associated items on those types. For the same reason, I'm not labeling this as requires-nightly.
@rustbot label T-compiler A-resolve A-associated-items