Skip to content

Wrong number of parameters bug #13229

Closed
Closed
@Ygg01

Description

@Ygg01

Hi, I've been running into weird issues with current Rust nightly.

As of right now I have a branch called bug_hunting, where I have two commits. First commit (a3cf404.. of current bug_hunting branch) has a weird error - in which compiler/linker complains that the method has 0 paramteres when it has two. Error can be replicated by running make check in root folder (where src folder is located) to get following error:

src/test/test_util.rs:5:22: 5:41 error: this function takes 0 parameters but 1 parameter was supplied
src/test/test_util.rs:5     assert_eq!(true, is_restricted(&'c'));
                                             ^~~~~~~~~~~~~~~~~~~
<std macros>:1:1: 12:2 note: in expansion of assert_eq!
src/test/test_util.rs:5:5: 5:43 note: expansion site
<std macros>:6:29: 6:42 error: mismatched types: expected `bool` but found `()` (expected bool but found ())
<std macros>:6         if !((*given_val == *expected_val) &&
                                           ^~~~~~~~~~~~~
<std macros>:1:1: 12:2 note: in expansion of assert_eq!
src/test/test_util.rs:5:5: 5:43 note: expansion site
<std macros>:7:32: 7:42 error: mismatched types: expected `()` but found `bool` (expected () but found bool)
<std macros>:7              (*expected_val == *given_val)) {
                                              ^~~~~~~~~~
<std macros>:1:1: 12:2 note: in expansion of assert_eq!
src/test/test_util.rs:5:5: 5:43 note: expansion site
src/test/test_util.rs:6:13: 6:32 error: this function takes 0 parameters but 1 parameter was supplied
src/test/test_util.rs:6     assert!(is_restricted(&'c'));
                                    ^~~~~~~~~~~~~~~~~~~
<std macros>:1:1: 17:2 note: in expansion of assert!
src/test/test_util.rs:6:5: 6:34 note: expansion site
<std macros>:3:12: 6:32 error: cannot apply unary operator `!` to type `()`
<std macros>:3         if !$cond {
<std macros>:4             fail!("assertion failed: {:s}", stringify!($cond))
<std macros>:5         }
<std macros>:6     );
<std macros>:1:1: 17:2 note: in expansion of assert!
src/test/test_util.rs:6:5: 6:34 note: expansion site
error: aborting due to 5 previous errors
make: *** [build/tests] Error 101

Same code, with function renamed to is_crazy works ok, as evidenced by commit 23cf925... In the diff the only change I notice is the fact that function was renamed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions