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

Wrong number of parameters bug #13229

Closed
Ygg01 opened this issue Mar 31, 2014 · 2 comments
Closed

Wrong number of parameters bug #13229

Ygg01 opened this issue Mar 31, 2014 · 2 comments

Comments

@Ygg01
Copy link

Ygg01 commented Mar 31, 2014

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.

@Ygg01 Ygg01 changed the title Weird wrong parameter bug. Wrong number of parameters bug Mar 31, 2014
@emberian
Copy link
Member

emberian commented Apr 1, 2014

@danielfath you have defined a function is_restrictedin test_util.rs which is shadowing the one you imported from xml.

@Ygg01
Copy link
Author

Ygg01 commented Apr 1, 2014

Oh, thanks. Well that's a silly mistake.

I apologize for the inconvenience.

@Ygg01 Ygg01 closed this as completed Apr 1, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 25, 2024
…t-edit, r=Veykril

feat: Support multiple tab stops for completions in VSCode

Uses the native VSCode support for `SnippetTextEdit`s. Fixes rust-lang#13229 and fixes rust-lang#8531.

https://github.com/rust-lang/rust-analyzer/assets/13354275/a2d2c033-bb30-4f34-92ca-bf3f4f744cdc

This is done in a slightly hacky way, as `vscode-languageclient` can't convert RA's `SnippetTextEdit`s into vscode `SnippetTextEdit`s and will appear to use a [different format](https://github.com/microsoft/vscode-languageserver-node/blob/295aaa393fda8ecce110c38880a00466b9320e63/types/src/main.ts#L1501-L1516) in the future.

---

~~Marked as draft since as-is, this will cause completions to double-indent any multi-line code generated.~~
**Update:** This also fixes up edits so that any multi-line code won't be double-indented.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants