Skip to content

Commit c8b67da

Browse files
committed
---
yaml --- r: 213983 b: refs/heads/master c: 29c8653 h: refs/heads/master i: 213981: ac8d1f0 213979: 8d11211 213975: b2cc8c5 213967: 3e45faf 213951: 3870f00 v: v3
1 parent 33186b1 commit c8b67da

File tree

124 files changed

+4552
-3774
lines changed

Some content is hidden

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

124 files changed

+4552
-3774
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: e4efb47b9d23a96ff4684df80360bbed0ec68bc9
2+
refs/heads/master: 29c86539b392b98ba84570143c625781ba248a9b
33
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

trunk/src/librustc/diagnostics.rs

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -256,21 +256,6 @@ See [RFC 911] for more details on the design of `const fn`s.
256256
[RFC 911]: https://github.com/rust-lang/rfcs/blob/master/text/0911-const-fn.md
257257
"##,
258258

259-
E0016: r##"
260-
Blocks in constants may only contain items (such as constant, function
261-
definition, etc...) and a tail expression. Example:
262-
263-
```
264-
const FOO: i32 = { let x = 0; x }; // 'x' isn't an item!
265-
```
266-
267-
To avoid it, you have to replace the non-item object:
268-
269-
```
270-
const FOO: i32 = { const X : i32 = 0; X };
271-
```
272-
"##,
273-
274259
E0018: r##"
275260
The value of static and const variables must be known at compile time. You
276261
can't cast a pointer as an integer because we can't know what value the
@@ -294,42 +279,6 @@ println!("{}", Y);
294279
```
295280
"##,
296281

297-
E0019: r##"
298-
A function call isn't allowed in the const's initialization expression
299-
because the expression's value must be known at compile-time. Example of
300-
erroneous code:
301-
302-
```
303-
enum Test {
304-
V1
305-
}
306-
307-
impl Test {
308-
fn test(&self) -> i32 {
309-
12
310-
}
311-
}
312-
313-
fn main() {
314-
const FOO: Test = Test::V1;
315-
316-
const A: i32 = FOO.test(); // You can't call Test::func() here !
317-
}
318-
```
319-
320-
Remember: you can't use a function call inside a const's initialization
321-
expression! However, you can totally use it elsewhere you want:
322-
323-
```
324-
fn main() {
325-
const FOO: Test = Test::V1;
326-
327-
FOO.func(); // here is good
328-
let x = FOO.func(); // or even here!
329-
}
330-
```
331-
"##,
332-
333282
E0020: r##"
334283
This error indicates that an attempt was made to divide by zero (or take the
335284
remainder of a zero divisor) in a static or constant expression.
@@ -1001,7 +950,9 @@ static mut BAR: Option<Vec<i32>> = None;
1001950

1002951

1003952
register_diagnostics! {
953+
E0016,
1004954
E0017,
955+
E0019,
1005956
E0022,
1006957
E0038,
1007958
E0109,

trunk/src/librustc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
#![feature(ref_slice)]
5252
#![feature(rustc_diagnostic_macros)]
5353
#![feature(rustc_private)]
54-
#![feature(scoped_tls)]
5554
#![feature(slice_bytes)]
5655
#![feature(slice_extras)]
5756
#![feature(slice_patterns)]

trunk/src/librustc/metadata/tydecode.rs

Lines changed: 1 addition & 1 deletion
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::BuiltinBounds::empty();
901+
let mut builtin_bounds = ty::empty_builtin_bounds();
902902

903903
loop {
904904
match next(st) {

trunk/src/librustc/middle/astconv_util.rs

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

2122
pub const NO_REGIONS: usize = 1;
2223
pub const NO_TPS: usize = 2;
@@ -62,7 +63,7 @@ pub fn ast_ty_to_prim_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ast_ty: &ast::Ty)
6263
let def = match tcx.def_map.borrow().get(&ast_ty.id) {
6364
None => {
6465
tcx.sess.span_bug(ast_ty.span,
65-
&format!("unbound path {:?}", path))
66+
&format!("unbound path {}", path.repr(tcx)))
6667
}
6768
Some(d) => d.full_def()
6869
};

trunk/src/librustc/middle/astencode.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ 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;
3435

3536
use syntax::{ast, ast_util, codemap, fold};
3637
use syntax::codemap::Span;
@@ -1622,8 +1623,8 @@ fn decode_side_tables(dcx: &DecodeContext,
16221623
}
16231624
c::tag_table_node_type => {
16241625
let ty = val_dsr.read_ty(dcx);
1625-
debug!("inserting ty for node {}: {:?}",
1626-
id, ty);
1626+
debug!("inserting ty for node {}: {}",
1627+
id, ty_to_string(dcx.tcx, ty));
16271628
dcx.tcx.node_type_insert(id, ty);
16281629
}
16291630
c::tag_table_item_subst => {

trunk/src/librustc/middle/cfg/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ impl CFG {
6363
}
6464

6565
pub fn node_is_reachable(&self, id: ast::NodeId) -> bool {
66-
self.graph.depth_traverse(self.entry).any(|node| node.id() == id)
66+
self.graph.depth_traverse(self.entry)
67+
.any(|idx| self.graph.node_data(idx).id() == id)
6768
}
6869
}

trunk/src/librustc/middle/check_const.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ 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;
3637

3738
use syntax::ast;
3839
use syntax::codemap::Span;
@@ -299,7 +300,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
299300

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

trunk/src/librustc/middle/check_match.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ 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;
3940
use util::nodemap::FnvHashMap;
4041

4142
pub const DUMMY_WILD_PAT: &'static Pat = &Pat {
@@ -208,8 +209,9 @@ fn check_expr(cx: &mut MatchCheckCtxt, ex: &ast::Expr) {
208209
if !type_is_empty(cx.tcx, pat_ty) {
209210
// We know the type is inhabited, so this must be wrong
210211
span_err!(cx.tcx.sess, ex.span, E0002,
211-
"non-exhaustive patterns: type {} is non-empty",
212-
pat_ty);
212+
"non-exhaustive patterns: type {} is non-empty",
213+
ty_to_string(cx.tcx, pat_ty)
214+
);
213215
}
214216
// If the type *is* empty, it's vacuously exhaustive
215217
return;
@@ -242,11 +244,11 @@ fn check_for_bindings_named_the_same_as_variants(cx: &MatchCheckCtxt, pat: &Pat)
242244
span_warn!(cx.tcx.sess, p.span, E0170,
243245
"pattern binding `{}` is named the same as one \
244246
of the variants of the type `{}`",
245-
&token::get_ident(ident.node), pat_ty);
247+
&token::get_ident(ident.node), ty_to_string(cx.tcx, pat_ty));
246248
fileline_help!(cx.tcx.sess, p.span,
247249
"if you meant to match on a variant, \
248250
consider making the path in the pattern qualified: `{}::{}`",
249-
pat_ty, &token::get_ident(ident.node));
251+
ty_to_string(cx.tcx, pat_ty), &token::get_ident(ident.node));
250252
}
251253
}
252254
}

trunk/src/librustc/middle/check_rvalues.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ 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;
1819

1920
use syntax::ast;
2021
use syntax::codemap::Span;
@@ -58,11 +59,11 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for RvalueContextDelegate<'a, 'tcx> {
5859
span: Span,
5960
cmt: mc::cmt<'tcx>,
6061
_: euv::ConsumeMode) {
61-
debug!("consume; cmt: {:?}; type: {:?}", *cmt, cmt.ty);
62+
debug!("consume; cmt: {:?}; type: {}", *cmt, ty_to_string(self.tcx, cmt.ty));
6263
if !ty::type_is_sized(Some(self.param_env), self.tcx, span, cmt.ty) {
6364
span_err!(self.tcx.sess, span, E0161,
6465
"cannot move a value of type {0}: the size of {0} cannot be statically determined",
65-
cmt.ty);
66+
ty_to_string(self.tcx, cmt.ty));
6667
}
6768
}
6869

trunk/src/librustc/middle/const_eval.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ 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;
2627

2728
use syntax::ast::{self, Expr};
2829
use syntax::ast_util;
@@ -1029,8 +1030,8 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
10291030
rcvr_self,
10301031
Vec::new()));
10311032
let trait_substs = tcx.mk_substs(trait_substs);
1032-
debug!("resolve_trait_associated_const: trait_substs={:?}",
1033-
trait_substs);
1033+
debug!("resolve_trait_associated_const: trait_substs={}",
1034+
trait_substs.repr(tcx));
10341035
let trait_ref = ty::Binder(ty::TraitRef { def_id: trait_id,
10351036
substs: trait_substs });
10361037

@@ -1051,10 +1052,10 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
10511052
}
10521053
Err(e) => {
10531054
tcx.sess.span_bug(ti.span,
1054-
&format!("Encountered error `{:?}` when trying \
1055+
&format!("Encountered error `{}` when trying \
10551056
to select an implementation for \
10561057
constant trait item reference.",
1057-
e))
1058+
e.repr(tcx)))
10581059
}
10591060
};
10601061

trunk/src/librustc/middle/effect.rs

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

1920
use syntax::ast;
2021
use syntax::codemap::Span;
@@ -65,8 +66,8 @@ impl<'a, 'tcx> EffectCheckVisitor<'a, 'tcx> {
6566
ast::ExprIndex(ref base, _) => ty::node_id_to_type(self.tcx, base.id),
6667
_ => return
6768
};
68-
debug!("effect: checking index with base type {:?}",
69-
base_type);
69+
debug!("effect: checking index with base type {}",
70+
ppaux::ty_to_string(self.tcx, base_type));
7071
match base_type.sty {
7172
ty::TyBox(ty) | ty::TyRef(_, ty::mt{ty, ..}) => if ty::TyStr == ty.sty {
7273
span_err!(self.tcx.sess, e.span, E0134,
@@ -141,25 +142,25 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
141142
ast::ExprMethodCall(_, _, _) => {
142143
let method_call = MethodCall::expr(expr.id);
143144
let base_type = self.tcx.method_map.borrow().get(&method_call).unwrap().ty;
144-
debug!("effect: method call case, base type is {:?}",
145-
base_type);
145+
debug!("effect: method call case, base type is {}",
146+
ppaux::ty_to_string(self.tcx, base_type));
146147
if type_is_unsafe_function(base_type) {
147148
self.require_unsafe(expr.span,
148149
"invocation of unsafe method")
149150
}
150151
}
151152
ast::ExprCall(ref base, _) => {
152153
let base_type = ty::node_id_to_type(self.tcx, base.id);
153-
debug!("effect: call case, base type is {:?}",
154-
base_type);
154+
debug!("effect: call case, base type is {}",
155+
ppaux::ty_to_string(self.tcx, base_type));
155156
if type_is_unsafe_function(base_type) {
156157
self.require_unsafe(expr.span, "call to unsafe function")
157158
}
158159
}
159160
ast::ExprUnary(ast::UnDeref, ref base) => {
160161
let base_type = ty::node_id_to_type(self.tcx, base.id);
161-
debug!("effect: unary case, base type is {:?}",
162-
base_type);
162+
debug!("effect: unary case, base type is {}",
163+
ppaux::ty_to_string(self.tcx, base_type));
163164
if let ty::TyRawPtr(_) = base_type.sty {
164165
self.require_unsafe(expr.span, "dereference of raw pointer")
165166
}

0 commit comments

Comments
 (0)