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

deno-ast 0.15 does not compile #97

Closed
carllerche opened this issue May 23, 2022 · 3 comments
Closed

deno-ast 0.15 does not compile #97

carllerche opened this issue May 23, 2022 · 3 comments

Comments

@carllerche
Copy link

My guess is there are some swc feature flags that deno-ast is depending on implicitly, but I have not debugged yet.

$ rustc --version    
rustc 1.61.0 (fe5b13d68 2022-05-18)

I created a new cargo project and added the following dependency:

deno_ast = "0.15.0"

The body of the code is:

use deno_ast::parse_module;
use deno_ast::MediaType;
use deno_ast::ParseParams;
use deno_ast::SourceTextInfo;
use std::sync::Arc;

fn main() {
    let source_text = Arc::new("class MyClass {}");
    let text_info = SourceTextInfo::new(source_text);
    let parsed_source = parse_module(ParseParams {
      specifier: "file:///my_file.ts".to_string(),
      media_type: MediaType::TypeScript,
      text_info,
      capture_tokens: true,
      maybe_syntax: None,
      scope_analysis: false,
    }).expect("should parse");
    
    // returns the comments
    parsed_source.comments();
    // returns the tokens if captured
    parsed_source.tokens();
    // returns the module (AST)
    parsed_source.module();
    // returns the `SourceTextInfo`
    parsed_source.source();
}

Compiling:

   Compiling swc_ecma_parser v0.104.2
error[E0599]: no method named `span_lo` found for struct `Box<swc_ecma_ast::Expr>` in the current scope
   --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/class_and_fn.rs:323:36
    |
323 |             span: span!(self, expr.span_lo()),
    |                                    ^^^^^^^ method not found in `Box<swc_ecma_ast::Expr>`

error[E0599]: no method named `span_lo` found for struct `Box<swc_ecma_ast::Expr>` in the current scope
  --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr/ops.rs:96:30
   |
96 |             let start = left.span_lo();
   |                              ^^^^^^^ method not found in `Box<swc_ecma_ast::Expr>`

error[E0599]: no method named `span_lo` found for struct `Box<swc_ecma_ast::Expr>` in the current scope
   --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr/ops.rs:215:34
    |
215 |             span: Span::new(left.span_lo(), right.span_hi(), Default::default()),
    |                                  ^^^^^^^ method not found in `Box<swc_ecma_ast::Expr>`

error[E0599]: no method named `span_hi` found for struct `Box<swc_ecma_ast::Expr>` in the current scope
   --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr/ops.rs:215:51
    |
215 |             span: Span::new(left.span_lo(), right.span_hi(), Default::default()),
    |                                                   ^^^^^^^ method not found in `Box<swc_ecma_ast::Expr>`

error[E0599]: no method named `span_hi` found for struct `Box<swc_ecma_ast::Expr>` in the current scope
   --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr/ops.rs:256:45
    |
256 |             let span = Span::new(start, arg.span_hi(), Default::default());
    |                                             ^^^^^^^ method not found in `Box<swc_ecma_ast::Expr>`

error[E0599]: no method named `span_hi` found for struct `Box<swc_ecma_ast::Expr>` in the current scope
   --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr/ops.rs:314:44
    |
314 |                 span: Span::new(start, arg.span_hi(), Default::default()),
    |                                            ^^^^^^^ method not found in `Box<swc_ecma_ast::Expr>`

error[E0599]: no method named `span_lo` found for struct `Box<swc_ecma_ast::Expr>` in the current scope
   --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr/ops.rs:347:40
    |
347 |                 span: span!(self, expr.span_lo()),
    |                                        ^^^^^^^ method not found in `Box<swc_ecma_ast::Expr>`

error[E0599]: no method named `span_lo` found for struct `Box<swc_ecma_ast::Expr>` in the current scope
  --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr.rs:22:26
   |
22 |         let start = expr.span_lo();
   |                          ^^^^^^^ method not found in `Box<swc_ecma_ast::Expr>`

error[E0599]: no method named `span_hi` found for struct `Box<swc_ecma_ast::Expr>` in the current scope
   --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr.rs:220:45
    |
220 |             let span = Span::new(start, alt.span_hi(), Default::default());
    |                                             ^^^^^^^ method not found in `Box<swc_ecma_ast::Expr>`

error[E0599]: no method named `span_lo` found for reference `&Box<swc_ecma_ast::Expr>` in the current scope
   --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr.rs:918:44
    |
