Use static strings
This commit is contained in:
parent
d1f7220219
commit
35b91e2f73
@ -115,7 +115,7 @@ pub impl LoanContext {
|
|||||||
if cmt.lp.is_none() {
|
if cmt.lp.is_none() {
|
||||||
self.bccx.tcx.sess.span_bug(
|
self.bccx.tcx.sess.span_bug(
|
||||||
cmt.span,
|
cmt.span,
|
||||||
~"loan() called with non-lendable value");
|
"loan() called with non-lendable value");
|
||||||
}
|
}
|
||||||
|
|
||||||
match cmt.cat {
|
match cmt.cat {
|
||||||
@ -123,7 +123,7 @@ pub impl LoanContext {
|
|||||||
// should never be loanable
|
// should never be loanable
|
||||||
self.bccx.tcx.sess.span_bug(
|
self.bccx.tcx.sess.span_bug(
|
||||||
cmt.span,
|
cmt.span,
|
||||||
~"rvalue with a non-none lp");
|
"rvalue with a non-none lp");
|
||||||
}
|
}
|
||||||
cat_local(local_id) | cat_arg(local_id) | cat_self(local_id) => {
|
cat_local(local_id) | cat_arg(local_id) | cat_self(local_id) => {
|
||||||
// FIXME(#4903)
|
// FIXME(#4903)
|
||||||
@ -188,7 +188,7 @@ pub impl LoanContext {
|
|||||||
// Aliased data is simply not lendable.
|
// Aliased data is simply not lendable.
|
||||||
self.bccx.tcx.sess.span_bug(
|
self.bccx.tcx.sess.span_bug(
|
||||||
cmt.span,
|
cmt.span,
|
||||||
~"aliased ptr with a non-none lp");
|
"aliased ptr with a non-none lp");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -525,11 +525,11 @@ pub impl BorrowckCtxt {
|
|||||||
self.note_and_explain_bckerr(err);
|
self.note_and_explain_bckerr(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn span_err(&self, s: span, m: ~str) {
|
fn span_err(&self, s: span, m: &str) {
|
||||||
self.tcx.sess.span_err(s, m);
|
self.tcx.sess.span_err(s, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn span_note(&self, s: span, m: ~str) {
|
fn span_note(&self, s: span, m: &str) {
|
||||||
self.tcx.sess.span_note(s, m);
|
self.tcx.sess.span_note(s, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ pub impl<'self> PreserveCtxt<'self> {
|
|||||||
if self.root_managed_data {
|
if self.root_managed_data {
|
||||||
self.tcx().sess.span_bug(
|
self.tcx().sess.span_bug(
|
||||||
cmt.span,
|
cmt.span,
|
||||||
~"preserve() called with local and !root_managed_data");
|
"preserve() called with local and !root_managed_data");
|
||||||
}
|
}
|
||||||
let local_region = self.tcx().region_maps.encl_region(local_id);
|
let local_region = self.tcx().region_maps.encl_region(local_id);
|
||||||
self.compare_scope(cmt, local_region)
|
self.compare_scope(cmt, local_region)
|
||||||
|
@ -557,8 +557,7 @@ pub fn enter_opt<'r>(bcx: block,
|
|||||||
struct_id = found_struct_id;
|
struct_id = found_struct_id;
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_bug(p.span, ~"expected enum \
|
tcx.sess.span_bug(p.span, "expected enum variant def");
|
||||||
variant def");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1125,10 +1125,11 @@ pub fn init_local(bcx: block, local: @ast::local) -> block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let llptr = match bcx.fcx.lllocals.find(&local.node.id) {
|
let llptr = match bcx.fcx.lllocals.find(&local.node.id) {
|
||||||
Some(&local_mem(v)) => v,
|
Some(&local_mem(v)) => v,
|
||||||
_ => { bcx.tcx().sess.span_bug(local.span,
|
_ => {
|
||||||
~"init_local: Someone forgot to document why it's\
|
bcx.tcx().sess.span_bug(local.span,
|
||||||
safe to assume local.node.init must be local_mem!");
|
"init_local: Someone forgot to document why it's\
|
||||||
|
safe to assume local.node.init must be local_mem!");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -356,9 +356,7 @@ pub fn trans_method_call(in_cx: block,
|
|||||||
origin)
|
origin)
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
cx.tcx().sess.span_bug(call_ex.span,
|
cx.tcx().sess.span_bug(call_ex.span, "method call expr wasn't in method map")
|
||||||
~"method call expr wasn't in \
|
|
||||||
method map")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -58,8 +58,7 @@ pub fn const_lit(cx: @CrateContext, e: @ast::expr, lit: ast::lit)
|
|||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
cx.sess.span_bug(lit.span,
|
cx.sess.span_bug(lit.span,
|
||||||
~"floating point literal doesn't have the right \
|
"floating point literal doesn't have the right type");
|
||||||
type");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,7 +280,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef {
|
|||||||
else { llvm::LLVMConstURem(te1, te2) }
|
else { llvm::LLVMConstURem(te1, te2) }
|
||||||
}
|
}
|
||||||
ast::and |
|
ast::and |
|
||||||
ast::or => cx.sess.span_unimpl(e.span, ~"binop logic"),
|
ast::or => cx.sess.span_unimpl(e.span, "binop logic"),
|
||||||
ast::bitxor => llvm::LLVMConstXor(te1, te2),
|
ast::bitxor => llvm::LLVMConstXor(te1, te2),
|
||||||
ast::bitand => llvm::LLVMConstAnd(te1, te2),
|
ast::bitand => llvm::LLVMConstAnd(te1, te2),
|
||||||
ast::bitor => llvm::LLVMConstOr(te1, te2),
|
ast::bitor => llvm::LLVMConstOr(te1, te2),
|
||||||
@ -295,7 +294,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef {
|
|||||||
ast::le |
|
ast::le |
|
||||||
ast::ne |
|
ast::ne |
|
||||||
ast::ge |
|
ast::ge |
|
||||||
ast::gt => cx.sess.span_unimpl(e.span, ~"binop comparator")
|
ast::gt => cx.sess.span_unimpl(e.span, "binop comparator")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::expr_unary(u, e) => {
|
ast::expr_unary(u, e) => {
|
||||||
@ -344,8 +343,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef {
|
|||||||
const_eval::const_int(i) => i as u64,
|
const_eval::const_int(i) => i as u64,
|
||||||
const_eval::const_uint(u) => u,
|
const_eval::const_uint(u) => u,
|
||||||
_ => cx.sess.span_bug(index.span,
|
_ => cx.sess.span_bug(index.span,
|
||||||
~"index is not an integer-constant \
|
"index is not an integer-constant expression")
|
||||||
expression")
|
|
||||||
};
|
};
|
||||||
let (arr, len) = match ty::get(bt).sty {
|
let (arr, len) = match ty::get(bt).sty {
|
||||||
ty::ty_evec(_, vstore) | ty::ty_estr(vstore) =>
|
ty::ty_evec(_, vstore) | ty::ty_estr(vstore) =>
|
||||||
@ -363,12 +361,10 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef {
|
|||||||
unit_sz))
|
unit_sz))
|
||||||
},
|
},
|
||||||
_ => cx.sess.span_bug(base.span,
|
_ => cx.sess.span_bug(base.span,
|
||||||
~"index-expr base must be \
|
"index-expr base must be fixed-size or slice")
|
||||||
fixed-size or slice")
|
|
||||||
},
|
},
|
||||||
_ => cx.sess.span_bug(base.span,
|
_ => cx.sess.span_bug(base.span,
|
||||||
~"index-expr base must be \
|
"index-expr base must be a vector or string type")
|
||||||
a vector or string type")
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let len = llvm::LLVMConstIntGetZExtValue(len) as u64;
|
let len = llvm::LLVMConstIntGetZExtValue(len) as u64;
|
||||||
@ -380,7 +376,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef {
|
|||||||
// FIXME #3170: report this earlier on in the const-eval
|
// FIXME #3170: report this earlier on in the const-eval
|
||||||
// pass. Reporting here is a bit late.
|
// pass. Reporting here is a bit late.
|
||||||
cx.sess.span_err(e.span,
|
cx.sess.span_err(e.span,
|
||||||
~"const index-expr is out of bounds");
|
"const index-expr is out of bounds");
|
||||||
}
|
}
|
||||||
const_get_elt(cx, arr, [iv as c_uint])
|
const_get_elt(cx, arr, [iv as c_uint])
|
||||||
}
|
}
|
||||||
@ -454,8 +450,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef {
|
|||||||
match fs.find(|f| field_ty.ident == f.node.ident) {
|
match fs.find(|f| field_ty.ident == f.node.ident) {
|
||||||
Some(ref f) => const_expr(cx, (*f).node.expr),
|
Some(ref f) => const_expr(cx, (*f).node.expr),
|
||||||
None => {
|
None => {
|
||||||
cx.tcx.sess.span_bug(
|
cx.tcx.sess.span_bug(e.span, "missing struct field");
|
||||||
e.span, ~"missing struct field");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -471,8 +466,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef {
|
|||||||
ast::expr_lit(ref lit) => {
|
ast::expr_lit(ref lit) => {
|
||||||
match lit.node {
|
match lit.node {
|
||||||
ast::lit_str(*) => { const_expr(cx, sub) }
|
ast::lit_str(*) => { const_expr(cx, sub) }
|
||||||
_ => { cx.sess.span_bug(e.span,
|
_ => { cx.sess.span_bug(e.span, "bad const-slice lit") }
|
||||||
~"bad const-slice lit") }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::expr_vec(ref es, ast::m_imm) => {
|
ast::expr_vec(ref es, ast::m_imm) => {
|
||||||
@ -487,8 +481,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef {
|
|||||||
let p = const_ptrcast(cx, gv, llunitty);
|
let p = const_ptrcast(cx, gv, llunitty);
|
||||||
C_struct(~[p, sz])
|
C_struct(~[p, sz])
|
||||||
}
|
}
|
||||||
_ => cx.sess.span_bug(e.span,
|
_ => cx.sess.span_bug(e.span, "bad const-slice expr")
|
||||||
~"bad const-slice expr")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::expr_path(pth) => {
|
ast::expr_path(pth) => {
|
||||||
@ -520,8 +513,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef {
|
|||||||
C_null(llty)
|
C_null(llty)
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
cx.sess.span_bug(e.span, ~"expected a const, fn, \
|
cx.sess.span_bug(e.span, "expected a const, fn, struct, or variant def")
|
||||||
struct, or variant def")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -542,13 +534,12 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef {
|
|||||||
adt::trans_const(cx, repr, vinfo.disr_val,
|
adt::trans_const(cx, repr, vinfo.disr_val,
|
||||||
args.map(|a| const_expr(cx, *a)))
|
args.map(|a| const_expr(cx, *a)))
|
||||||
}
|
}
|
||||||
_ => cx.sess.span_bug(e.span, ~"expected a struct or \
|
_ => cx.sess.span_bug(e.span, "expected a struct or variant def")
|
||||||
variant def")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::expr_paren(e) => { return const_expr(cx, e); }
|
ast::expr_paren(e) => { return const_expr(cx, e); }
|
||||||
_ => cx.sess.span_bug(e.span,
|
_ => cx.sess.span_bug(e.span,
|
||||||
~"bad constant expression type in consts::const_expr")
|
"bad constant expression type in consts::const_expr")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -761,8 +761,8 @@ pub impl Datum {
|
|||||||
match self.try_deref(bcx, expr.id, derefs, false) {
|
match self.try_deref(bcx, expr.id, derefs, false) {
|
||||||
(Some(lvres), bcx) => DatumBlock { bcx: bcx, datum: lvres },
|
(Some(lvres), bcx) => DatumBlock { bcx: bcx, datum: lvres },
|
||||||
(None, _) => {
|
(None, _) => {
|
||||||
bcx.ccx().sess.span_bug(
|
bcx.ccx().sess.span_bug(expr.span,
|
||||||
expr.span, ~"Cannot deref this expression");
|
"Cannot deref this expression");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -756,7 +756,7 @@ fn create_ty(cx: @CrateContext, t: ty::t, span: span)
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
ty::ty_enum(_did, ref _substs) => {
|
ty::ty_enum(_did, ref _substs) => {
|
||||||
cx.sess.span_bug(span, ~"debuginfo for enum NYI")
|
cx.sess.span_bug(span, "debuginfo for enum NYI")
|
||||||
}
|
}
|
||||||
ty::ty_box(ref mt) | ty::ty_uniq(ref mt) => {
|
ty::ty_box(ref mt) | ty::ty_uniq(ref mt) => {
|
||||||
let boxed = create_ty(cx, mt.ty, span);
|
let boxed = create_ty(cx, mt.ty, span);
|
||||||
@ -782,7 +782,7 @@ fn create_ty(cx: @CrateContext, t: ty::t, span: span)
|
|||||||
create_pointer_type(cx, t, span, pointee)
|
create_pointer_type(cx, t, span, pointee)
|
||||||
},
|
},
|
||||||
ty::ty_rptr(ref _region, ref _mt) => {
|
ty::ty_rptr(ref _region, ref _mt) => {
|
||||||
cx.sess.span_bug(span, ~"debuginfo for rptr NYI")
|
cx.sess.span_bug(span, "debuginfo for rptr NYI")
|
||||||
},
|
},
|
||||||
ty::ty_bare_fn(ref barefnty) => {
|
ty::ty_bare_fn(ref barefnty) => {
|
||||||
let inputs = do barefnty.sig.inputs.map |a| { a.ty };
|
let inputs = do barefnty.sig.inputs.map |a| { a.ty };
|
||||||
@ -790,10 +790,10 @@ fn create_ty(cx: @CrateContext, t: ty::t, span: span)
|
|||||||
create_fn_ty(cx, t, inputs, output, span)
|
create_fn_ty(cx, t, inputs, output, span)
|
||||||
},
|
},
|
||||||
ty::ty_closure(ref _closurety) => {
|
ty::ty_closure(ref _closurety) => {
|
||||||
cx.sess.span_bug(span, ~"debuginfo for closure NYI")
|
cx.sess.span_bug(span, "debuginfo for closure NYI")
|
||||||
},
|
},
|
||||||
ty::ty_trait(_did, ref _substs, ref _vstore, _) => {
|
ty::ty_trait(_did, ref _substs, ref _vstore, _) => {
|
||||||
cx.sess.span_bug(span, ~"debuginfo for trait NYI")
|
cx.sess.span_bug(span, "debuginfo for trait NYI")
|
||||||
},
|
},
|
||||||
ty::ty_struct(did, ref substs) => {
|
ty::ty_struct(did, ref substs) => {
|
||||||
let fields = ty::struct_fields(cx.tcx, did, substs);
|
let fields = ty::struct_fields(cx.tcx, did, substs);
|
||||||
@ -860,14 +860,12 @@ pub fn create_local_var(bcx: block, local: @ast::local)
|
|||||||
let llptr = match bcx.fcx.lllocals.find(&local.node.id) {
|
let llptr = match bcx.fcx.lllocals.find(&local.node.id) {
|
||||||
option::Some(&local_mem(v)) => v,
|
option::Some(&local_mem(v)) => v,
|
||||||
option::Some(_) => {
|
option::Some(_) => {
|
||||||
bcx.tcx().sess.span_bug(local.span, ~"local is bound to \
|
bcx.tcx().sess.span_bug(local.span, "local is bound to something weird");
|
||||||
something weird");
|
|
||||||
}
|
}
|
||||||
option::None => {
|
option::None => {
|
||||||
match *bcx.fcx.lllocals.get(&local.node.pat.id) {
|
match *bcx.fcx.lllocals.get(&local.node.pat.id) {
|
||||||
local_imm(v) => v,
|
local_imm(v) => v,
|
||||||
_ => bcx.tcx().sess.span_bug(local.span, ~"local is bound to \
|
_ => bcx.tcx().sess.span_bug(local.span, "local is bound to something weird")
|
||||||
something weird")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -966,8 +964,7 @@ pub fn create_function(fcx: fn_ctxt) -> @Metadata<SubProgramMetadata> {
|
|||||||
ast::item_fn(ref decl, _, _, _, _) => {
|
ast::item_fn(ref decl, _, _, _, _) => {
|
||||||
(item.ident, decl.output, item.id)
|
(item.ident, decl.output, item.id)
|
||||||
}
|
}
|
||||||
_ => fcx.ccx.sess.span_bug(item.span, ~"create_function: item \
|
_ => fcx.ccx.sess.span_bug(item.span, "create_function: item bound to non-function")
|
||||||
bound to non-function")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast_map::node_method(method, _, _) => {
|
ast_map::node_method(method, _, _) => {
|
||||||
@ -979,12 +976,10 @@ pub fn create_function(fcx: fn_ctxt) -> @Metadata<SubProgramMetadata> {
|
|||||||
((dbg_cx.names)(~"fn"), decl.output, expr.id)
|
((dbg_cx.names)(~"fn"), decl.output, expr.id)
|
||||||
}
|
}
|
||||||
_ => fcx.ccx.sess.span_bug(expr.span,
|
_ => fcx.ccx.sess.span_bug(expr.span,
|
||||||
~"create_function: \
|
"create_function: expected an expr_fn_block here")
|
||||||
expected an expr_fn_block here")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => fcx.ccx.sess.bug(~"create_function: unexpected \
|
_ => fcx.ccx.sess.bug("create_function: unexpected sort of node")
|
||||||
sort of node")
|
|
||||||
};
|
};
|
||||||
|
|
||||||
debug!("%?", ident);
|
debug!("%?", ident);
|
||||||
|
@ -690,7 +690,7 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
|
|||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
bcx.tcx().sess.span_bug(expr.span,
|
bcx.tcx().sess.span_bug(expr.span,
|
||||||
~"expr_cast of non-trait");
|
"expr_cast of non-trait");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -700,8 +700,7 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
|
|||||||
_ => {
|
_ => {
|
||||||
bcx.tcx().sess.span_bug(
|
bcx.tcx().sess.span_bug(
|
||||||
expr.span,
|
expr.span,
|
||||||
fmt!("trans_rvalue_dps_unadjusted reached \
|
fmt!("trans_rvalue_dps_unadjusted reached fall-through case: %?",
|
||||||
fall-through case: %?",
|
|
||||||
expr.node));
|
expr.node));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1202,7 +1201,7 @@ fn trans_rec_or_struct(bcx: block,
|
|||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
tcx.sess.span_bug(field.span,
|
tcx.sess.span_bug(field.span,
|
||||||
~"Couldn't find field in struct type")
|
"Couldn't find field in struct type")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1478,7 +1477,7 @@ fn trans_eager_binop(bcx: block,
|
|||||||
} else {
|
} else {
|
||||||
if !ty::type_is_scalar(rhs_t) {
|
if !ty::type_is_scalar(rhs_t) {
|
||||||
bcx.tcx().sess.span_bug(binop_expr.span,
|
bcx.tcx().sess.span_bug(binop_expr.span,
|
||||||
~"non-scalar comparison");
|
"non-scalar comparison");
|
||||||
}
|
}
|
||||||
let cmpr = base::compare_scalar_types(bcx, lhs, rhs, rhs_t, op);
|
let cmpr = base::compare_scalar_types(bcx, lhs, rhs, rhs_t, op);
|
||||||
bcx = cmpr.bcx;
|
bcx = cmpr.bcx;
|
||||||
@ -1486,7 +1485,7 @@ fn trans_eager_binop(bcx: block,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
bcx.tcx().sess.span_bug(binop_expr.span, ~"unexpected binop");
|
bcx.tcx().sess.span_bug(binop_expr.span, "unexpected binop");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1080,7 +1080,7 @@ pub fn trans_intrinsic(ccx: @CrateContext,
|
|||||||
_ => {
|
_ => {
|
||||||
// Could we make this an enum rather than a string? does it get
|
// Could we make this an enum rather than a string? does it get
|
||||||
// checked earlier?
|
// checked earlier?
|
||||||
ccx.sess.span_bug(item.span, ~"unknown intrinsic");
|
ccx.sess.span_bug(item.span, "unknown intrinsic");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
build_return(bcx);
|
build_return(bcx);
|
||||||
|
@ -160,7 +160,7 @@ pub fn monomorphic_fn(ccx: @CrateContext,
|
|||||||
// causing an infinite expansion.
|
// causing an infinite expansion.
|
||||||
if depth > 30 {
|
if depth > 30 {
|
||||||
ccx.sess.span_fatal(
|
ccx.sess.span_fatal(
|
||||||
span, ~"overly deep expansion of inlined function");
|
span, "overly deep expansion of inlined function");
|
||||||
}
|
}
|
||||||
ccx.monomorphizing.insert(fn_id, depth + 1);
|
ccx.monomorphizing.insert(fn_id, depth + 1);
|
||||||
|
|
||||||
|
@ -170,11 +170,13 @@ fn traverse_inline_body(cx: &ctx, body: &blk) {
|
|||||||
expr_path(_) => {
|
expr_path(_) => {
|
||||||
match cx.tcx.def_map.find(&e.id) {
|
match cx.tcx.def_map.find(&e.id) {
|
||||||
Some(&d) => {
|
Some(&d) => {
|
||||||
traverse_def_id(cx, def_id_of_def(d));
|
traverse_def_id(cx, def_id_of_def(d));
|
||||||
}
|
}
|
||||||
None => cx.tcx.sess.span_bug(e.span, fmt!("Unbound node \
|
None => cx.tcx.sess.span_bug(
|
||||||
id %? while traversing %s", e.id,
|
e.span,
|
||||||
expr_to_str(e, cx.tcx.sess.intr())))
|
fmt!("Unbound node id %? while traversing %s",
|
||||||
|
e.id,
|
||||||
|
expr_to_str(e, cx.tcx.sess.intr())))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expr_field(_, _, _) => {
|
expr_field(_, _, _) => {
|
||||||
|
@ -469,7 +469,7 @@ pub fn write_content(bcx: block,
|
|||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
bcx.tcx().sess.span_bug(content_expr.span,
|
bcx.tcx().sess.span_bug(content_expr.span,
|
||||||
~"Unexpected evec content");
|
"Unexpected evec content");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -503,7 +503,7 @@ pub fn elements_required(bcx: block, content_expr: @ast::expr) -> uint {
|
|||||||
ty::eval_repeat_count(bcx.tcx(), count_expr)
|
ty::eval_repeat_count(bcx.tcx(), count_expr)
|
||||||
}
|
}
|
||||||
_ => bcx.tcx().sess.span_bug(content_expr.span,
|
_ => bcx.tcx().sess.span_bug(content_expr.span,
|
||||||
~"Unexpected evec content")
|
"Unexpected evec content")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,10 +291,8 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
|
|||||||
ty::vstore_fixed(*) => {
|
ty::vstore_fixed(*) => {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
path.span,
|
path.span,
|
||||||
~"@trait, ~trait or &trait \
|
"@trait, ~trait or &trait are the only supported \
|
||||||
are the only supported \
|
forms of casting-to-trait");
|
||||||
forms of casting-to-\
|
|
||||||
trait");
|
|
||||||
ty::BoxTraitStore
|
ty::BoxTraitStore
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -321,7 +319,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
|
|||||||
if path.types.len() > 0u {
|
if path.types.len() > 0u {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
path.span,
|
path.span,
|
||||||
~"type parameters are not allowed on this type");
|
"type parameters are not allowed on this type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +327,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
|
|||||||
if path.rp.is_some() {
|
if path.rp.is_some() {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
path.span,
|
path.span,
|
||||||
~"region parameters are not allowed on this type");
|
"region parameters are not allowed on this type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -339,9 +337,8 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
|
|||||||
match tcx.ast_ty_to_ty_cache.find(&ast_ty.id) {
|
match tcx.ast_ty_to_ty_cache.find(&ast_ty.id) {
|
||||||
Some(&ty::atttce_resolved(ty)) => return ty,
|
Some(&ty::atttce_resolved(ty)) => return ty,
|
||||||
Some(&ty::atttce_unresolved) => {
|
Some(&ty::atttce_unresolved) => {
|
||||||
tcx.sess.span_fatal(ast_ty.span, ~"illegal recursive type; \
|
tcx.sess.span_fatal(ast_ty.span, "illegal recursive type; \
|
||||||
insert an enum in the cycle, \
|
insert an enum in the cycle, if this is desired");
|
||||||
if this is desired");
|
|
||||||
}
|
}
|
||||||
None => { /* go on */ }
|
None => { /* go on */ }
|
||||||
}
|
}
|
||||||
@ -359,11 +356,9 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
|
|||||||
|tmt| ty::mk_uniq(tcx, tmt))
|
|tmt| ty::mk_uniq(tcx, tmt))
|
||||||
}
|
}
|
||||||
ast::ty_vec(ref mt) => {
|
ast::ty_vec(ref mt) => {
|
||||||
tcx.sess.span_err(ast_ty.span,
|
tcx.sess.span_err(ast_ty.span, "bare `[]` is not a type");
|
||||||
~"bare `[]` is not a type");
|
|
||||||
// return /something/ so they can at least get more errors
|
// return /something/ so they can at least get more errors
|
||||||
ty::mk_evec(tcx, ast_mt_to_mt(self, rscope, mt),
|
ty::mk_evec(tcx, ast_mt_to_mt(self, rscope, mt), ty::vstore_uniq)
|
||||||
ty::vstore_uniq)
|
|
||||||
}
|
}
|
||||||
ast::ty_ptr(ref mt) => {
|
ast::ty_ptr(ref mt) => {
|
||||||
ty::mk_ptr(tcx, ast_mt_to_mt(self, rscope, mt))
|
ty::mk_ptr(tcx, ast_mt_to_mt(self, rscope, mt))
|
||||||
@ -434,7 +429,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
|
|||||||
}
|
}
|
||||||
ast::ty_str => {
|
ast::ty_str => {
|
||||||
tcx.sess.span_err(ast_ty.span,
|
tcx.sess.span_err(ast_ty.span,
|
||||||
~"bare `str` is not a type");
|
"bare `str` is not a type");
|
||||||
// return /something/ so they can at least get more errors
|
// return /something/ so they can at least get more errors
|
||||||
ty::mk_estr(tcx, ty::vstore_uniq)
|
ty::mk_estr(tcx, ty::vstore_uniq)
|
||||||
}
|
}
|
||||||
@ -454,7 +449,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
|
|||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_fatal(ast_ty.span,
|
tcx.sess.span_fatal(ast_ty.span,
|
||||||
~"found type name used as a variable");
|
"found type name used as a variable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -470,7 +465,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
|
|||||||
ty::vstore_fixed(i as uint)),
|
ty::vstore_fixed(i as uint)),
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_fatal(
|
tcx.sess.span_fatal(
|
||||||
ast_ty.span, ~"expected constant expr for vector length");
|
ast_ty.span, "expected constant expr for vector length");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -489,11 +484,11 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
|
|||||||
// routine.
|
// routine.
|
||||||
self.tcx().sess.span_bug(
|
self.tcx().sess.span_bug(
|
||||||
ast_ty.span,
|
ast_ty.span,
|
||||||
~"found `ty_infer` in unexpected place");
|
"found `ty_infer` in unexpected place");
|
||||||
}
|
}
|
||||||
ast::ty_mac(_) => {
|
ast::ty_mac(_) => {
|
||||||
tcx.sess.span_bug(ast_ty.span,
|
tcx.sess.span_bug(ast_ty.span,
|
||||||
~"found `ty_mac` in unexpected place");
|
"found `ty_mac` in unexpected place");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -204,8 +204,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::pat, path: @ast::Path,
|
|||||||
if arg_len > 0 {
|
if arg_len > 0 {
|
||||||
// N-ary variant.
|
// N-ary variant.
|
||||||
if arg_len != subpats_len {
|
if arg_len != subpats_len {
|
||||||
let s = fmt!("this pattern has %u field%s, but the corresponding \
|
let s = fmt!("this pattern has %u field%s, but the corresponding %s has %u field%s",
|
||||||
%s has %u field%s",
|
|
||||||
subpats_len,
|
subpats_len,
|
||||||
if subpats_len == 1u { ~"" } else { ~"s" },
|
if subpats_len == 1u { ~"" } else { ~"s" },
|
||||||
kind_name,
|
kind_name,
|
||||||
@ -223,13 +222,12 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::pat, path: @ast::Path,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if subpats_len > 0 {
|
} else if subpats_len > 0 {
|
||||||
tcx.sess.span_err
|
tcx.sess.span_err(pat.span,
|
||||||
(pat.span, fmt!("this pattern has %u field%s, but the \
|
fmt!("this pattern has %u field%s, but the corresponding %s has no \
|
||||||
corresponding %s has no fields",
|
fields",
|
||||||
subpats_len,
|
subpats_len,
|
||||||
if subpats_len == 1u { ~"" }
|
if subpats_len == 1u { "" } else { "s" },
|
||||||
else { ~"s" },
|
kind_name));
|
||||||
kind_name));
|
|
||||||
error_happened = true;
|
error_happened = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,20 +317,19 @@ pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::node_id, span: span,
|
|||||||
Some(&ast::def_struct(*)) | Some(&ast::def_variant(*)) => {
|
Some(&ast::def_struct(*)) | Some(&ast::def_variant(*)) => {
|
||||||
let name = pprust::path_to_str(path, tcx.sess.intr());
|
let name = pprust::path_to_str(path, tcx.sess.intr());
|
||||||
tcx.sess.span_err(span,
|
tcx.sess.span_err(span,
|
||||||
fmt!("mismatched types: expected `%s` but \
|
fmt!("mismatched types: expected `%s` but found `%s`",
|
||||||
found `%s`",
|
|
||||||
fcx.infcx().ty_to_str(expected),
|
fcx.infcx().ty_to_str(expected),
|
||||||
name));
|
name));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_bug(span, ~"resolve didn't write in class");
|
tcx.sess.span_bug(span, "resolve didn't write in class");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forbid pattern-matching structs with destructors.
|
// Forbid pattern-matching structs with destructors.
|
||||||
if ty::has_dtor(tcx, class_id) {
|
if ty::has_dtor(tcx, class_id) {
|
||||||
tcx.sess.span_err(span, ~"deconstructing struct not allowed in \
|
tcx.sess.span_err(span, "deconstructing struct not allowed in pattern \
|
||||||
pattern (it has a destructor)");
|
(it has a destructor)");
|
||||||
}
|
}
|
||||||
|
|
||||||
check_struct_pat_fields(pcx, span, path, fields, class_fields, class_id,
|
check_struct_pat_fields(pcx, span, path, fields, class_fields, class_id,
|
||||||
@ -370,7 +367,7 @@ pub fn check_struct_like_enum_variant_pat(pcx: &pat_ctxt,
|
|||||||
name));
|
name));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_bug(span, ~"resolve didn't write in variant");
|
tcx.sess.span_bug(span, "resolve didn't write in variant");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -404,10 +401,9 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::pat, expected: ty::t) {
|
|||||||
{
|
{
|
||||||
// no-op
|
// no-op
|
||||||
} else if !ty::type_is_numeric(b_ty) {
|
} else if !ty::type_is_numeric(b_ty) {
|
||||||
tcx.sess.span_err(pat.span, ~"non-numeric type used in range");
|
tcx.sess.span_err(pat.span, "non-numeric type used in range");
|
||||||
} else if !valid_range_bounds(fcx.ccx, begin, end) {
|
} else if !valid_range_bounds(fcx.ccx, begin, end) {
|
||||||
tcx.sess.span_err(begin.span, ~"lower range bound must be less \
|
tcx.sess.span_err(begin.span, "lower range bound must be less than upper");
|
||||||
than upper");
|
|
||||||
}
|
}
|
||||||
fcx.write_ty(pat.id, b_ty);
|
fcx.write_ty(pat.id, b_ty);
|
||||||
}
|
}
|
||||||
@ -476,9 +472,8 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::pat, expected: ty::t) {
|
|||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_err(pat.span,
|
tcx.sess.span_err(pat.span,
|
||||||
fmt!("mismatched types: expected `%s` \
|
fmt!("mismatched types: expected `%s` but found struct",
|
||||||
but found struct",
|
fcx.infcx().ty_to_str(expected)));
|
||||||
fcx.infcx().ty_to_str(expected)));
|
|
||||||
error_happened = true;
|
error_happened = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -872,7 +872,7 @@ pub impl<'self> LookupContext<'self> {
|
|||||||
if relevant_candidates.len() > 1 {
|
if relevant_candidates.len() > 1 {
|
||||||
self.tcx().sess.span_err(
|
self.tcx().sess.span_err(
|
||||||
self.expr.span,
|
self.expr.span,
|
||||||
~"multiple applicable methods in scope");
|
"multiple applicable methods in scope");
|
||||||
for uint::range(0, relevant_candidates.len()) |idx| {
|
for uint::range(0, relevant_candidates.len()) |idx| {
|
||||||
self.report_candidate(idx, &relevant_candidates[idx].origin);
|
self.report_candidate(idx, &relevant_candidates[idx].origin);
|
||||||
}
|
}
|
||||||
@ -983,12 +983,12 @@ pub impl<'self> LookupContext<'self> {
|
|||||||
} else if num_method_tps == 0u {
|
} else if num_method_tps == 0u {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
self.expr.span,
|
self.expr.span,
|
||||||
~"this method does not take type parameters");
|
"this method does not take type parameters");
|
||||||
self.fcx.infcx().next_ty_vars(num_method_tps)
|
self.fcx.infcx().next_ty_vars(num_method_tps)
|
||||||
} else if num_supplied_tps != num_method_tps {
|
} else if num_supplied_tps != num_method_tps {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
self.expr.span,
|
self.expr.span,
|
||||||
~"incorrect number of type \
|
"incorrect number of type \
|
||||||
parameters given for this method");
|
parameters given for this method");
|
||||||
self.fcx.infcx().next_ty_vars(num_method_tps)
|
self.fcx.infcx().next_ty_vars(num_method_tps)
|
||||||
} else {
|
} else {
|
||||||
@ -1082,14 +1082,14 @@ pub impl<'self> LookupContext<'self> {
|
|||||||
if ty::type_has_self(method_fty) {
|
if ty::type_has_self(method_fty) {
|
||||||
self.tcx().sess.span_err(
|
self.tcx().sess.span_err(
|
||||||
self.expr.span,
|
self.expr.span,
|
||||||
~"cannot call a method whose type contains a \
|
"cannot call a method whose type contains a \
|
||||||
self-type through a boxed trait");
|
self-type through a boxed trait");
|
||||||
}
|
}
|
||||||
|
|
||||||
if candidate.method_ty.generics.has_type_params() {
|
if candidate.method_ty.generics.has_type_params() {
|
||||||
self.tcx().sess.span_err(
|
self.tcx().sess.span_err(
|
||||||
self.expr.span,
|
self.expr.span,
|
||||||
~"cannot call a generic method through a boxed trait");
|
"cannot call a generic method through a boxed trait");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1109,7 +1109,7 @@ pub impl<'self> LookupContext<'self> {
|
|||||||
|
|
||||||
if bad {
|
if bad {
|
||||||
self.tcx().sess.span_err(self.expr.span,
|
self.tcx().sess.span_err(self.expr.span,
|
||||||
~"explicit call to destructor");
|
"explicit call to destructor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,17 +542,15 @@ pub fn check_no_duplicate_fields(tcx: ty::ctxt,
|
|||||||
let (id, sp) = *p;
|
let (id, sp) = *p;
|
||||||
let orig_sp = field_names.find(&id).map_consume(|x| *x);
|
let orig_sp = field_names.find(&id).map_consume(|x| *x);
|
||||||
match orig_sp {
|
match orig_sp {
|
||||||
Some(orig_sp) => {
|
Some(orig_sp) => {
|
||||||
tcx.sess.span_err(sp, fmt!("Duplicate field \
|
tcx.sess.span_err(sp, fmt!("Duplicate field name %s in record type declaration",
|
||||||
name %s in record type declaration",
|
*tcx.sess.str_of(id)));
|
||||||
*tcx.sess.str_of(id)));
|
tcx.sess.span_note(orig_sp, "First declaration of this field occurred here");
|
||||||
tcx.sess.span_note(orig_sp, ~"First declaration of \
|
break;
|
||||||
this field occurred here");
|
}
|
||||||
break;
|
None => {
|
||||||
}
|
field_names.insert(id, sp);
|
||||||
None => {
|
}
|
||||||
field_names.insert(id, sp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1252,8 +1250,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
|||||||
ty::ty_rptr(_, mt) => formal_ty = mt.ty,
|
ty::ty_rptr(_, mt) => formal_ty = mt.ty,
|
||||||
ty::ty_err => (),
|
ty::ty_err => (),
|
||||||
_ => {
|
_ => {
|
||||||
fcx.ccx.tcx.sess.span_bug(arg.span,
|
fcx.ccx.tcx.sess.span_bug(arg.span, "no ref");
|
||||||
~"no ref");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1559,8 +1556,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
|||||||
match ty::get(lhs_resolved_t).sty {
|
match ty::get(lhs_resolved_t).sty {
|
||||||
ty::ty_bare_fn(_) | ty::ty_closure(_) => {
|
ty::ty_bare_fn(_) | ty::ty_closure(_) => {
|
||||||
tcx.sess.span_note(
|
tcx.sess.span_note(
|
||||||
ex.span, ~"did you forget the `do` keyword \
|
ex.span, "did you forget the `do` keyword for the call?");
|
||||||
for the call?");
|
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
@ -1851,9 +1847,9 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
|||||||
tcx.sess.span_err(span,
|
tcx.sess.span_err(span,
|
||||||
fmt!("missing field%s: %s",
|
fmt!("missing field%s: %s",
|
||||||
if missing_fields.len() == 1 {
|
if missing_fields.len() == 1 {
|
||||||
~""
|
""
|
||||||
} else {
|
} else {
|
||||||
~"s"
|
"s"
|
||||||
},
|
},
|
||||||
str::connect(missing_fields, ~", ")));
|
str::connect(missing_fields, ~", ")));
|
||||||
}
|
}
|
||||||
@ -1901,7 +1897,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
|||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_bug(span,
|
tcx.sess.span_bug(span,
|
||||||
~"resolve didn't map this to a class");
|
"resolve didn't map this to a class");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1989,7 +1985,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
|||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_bug(span,
|
tcx.sess.span_bug(span,
|
||||||
~"resolve didn't map this to an enum");
|
"resolve didn't map this to an enum");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2201,7 +2197,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ =>
|
_ =>
|
||||||
tcx.sess.span_bug(expr.span, ~"vstore modifier on non-sequence")
|
tcx.sess.span_bug(expr.span, "vstore modifier on non-sequence")
|
||||||
};
|
};
|
||||||
fcx.write_ty(ev.id, typ);
|
fcx.write_ty(ev.id, typ);
|
||||||
fcx.write_ty(id, typ);
|
fcx.write_ty(id, typ);
|
||||||
@ -2284,21 +2280,18 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
|||||||
ty::ty_enum(*) => {
|
ty::ty_enum(*) => {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
expr.span,
|
expr.span,
|
||||||
~"can only dereference enums \
|
"can only dereference enums with a single variant which \
|
||||||
with a single variant which has a \
|
has a single argument");
|
||||||
single argument");
|
|
||||||
}
|
}
|
||||||
ty::ty_struct(*) => {
|
ty::ty_struct(*) => {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
expr.span,
|
expr.span,
|
||||||
~"can only dereference structs with \
|
"can only dereference structs with one anonymous field");
|
||||||
one anonymous field");
|
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
fcx.type_error_message(expr.span,
|
fcx.type_error_message(expr.span,
|
||||||
|actual| {
|
|actual| {
|
||||||
fmt!("type %s cannot be \
|
fmt!("type %s cannot be dereferenced", actual)
|
||||||
dereferenced", actual)
|
|
||||||
}, oprnd_t, None);
|
}, oprnd_t, None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2394,7 +2387,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
|||||||
result::Err(_) => {
|
result::Err(_) => {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
expr.span,
|
expr.span,
|
||||||
~"`return;` in function returning non-nil");
|
"`return;` in function returning non-nil");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Some(e) => {
|
Some(e) => {
|
||||||
@ -2758,8 +2751,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
|||||||
variant_id, *fields);
|
variant_id, *fields);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_bug(path.span, ~"structure constructor does \
|
tcx.sess.span_bug(path.span,
|
||||||
not name a structure type");
|
"structure constructor does not name a structure type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2961,7 +2954,7 @@ pub fn check_block_with_expected(fcx: @mut FnCtxt,
|
|||||||
}
|
}
|
||||||
_ => false
|
_ => false
|
||||||
} {
|
} {
|
||||||
fcx.ccx.tcx.sess.span_warn(s.span, ~"unreachable statement");
|
fcx.ccx.tcx.sess.span_warn(s.span, "unreachable statement");
|
||||||
warned = true;
|
warned = true;
|
||||||
}
|
}
|
||||||
if ty::type_is_bot(s_ty) {
|
if ty::type_is_bot(s_ty) {
|
||||||
@ -2982,7 +2975,7 @@ pub fn check_block_with_expected(fcx: @mut FnCtxt,
|
|||||||
},
|
},
|
||||||
Some(e) => {
|
Some(e) => {
|
||||||
if any_bot && !warned {
|
if any_bot && !warned {
|
||||||
fcx.ccx.tcx.sess.span_warn(e.span, ~"unreachable expression");
|
fcx.ccx.tcx.sess.span_warn(e.span, "unreachable expression");
|
||||||
}
|
}
|
||||||
check_expr_with_opt_hint(fcx, e, expected);
|
check_expr_with_opt_hint(fcx, e, expected);
|
||||||
let ety = fcx.expr_ty(e);
|
let ety = fcx.expr_ty(e);
|
||||||
@ -3073,8 +3066,8 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt,
|
|||||||
*disr_val = val as int;
|
*disr_val = val as int;
|
||||||
}
|
}
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
ccx.tcx.sess.span_err(e.span, ~"expected signed integer \
|
ccx.tcx.sess.span_err(e.span, "expected signed integer \
|
||||||
constant");
|
constant");
|
||||||
}
|
}
|
||||||
Err(ref err) => {
|
Err(ref err) => {
|
||||||
ccx.tcx.sess.span_err(e.span,
|
ccx.tcx.sess.span_err(e.span,
|
||||||
@ -3085,7 +3078,7 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt,
|
|||||||
}
|
}
|
||||||
if vec::contains(*disr_vals, &*disr_val) {
|
if vec::contains(*disr_vals, &*disr_val) {
|
||||||
ccx.tcx.sess.span_err(v.span,
|
ccx.tcx.sess.span_err(v.span,
|
||||||
~"discriminator value already exists");
|
"discriminator value already exists");
|
||||||
}
|
}
|
||||||
disr_vals.push(*disr_val);
|
disr_vals.push(*disr_val);
|
||||||
let ctor_ty = ty::node_id_to_type(ccx.tcx, v.node.id);
|
let ctor_ty = ty::node_id_to_type(ccx.tcx, v.node.id);
|
||||||
@ -3142,9 +3135,9 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt,
|
|||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
ccx.tcx.sess.span_err(sp, ~"illegal recursive enum type; \
|
ccx.tcx.sess.span_err(sp,
|
||||||
wrap the inner value in a box to \
|
"illegal recursive enum type; \
|
||||||
make it representable");
|
wrap the inner value in a box to make it representable");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that it is possible to instantiate this enum:
|
// Check that it is possible to instantiate this enum:
|
||||||
@ -3205,26 +3198,25 @@ pub fn ty_param_bounds_and_ty_for_def(fcx: @mut FnCtxt,
|
|||||||
ast::def_ty(_) |
|
ast::def_ty(_) |
|
||||||
ast::def_prim_ty(_) |
|
ast::def_prim_ty(_) |
|
||||||
ast::def_ty_param(*)=> {
|
ast::def_ty_param(*)=> {
|
||||||
fcx.ccx.tcx.sess.span_bug(sp, ~"expected value but found type");
|
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found type");
|
||||||
}
|
}
|
||||||
ast::def_mod(*) | ast::def_foreign_mod(*) => {
|
ast::def_mod(*) | ast::def_foreign_mod(*) => {
|
||||||
fcx.ccx.tcx.sess.span_bug(sp, ~"expected value but found module");
|
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found module");
|
||||||
}
|
}
|
||||||
ast::def_use(*) => {
|
ast::def_use(*) => {
|
||||||
fcx.ccx.tcx.sess.span_bug(sp, ~"expected value but found use");
|
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found use");
|
||||||
}
|
}
|
||||||
ast::def_region(*) => {
|
ast::def_region(*) => {
|
||||||
fcx.ccx.tcx.sess.span_bug(sp, ~"expected value but found region");
|
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found region");
|
||||||
}
|
}
|
||||||
ast::def_typaram_binder(*) => {
|
ast::def_typaram_binder(*) => {
|
||||||
fcx.ccx.tcx.sess.span_bug(sp, ~"expected value but found type \
|
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found type parameter");
|
||||||
parameter");
|
|
||||||
}
|
}
|
||||||
ast::def_label(*) => {
|
ast::def_label(*) => {
|
||||||
fcx.ccx.tcx.sess.span_bug(sp, ~"expected value but found label");
|
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found label");
|
||||||
}
|
}
|
||||||
ast::def_self_ty(*) => {
|
ast::def_self_ty(*) => {
|
||||||
fcx.ccx.tcx.sess.span_bug(sp, ~"expected value but found self ty");
|
fcx.ccx.tcx.sess.span_bug(sp, "expected value but found self ty");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3253,7 +3245,7 @@ pub fn instantiate_path(fcx: @mut FnCtxt,
|
|||||||
match tpt.generics.region_param {
|
match tpt.generics.region_param {
|
||||||
None => { // ...but the type is not lifetime parameterized!
|
None => { // ...but the type is not lifetime parameterized!
|
||||||
fcx.ccx.tcx.sess.span_err
|
fcx.ccx.tcx.sess.span_err
|
||||||
(span, ~"this item is not region-parameterized");
|
(span, "this item is not region-parameterized");
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
Some(_) => { // ...and the type is lifetime parameterized, ok.
|
Some(_) => { // ...and the type is lifetime parameterized, ok.
|
||||||
@ -3273,15 +3265,15 @@ pub fn instantiate_path(fcx: @mut FnCtxt,
|
|||||||
fcx.infcx().next_ty_vars(ty_param_count)
|
fcx.infcx().next_ty_vars(ty_param_count)
|
||||||
} else if ty_param_count == 0 {
|
} else if ty_param_count == 0 {
|
||||||
fcx.ccx.tcx.sess.span_err
|
fcx.ccx.tcx.sess.span_err
|
||||||
(span, ~"this item does not take type parameters");
|
(span, "this item does not take type parameters");
|
||||||
fcx.infcx().next_ty_vars(ty_param_count)
|
fcx.infcx().next_ty_vars(ty_param_count)
|
||||||
} else if ty_substs_len > ty_param_count {
|
} else if ty_substs_len > ty_param_count {
|
||||||
fcx.ccx.tcx.sess.span_err
|
fcx.ccx.tcx.sess.span_err
|
||||||
(span, ~"too many type parameters provided for this item");
|
(span, "too many type parameters provided for this item");
|
||||||
fcx.infcx().next_ty_vars(ty_param_count)
|
fcx.infcx().next_ty_vars(ty_param_count)
|
||||||
} else if ty_substs_len < ty_param_count {
|
} else if ty_substs_len < ty_param_count {
|
||||||
fcx.ccx.tcx.sess.span_err
|
fcx.ccx.tcx.sess.span_err
|
||||||
(span, ~"not enough type parameters provided for this item");
|
(span, "not enough type parameters provided for this item");
|
||||||
fcx.infcx().next_ty_vars(ty_param_count)
|
fcx.infcx().next_ty_vars(ty_param_count)
|
||||||
} else {
|
} else {
|
||||||
pth.types.map(|aty| fcx.to_ty(*aty))
|
pth.types.map(|aty| fcx.to_ty(*aty))
|
||||||
|
@ -490,13 +490,13 @@ fn constrain_auto_ref(rcx: @mut Rcx, expr: @ast::expr) {
|
|||||||
// reporting an error would be the correct path.
|
// reporting an error would be the correct path.
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
expr.span,
|
expr.span,
|
||||||
~"lifetime of borrowed pointer does not include \
|
"lifetime of borrowed pointer does not include \
|
||||||
the expression being borrowed");
|
the expression being borrowed");
|
||||||
note_and_explain_region(
|
note_and_explain_region(
|
||||||
tcx,
|
tcx,
|
||||||
~"lifetime of the borrowed pointer is",
|
"lifetime of the borrowed pointer is",
|
||||||
region,
|
region,
|
||||||
~"");
|
"");
|
||||||
rcx.errors_reported += 1;
|
rcx.errors_reported += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -522,17 +522,17 @@ fn constrain_free_variables(
|
|||||||
result::Err(_) => {
|
result::Err(_) => {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
freevar.span,
|
freevar.span,
|
||||||
~"captured variable does not outlive the enclosing closure");
|
"captured variable does not outlive the enclosing closure");
|
||||||
note_and_explain_region(
|
note_and_explain_region(
|
||||||
tcx,
|
tcx,
|
||||||
~"captured variable is valid for ",
|
"captured variable is valid for ",
|
||||||
en_region,
|
en_region,
|
||||||
~"");
|
"");
|
||||||
note_and_explain_region(
|
note_and_explain_region(
|
||||||
tcx,
|
tcx,
|
||||||
~"closure is valid for ",
|
"closure is valid for ",
|
||||||
region,
|
region,
|
||||||
~"");
|
"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,7 @@ fn lookup_vtable(vcx: &VtableContext,
|
|||||||
if !is_early {
|
if !is_early {
|
||||||
vcx.tcx().sess.span_err(
|
vcx.tcx().sess.span_err(
|
||||||
location_info.span,
|
location_info.span,
|
||||||
~"multiple applicable methods in scope");
|
"multiple applicable methods in scope");
|
||||||
}
|
}
|
||||||
return Some(/*bad*/copy found[0]);
|
return Some(/*bad*/copy found[0]);
|
||||||
}
|
}
|
||||||
|
@ -76,10 +76,8 @@ pub fn get_base_type(inference_context: @mut InferCtxt,
|
|||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
inference_context.tcx.sess.span_fatal(span,
|
inference_context.tcx.sess.span_fatal(span,
|
||||||
~"the type of this value \
|
"the type of this value must be known in order \
|
||||||
must be known in order \
|
to determine the base type");
|
||||||
to determine the base \
|
|
||||||
type");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,9 +255,8 @@ pub impl CoherenceChecker {
|
|||||||
None => {
|
None => {
|
||||||
let session = self.crate_context.tcx.sess;
|
let session = self.crate_context.tcx.sess;
|
||||||
session.span_err(item.span,
|
session.span_err(item.span,
|
||||||
~"no base type found for inherent \
|
"no base type found for inherent implementation; \
|
||||||
implementation; implement a \
|
implement a trait or new type instead");
|
||||||
trait or new type instead");
|
|
||||||
}
|
}
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
@ -483,11 +480,9 @@ pub impl CoherenceChecker {
|
|||||||
if self.polytypes_unify(polytype_a, polytype_b) {
|
if self.polytypes_unify(polytype_a, polytype_b) {
|
||||||
let session = self.crate_context.tcx.sess;
|
let session = self.crate_context.tcx.sess;
|
||||||
session.span_err(self.span_of_impl(implementation_b),
|
session.span_err(self.span_of_impl(implementation_b),
|
||||||
~"conflicting implementations for a \
|
"conflicting implementations for a trait");
|
||||||
trait");
|
|
||||||
session.span_note(self.span_of_impl(implementation_a),
|
session.span_note(self.span_of_impl(implementation_a),
|
||||||
~"note conflicting implementation \
|
"note conflicting implementation here");
|
||||||
here");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -667,11 +662,9 @@ pub impl CoherenceChecker {
|
|||||||
// This is an error.
|
// This is an error.
|
||||||
let session = self.crate_context.tcx.sess;
|
let session = self.crate_context.tcx.sess;
|
||||||
session.span_err(item.span,
|
session.span_err(item.span,
|
||||||
~"cannot associate methods with \
|
"cannot associate methods with a type outside the \
|
||||||
a type outside the crate the \
|
crate the type is defined in; define and implement \
|
||||||
type is defined in; define \
|
a trait or new type instead");
|
||||||
and implement a trait or new \
|
|
||||||
type instead");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item_impl(_, Some(trait_ref), _, _) => {
|
item_impl(_, Some(trait_ref), _, _) => {
|
||||||
@ -690,10 +683,8 @@ pub impl CoherenceChecker {
|
|||||||
if trait_def_id.crate != local_crate {
|
if trait_def_id.crate != local_crate {
|
||||||
let session = self.crate_context.tcx.sess;
|
let session = self.crate_context.tcx.sess;
|
||||||
session.span_err(item.span,
|
session.span_err(item.span,
|
||||||
~"cannot provide an \
|
"cannot provide an extension implementation \
|
||||||
extension implementation \
|
for a trait not defined in this crate");
|
||||||
for a trait not defined \
|
|
||||||
in this crate");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -765,7 +756,7 @@ pub impl CoherenceChecker {
|
|||||||
None => {
|
None => {
|
||||||
self.crate_context.tcx.sess.span_bug(
|
self.crate_context.tcx.sess.span_bug(
|
||||||
original_type.span,
|
original_type.span,
|
||||||
~"resolve didn't resolve this type?!");
|
"resolve didn't resolve this type?!");
|
||||||
}
|
}
|
||||||
Some(&node_item(item, _)) => {
|
Some(&node_item(item, _)) => {
|
||||||
match item.node {
|
match item.node {
|
||||||
@ -849,8 +840,7 @@ pub impl CoherenceChecker {
|
|||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
self.crate_context.tcx.sess.span_bug(item.span,
|
self.crate_context.tcx.sess.span_bug(item.span,
|
||||||
~"can't convert a \
|
"can't convert a non-impl to an impl");
|
||||||
non-impl to an impl");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -862,9 +852,8 @@ pub impl CoherenceChecker {
|
|||||||
return item.span;
|
return item.span;
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
self.crate_context.tcx.sess.bug(~"span_of_impl() called on \
|
self.crate_context.tcx.sess.bug("span_of_impl() called on something that \
|
||||||
something that wasn't an \
|
wasn't an impl!");
|
||||||
impl!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1045,17 +1034,16 @@ pub impl CoherenceChecker {
|
|||||||
match tcx.items.find(&impl_info.did.node) {
|
match tcx.items.find(&impl_info.did.node) {
|
||||||
Some(&ast_map::node_item(@ref item, _)) => {
|
Some(&ast_map::node_item(@ref item, _)) => {
|
||||||
tcx.sess.span_err((*item).span,
|
tcx.sess.span_err((*item).span,
|
||||||
~"the Drop trait may only \
|
"the Drop trait may only be implemented on \
|
||||||
be implemented on \
|
structures");
|
||||||
structures");
|
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.bug(~"didn't find impl in ast map");
|
tcx.sess.bug("didn't find impl in ast map");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tcx.sess.bug(~"found external impl of Drop trait on \
|
tcx.sess.bug("found external impl of Drop trait on \
|
||||||
something other than a struct");
|
something other than a struct");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ impl AstConv for CrateCtxt {
|
|||||||
|
|
||||||
fn ty_infer(&self, span: span) -> ty::t {
|
fn ty_infer(&self, span: span) -> ty::t {
|
||||||
self.tcx.sess.span_bug(span,
|
self.tcx.sess.span_bug(span,
|
||||||
~"found `ty_infer` in unexpected place");
|
"found `ty_infer` in unexpected place");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,8 +416,7 @@ pub fn ensure_supertraits(ccx: &CrateCtxt,
|
|||||||
if ty_trait_refs.any(|other_trait| other_trait.def_id == trait_ref.def_id) {
|
if ty_trait_refs.any(|other_trait| other_trait.def_id == trait_ref.def_id) {
|
||||||
// This means a trait inherited from the same supertrait more
|
// This means a trait inherited from the same supertrait more
|
||||||
// than once.
|
// than once.
|
||||||
tcx.sess.span_err(sp, ~"Duplicate supertrait in trait \
|
tcx.sess.span_err(sp, "Duplicate supertrait in trait declaration");
|
||||||
declaration");
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
ty_trait_refs.push(trait_ref);
|
ty_trait_refs.push(trait_ref);
|
||||||
|
@ -1587,9 +1587,9 @@ pub impl RegionVarBindings {
|
|||||||
|
|
||||||
note_and_explain_region(
|
note_and_explain_region(
|
||||||
self.tcx,
|
self.tcx,
|
||||||
~"first, the lifetime cannot outlive ",
|
"first, the lifetime cannot outlive ",
|
||||||
upper_bound.region,
|
upper_bound.region,
|
||||||
~"...");
|
"...");
|
||||||
|
|
||||||
self.tcx.sess.span_note(
|
self.tcx.sess.span_note(
|
||||||
upper_bound.span,
|
upper_bound.span,
|
||||||
@ -1597,9 +1597,9 @@ pub impl RegionVarBindings {
|
|||||||
|
|
||||||
note_and_explain_region(
|
note_and_explain_region(
|
||||||
self.tcx,
|
self.tcx,
|
||||||
~"but, the lifetime must be valid for ",
|
"but, the lifetime must be valid for ",
|
||||||
lower_bound.region,
|
lower_bound.region,
|
||||||
~"...");
|
"...");
|
||||||
|
|
||||||
self.tcx.sess.span_note(
|
self.tcx.sess.span_note(
|
||||||
lower_bound.span,
|
lower_bound.span,
|
||||||
|
@ -214,7 +214,7 @@ pub fn lookup_def_tcx(tcx: ty::ctxt, sp: span, id: ast::node_id) -> ast::def {
|
|||||||
match tcx.def_map.find(&id) {
|
match tcx.def_map.find(&id) {
|
||||||
Some(&x) => x,
|
Some(&x) => x,
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_fatal(sp, ~"internal error looking up a definition")
|
tcx.sess.span_fatal(sp, "internal error looking up a definition")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,8 +301,7 @@ fn check_main_fn_ty(ccx: @mut CrateCtxt,
|
|||||||
if ps.is_parameterized() => {
|
if ps.is_parameterized() => {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
main_span,
|
main_span,
|
||||||
~"main function is not allowed \
|
"main function is not allowed to have type parameters");
|
||||||
to have type parameters");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
@ -343,8 +342,7 @@ fn check_start_fn_ty(ccx: @mut CrateCtxt,
|
|||||||
if ps.is_parameterized() => {
|
if ps.is_parameterized() => {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
start_span,
|
start_span,
|
||||||
~"start function is not allowed to have type \
|
"start function is not allowed to have type parameters");
|
||||||
parameters");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
|
@ -342,7 +342,7 @@ pub fn expr_to_str(cx: @ext_ctxt, expr: @ast::expr, err_msg: ~str) -> ~str {
|
|||||||
|
|
||||||
pub fn expr_to_ident(cx: @ext_ctxt,
|
pub fn expr_to_ident(cx: @ext_ctxt,
|
||||||
expr: @ast::expr,
|
expr: @ast::expr,
|
||||||
err_msg: ~str) -> ast::ident {
|
err_msg: &str) -> ast::ident {
|
||||||
match expr.node {
|
match expr.node {
|
||||||
ast::expr_path(p) => {
|
ast::expr_path(p) => {
|
||||||
if vec::len(p.types) > 0u || vec::len(p.idents) != 1u {
|
if vec::len(p.types) > 0u || vec::len(p.idents) != 1u {
|
||||||
|
@ -308,22 +308,22 @@ pub impl Parser {
|
|||||||
}
|
}
|
||||||
return copy self.buffer[(*self.buffer_start + dist - 1) & 3].tok;
|
return copy self.buffer[(*self.buffer_start + dist - 1) & 3].tok;
|
||||||
}
|
}
|
||||||
fn fatal(&self, m: ~str) -> ! {
|
fn fatal(&self, m: &str) -> ! {
|
||||||
self.sess.span_diagnostic.span_fatal(*copy self.span, m)
|
self.sess.span_diagnostic.span_fatal(*copy self.span, m)
|
||||||
}
|
}
|
||||||
fn span_fatal(&self, sp: span, m: ~str) -> ! {
|
fn span_fatal(&self, sp: span, m: &str) -> ! {
|
||||||
self.sess.span_diagnostic.span_fatal(sp, m)
|
self.sess.span_diagnostic.span_fatal(sp, m)
|
||||||
}
|
}
|
||||||
fn span_note(&self, sp: span, m: ~str) {
|
fn span_note(&self, sp: span, m: &str) {
|
||||||
self.sess.span_diagnostic.span_note(sp, m)
|
self.sess.span_diagnostic.span_note(sp, m)
|
||||||
}
|
}
|
||||||
fn bug(&self, m: ~str) -> ! {
|
fn bug(&self, m: &str) -> ! {
|
||||||
self.sess.span_diagnostic.span_bug(*copy self.span, m)
|
self.sess.span_diagnostic.span_bug(*copy self.span, m)
|
||||||
}
|
}
|
||||||
fn warn(&self, m: ~str) {
|
fn warn(&self, m: &str) {
|
||||||
self.sess.span_diagnostic.span_warn(*copy self.span, m)
|
self.sess.span_diagnostic.span_warn(*copy self.span, m)
|
||||||
}
|
}
|
||||||
fn span_err(&self, sp: span, m: ~str) {
|
fn span_err(&self, sp: span, m: &str) {
|
||||||
self.sess.span_diagnostic.span_err(sp, m)
|
self.sess.span_diagnostic.span_err(sp, m)
|
||||||
}
|
}
|
||||||
fn abort_if_errors(&self) {
|
fn abort_if_errors(&self) {
|
||||||
@ -2029,8 +2029,7 @@ pub impl Parser {
|
|||||||
// This is a 'continue' expression
|
// This is a 'continue' expression
|
||||||
if opt_ident.is_some() {
|
if opt_ident.is_some() {
|
||||||
self.span_err(*self.last_span,
|
self.span_err(*self.last_span,
|
||||||
~"a label may not be used with a `loop` \
|
"a label may not be used with a `loop` expression");
|
||||||
expression");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
@ -2167,7 +2166,7 @@ pub impl Parser {
|
|||||||
@ast::pat { node: pat_wild, _ } => (),
|
@ast::pat { node: pat_wild, _ } => (),
|
||||||
@ast::pat { node: pat_ident(_, _, _), _ } => (),
|
@ast::pat { node: pat_ident(_, _, _), _ } => (),
|
||||||
@ast::pat { span, _ } => self.span_fatal(
|
@ast::pat { span, _ } => self.span_fatal(
|
||||||
span, ~"expected an identifier or `_`"
|
span, "expected an identifier or `_`"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
slice = Some(subpat);
|
slice = Some(subpat);
|
||||||
@ -2459,7 +2458,7 @@ pub impl Parser {
|
|||||||
-> ast::pat_ {
|
-> ast::pat_ {
|
||||||
if !is_plain_ident(&*self.token) {
|
if !is_plain_ident(&*self.token) {
|
||||||
self.span_fatal(*self.last_span,
|
self.span_fatal(*self.last_span,
|
||||||
~"expected identifier, found path");
|
"expected identifier, found path");
|
||||||
}
|
}
|
||||||
// why a path here, and not just an identifier?
|
// why a path here, and not just an identifier?
|
||||||
let name = self.parse_path_without_tps();
|
let name = self.parse_path_without_tps();
|
||||||
@ -2478,7 +2477,7 @@ pub impl Parser {
|
|||||||
if *self.token == token::LPAREN {
|
if *self.token == token::LPAREN {
|
||||||
self.span_fatal(
|
self.span_fatal(
|
||||||
*self.last_span,
|
*self.last_span,
|
||||||
~"expected identifier, found enum pattern");
|
"expected identifier, found enum pattern");
|
||||||
}
|
}
|
||||||
|
|
||||||
pat_ident(binding_mode, name, sub)
|
pat_ident(binding_mode, name, sub)
|
||||||
@ -2609,19 +2608,19 @@ pub impl Parser {
|
|||||||
|
|
||||||
match self.parse_item_or_view_item(/*bad*/ copy item_attrs,
|
match self.parse_item_or_view_item(/*bad*/ copy item_attrs,
|
||||||
false) {
|
false) {
|
||||||
iovi_item(i) => {
|
iovi_item(i) => {
|
||||||
let hi = i.span.hi;
|
let hi = i.span.hi;
|
||||||
let decl = @spanned(lo, hi, decl_item(i));
|
let decl = @spanned(lo, hi, decl_item(i));
|
||||||
return @spanned(lo, hi, stmt_decl(decl, self.get_id()));
|
return @spanned(lo, hi, stmt_decl(decl, self.get_id()));
|
||||||
}
|
}
|
||||||
iovi_view_item(vi) => {
|
iovi_view_item(vi) => {
|
||||||
self.span_fatal(vi.span, ~"view items must be declared at \
|
self.span_fatal(vi.span,
|
||||||
the top of the block");
|
"view items must be declared at the top of the block");
|
||||||
}
|
}
|
||||||
iovi_foreign_item(_) => {
|
iovi_foreign_item(_) => {
|
||||||
self.fatal(~"foreign items are not allowed here");
|
self.fatal(~"foreign items are not allowed here");
|
||||||
}
|
}
|
||||||
iovi_none() => { /* fallthrough */ }
|
iovi_none() => { /* fallthrough */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
check_expected_item(self, item_attrs);
|
check_expected_item(self, item_attrs);
|
||||||
@ -2822,8 +2821,7 @@ pub impl Parser {
|
|||||||
result.push(RegionTyParamBound);
|
result.push(RegionTyParamBound);
|
||||||
} else {
|
} else {
|
||||||
self.span_err(*self.span,
|
self.span_err(*self.span,
|
||||||
~"`'static` is the only permissible \
|
"`'static` is the only permissible region bound here");
|
||||||
region bound here");
|
|
||||||
}
|
}
|
||||||
self.bump();
|
self.bump();
|
||||||
}
|
}
|
||||||
@ -3238,7 +3236,7 @@ pub impl Parser {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
self.span_err(*self.span, ~"not a trait");
|
self.span_err(*self.span, "not a trait");
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -3467,9 +3465,8 @@ pub impl Parser {
|
|||||||
) {
|
) {
|
||||||
iovi_item(item) => items.push(item),
|
iovi_item(item) => items.push(item),
|
||||||
iovi_view_item(view_item) => {
|
iovi_view_item(view_item) => {
|
||||||
self.span_fatal(view_item.span, ~"view items must be \
|
self.span_fatal(view_item.span, "view items must be declared at the top of the \
|
||||||
declared at the top of the \
|
module");
|
||||||
module");
|
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
self.fatal(
|
self.fatal(
|
||||||
@ -3762,7 +3759,7 @@ pub impl Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if opt_abis.is_some() {
|
if opt_abis.is_some() {
|
||||||
self.span_err(*self.span, ~"an ABI may not be specified here");
|
self.span_err(*self.span, "an ABI may not be specified here");
|
||||||
}
|
}
|
||||||
|
|
||||||
// extern mod foo;
|
// extern mod foo;
|
||||||
@ -4397,9 +4394,7 @@ pub impl Parser {
|
|||||||
view_item_extern_mod(*)
|
view_item_extern_mod(*)
|
||||||
if !extern_mod_allowed => {
|
if !extern_mod_allowed => {
|
||||||
self.span_err(view_item.span,
|
self.span_err(view_item.span,
|
||||||
~"\"extern mod\" \
|
"\"extern mod\" declarations are not allowed here");
|
||||||
declarations are not \
|
|
||||||
allowed here");
|
|
||||||
}
|
}
|
||||||
view_item_extern_mod(*) => {}
|
view_item_extern_mod(*) => {}
|
||||||
}
|
}
|
||||||
@ -4425,8 +4420,7 @@ pub impl Parser {
|
|||||||
iovi_none => break,
|
iovi_none => break,
|
||||||
iovi_view_item(view_item) => {
|
iovi_view_item(view_item) => {
|
||||||
self.span_err(view_item.span,
|
self.span_err(view_item.span,
|
||||||
~"`use` and `extern mod` declarations \
|
"`use` and `extern mod` declarations must precede items");
|
||||||
must precede items");
|
|
||||||
}
|
}
|
||||||
iovi_item(item) => {
|
iovi_item(item) => {
|
||||||
items.push(item)
|
items.push(item)
|
||||||
@ -4461,8 +4455,7 @@ pub impl Parser {
|
|||||||
iovi_view_item(view_item) => {
|
iovi_view_item(view_item) => {
|
||||||
// I think this can't occur:
|
// I think this can't occur:
|
||||||
self.span_err(view_item.span,
|
self.span_err(view_item.span,
|
||||||
~"`use` and `extern mod` declarations \
|
"`use` and `extern mod` declarations must precede items");
|
||||||
must precede items");
|
|
||||||
}
|
}
|
||||||
iovi_item(_) => {
|
iovi_item(_) => {
|
||||||
// FIXME #5668: this will occur for a macro invocation:
|
// FIXME #5668: this will occur for a macro invocation:
|
||||||
|
Loading…
Reference in New Issue
Block a user