racer-rust / racer

Rust Code Completion utility
MIT License
3.36k stars 278 forks source link

build from master failed #1058

Closed jiacai2050 closed 5 years ago

jiacai2050 commented 5 years ago

cargo +nightly build --release

 Compiling rustc-ap-arena v491.0.0
error[E0599]: no method named `cap` found for type `alloc::raw_vec::RawVec<T>` in the current scope
   --> /Users/chenxiang/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/rustc-ap-arena-491.0.0/lib.rs:102:47
    |
102 |                 self.start().add(self.storage.cap())
    |                                               ^^^ private field, not a method

error[E0599]: no method named `cap` found for type `alloc::raw_vec::RawVec<T>` in the current scope
   --> /Users/chenxiang/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/rustc-ap-arena-491.0.0/lib.rs:273:55
    |
273 |                     new_capacity = last_chunk.storage.cap();
    |                                                       ^^^ private field, not a method

error[E0599]: no method named `cap` found for type `alloc::raw_vec::RawVec<u8>` in the current scope
   --> /Users/chenxiang/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/rustc-ap-arena-491.0.0/lib.rs:408:55
    |
408 |                     new_capacity = last_chunk.storage.cap();
    |                                                       ^^^ private field, not a method

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0599`.
error: Could not compile `rustc-ap-arena`.
warning: build failed, waiting for other jobs to finish...
error: build failed
 (master)$ rustup --version
rustup 1.17.0 ( )
 (master)$ cargo --version
cargo 1.36.0 (c4fcfb725 2019-05-15)
 (master)$ rustc --version
rustc 1.36.0 (a53f9df32 2019-07-03)
 (master)$ rustup run nightly rustup show
Default host: x86_64-apple-darwin

installed toolchains
--------------------

stable-x86_64-apple-darwin
nightly-x86_64-apple-darwin

active toolchain
----------------

nightly-x86_64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
rustc 1.38.0-nightly (890881f8f 2019-07-25)
koka831 commented 5 years ago

same here. I tried to build from #9cf8f29, and faced the error above.

$ uname -a
Linux koka 4.18.0-25-generic #26~18.04.1-Ubuntu SMP Thu Jun 27 07:28:31 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ rustup --version                 [master]
rustup 1.18.3 (435397f48 2019-05-22)

$ cargo --version                  [master]
cargo 1.36.0 (c4fcfb725 2019-05-15)

$ rustc --version                  [master]
rustc 1.36.0 (a53f9df32 2019-07-03)

$ rustup run nightly rustup show   [master]
Default host: x86_64-unknown-linux-gnu

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
rustc 1.38.0-nightly (890881f8f 2019-07-25)
koka831 commented 5 years ago

according to this: https://docs.rs/crate/rustc-ap-arena/491.0.0/source/lib.rs , self.storage is alloc::raw_vec::RawVec<T>. and from https://github.com/rust-lang/rust/blob/4268e7ee22935f086b856ef0063a9e22b49aeddb/src/liballoc/raw_vec.rs#L204 it might be renamed to capacity() from cap().

kngwyu commented 5 years ago

@jiacai2050 @koka831 Thank you for reporting and sorry for the delay in response. I'm going to fix it

mathewcohle commented 5 years ago

I've found following workaround:

  1. clone repo
  2. apply following patch:
    
    diff --git a/Cargo.toml b/Cargo.toml
    index 7fed526..68f87d9 100644
    --- a/Cargo.toml
    +++ b/Cargo.toml
    @@ -24,7 +24,7 @@ debug = false # because of #1005
    [dependencies]
    bitflags = "1.0"
    log = "0.4"
    -rustc-ap-syntax = "491.0.0"
    +rustc-ap-syntax = "541.0.0"
    env_logger = "0.6"
    clap = "2.32"
    lazy_static = "1.2"
    diff --git a/src/racer/ast.rs b/src/racer/ast.rs
    index 000b83a..c7b87c1 100644
    --- a/src/racer/ast.rs
    +++ b/src/racer/ast.rs
    @@ -168,7 +168,7 @@ impl<'ast> visit::Visitor<'ast> for PatBindVisitor {
     fn visit_expr(&mut self, ex: &ast::Expr) {
         // don't visit the RHS or block of an 'if let' or 'for' stmt
         match ex.node {
    -            ExprKind::IfLet(ref pat, ..) | ExprKind::WhileLet(ref pat, ..) => {
    +            ExprKind::Let(ref pat, ..) => {
                 pat.iter().for_each(|pat| self.visit_pat(pat))
             }
             ExprKind::ForLoop(ref pat, ..) => self.visit_pat(pat),
    @@ -717,8 +717,7 @@ impl<'c, 's, 'ast> visit::Visitor<'ast> for ExprTypeVisitor<'c, 's> {
                     }
                 }
             }
    -            ExprKind::If(_, ref block, ref else_block)
    -            | ExprKind::IfLet(_, _, ref block, ref else_block) => {
    +            ExprKind::If(_, ref block, ref else_block) => {
                 debug!("if/iflet expr");
                 if let Some(stmt) = block.stmts.last() {
                     visit::walk_stmt(self, stmt);
    @@ -1333,7 +1332,7 @@ pub(crate) struct IfLetVisitor<'r, 's> {
    impl<'ast, 'r, 's> visit::Visitor<'ast> for IfLetVisitor<'r, 's> {
     fn visit_expr(&mut self, ex: &'ast ast::Expr) {
         match &ex.node {
    -            ExprKind::IfLet(pats, expr, _, _) | ExprKind::WhileLet(pats, expr, _, _) => {
    +            ExprKind::Let(pats, expr) => {
                 if let Some(pat) = pats.get(0) {
                     self.let_pat = Some(Pat::from_ast(&pat.node, &self.scope));
                     let mut expr_visitor = ExprTypeVisitor::new(self.scope.clone(), self.session);
    diff --git a/src/racer/lib.rs b/src/racer/lib.rs
    index 6291cdb..351d52a 100644
    --- a/src/racer/lib.rs
    +++ b/src/racer/lib.rs
    @@ -8,10 +8,8 @@ extern crate lazy_static;
    #[macro_use]
    extern crate bitflags;

-use syntax;

[macro_use]

extern crate derive_more; -use rls_span;

[macro_use]

mod testutils;


3. build locally `cargo +nightly build --release`

As I'm new to rust I'm not confident enough to submit it as PR, but hopefully it will help in the meantime.
kngwyu commented 5 years ago

@mathewcohle Thanks, looks ExprKind::IfLet has gone...

mathewcohle commented 5 years ago

@kngwyu indeed, see https://github.com/rust-lang/rust/pull/60861

davesque commented 5 years ago

After applying that patch (or trying the fix branch from the PR), I'm still getting build errors:

$ cargo +nightly build --release
    Updating crates.io index
   Compiling semver-parser v0.7.0
   Compiling libc v0.2.48
   Compiling autocfg v0.1.2
   Compiling arrayvec v0.4.10
   Compiling nodrop v0.1.13
   Compiling cfg-if v0.1.6
   Compiling rand_core v0.4.0
   Compiling scopeguard v0.3.3
   Compiling memoffset v0.2.1
   Compiling lazy_static v1.2.0
   Compiling proc-macro2 v0.4.27
   Compiling void v1.0.2
   Compiling stable_deref_trait v1.1.1
   Compiling rustc-rayon-core v0.2.0
   Compiling unicode-xid v0.1.0
   Compiling byteorder v1.3.1
   Compiling rustc-rayon v0.2.0
   Compiling either v1.5.0
   Compiling indexmap v1.0.2
   Compiling rustc-ap-graphviz v541.0.0
   Compiling memchr v2.1.3
   Compiling serde v1.0.87
   Compiling ryu v0.2.7
   Compiling unicode-width v0.1.5
   Compiling scoped-tls v1.0.0
   Compiling ucd-util v0.1.3
   Compiling regex v1.1.0
   Compiling rustc-ap-rustc_target v541.0.0
   Compiling itoa v0.4.3
   Compiling bitflags v1.0.4
   Compiling annotate-snippets v0.6.1
   Compiling rustc-ap-syntax v541.0.0
   Compiling termcolor v1.0.4
   Compiling quick-error v1.2.2
   Compiling utf8-ranges v1.0.2
   Compiling strsim v0.7.0
   Compiling rustc-ap-rustc_lexer v541.0.0
   Compiling vec_map v0.8.1
   Compiling ansi_term v0.11.0
   Compiling lazycell v1.2.1
   Compiling crossbeam-utils v0.2.2
   Compiling log v0.4.6
   Compiling unreachable v1.0.0
   Compiling crossbeam-utils v0.6.6
   Compiling thread_local v0.3.6
   Compiling owning_ref v0.4.0
   Compiling rand_core v0.3.1
   Compiling itertools v0.8.0
   Compiling rand_chacha v0.1.1
   Compiling rand v0.6.5
   Compiling textwrap v0.10.0
   Compiling semver v0.9.0
   Compiling humantime v1.2.0
   Compiling regex-syntax v0.6.5
   Compiling smallvec v0.6.8
   Compiling ena v0.13.0
   Compiling rand_isaac v0.1.1
   Compiling rand_hc v0.1.0
   Compiling rand_xorshift v0.1.1
   Compiling lock_api v0.1.5
   Compiling rustc-ap-serialize v541.0.0
   Compiling rustc_version v0.2.3
   Compiling crossbeam-epoch v0.3.1
   Compiling rand_os v0.1.2
   Compiling rand_jitter v0.1.3
   Compiling num_cpus v1.9.0
   Compiling jobserver v0.1.13
   Compiling atty v0.2.11
   Compiling rustc-hash v1.0.1
   Compiling clap v2.32.0
   Compiling rand_pcg v0.1.1
   Compiling parking_lot_core v0.4.0
   Compiling crossbeam-deque v0.2.0
   Compiling aho-corasick v0.6.9
   Compiling quote v0.6.11
   Compiling syn v0.15.26
   Compiling parking_lot v0.7.1
   Compiling rustc-ap-rustc_data_structures v541.0.0
   Compiling rustc-ap-arena v541.0.0
   Compiling env_logger v0.6.0
   Compiling synstructure v0.10.2
   Compiling serde_derive v1.0.87
   Compiling derive_more v0.13.0
   Compiling rustc-ap-rustc_macros v541.0.0
   Compiling rustc-ap-syntax_pos v541.0.0
   Compiling rustc-ap-rustc_errors v541.0.0
error: expected one of `,`, `@`, or `]`, found `..`
   --> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_target-541.0.0/abi/mod.rs:114:28
    |
114 |                 ["a", ref a..] => dl.aggregate_align = align(a, "a")?,
    |                            ^^ expected one of `,`, `@`, or `]` here

error: expected one of `,`, `@`, or `]`, found `..`
   --> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_target-541.0.0/abi/mod.rs:115:30
    |
115 |                 ["f32", ref a..] => dl.f32_align = align(a, "f32")?,
    |                              ^^ expected one of `,`, `@`, or `]` here

error: expected one of `,`, `@`, or `]`, found `..`
   --> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_target-541.0.0/abi/mod.rs:116:30
    |
116 |                 ["f64", ref a..] => dl.f64_align = align(a, "f64")?,
    |                              ^^ expected one of `,`, `@`, or `]` here

error: expected one of `,`, `@`, or `]`, found `..`
   --> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_target-541.0.0/abi/mod.rs:117:35
    |
117 |                 [p @ "p", s, ref a..] | [p @ "p0", s, ref a..] => {
    |                                   ^^ expected one of `,`, `@`, or `]` here

error: expected one of `,`, `@`, or `]`, found `..`
   --> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_target-541.0.0/abi/mod.rs:117:60
    |
117 |                 [p @ "p", s, ref a..] | [p @ "p0", s, ref a..] => {
    |                                                            ^^ expected one of `,`, `@`, or `]` here

error: expected one of `,`, `@`, or `]`, found `..`
   --> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_target-541.0.0/abi/mod.rs:121:26
    |
121 |                 [s, ref a..] if s.starts_with("i") => {
    |                          ^^ expected one of `,`, `@`, or `]` here

error: expected one of `,`, `@`, or `]`, found `..`
   --> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_target-541.0.0/abi/mod.rs:145:26
    |
145 |                 [s, ref a..] if s.starts_with("v") => {
    |                          ^^ expected one of `,`, `@`, or `]` here

error[E0308]: mismatched types
   --> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_target-541.0.0/abi/mod.rs:114:62
    |
114 |                 ["a", ref a..] => dl.aggregate_align = align(a, "a")?,
    |                                                              ^ expected slice, found &str
    |
    = note: expected type `&[&str]`
               found type `&&str`

error[E0308]: mismatched types
   --> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_target-541.0.0/abi/mod.rs:115:58
    |
115 |                 ["f32", ref a..] => dl.f32_align = align(a, "f32")?,
    |                                                          ^ expected slice, found &str
    |
    = note: expected type `&[&str]`
               found type `&&str`

error[E0308]: mismatched types
   --> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_target-541.0.0/abi/mod.rs:116:58
    |
116 |                 ["f64", ref a..] => dl.f64_align = align(a, "f64")?,
    |                                                          ^ expected slice, found &str
    |
    = note: expected type `&[&str]`
               found type `&&str`

error[E0308]: mismatched types
   --> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_target-541.0.0/abi/mod.rs:119:46
    |
119 |                     dl.pointer_align = align(a, p)?;
    |                                              ^ expected slice, found &str
    |
    = note: expected type `&[&str]`
               found type `&&str`

error[E0308]: mismatched types
   --> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_target-541.0.0/abi/mod.rs:129:35
    |
129 |                     let a = align(a, s)?;
    |                                   ^ expected slice, found &str
    |
    = note: expected type `&[&str]`
               found type `&&str`

error[E0308]: mismatched types
   --> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_target-541.0.0/abi/mod.rs:147:35
    |
147 |                     let a = align(a, s)?;
    |                                   ^ expected slice, found &str
    |
    = note: expected type `&[&str]`
               found type `&&str`

error: aborting due to 13 previous errors

For more information about this error, try `rustc --explain E0308`.
error: Could not compile `rustc-ap-rustc_target`.
warning: build failed, waiting for other jobs to finish...
error: build failed
Davids-MacBook-Pro-2 ~/projects/racer
$
kngwyu commented 5 years ago

@davesque Thanks, I reported it to rustc repo

davesque commented 5 years ago

@kngwyu Thanks. Sorry if it didn't belong here. I'm very new to Rust.

vivikey commented 5 years ago

与楼主一样的问题。 四天了还没解决,进度有点慢啊。

error[E0599]: no method named cap found for type alloc::raw_vec::RawVec<T> in the current scope --> C:\Users\Administrator.cargo\registry\src\github.com-1ecc6299db9ec823\rustc-ap-arena-491.0.0\lib.rs:102:47 | 102 | self.start().add(self.storage.cap()) | ^^^ private field, not a method

error[E0599]: no method named cap found for type alloc::raw_vec::RawVec<T> in the current scope --> C:\Users\Administrator.cargo\registry\src\github.com-1ecc6299db9ec823\rustc-ap-arena-491.0.0\lib.rs:273:55 | 273 | new_capacity = last_chunk.storage.cap(); | ^^^ private field, not a method

error[E0599]: no method named cap found for type alloc::raw_vec::RawVec<u8> in the current scope --> C:\Users\Administrator.cargo\registry\src\github.com-1ecc6299db9ec823\rustc-ap-arena-491.0.0\lib.rs:408:55 | 408 | new_capacity = last_chunk.storage.cap(); | ^^^ private field, not a method

error: aborting due to 3 previous errors

For more information about this error, try rustc --explain E0599. error: Could not compile rustc-ap-arena. warning: build failed, waiting for other jobs to finish... error: failed to compile racer v2.1.23, intermediate artifacts can be found at C:\Users\ADMINI~1\AppData\Local\Temp\cargo-installp53wWA

Caused by: build failed