Open haihala opened 3 years ago
It happens when for some reason (wrong type inference/trait solving, wrong macro expansion, unsupported features like const generics) we pick up the wrong function.
It would really help if you can extract a reduced test case, but it's all right if you can't or don't have the time.
This is still happening, and really confusing. Here's a small reproduction:
fn foo(s: gfx::TextureSampler<[f32; 4]>) {
let (a, b, c, d);
s.bind_to(a, b, c, d);
}
Hovering over bind_to shows
gfx::pso::DataBind
pub fn bind_to(&self, RawDataSet: {error}, _: {error}, _: {error}, _: {error}, _: {error}, AccessInfo: {error}, _: {error})
---
Dump the given data into the raw data set.
but going to the definition shows the following code:
/// The "bind" logic portion of the PSO component.
/// Defines how the user data translates into the raw data set.
pub trait DataBind<R: c::Resources> {
/// The associated "data" type - a member of the PSO "data" struct.
type Data;
/// Dump the given data into the raw data set.
fn bind_to(&self,
&mut RawDataSet<R>,
&Self::Data,
&mut c::handle::Manager<R>,
&mut AccessInfo<R>);
}
which clearly takes 4 parameters. I don't understand how we can have two different definitions here.
The reason for that is that we fail to parse the param list properly here. Because of that error recovery kicks in which parses each path segment as a new parameter, so Self::Data
becomes two, and c::handle::Manager<R>
becomes 3 parameters totalling 8 parameters.
Given anonymous parameters are a hard error since the 2018 edition we could consider this a wontfix if it turns out to be too much work to fix in the parser
If we do end up with a shared parser, we might have to fix this anyway.
Well, it might be a wontfix-until-shared-parser then ;)
gfx
is also kind of deprecated; there are probably few maintained crates that use anonymous parameters.
I'm new-ish to rust and don't know if the error is in the code or in the analyzer.
Opening https://github.com/PistonDevelopers/piston-examples/blob/master/examples/cube.rs in vscode makes rust-analyzer complain about mismatched-arg-count on lines 25-32. The exact message is a bit stranger still:
The message says it expects 7 arguments, but found 4. Neither of these numbers make sense in any way I can think of.
Code of the macro:
Application of the macro: