Skip to content

Commit e4efb47

Browse files
committed
Auto merge of #26351 - eddyb:tls-tcx, r=nikomatsakis
Pre-requisite for splitting the type context into global and local parts. The `Repr` and `UserString` traits were also replaced by `Debug` and `Display`.
2 parents 89485b2 + 6eed166 commit e4efb47

File tree

116 files changed

+3525
-4477
lines changed

Some content is hidden

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

116 files changed

+3525
-4477
lines changed

src/librustc/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#![feature(ref_slice)]
5252
#![feature(rustc_diagnostic_macros)]
5353
#![feature(rustc_private)]
54+
#![feature(scoped_tls)]
5455
#![feature(slice_bytes)]
5556
#![feature(slice_extras)]
5657
#![feature(slice_patterns)]

src/librustc/metadata/tydecode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ fn parse_builtin_bounds<F>(st: &mut PState, mut _conv: F) -> ty::BuiltinBounds w
898898
fn parse_builtin_bounds_<F>(st: &mut PState, _conv: &mut F) -> ty::BuiltinBounds where
899899
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
900900
{
901-
let mut builtin_bounds = ty::empty_builtin_bounds();
901+
let mut builtin_bounds = ty::BuiltinBounds::empty();
902902

903903
loop {
904904
match next(st) {

src/librustc/middle/astconv_util.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use middle::def;
1818
use middle::ty::{self, Ty};
1919
use syntax::ast;
20-
use util::ppaux::Repr;
2120

2221
pub const NO_REGIONS: usize = 1;
2322
pub const NO_TPS: usize = 2;
@@ -63,7 +62,7 @@ pub fn ast_ty_to_prim_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ast_ty: &ast::Ty)
6362
let def = match tcx.def_map.borrow().get(&ast_ty.id) {
6463
None => {
6564
tcx.sess.span_bug(ast_ty.span,
66-
&format!("unbound path {}", path.repr(tcx)))
65+
&format!("unbound path {:?}", path))
6766
}
6867
Some(d) => d.full_def()
6968
};

src/librustc/middle/astencode.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ use middle::privacy::{AllPublic, LastMod};
3131
use middle::subst;
3232
use middle::subst::VecPerParamSpace;
3333
use middle::ty::{self, Ty, MethodCall, MethodCallee, MethodOrigin};
34-
use util::ppaux::ty_to_string;
3534

3635
use syntax::{ast, ast_util, codemap, fold};
3736
use syntax::codemap::Span;
@@ -1623,8 +1622,8 @@ fn decode_side_tables(dcx: &DecodeContext,
16231622
}
16241623
c::tag_table_node_type => {
16251624
let ty = val_dsr.read_ty(dcx);
1626-
debug!("inserting ty for node {}: {}",
1627-
id, ty_to_string(dcx.tcx, ty));
1625+
debug!("inserting ty for node {}: {:?}",
1626+
id, ty);
16281627
dcx.tcx.node_type_insert(id, ty);
16291628
}
16301629
c::tag_table_item_subst => {

src/librustc/middle/check_const.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use middle::mem_categorization as mc;
3333
use middle::traits;
3434
use middle::ty::{self, Ty};
3535
use util::nodemap::NodeMap;
36-
use util::ppaux::Repr;
3736

3837
use syntax::ast;
3938
use syntax::codemap::Span;
@@ -300,7 +299,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
300299

301300
impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
302301
fn visit_item(&mut self, i: &ast::Item) {
303-
debug!("visit_item(item={})", i.repr(self.tcx));
302+
debug!("visit_item(item={})", self.tcx.map.node_to_string(i.id));
304303
match i.node {
305304
ast::ItemStatic(_, ast::MutImmutable, ref expr) => {
306305
self.check_static_type(&**expr);

src/librustc/middle/check_match.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ use syntax::print::pprust::pat_to_string;
3636
use syntax::parse::token;
3737
use syntax::ptr::P;
3838
use syntax::visit::{self, Visitor, FnKind};
39-
use util::ppaux::ty_to_string;
4039
use util::nodemap::FnvHashMap;
4140

4241
pub const DUMMY_WILD_PAT: &'static Pat = &Pat {
@@ -209,9 +208,8 @@ fn check_expr(cx: &mut MatchCheckCtxt, ex: &ast::Expr) {
209208
if !type_is_empty(cx.tcx, pat_ty) {
210209
// We know the type is inhabited, so this must be wrong
211210
span_err!(cx.tcx.sess, ex.span, E0002,
212-
"non-exhaustive patterns: type {} is non-empty",
213-
ty_to_string(cx.tcx, pat_ty)
214-
);
211+
"non-exhaustive patterns: type {} is non-empty",
212+
pat_ty);
215213
}
216214
// If the type *is* empty, it's vacuously exhaustive
217215
return;
@@ -244,11 +242,11 @@ fn check_for_bindings_named_the_same_as_variants(cx: &MatchCheckCtxt, pat: &Pat)
244242
span_warn!(cx.tcx.sess, p.span, E0170,
245243
"pattern binding `{}` is named the same as one \
246244
of the variants of the type `{}`",
247-
&token::get_ident(ident.node), ty_to_string(cx.tcx, pat_ty));
245+
&token::get_ident(ident.node), pat_ty);
248246
fileline_help!(cx.tcx.sess, p.span,
249247
"if you meant to match on a variant, \
250248
consider making the path in the pattern qualified: `{}::{}`",
251-
ty_to_string(cx.tcx, pat_ty), &token::get_ident(ident.node));
249+
pat_ty, &token::get_ident(ident.node));
252250
}
253251
}
254252
}

