8000 Passing excessive arguments to Rust functions doesn't cause errors · Issue #187 · tomaka/hlua · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Passing excessive arguments to Rust functions doesn't cause errors #187

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

Open
mkpankov opened this issue Apr 4, 2018 · 0 comments
Open

Comments

@mkpankov
Copy link
Contributor
mkpankov commented Apr 4, 2018

Paste the following test to hlua/hlua/src/functions_write.rs (mod tests):

    #[test]
    fn simple_function_excessive_arguments() {
        let mut lua = Lua::new();

        fn ret5() -> i32 {
            5
        };
        lua.set("ret5", function0(ret5));

        let val: i32 = lua.execute("return ret5(1)").unwrap();
        assert_eq!(val, 5);
    }

Then cargo test simple_function_excessive_arguments:

running 1 test
test functions_write::tests::simple_function_excessive_arguments ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 72 filtered out

It doesn't fail.

I expected "wrong parameters for callback" as it's done when types you pass from Lua don't match Rust ones.

Now it seems excessive arguments are just ignored, which makes it harder to make sure Lua call sites are correct and in sync with Rust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0