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

error[E0432]: unresolved import syntax::ast::SpannedIdent #3

Closed
zengsai opened this issue Apr 7, 2018 · 1 comment
Closed

error[E0432]: unresolved import syntax::ast::SpannedIdent #3

zengsai opened this issue Apr 7, 2018 · 1 comment

Comments

@zengsai
Copy link

zengsai commented Apr 7, 2018

got this error while compile rocket 0.3.7 using toolchain nightly-x86_64-apple-darwin (default) rustc 1.27.0-nightly (eeea94c11 2018-04-06):

Compiling pear_codegen v0.0.14
   Compiling cookie v0.9.2
error[E0432]: unresolved import `syntax::ast::SpannedIdent`
  --> /Users/Sai/.cargo/registry/src/github.com-1ecc6299db9ec823/pear_codegen-0.0.14/src/lib.rs:27:56
   |
27 | use syntax::ast::{ItemKind, MetaItem, FnDecl, PatKind, SpannedIdent};
   |                                                        ^^^^^^^^^^^^ no `SpannedIdent` in `ast`

error[E0609]: no field `identifier` on type `syntax::ast::PathSegment`
   --> /Users/Sai/.cargo/registry/src/github.com-1ecc6299db9ec823/pear_codegen-0.0.14/src/lib.rs:131:59
    |
131 |             let penultimate = path.segments[num_segs - 2].identifier.name.as_str();
    |                                                           ^^^^^^^^^^ unknown field
    |
    = note: available fields are: `ident`, `parameters`

error[E0609]: no field `identifier` on type `syntax::ast::PathSegment`
   --> /Users/Sai/.cargo/registry/src/github.com-1ecc6299db9ec823/pear_codegen-0.0.14/src/lib.rs:138:48
    |
138 |         let last = path.segments[num_segs - 1].identifier.name.as_str();
    |                                                ^^^^^^^^^^ unknown field
    |
    = note: available fields are: `ident`, `parameters`

error[E0609]: no field `identifier` on type `syntax::ast::PathSegment`
   --> /Users/Sai/.cargo/registry/src/github.com-1ecc6299db9ec823/pear_codegen-0.0.14/src/lib.rs:147:40
    |
147 |     let first_ident = path.segments[0].identifier.name.as_str();
    |                                        ^^^^^^^^^^ unknown field
    |
    = note: available fields are: `ident`, `parameters`

error: aborting due to 4 previous errors

Some errors occurred: E0432, E0609.
For more information about an error, try `rustc --explain E0432`.
error: Could not compile `pear_codegen`.
warning: build failed, waiting for other jobs to finish...
error: build failed

the reason is libsyntax get rid of SpannedInde:

@@ -101,11 +99,8 @@ impl fmt::Display for Path {
 impl Path {
     // convert a span and an identifier to the corresponding
...skipping...
    Get rid of `SpannedIdent`

diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index a3839a861c..652aaa795c 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -541,7 +541,7 @@ impl Pat {
         let node = match &self.node {
             PatKind::Wild => TyKind::Infer,
             PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), ident, None) =>
-                TyKind::Path(None, Path::from_ident(ident.span, ident.node)),
+                TyKind::Path(None, Path::from_ident(ident.span, *ident)),
             PatKind::Path(qself, path) => TyKind::Path(qself.clone(), path.clone()),
             PatKind::Mac(mac) => TyKind::Mac(mac.clone()),
             PatKind::Ref(pat, mutbl) =>
@@ -638,7 +638,7 @@ pub enum PatKind {
     /// or a unit struct/variant pattern, or a const pattern (in the last two cases the third
     /// field must be `None`). Disambiguation cannot be done with parser alone, so it happens
     /// during name resolution.
-    Ident(BindingMode, SpannedIdent, Option<P<Pat>>),
+    Ident(BindingMode, Ident, Option<P<Pat>>),

     /// A struct or struct variant pattern, e.g. `Variant {x, y, ..}`.
     /// The `bool` is `true` in the presence of a `..`.
@SergioBenitez
Copy link
Owner

Fixed in a7f1116.

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