Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute argument / function parameter amount mismatch: improve error message #12

Open
foresterre opened this issue Nov 13, 2019 · 0 comments
Labels
A-ui Area: changes related specifically to the ui (such as how we report errors to the user) C-enhancement Category: enhancements

Comments

@foresterre
Copy link
Owner

The following code will obvisouly fail, since our function has two inputs, but in our attribute, we only provide one.

        #[parameterized(input = {
            &["03579", "0", "1", "1"]
        })]
        fn should_fail(input: &[&str], expected: (u32, u32, u32, u32)) {
            let some: (u32, u32, u32, u32) = ParseInputsFromIter::parse(input).unwrap();
            assert_eq!(some, expected);
        }

it does fail (which is good), but the error states "this should never happen", while it can and isn't an unreachable error case.

        #[parameterized(input = {
            &["03579", "0", "1", "1"]
        })]
        fn should_fail(input: &[&str], expected: (u32, u32, u32, u32)) {
            let some: (u32, u32, u32, u32) = ParseInputsFromIter::parse(input).unwrap();
            assert_eq!(some, expected);
        }
@foresterre foresterre added C-enhancement Category: enhancements A-ui Area: changes related specifically to the ui (such as how we report errors to the user) labels Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ui Area: changes related specifically to the ui (such as how we report errors to the user) C-enhancement Category: enhancements
Projects
None yet
Development

No branches or pull requests

1 participant