Skip to content

Commit

Permalink
Update rustc-ap-* crates to 659.0.0 for rustfmt-1.4.15 (#4184)
Browse files Browse the repository at this point in the history
  • Loading branch information
topecongiro authored May 19, 2020
1 parent a5cb5d2 commit 577ef81
Show file tree
Hide file tree
Showing 14 changed files with 227 additions and 184 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ matrix:
script:
- |
if [ -z ${INTEGRATION} ]; then
export CFG_RELEASE_CHANNEL=nightly
export CFG_RELEASE=nightly
cargo build
cargo test
cargo test -- --ignored
Expand Down
286 changes: 157 additions & 129 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,32 +65,36 @@ rustc-workspace-hack = "1.0.0"

[dependencies.rustc_ast]
package = "rustc-ap-rustc_ast"
version = "654.0.0"
version = "659.0.0"

[dependencies.rustc_ast_pretty]
package = "rustc-ap-rustc_ast_pretty"
version = "654.0.0"
version = "659.0.0"

[dependencies.rustc_attr]
package = "rustc-ap-rustc_attr"
version = "659.0.0"

[dependencies.rustc_data_structures]
package = "rustc-ap-rustc_data_structures"
version = "654.0.0"
version = "659.0.0"

[dependencies.rustc_errors]
package = "rustc-ap-rustc_errors"
version = "654.0.0"
version = "659.0.0"

[dependencies.rustc_expand]
package = "rustc-ap-rustc_expand"
version = "654.0.0"
version = "659.0.0"

[dependencies.rustc_parse]
package = "rustc-ap-rustc_parse"
version = "654.0.0"
version = "659.0.0"

[dependencies.rustc_session]
package = "rustc-ap-rustc_session"
version = "654.0.0"
version = "659.0.0"

[dependencies.rustc_span]
package = "rustc-ap-rustc_span"
version = "654.0.0"
version = "659.0.0"
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ install:
build: false

test_script:
- set CFG_RELEASE_CHANNEL=nightly
- set CFG_RELEASE=nightly
- cargo build --verbose
- cargo test
- cargo test -- --ignored
2 changes: 1 addition & 1 deletion ci/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set -ex
# it again.
#
#which cargo-fmt || cargo install --force
cargo install --path . --force
CFG_RELEASE=nightly CFG_RELEASE_CHANNEL=nightly cargo install --path . --force

echo "Integration tests for: ${INTEGRATION}"
cargo fmt -- --version
Expand Down
8 changes: 4 additions & 4 deletions src/chains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ use std::borrow::Cow;
use std::cmp::min;

use rustc_ast::{ast, ptr};
use rustc_span::{BytePos, Span};
use rustc_span::{symbol, BytePos, Span};

use crate::comment::{rewrite_comment, CharClasses, FullCodeCharKind, RichChar};
use crate::config::IndentStyle;
Expand Down Expand Up @@ -116,8 +116,8 @@ enum ChainItemKind {
Vec<ast::GenericArg>,
Vec<ptr::P<ast::Expr>>,
),
StructField(ast::Ident),
TupleField(ast::Ident, bool),
StructField(symbol::Ident),
TupleField(symbol::Ident, bool),
Await,
Comment(String, CommentPosition),
}
Expand Down Expand Up @@ -234,7 +234,7 @@ impl ChainItem {
}

