Skip to content

./install.py --rust-completer => error[E0423]: expected function, tuple struct or tuple variant, found struct ast::Name #3603

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

Closed
8 of 12 tasks
yanqd0 opened this issue Feb 17, 2020 · 4 comments

Comments

@yanqd0
Copy link

yanqd0 commented Feb 17, 2020

Issue Prelude

  • I have read and understood YCM's CONTRIBUTING document.
  • I have read and understood YCM's CODE_OF_CONDUCT document.
  • I have read and understood YCM's README, especially the
    Frequently Asked Questions section.
  • I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. (Example Google
    search.
    )
  • If filing a bug report, I have included the output of vim --version.
  • If filing a bug report, I have included the output of :YcmDebugInfo.
  • If filing a bug report, I have attached the contents of the logfiles using
    the :YcmToggleLogs command.
  • If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • If filing a bug report, I have included a minimal test case that reproduces
    my issue, including what I expected to happen and what actually happened.
  • If filing a installation failure report, I have included the entire output
    of install.py (or cmake/make/ninja) including its invocation
  • I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt gift of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.

Issue Details

When installing YCM with Rust support, I meet a compile error with rustc 1.41.0 version.

$ ./install.py --rust-completer
...
[100%] Linking C shared library /home/y00445480/.vim/vim-plug/YouCompleteMe/third_party/ycmd/third_party/cregex/regex_3/_regex.so
[100%] Built target _regex
   Compiling url v1.5.1
   Compiling syntex_syntax v0.54.0
   Compiling syntex_syntax v0.52.0
error[E0713]: borrow may still be in use when destructor runs
   --> /home/y00445480/.cargo/registry/src/github.com-1ecc6299db9ec823/url-1.5.1/src/form_urlencoded.rs:251:40
    |
249 | impl<'a> Target for ::UrlQuery<'a> {
    |      -- lifetime `'a` defined here
250 |     fn as_mut_string(&mut self) -> &mut String { &mut self.url.serialization }
251 |     fn finish(self) -> &'a mut ::Url { self.url }
    |                                        ^^^^^^^^ - here, drop of `self` needs exclusive access to `*self.url`, because the type `UrlQuery<'_>` implements the `Drop` trait
    |                                        |
    |                                        returning this value requires that `*self.url` is borrowed for `'a`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0713`.
error: could not compile `url`.
warning: build failed, waiting for other jobs to finish...
error[E0423]: expected function, tuple struct or tuple variant, found struct `ast::Name`
   --> /home/y00445480/.cargo/registry/src/github.com-1ecc6299db9ec823/syntex_syntax-0.54.0/src/symbol.rs:146:27
    |
146 |                       name: ast::Name($index),
    |                             ^^^^^^^^^
...
165 | / declare_keywords! {
166 | |     // Invalid identifier
167 | |     (0,  Invalid,        "")
168 | |
...   |
231 | |     (56, CrateRoot, "{{root}}")
232 | | }
    | |_- in this macro invocation

error[E0423]: expected function, tuple struct or tuple variant, found struct `ast::Name`
   --> /home/y00445480/.cargo/registry/src/github.com-1ecc6299db9ec823/syntex_syntax-0.52.0/src/symbol.rs:146:27
    |
146 |                       name: ast::Name($index),
    |                             ^^^^^^^^^
...
165 | / declare_keywords! {
166 | |     // Invalid identifier
167 | |     (0,  Invalid,        "")
168 | |
...   |
228 | |     (55, Union,          "union")
229 | | }
    | |_- in this macro invocation

error: aborting due to previous error

For more information about this error, try `rustc --explain E0423`.
error: could not compile `syntex_syntax`.
warning: build failed, waiting for other jobs to finish...
error: aborting due to previous error

For more information about this error, try `rustc --explain E0423`.
error: could not compile `syntex_syntax`.

To learn more, run the command again with --verbose.

More information about E0423:


$ rustc --explain E0423
An identifier was used like a function name or a value was expected and the
identifier exists but it belongs to a different namespace.

For (an erroneous) example, here a `struct` variant name were used as a
function:

```
struct Foo { a: bool };

let f = Foo();
// error: expected function, tuple struct or tuple variant, found `Foo`
// `Foo` is a struct name, but this expression uses it like a function name
```

Please verify you didn't misspell the name of what you actually wanted to use
here. Example:

```
fn Foo() -> u32 { 0 }

let f = Foo(); // ok!
```

It is common to forget the trailing `!` on macro invocations, which would also
yield this error:

```
println("");
// error: expected function, tuple struct or tuple variant,
// found macro `println`
// did you mean `println!(...)`? (notice the trailing `!`)
```

Another case where this error is emitted is when a value is expected, but
something else is found:

```
pub mod a {
    pub const I: i32 = 1;
}

fn h1() -> i32 {
    a.I
    //~^ ERROR expected value, found module `a`
    // did you mean `a::I`?
}
```

Environments

$ lsb_release -a
LSB Version:    core-9.20170808ubuntu1-noarch:printing-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:        18.04
Codename:       bionic
$ rustc --version -v
rustc 1.41.0 (5e1a79984 2020-01-27)
binary: rustc
commit-hash: 5e1a799842ba6ed4a57e91f7ab9435947482f7d8
commit-date: 2020-01-27
host: x86_64-unknown-linux-gnu
release: 1.41.0
LLVM version: 9.0
@bstaletic
Copy link
Collaborator

   Compiling url v1.5.1
   Compiling syntex_syntax v0.54.0
   Compiling syntex_syntax v0.52.0

This implies you're on an ancient YCM. Please update YCM and the submodules and rerun the script.

@yanqd0
Copy link
Author

yanqd0 commented Feb 17, 2020

There is another similar issue: rust/lang#68729.

@yanqd0
Copy link
Author

yanqd0 commented Feb 17, 2020

   Compiling url v1.5.1
   Compiling syntex_syntax v0.54.0
   Compiling syntex_syntax v0.52.0

This implies you're on an ancient YCM. Please update YCM and the submodules and rerun the script.

Thanks!

I tried git pull before creating this issue, but not working. git submodule update --init works.

@bstaletic
Copy link
Collaborator

Great. We can close this now.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants