When instantiating substs for ADTs, confirming methods, etc., we create new type variables in the current universe, rather than the root universe, even though these variables could be in the root universe since they represent the "surface" types of a Rust program.
This causes us to unnecessarily generalize aliases, leading to ambiguity.
TODO: minimize this test case:
use syn::Ident;
use syn::Attribute;
use syn::parse::*;
struct TypeParam {
pub attrs: Vec<Attribute>,
pub ident: Ident,
}
impl Parse for TypeParam {
fn parse(input: ParseStream) -> Result<Self> {
let attrs = input.call(Attribute::parse_outer)?;
let ident = input.parse()?;
Ok(TypeParam {
attrs,
ident,
})
}
}
which results in:
error[E0284]: type annotations needed: cannot satisfy `<std::result::Result<syn::Ident, syn::Error> as std::ops::Try>::Residual == <std::result::Result<_, syn::Error> as std::ops::Try>::Residual`
--> src/lib.rs:13:34
|
13 | let ident = input.parse()?;
| ^ cannot satisfy `<std::result::Result<syn::Ident, syn::Error> as std::ops::Try>::Residual == <std::result::Result<_, syn::Error> as std::ops::Try>::Residual`
19
60
When instantiating substs for ADTs, confirming methods, etc., we create new type variables in the current universe, rather than the root universe, even though these variables could be in the root universe since they represent the "surface" types of a Rust program.
This causes us to unnecessarily generalize aliases, leading to ambiguity.
TODO: minimize this test case:
which results in: