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

rustc 658 #4174

Closed
wants to merge 1 commit into from
Closed

rustc 658 #4174

wants to merge 1 commit into from

Conversation

ctaggart
Copy link
Contributor

I bumped the rustc dependency to 658 and ran cargo update. This should make rustfmt_lib work in wasm #4132 (comment) .

@ctaggart
Copy link
Contributor Author

It is erroring out with:

    Compiling rustc-ap-rustc_parse v658.0.0
error: environment variable `CFG_RELEASE_CHANNEL` not defined
   --> /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_attr-658.0.0/builtin.rs:655:27
    |
655 |             let channel = env!("CFG_RELEASE_CHANNEL");
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^

@ctaggart
Copy link
Contributor Author

I was able to reproduce locally. If I set

export CFG_RELEASE_CHANNEL=nightly

I then get an error about CFG_RELEASE not being set.

   Compiling rustc-ap-rustc_parse v658.0.0
error: environment variable `CFG_RELEASE` not defined
   --> /Users/cameron/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_attr-658.0.0/builtin.rs:657:48
    |
657 |             let rustc_version = Version::parse(env!("CFG_RELEASE")).unwrap();
    |                 

If I then set

export CFG_RELEASE=658.0.0

It then looks like some stuff may have moved around in the ast:

   Compiling rustfmt_lib v2.0.0-rc.1 (/Users/cameron/rs/rustfmt/rustfmt-core/rustfmt-lib)
error[E0412]: cannot find type `Name` in module `ast`
   --> rustfmt-core/rustfmt-lib/src/macros.rs:621:23
    |
621 |     MetaVariable(ast::Name, String),
    |                       ^^^^ not found in `ast`
    |
help: there is an enum variant `rustc_ast_pretty::pprust::AnnNode::Name`; try using the variant's enum
    |
621 |     MetaVariable(rustc_ast_pretty::pprust::AnnNode, String),
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0603]: struct `Ident` is private
  --> rustfmt-core/rustfmt-lib/src/utils.rs:27:78
   |
27 | pub(crate) fn rewrite_ident<'a>(context: &'a RewriteContext<'_>, ident: ast::Ident) -> &'a str {
   |                                                                              ^^^^^ private struct
   |
note: the struct `Ident` is defined here
  --> /Users/cameron/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_ast-658.0.0/ast.rs:35:35
   |
35 | use rustc_span::symbol::{kw, sym, Ident, Symbol};
   |                                   ^^^^^

error[E0603]: struct `Ident` is private
   --> rustfmt-core/rustfmt-lib/src/chains.rs:119:22
    |
119 |     StructField(ast::Ident),
    |                      ^^^^^ private struct

@ctaggart
Copy link
Contributor Author

I'd like to see this upgraded, but I don't know how.

@ctaggart ctaggart closed this May 13, 2020
@calebcartwright
Copy link
Member

IIRC, Ident is defined in rustc_span and has just historically been re-exported from rustc_ast. Assuming that's the case it should be a relatively simple refactor within rustfmt to import from rustc_span (which is already in our dep tree).

If the visibility of Ident has been removed that'd be a huge problem for us though

@CAD97
Copy link
Contributor

CAD97 commented May 15, 2020

The rustc_ast re-export was removed in rust-lang/rust#71555.

@CAD97
Copy link
Contributor

CAD97 commented May 15, 2020

Reopened as #4177.

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

Successfully merging this pull request may close these issues.

None yet

3 participants