Skip to content

Commit f009252

Browse files
authored
Merge pull request #2950 from CAD97/master
Rename CodeMap/FileMap to SourceMap/SourceFile
2 parents 693c7d6 + fc1909d commit f009252

34 files changed

+210
-204
lines changed

Cargo.lock

+35-35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ env_logger = "0.5"
4747
getopts = "0.2"
4848
derive-new = "0.5"
4949
cargo_metadata = "0.6"
50-
rustc-ap-rustc_target = "230.0.0"
51-
rustc-ap-syntax = "230.0.0"
52-
rustc-ap-syntax_pos = "230.0.0"
50+
rustc-ap-rustc_target = "235.0.0"
51+
rustc-ap-syntax = "235.0.0"
52+
rustc-ap-syntax_pos = "235.0.0"
5353
failure = "0.1.1"
5454

5555
[dev-dependencies]

src/attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use utils::{count_newlines, mk_sp};
2222

2323
use std::borrow::Cow;
2424
use syntax::ast;
25-
use syntax::codemap::{BytePos, Span, DUMMY_SP};
25+
use syntax::source_map::{BytePos, Span, DUMMY_SP};
2626

2727
/// Returns attributes on the given statement.
2828
pub fn get_attrs_from_stmt(stmt: &ast::Stmt) -> &[ast::Attribute] {

src/chains.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@
6565
//! .qux
6666
//! ```
6767
68-
use codemap::SpanUtils;
6968
use comment::rewrite_comment;
7069
use config::IndentStyle;
7170
use expr::rewrite_call;
7271
use lists::{extract_post_comment, extract_pre_comment, get_comment_end};
7372
use macros::convert_try_mac;
7473
use rewrite::{Rewrite, RewriteContext};
7574
use shape::Shape;
75+
use source_map::SpanUtils;
7676
use utils::{
7777
first_line_width, last_line_extendable, last_line_width, mk_sp, trimmed_last_line_width,
7878
wrap_str,
@@ -82,7 +82,7 @@ use std::borrow::Cow;
8282
use std::cmp::min;
8383
use std::iter;
8484

85-
use syntax::codemap::{BytePos, Span};
85+
use syntax::source_map::{BytePos, Span};
8686
use syntax::{ast, ptr};
8787

8888
pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -> Option<String> {

src/closures.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
// except according to those terms.
1010

1111
use config::lists::*;
12-
use syntax::codemap::Span;
1312
use syntax::parse::classify;
13+
use syntax::source_map::Span;
1414
use syntax::{ast, ptr};
1515

16-
use codemap::SpanUtils;
1716
use expr::{block_contains_comment, is_simple_block, is_unsafe_block, rewrite_cond, ToExpr};
1817
use items::{span_hi_for_arg, span_lo_for_arg};
1918
use lists::{definitive_tactic, itemize_list, write_list, ListFormatting, Separator};
2019
use rewrite::{Rewrite, RewriteContext};
2120
use shape::Shape;
21+
use source_map::SpanUtils;
2222
use utils::{last_line_width, left_most_sub_expr, stmt_expr};
2323

2424
// This module is pretty messy because of the rules around closures and blocks:
@@ -51,7 +51,7 @@ pub fn rewrite_closure(
5151

5252
if let ast::ExprKind::Block(ref block, _) = body.node {
5353
// The body of the closure is an empty block.
54-
if block.stmts.is_empty() && !block_contains_comment(block, context.codemap) {
54+
if block.stmts.is_empty() && !block_contains_comment(block, context.source_map) {
5555
return body
5656
.rewrite(context, shape)
5757
.map(|s| format!("{} {}", prefix, s));
@@ -114,7 +114,7 @@ fn get_inner_expr<'a>(
114114
fn needs_block(block: &ast::Block, prefix: &str, context: &RewriteContext) -> bool {
115115
is_unsafe_block(block)
116116
|| block.stmts.len() > 1
117-
|| block_contains_comment(block, context.codemap)
117+
|| block_contains_comment(block, context.source_map)
118118
|| prefix.contains('\n')
119119
}
120120

@@ -304,7 +304,7 @@ pub fn rewrite_last_closure(
304304
let body = match body.node {
305305
ast::ExprKind::Block(ref block, _)
306306
if !is_unsafe_block(block)
307-
&& is_simple_block(block, Some(&body.attrs), context.codemap) =>
307+
&& is_simple_block(block, Some(&body.attrs), context.source_map) =>
308308
{
309309
stmt_expr(&block.stmts[0]).unwrap_or(body)
310310
}

src/comment.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use std::{self, borrow::Cow, iter};
1414

1515
use itertools::{multipeek, MultiPeek};
16-
use syntax::codemap::Span;
16+
use syntax::source_map::Span;
1717

1818
use config::Config;
1919
use rewrite::RewriteContext;
@@ -1151,10 +1151,10 @@ pub fn recover_comment_removed(
11511151
// We missed some comments. Warn and keep the original text.
11521152
if context.config.error_on_unformatted() {
11531153
context.report.append(
1154-
context.codemap.span_to_filename(span).into(),
1154+
context.source_map.span_to_filename(span).into(),
11551155
vec![FormattingError::from_span(
11561156
&span,
1157-
&context.codemap,
1157+
&context.source_map,
11581158
ErrorKind::LostComment,
11591159
)],
11601160
);

src/config/file_lines.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ use serde::de::{Deserialize, Deserializer};
1919
use serde::ser::{self, Serialize, Serializer};
2020
use serde_json as json;
2121

22-
use syntax::codemap::{self, FileMap};
22+
use syntax::source_map::{self, SourceFile};
2323

2424
/// A range of lines in a file, inclusive of both ends.
2525
pub struct LineRange {
26-
pub file: Rc<FileMap>,
26+
pub file: Rc<SourceFile>,
2727
pub lo: usize,
2828
pub hi: usize,
2929
}
@@ -35,11 +35,11 @@ pub enum FileName {
3535
Stdin,
3636
}
3737

38-
impl From<codemap::FileName> for FileName {
39-
fn from(name: codemap::FileName) -> FileName {
38+
impl From<source_map::FileName> for FileName {
39+
fn from(name: source_map::FileName) -> FileName {
4040
match name {
41-
codemap::FileName::Real(p) => FileName::Real(p),
42-
codemap::FileName::Custom(ref f) if f == "stdin" => FileName::Stdin,
41+
source_map::FileName::Real(p) => FileName::Real(p),
42+
source_map::FileName::Custom(ref f) if f == "stdin" => FileName::Stdin,
4343
_ => unreachable!(),
4444
}
4545
}

0 commit comments

Comments
 (0)