Skip to content

Commit d3fe97f

Browse files
committed
mv codemap() source_map()
1 parent 82607d2 commit d3fe97f

File tree

78 files changed

+209
-209
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+209
-209
lines changed

src/libproc_macro/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ pub mod __internal {
11861186
use super::{TokenStream, LexError, Span};
11871187

11881188
pub fn lookup_char_pos(pos: BytePos) -> Loc {
1189-
with_sess(|sess, _| sess.codemap().lookup_char_pos(pos))
1189+
with_sess(|sess, _| sess.source_map().lookup_char_pos(pos))
11901190
}
11911191

11921192
pub fn new_token_stream(item: P<ast::Item>) -> TokenStream {

src/librustc/hir/lowering.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3621,7 +3621,7 @@ impl<'a> LoweringContext<'a> {
36213621
let tail = block.expr.take().map_or_else(
36223622
|| {
36233623
let LoweredNodeId { node_id, hir_id } = this.next_id();
3624-
let span = this.sess.codemap().end_point(unstable_span);
3624+
let span = this.sess.source_map().end_point(unstable_span);
36253625
hir::Expr {
36263626
id: node_id,
36273627
span,

src/librustc/hir/map/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ pub fn map_crate<'hir>(sess: &::session::Session,
12021202
let cmdline_args = sess.opts.dep_tracking_hash();
12031203
collector.finalize_and_compute_crate_hash(crate_disambiguator,
12041204
cstore,
1205-
sess.codemap(),
1205+
sess.source_map(),
12061206
cmdline_args)
12071207
};
12081208

src/librustc/ich/hcx.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<'a> StableHashingContext<'a> {
101101
definitions,
102102
cstore,
103103
caching_codemap: None,
104-
raw_codemap: sess.codemap(),
104+
raw_codemap: sess.source_map(),
105105
hash_spans: hash_spans_initial,
106106
hash_bodies: true,
107107
node_id_hashing_mode: NodeIdHashingMode::HashDefPath,
@@ -169,7 +169,7 @@ impl<'a> StableHashingContext<'a> {
169169
}
170170

171171
#[inline]
172-
pub fn codemap(&mut self) -> &mut CachingCodemapView<'a> {
172+
pub fn source_map(&mut self) -> &mut CachingCodemapView<'a> {
173173
match self.caching_codemap {
174174
Some(ref mut cm) => {
175175
cm
@@ -340,7 +340,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
340340
return std_hash::Hash::hash(&TAG_INVALID_SPAN, hasher);
341341
}
342342

343-
let (file_lo, line_lo, col_lo) = match hcx.codemap()
343+
let (file_lo, line_lo, col_lo) = match hcx.source_map()
344344
.byte_pos_to_line_and_col(span.lo) {
345345
Some(pos) => pos,
346346
None => {

src/librustc/infer/error_reporting/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
189189
self,
190190
region: ty::Region<'tcx>,
191191
) -> (String, Option<Span>) {
192-
let cm = self.sess.codemap();
192+
let cm = self.sess.source_map();
193193

194194
let scope = region.free_region_binding_scope(self);
195195
let node = self.hir.as_local_node_id(scope).unwrap_or(DUMMY_NODE_ID);
@@ -286,7 +286,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
286286
}
287287

288288
fn explain_span(self, heading: &str, span: Span) -> (String, Option<Span>) {
289-
let lo = self.sess.codemap().lookup_char_pos_adj(span.lo());
289+
let lo = self.sess.source_map().lookup_char_pos_adj(span.lo());
290290
(
291291
format!("the {} at {}:{}", heading, lo.line, lo.col.to_usize() + 1),
292292
Some(span),
@@ -502,14 +502,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
502502
ObligationCauseCode::MatchExpressionArm { arm_span, source } => match source {
503503
hir::MatchSource::IfLetDesugar { .. } => {
504504
let msg = "`if let` arm with an incompatible type";
505-
if self.tcx.sess.codemap().is_multiline(arm_span) {
505+
if self.tcx.sess.source_map().is_multiline(arm_span) {
506506
err.span_note(arm_span, msg);
507507
} else {
508508
err.span_label(arm_span, msg);
509509
}
510510
},
511511
hir::MatchSource::TryDesugar => { // Issue #51632
512-
if let Ok(try_snippet) = self.tcx.sess.codemap().span_to_snippet(arm_span) {
512+
if let Ok(try_snippet) = self.tcx.sess.source_map().span_to_snippet(arm_span) {
513513
err.span_suggestion_with_applicability(
514514
arm_span,
515515
"try wrapping with a success variant",
@@ -520,7 +520,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
520520
},
521521
_ => {
522522
let msg = "match arm with an incompatible type";
523-
if self.tcx.sess.codemap().is_multiline(arm_span) {
523+
if self.tcx.sess.source_map().is_multiline(arm_span) {
524524
err.span_note(arm_span, msg);
525525
} else {
526526
err.span_label(arm_span, msg);
@@ -1136,8 +1136,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
11361136
let sp = if has_bounds {
11371137
sp.to(self.tcx
11381138
.sess
1139-
.codemap()
1140-
.next_point(self.tcx.sess.codemap().next_point(sp)))
1139+
.source_map()
1140+
.next_point(self.tcx.sess.source_map().next_point(sp)))
11411141
} else {
11421142
sp
11431143
};

src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
6060
}) => name.to_string(),
6161
_ => "'_".to_owned(),
6262
};
63-
if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(return_sp) {
63+
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(return_sp) {
6464
err.span_suggestion(
6565
return_sp,
6666
&format!(

src/librustc/lint/builtin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ impl BuiltinLintDiagnostics {
420420
match self {
421421
BuiltinLintDiagnostics::Normal => (),
422422
BuiltinLintDiagnostics::BareTraitObject(span, is_global) => {
423-
let (sugg, app) = match sess.codemap().span_to_snippet(span) {
423+
let (sugg, app) = match sess.source_map().span_to_snippet(span) {
424424
Ok(ref s) if is_global => (format!("dyn ({})", s),
425425
Applicability::MachineApplicable),
426426
Ok(s) => (format!("dyn {}", s), Applicability::MachineApplicable),
@@ -429,7 +429,7 @@ impl BuiltinLintDiagnostics {
429429
db.span_suggestion_with_applicability(span, "use `dyn`", sugg, app);
430430
}
431431
BuiltinLintDiagnostics::AbsPathWithModule(span) => {
432-
let (sugg, app) = match sess.codemap().span_to_snippet(span) {
432+
let (sugg, app) = match sess.source_map().span_to_snippet(span) {
433433
Ok(ref s) => {
434434
// FIXME(Manishearth) ideally the emitting code
435435
// can tell us whether or not this is global
@@ -462,7 +462,7 @@ impl BuiltinLintDiagnostics {
462462
// When possible, prefer a suggestion that replaces the whole
463463
// `Path<T>` expression with `Path<'_, T>`, rather than inserting `'_, `
464464
// at a point (which makes for an ugly/confusing label)
465-
if let Ok(snippet) = sess.codemap().span_to_snippet(path_span) {
465+
if let Ok(snippet) = sess.source_map().span_to_snippet(path_span) {
466466
// But our spans can get out of whack due to macros; if the place we think
467467
// we want to insert `'_` isn't even within the path expression's span, we
468468
// should bail out of making any suggestion rather than panicking on a

src/librustc/lint/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ pub fn in_external_macro(sess: &Session, span: Span) -> bool {
754754
None => return true,
755755
};
756756

757-
match sess.codemap().span_to_snippet(def_site) {
757+
match sess.source_map().span_to_snippet(def_site) {
758758
Ok(code) => !code.starts_with("macro_rules"),
759759
// no snippet = external macro or compiler-builtin expansion
760760
Err(_) => true,

src/librustc/middle/dead.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> {
551551
hir::ItemKind::Struct(..) |
552552
hir::ItemKind::Union(..) |
553553
hir::ItemKind::Trait(..) |
554-
hir::ItemKind::Impl(..) => self.tcx.sess.codemap().def_span(item.span),
554+
hir::ItemKind::Impl(..) => self.tcx.sess.source_map().def_span(item.span),
555555
_ => item.span,
556556
};
557557
let participle = match item.node {
@@ -612,7 +612,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> {
612612
}
613613
hir::ImplItemKind::Method(_, body_id) => {
614614
if !self.symbol_is_live(impl_item.id, None) {
615-
let span = self.tcx.sess.codemap().def_span(impl_item.span);
615+
let span = self.tcx.sess.source_map().def_span(impl_item.span);
616616
self.warn_dead_code(impl_item.id, span, impl_item.ident.name, "method", "used");
617617
}
618618
self.visit_nested_body(body_id)

src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ enum LiveNodeKind {
157157
}
158158

159159
fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt) -> String {
160-
let cm = tcx.sess.codemap();
160+
let cm = tcx.sess.source_map();
161161
match lnk {
162162
FreeVarNode(s) => {
163163
format!("Free var node [{}]", cm.span_to_string(s))

0 commit comments

Comments
 (0)