Closed sweirich closed 5 years ago
As of 08059b316f496d20bcb7be6c8491b324f5588603, fns
entries now inherit the generics.params
and predicates
from their enclosing elements. For example, on this code:
struct S<T>(T);
impl<A: Clone> S<A> {
fn f<B: From<A>>(&self) -> B {
self.0.clone().into()
}
}
the crux-mir representation is:
// Type parameter _0 is A, and _1 is B.
fn ::{{impl}}::f(_1 : &::S<_0>) -> _1 where [::marker::Sized<_1>
,::convert::From<_1,_0>
,::marker::Sized<_0>
,::clone::Clone<_0>] {
// ...
}
Also, the JSON output now includes the def path for each type parameter, in case crux-mir ever needs to distinguish impl/trait params from ones directly on the fn:
"generics": {
"params": [
{
"def_id": "::{{impl}}[0]::A[0]",
"param_def": "A"
},
{
"def_id": "::{{impl}}[0]::f[0]::B[0]",
"param_def": "B"
}
]
},
Consider this code
The function g produced by mir-json is lacking the predicate that the parameter must implement G.
(In fact, it has no predicates.)