src/librustc/middle/check_rvalues.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use middle::expr_use_visitor as euv;
1515
use middle::mem_categorization as mc;
1616
use middle::ty::ParameterEnvironment;
1717
use middle::ty;
18-
use util::ppaux::ty_to_string;
1918

2019
use syntax::ast;
2120
use syntax::codemap::Span;
@@ -59,11 +58,11 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for RvalueContextDelegate<'a, 'tcx> {
5958
span: Span,
6059
cmt: mc::cmt<'tcx>,
6160
_: euv::ConsumeMode) {
62-
debug!("consume; cmt: {:?}; type: {}", *cmt, ty_to_string(self.tcx, cmt.ty));
61+
debug!("consume; cmt: {:?}; type: {:?}", *cmt, cmt.ty);
6362
if !ty::type_is_sized(Some(self.param_env), self.tcx, span, cmt.ty) {
6463
span_err!(self.tcx.sess, span, E0161,
6564
"cannot move a value of type {0}: the size of {0} cannot be statically determined",
66-
ty_to_string(self.tcx, cmt.ty));
65+
cmt.ty);
6766
}
6867
}
6968

src/librustc/middle/const_eval.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use middle::pat_util::def_to_path;
2323
use middle::ty::{self, Ty};
2424
use middle::astconv_util::ast_ty_to_prim_ty;
2525
use util::num::ToPrimitive;
26-
use util::ppaux::Repr;
2726

2827
use syntax::ast::{self, Expr};
2928
use syntax::ast_util;
@@ -1030,8 +1029,8 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
10301029
rcvr_self,
10311030
Vec::new()));
10321031
let trait_substs = tcx.mk_substs(trait_substs);
1033-
debug!("resolve_trait_associated_const: trait_substs={}",
1034-
trait_substs.repr(tcx));
1032+
debug!("resolve_trait_associated_const: trait_substs={:?}",
1033+
trait_substs);
10351034
let trait_ref = ty::Binder(ty::TraitRef { def_id: trait_id,
10361035
substs: trait_substs });
10371036

@@ -1052,10 +1051,10 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
10521051
}
10531052
Err(e) => {
10541053
tcx.sess.span_bug(ti.span,
1055-
&format!("Encountered error `{}` when trying \
1054+
&format!("Encountered error `{:?}` when trying \
10561055
to select an implementation for \
10571056
constant trait item reference.",
1058-
e.repr(tcx)))
1057+
e))
10591058
}
10601059
};
10611060

src/librustc/middle/effect.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use self::UnsafeContext::*;
1515
use middle::def;
1616
use middle::ty::{self, Ty};
1717
use middle::ty::MethodCall;
18-
use util::ppaux;
1918

2019
use syntax::ast;
2120
use syntax::codemap::Span;
@@ -66,8 +65,8 @@ impl<'a, 'tcx> EffectCheckVisitor<'a, 'tcx> {
6665
ast::ExprIndex(ref base, _) => ty::node_id_to_type(self.tcx, base.id),
6766
_ => return
6867
};
69-
debug!("effect: checking index with base type {}",
70-
ppaux::ty_to_string(self.tcx, base_type));
68+
debug!("effect: checking index with base type {:?}",
69+
base_type);
7170
match base_type.sty {
7271
ty::TyBox(ty) | ty::TyRef(_, ty::mt{ty, ..}) => if ty::TyStr == ty.sty {
7372
span_err!(self.tcx.sess, e.span, E0134,
@@ -142,25 +141,25 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
142141
ast::ExprMethodCall(_, _, _) => {
143142
let method_call = MethodCall::expr(expr.id);
144143
let base_type = self.tcx.method_map.borrow().get(&method_call).unwrap().ty;
145-
debug!("effect: method call case, base type is {}",
146-
ppaux::ty_to_string(self.tcx, base_type));
144+
debug!("effect: method call case, base type is {:?}",
145+
base_type);
147146
if type_is_unsafe_function(base_type) {
148147
self.require_unsafe(expr.span,
149148
"invocation of unsafe method")
150149
}
151150
}
152151
ast::ExprCall(ref base, _) => {
153152
let base_type = ty::node_id_to_type(self.tcx, base.id);
154-
debug!("effect: call case, base type is {}",
155-
ppaux::ty_to_string(self.tcx, base_type));
153+
debug!("effect: call case, base type is {:?}",
154+
base_type);
156155
if type_is_unsafe_function(base_type) {
157156
self.require_unsafe(expr.span, "call to unsafe function")
158157
}
159158
}
160159
ast::ExprUnary(ast::UnDeref, ref base) => {
161160
let base_type = ty::node_id_to_type(self.tcx, base.id);
162-
debug!("effect: unary case, base type is {}",
163-
ppaux::ty_to_string(self.tcx, base_type));
161+
debug!("effect: unary case, base type is {:?}",
162+
base_type);
164163
if let ty::TyRawPtr(_) = base_type.sty {
165164
self.require_unsafe(expr.span, "dereference of raw pointer")
166165
}

0 commit comments

Comments
 (0)