For example: playground
#![crate_type = "lib"]
#![feature(diagnostic_on_const, const_trait_impl)]
pub struct X<A, B> {
field: (A, B),
}
pub const trait Y<Z> {
fn blah(&self) {}
}
#[diagnostic::on_const(note = "Self = {Self}, Z = {Z}, A = {A}, B = {B}")]
impl<Z, A, B> Y<Z> for X<A, B> {}
const _: () = {
X {
field: (42_u8, "hello"),
}
.blah();
};
Compiler output:
= note: Self = X<u8, &str>, Z = _, A = {A}, B = {B}
- I expect it should be able to print A and B, since they're concrete in this scenario.
- Is it right to print
Z = _?
- There's also no lint for if you try to format a generic that isn't anywhere on the trait, impl, or adt.
For example: playground
Compiler output:
Z = _?