fn rewrite_method_call(
method_name: ast::Ident,
method_name: symbol::Ident,
types: &[ast::GenericArg],
args: &[ptr::P<ast::Expr>],
span: Span,
Expand Down
8 changes: 6 additions & 2 deletions src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ use std::cmp::Ordering;
use std::fmt;

use rustc_ast::ast::{self, UseTreeKind};
use rustc_span::{source_map, symbol::sym, BytePos, Span, DUMMY_SP};
use rustc_span::{
source_map,
symbol::{self, sym},
BytePos, Span, DUMMY_SP,
};

use crate::comment::combine_strs_with_missing_comments;
use crate::config::lists::*;
Expand All @@ -20,7 +24,7 @@ use crate::visitor::FmtVisitor;

/// Returns a name imported by a `use` declaration.
/// E.g., returns `Ordering` for `std::cmp::Ordering` and `self` for `std::cmp::self`.
pub(crate) fn path_to_imported_ident(path: &ast::Path) -> ast::Ident {
pub(crate) fn path_to_imported_ident(path: &ast::Path) -> symbol::Ident {
path.segments.last().unwrap().ident
}

Expand Down
30 changes: 15 additions & 15 deletions src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ impl<'a> FmtVisitor<'a> {
pub(crate) fn rewrite_fn_before_block(
&mut self,
indent: Indent,
ident: ast::Ident,
ident: symbol::Ident,
fn_sig: &FnSig<'_>,
span: Span,
) -> Option<(String, FnBraceStyle)> {
Expand All @@ -335,7 +335,7 @@ impl<'a> FmtVisitor<'a> {
pub(crate) fn rewrite_required_fn(
&mut self,
indent: Indent,
ident: ast::Ident,
ident: symbol::Ident,
sig: &ast::FnSig,
generics: &ast::Generics,
span: Span,
Expand Down Expand Up @@ -411,7 +411,7 @@ impl<'a> FmtVisitor<'a> {

pub(crate) fn visit_enum(
&mut self,
ident: ast::Ident,
ident: symbol::Ident,
vis: &ast::Visibility,
enum_def: &ast::EnumDef,
generics: &ast::Generics,
Expand Down Expand Up @@ -967,7 +967,7 @@ fn rewrite_trait_ref(

pub(crate) struct StructParts<'a> {
prefix: &'a str,
ident: ast::Ident,
ident: symbol::Ident,
vis: &'a ast::Visibility,
def: &'a ast::VariantData,
generics: Option<&'a ast::Generics>,
Expand Down Expand Up @@ -1234,7 +1234,7 @@ impl<'a> Rewrite for TraitAliasBounds<'a> {

pub(crate) fn format_trait_alias(
context: &RewriteContext<'_>,
ident: ast::Ident,
ident: symbol::Ident,
vis: &ast::Visibility,
generics: &ast::Generics,
generic_bounds: &ast::GenericBounds,
Expand Down Expand Up @@ -1513,7 +1513,7 @@ fn rewrite_type_prefix(
context: &RewriteContext<'_>,
indent: Indent,
prefix: &str,
ident: ast::Ident,
ident: symbol::Ident,
generics: &ast::Generics,
) -> Option<String> {
let mut result = String::with_capacity(128);
Expand Down Expand Up @@ -1554,7 +1554,7 @@ fn rewrite_type_item<R: Rewrite>(
indent: Indent,
prefix: &str,
suffix: &str,
ident: ast::Ident,
ident: symbol::Ident,
rhs: &R,
generics: &ast::Generics,
vis: &ast::Visibility,
Expand Down Expand Up @@ -1583,7 +1583,7 @@ fn rewrite_type_item<R: Rewrite>(
pub(crate) fn rewrite_type_alias(
context: &RewriteContext<'_>,
indent: Indent,
ident: ast::Ident,
ident: symbol::Ident,
ty: &ast::Ty,
generics: &ast::Generics,
vis: &ast::Visibility,
Expand All @@ -1594,7 +1594,7 @@ pub(crate) fn rewrite_type_alias(
pub(crate) fn rewrite_opaque_type(
context: &RewriteContext<'_>,
indent: Indent,
ident: ast::Ident,
ident: symbol::Ident,
generic_bounds: &ast::GenericBounds,
generics: &ast::Generics,
vis: &ast::Visibility,
Expand Down Expand Up @@ -1709,7 +1709,7 @@ pub(crate) fn rewrite_struct_field(
pub(crate) struct StaticParts<'a> {
prefix: &'a str,
vis: &'a ast::Visibility,
ident: ast::Ident,
ident: symbol::Ident,
ty: &'a ast::Ty,
mutability: ast::Mutability,
expr_opt: Option<&'a ptr::P<ast::Expr>>,
Expand Down Expand Up @@ -1830,7 +1830,7 @@ fn rewrite_static(
}

pub(crate) fn rewrite_associated_type(
ident: ast::Ident,
ident: symbol::Ident,
ty_opt: Option<&ptr::P<ast::Ty>>,
generics: &ast::Generics,
generic_bounds_opt: Option<&ast::GenericBounds>,
Expand Down Expand Up @@ -1880,7 +1880,7 @@ impl<'a> Rewrite for OpaqueType<'a> {

pub(crate) fn rewrite_opaque_impl_type(
context: &RewriteContext<'_>,
ident: ast::Ident,
ident: symbol::Ident,
generics: &ast::Generics,
generic_bounds: &ast::GenericBounds,
indent: Indent,
Expand All @@ -1904,7 +1904,7 @@ pub(crate) fn rewrite_opaque_impl_type(
}

pub(crate) fn rewrite_associated_impl_type(
ident: ast::Ident,
ident: symbol::Ident,
defaultness: ast::Defaultness,
ty_opt: Option<&ptr::P<ast::Ty>>,
generics: &ast::Generics,
Expand Down Expand Up @@ -2141,7 +2141,7 @@ pub(crate) enum FnBraceStyle {
fn rewrite_fn_base(
context: &RewriteContext<'_>,
indent: Indent,
ident: ast::Ident,
ident: symbol::Ident,
fn_sig: &FnSig<'_>,
span: Span,
fn_brace_style: FnBraceStyle,
Expand Down Expand Up @@ -2969,7 +2969,7 @@ fn rewrite_comments_before_after_where(
fn format_header(
context: &RewriteContext<'_>,
item_name: &str,
ident: ast::Ident,
ident: symbol::Ident,
vis: &ast::Visibility,
) -> String {
format!(
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use std::rc::Rc;
use failure::Fail;
use ignore;
use rustc_ast::ast;
use rustc_span::symbol;

use crate::comment::LineClasses;
use crate::emitter::Emitter;
Expand Down Expand Up @@ -524,7 +525,7 @@ impl Input {
let file_stem = file.file_stem()?;
if file.parent()?.to_path_buf().join(file_stem).is_dir() {
Some(DirectoryOwnership::Owned {
relative: file_stem.to_str().map(ast::Ident::from_str),
relative: file_stem.to_str().map(symbol::Ident::from_str),
})
} else {
None
Expand Down
24 changes: 14 additions & 10 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ use rustc_ast::tokenstream::{Cursor, TokenStream, TokenTree};
use rustc_ast::{ast, ptr};
use rustc_ast_pretty::pprust;
use rustc_parse::{new_parser_from_tts, parser::Parser};
use rustc_span::{symbol::kw, BytePos, Span, Symbol, DUMMY_SP};
use rustc_span::{
symbol::{self, kw},
BytePos, Span, Symbol, DUMMY_SP,
};

use crate::comment::{
contains_comment, CharClasses, FindUncommented, FullCodeCharKind, LineClasses,
Expand Down Expand Up @@ -52,7 +55,7 @@ pub(crate) enum MacroArg {
Ty(ptr::P<ast::Ty>),
Pat(ptr::P<ast::Pat>),
Item(ptr::P<ast::Item>),
Keyword(ast::Ident, Span),
Keyword(symbol::Ident, Span),
}

impl MacroArg {
Expand Down Expand Up @@ -137,7 +140,7 @@ fn parse_macro_arg<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> {
fn rewrite_macro_name(
context: &RewriteContext<'_>,
path: &ast::Path,
extra_ident: Option<ast::Ident>,
extra_ident: Option<symbol::Ident>,
) -> String {
let name = if path.segments.len() == 1 {
// Avoid using pretty-printer in the common case.
Expand Down Expand Up @@ -188,7 +191,7 @@ fn return_macro_parse_failure_fallback(

pub(crate) fn rewrite_macro(
mac: &ast::MacCall,
extra_ident: Option<ast::Ident>,
extra_ident: Option<symbol::Ident>,
context: &RewriteContext<'_>,
shape: Shape,
position: MacroPosition,
Expand Down Expand Up @@ -230,17 +233,18 @@ fn check_keyword<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> {
})
{
parser.bump();
let macro_arg =
MacroArg::Keyword(ast::Ident::with_dummy_span(keyword), parser.prev_token.span);
return Some(macro_arg);
return Some(MacroArg::Keyword(
symbol::Ident::with_dummy_span(keyword),
parser.prev_token.span,
));
}
}
None
}

fn rewrite_macro_inner(
mac: &ast::MacCall,
extra_ident: Option<ast::Ident>,
extra_ident: Option<symbol::Ident>,
context: &RewriteContext<'_>,
shape: Shape,
position: MacroPosition,
Expand Down Expand Up @@ -479,7 +483,7 @@ pub(crate) fn rewrite_macro_def(
shape: Shape,
indent: Indent,
def: &ast::MacroDef,
ident: ast::Ident,
ident: symbol::Ident,
vis: &ast::Visibility,
span: Span,
) -> Option<String> {
Expand Down Expand Up @@ -620,7 +624,7 @@ fn replace_names(input: &str) -> Option<(String, HashMap<String, String>)> {
#[derive(Debug, Clone)]
enum MacroArgKind {
/// e.g., `$x: expr`.
MetaVariable(ast::Name, String),
MetaVariable(Symbol, String),
/// e.g., `$($foo: expr),*`
Repeat(
/// `()`, `[]` or `{}`.
Expand Down
6 changes: 3 additions & 3 deletions src/modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};

use rustc_ast::ast;
use rustc_ast::visit::Visitor;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::symbol::{self, sym, Symbol};

use crate::attr::MetaVisitor;
use crate::config::FileName;
Expand Down Expand Up @@ -239,7 +239,7 @@ impl<'ast, 'sess, 'c> ModResolver<'ast, 'sess> {
/// Find a file path in the filesystem which corresponds to the given module.
fn find_external_module(
&self,
mod_name: ast::Ident,
mod_name: symbol::Ident,
attrs: &[ast::Attribute],
sub_mod: &Cow<'ast, ast::Mod>,
) -> Result<Option<SubModKind<'c, 'ast>>, String> {
Expand Down Expand Up @@ -326,7 +326,7 @@ impl<'ast, 'sess, 'c> ModResolver<'ast, 'sess> {
}
}

fn push_inline_mod_directory(&mut self, id: ast::Ident, attrs: &[ast::Attribute]) {
fn push_inline_mod_directory(&mut self, id: symbol::Ident, attrs: &[ast::Attribute]) {
if let Some(path) = find_path_value(attrs) {
self.directory.path.push(&*path.as_str());
self.directory.ownership = DirectoryOwnership::Owned { relative: None };
Expand Down
Loading

0 comments on commit 577ef81

Please sign in to comment.