918 |                     exprs.first().unwrap().span_lo(),
    |                                            ^^^^^^^ method not found in `&Box<swc_ecma_ast::Expr>`

error[E0599]: no method named `span_hi` found for reference `&Box<swc_ecma_ast::Expr>` in the current scope
   --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr.rs:919:43
    |
919 |                     exprs.last().unwrap().span_hi(),
    |                                           ^^^^^^^ method not found in `&Box<swc_ecma_ast::Expr>`

error[E0599]: no method named `span_lo` found for struct `Box<swc_ecma_ast::Expr>` in the current scope
   --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr.rs:960:36
    |
960 |         let tagged_tpl_start = tag.span_lo();
    |                                    ^^^^^^^ method not found in `Box<swc_ecma_ast::Expr>`

error[E0599]: no method named `span_lo` found for enum `swc_ecma_ast::Callee` in the current scope
    --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr.rs:1171:38
     |
1171 |             let span = Span::new(obj.span_lo(), self.input.last_pos(), Default::default());
     |                                      ^^^^^^^ method not found in `swc_ecma_ast::Callee`

error[E0599]: no method named `span_lo` found for enum `swc_ecma_ast::Callee` in the current scope
    --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr.rs:1172:34
     |
1172 |             debug_assert_eq!(obj.span_lo(), span.lo());
     |                                  ^^^^^^^ method not found in `swc_ecma_ast::Callee`

error[E0599]: no method named `span_lo` found for enum `swc_ecma_ast::Callee` in the current scope
    --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr.rs:1293:40
     |
1293 |             let span = span!(self, obj.span_lo());
     |                                        ^^^^^^^ method not found in `swc_ecma_ast::Callee`

error[E0599]: no method named `span_lo` found for enum `swc_ecma_ast::Callee` in the current scope
    --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr.rs:1294:34
     |
1294 |             debug_assert_eq!(obj.span_lo(), span.lo());
     |                                  ^^^^^^^ method not found in `swc_ecma_ast::Callee`

error[E0599]: no method named `span_hi` found for enum `swc_ecma_ast::MemberProp` in the current scope
    --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr.rs:1295:35
     |
1295 |             debug_assert_eq!(prop.span_hi(), span.hi());
     |                                   ^^^^^^^ method not found in `swc_ecma_ast::MemberProp`

error[E0599]: no method named `span_hi` found for struct `Box<swc_ecma_ast::Expr>` in the current scope
    --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr.rs:1634:60
     |
1634 | ...                   span: Span::new(start, alt.span_hi(), Default::default()),
     |                                                  ^^^^^^^ method not found in `Box<swc_ecma_ast::Expr>`

error[E0599]: no method named `span_lo` found for reference `&swc_ecma_ast::Expr` in the current scope
    --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/expr.rs:1841:58
     |
1841 |         Ok(self.state.potential_arrow_start == Some(expr.span_lo())
     |                                                          ^^^^^^^ method not found in `&swc_ecma_ast::Expr`

error[E0599]: no method named `span_lo` found for struct `Box<swc_ecma_ast::TsType>` in the current scope
    --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/typescript.rs:2152:42
     |
2152 |                     span: span!(self, ty.span_lo()),
     |                                          ^^^^^^^ method not found in `Box<swc_ecma_ast::TsType>`

error[E0599]: no method named `span_lo` found for struct `Box<swc_ecma_ast::TsType>` in the current scope
    --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/typescript.rs:2159:42
     |
2159 |                     span: span!(self, ty.span_lo()),
     |                                          ^^^^^^^ method not found in `Box<swc_ecma_ast::TsType>`

error[E0599]: no method named `span_lo` found for struct `swc_ecma_ast::Ident` in the current scope
    --> /home/carllerche/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_parser-0.104.2/src/parser/typescript.rs:2262:26
     |
2262 |         let start = expr.span_lo();
     |                          ^^^^^^^ method not found in `swc_ecma_ast::Ident`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `swc_ecma_parser` due to 22 previous errors
@dsherret
Copy link
Member

I saw this earlier. It's because swc did a patch release overnight to swc_ecma_parser using features in another crate that were not published. It happens quite often. I opened swc-project/swc#4760

@dsherret
Copy link
Member

@carllerche try running cargo update. Looks like this was just fixed in swc.

@carllerche
Copy link
Author

Awesome, thanks!

@dsherret dsherret closed this as completed Jun 3, 2022
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