expr_unary(deref, _) => { }
expr_unary(box(_), _) | expr_unary(uniq(_), _) => {
sess.span_err(e.span,
- ~"disallowed operator in constant expression");
+ "disallowed operator in constant expression");
return;
}
expr_lit(@codemap::spanned {node: lit_str(_), _}) => { }
expr_binary(_, _, _) | expr_unary(_, _) => {
if method_map.contains_key(&e.id) {
- sess.span_err(e.span, ~"user-defined operators are not \
+ sess.span_err(e.span, "user-defined operators are not \
allowed in constant expressions");
}
}
// a path in trans::callee that only works in block contexts.
if pth.types.len() != 0 {
sess.span_err(
- e.span, ~"paths in constants may only refer to \
- items without type parameters");
+ e.span, "paths in constants may only refer to \
+ items without type parameters");
}
match def_map.find(&e.id) {
Some(&def_const(_)) |
debug!("(checking const) found bad def: %?", def);
sess.span_err(
e.span,
- fmt!("paths in constants may only refer to \
- constants or functions"));
+ "paths in constants may only refer to \
+ constants or functions");
}
None => {
- sess.span_bug(e.span, ~"unbound path in const?!");
+ sess.span_bug(e.span, "unbound path in const?!");
}
}
}
_ => {
sess.span_err(
e.span,
- ~"function calls in constants are limited to \
- struct and enum constructors");
+ "function calls in constants are limited to \
+ struct and enum constructors");
}
}
}
expr_addr_of(*) => {
sess.span_err(
e.span,
- ~"borrowed pointers in constants may only refer to \
- immutable values");
+ "borrowed pointers in constants may only refer to \
+ immutable values");
}
_ => {
sess.span_err(e.span,
- ~"constant contains unimplemented expression type");
+ "constant contains unimplemented expression type");
return;
}
}
if t != ty_char {
if (v as u64) > ast_util::int_ty_max(
if t == ty_i { sess.targ_cfg.int_type } else { t }) {
- sess.span_err(e.span, ~"literal out of range for its type");
+ sess.span_err(e.span, "literal out of range for its type");
}
}
}
expr_lit(@codemap::spanned {node: lit_uint(v, t), _}) => {
if v > ast_util::uint_ty_max(
if t == ty_u { sess.targ_cfg.uint_type } else { t }) {
- sess.span_err(e.span, ~"literal out of range for its type");
+ sess.span_err(e.span, "literal out of range for its type");
}
}
_ => ()
fn visit_item(it: @item, env: env, v: visit::vt<env>) {
if env.idstack.contains(&(it.id)) {
- env.sess.span_fatal(env.root_it.span, ~"recursive constant");
+ env.sess.span_fatal(env.root_it.span, "recursive constant");
}
env.idstack.push(it.id);
visit::visit_item(it, env, v);
}
expr_break(_) => {
if !cx.in_loop {
- tcx.sess.span_err(e.span, ~"`break` outside of loop");
+ tcx.sess.span_err(e.span, "`break` outside of loop");
}
}
expr_again(_) => {
if !cx.in_loop {
- tcx.sess.span_err(e.span, ~"`again` outside of loop");
+ tcx.sess.span_err(e.span, "`again` outside of loop");
}
}
expr_ret(oe) => {
if !cx.can_ret {
- tcx.sess.span_err(e.span, ~"`return` in block function");
+ tcx.sess.span_err(e.span, "`return` in block function");
}
visit::visit_expr_opt(oe, cx, v);
}
}
let arms = vec::concat(arms.filter_mapped(unguarded_pat));
if arms.is_empty() {
- cx.tcx.sess.span_err(ex.span, ~"non-exhaustive patterns");
+ cx.tcx.sess.span_err(ex.span, "non-exhaustive patterns");
} else {
check_exhaustive(cx, ex.span, arms);
}
let v = ~[*pat];
match is_useful(cx, &seen, v) {
not_useful => {
- cx.tcx.sess.span_err(pat.span, ~"unreachable pattern");
+ cx.tcx.sess.span_err(pat.span, "unreachable pattern");
}
_ => ()
}
visit::visit_local(loc, s, v);
if is_refutable(cx, loc.node.pat) {
cx.tcx.sess.span_err(loc.node.pat.span,
- ~"refutable pattern in local binding");
+ "refutable pattern in local binding");
}
// Check legality of move bindings.
for decl.inputs.each |input| {
if is_refutable(cx, input.pat) {
cx.tcx.sess.span_err(input.pat.span,
- ~"refutable pattern in function argument");
+ "refutable pattern in function argument");
}
}
}
if sub.is_some() {
tcx.sess.span_err(
p.span,
- ~"cannot bind by-move with sub-bindings");
+ "cannot bind by-move with sub-bindings");
} else if has_guard {
tcx.sess.span_err(
p.span,
- ~"cannot bind by-move into a pattern guard");
+ "cannot bind by-move into a pattern guard");
} else if by_ref_span.is_some() {
tcx.sess.span_err(
p.span,
- ~"cannot bind by-move and by-ref \
- in the same pattern");
+ "cannot bind by-move and by-ref \
+ in the same pattern");
tcx.sess.span_note(
by_ref_span.get(),
- ~"by-ref binding occurs here");
+ "by-ref binding occurs here");
} else if is_lvalue {
tcx.sess.span_err(
p.span,
- ~"cannot bind by-move when \
- matching an lvalue");
+ "cannot bind by-move when \
+ matching an lvalue");
}
};
{
cx.tcx.sess.span_err(
pat.span,
- ~"by-move pattern \
- bindings may not occur \
- behind @ or & bindings");
+ "by-move pattern \
+ bindings may not occur \
+ behind @ or & bindings");
}
match sub {
});
if !ty::type_is_owned(cx.tcx, struct_ty) {
cx.tcx.sess.span_err(span,
- ~"cannot implement a destructor on a struct \
- that is not Owned");
+ "cannot implement a destructor on a struct \
+ that is not Owned");
cx.tcx.sess.span_note(span,
- ~"use \"#[unsafe_destructor]\" on the \
- implementation to force the compiler to \
- allow this");
+ "use \"#[unsafe_destructor]\" on the \
+ implementation to force the compiler to \
+ allow this");
}
} else {
cx.tcx.sess.span_err(span,
- ~"cannot implement a destructor on a struct \
- with type parameters");
+ "cannot implement a destructor on a struct \
+ with type parameters");
cx.tcx.sess.span_note(span,
- ~"use \"#[unsafe_destructor]\" on the \
- implementation to force the compiler to \
- allow this");
+ "use \"#[unsafe_destructor]\" on the \
+ implementation to force the compiler to \
+ allow this");
}
}
}
_ => {
cx.tcx.sess.span_bug(self_type.span,
- ~"the self type for \
- the Drop trait \
- impl is not a \
- path");
+ "the self type for \
+ the Drop trait \
+ impl is not a \
+ path");
}
}
}
fn check_for_bare(cx: Context, fv: @freevar_entry) {
cx.tcx.sess.span_err(
fv.span,
- ~"attempted dynamic environment capture");
+ "attempted dynamic environment capture");
}
let fty = ty::node_id_to_type(cx.tcx, id);
if is_mutbl {
cx.tcx.sess.span_err(
sp,
- ~"mutable variables cannot be implicitly captured");
+ "mutable variables cannot be implicitly captured");
}
}
def_arg(*) => { /* ok */ }
if !ty::type_is_durable(tcx, ty) {
match ty::get(ty).sty {
ty::ty_param(*) => {
- tcx.sess.span_err(sp, ~"value may contain borrowed \
- pointers; use `'static` bound");
+ tcx.sess.span_err(sp, "value may contain borrowed \
+ pointers; use `'static` bound");
}
_ => {
- tcx.sess.span_err(sp, ~"value may contain borrowed \
- pointers");
+ tcx.sess.span_err(sp, "value may contain borrowed \
+ pointers");
}
}
false
if !ty::type_is_owned(cx.tcx, source_ty) {
cx.tcx.sess.span_err(
target.span,
- ~"uniquely-owned trait objects must be sendable");
+ "uniquely-owned trait objects must be sendable");
}
}
_ => {} // Nothing to do.
_ => {
self.sess.span_err(
meta.span,
- ~"malformed lint attribute");
+ "malformed lint attribute");
}
}
}
}
_ => {
self.sess.span_err(meta.span,
- ~"malformed lint attribute");
+ "malformed lint attribute");
}
}
}
cx.sess.span_lint(
while_true, e.id, it.id,
e.span,
- ~"denote infinite loops \
- with loop { ... }");
+ "denote infinite loops \
+ with loop { ... }");
}
_ => ()
}
&& !check_limits(cx, *binop, l, r) {
cx.sess.span_lint(
type_limits, e.id, it.id, e.span,
- ~"comparison is useless due to type limits");
+ "comparison is useless due to type limits");
}
}
_ => ()
item.id,
item.id,
item.span,
- ~"default methods are experimental");
+ "default methods are experimental");
}
}
}
item.id,
item.id,
field.span,
- ~"mutable fields are deprecated");
+ "mutable fields are deprecated");
}
ast::named_field(*) | ast::unnamed_field => {}
}
cx.sess.span_lint(
ctypes, id, fn_id,
ty.span,
- ~"found rust type `int` in foreign module, while \
+ "found rust type `int` in foreign module, while \
libc::c_int or libc::c_long should be used");
}
ast::def_prim_ty(ast::ty_uint(ast::ty_u)) => {
cx.sess.span_lint(
ctypes, id, fn_id,
ty.span,
- ~"found rust type `uint` in foreign module, while \
+ "found rust type `uint` in foreign module, while \
libc::c_uint or libc::c_ulong should be used");
}
_ => ()
cx.sess.span_lint(
path_statement, id, it.id,
s.span,
- ~"path statement with no effect");
+ "path statement with no effect");
}
_ => ()
}
if !is_camel_case(cx, ident) {
cx.sess.span_lint(
non_camel_case_types, expr_id, item_id, span,
- ~"type, variant, or trait should have \
- a camel case identifier");
+ "type, variant, or trait should have \
+ a camel case identifier");
}
}
if !cx.used_unsafe.contains(&blk.node.id) {
cx.sess.span_lint(unused_unsafe, blk.node.id, it.id,
blk.span,
- ~"unnecessary `unsafe` block");
+ "unnecessary `unsafe` block");
}
}
_ => ()
}
if !used {
let msg = if bindings == 1 {
- ~"variable does not need to be mutable"
+ "variable does not need to be mutable"
} else {
- ~"variables do not need to be mutable"
+ "variables do not need to be mutable"
};
tcx.sess.span_lint(unused_mut, p.id, it.id, p.span, msg);
}
match self.capture_info_map.find(&expr.id) {
Some(&caps) => caps,
None => {
- self.tcx.sess.span_bug(expr.span, ~"no registered caps");
+ self.tcx.sess.span_bug(expr.span, "no registered caps");
}
}
}
}
None => {
self.tcx.sess.span_bug(
- span, ~"Not present in def map")
+ span, "Not present in def map")
}
}
}
// to find with one
match self.tcx.def_map.find(&id) {
Some(&def_label(loop_id)) => loop_id,
- _ => self.tcx.sess.span_bug(sp, ~"Label on break/loop \
- doesn't refer to a loop")
+ _ => self.tcx.sess.span_bug(sp, "Label on break/loop \
+ doesn't refer to a loop")
},
None => {
// Vanilla 'break' or 'loop', so use the enclosing
// loop scope
let loop_scope = &mut *self.loop_scope;
if loop_scope.len() == 0 {
- self.tcx.sess.span_bug(sp, ~"break outside loop");
+ self.tcx.sess.span_bug(sp, "break outside loop");
}
else {
// FIXME(#5275): this shouldn't have to be a method...
}
stmt_mac(*) => {
- self.tcx.sess.span_bug(stmt.span, ~"unexpanded macro");
+ self.tcx.sess.span_bug(stmt.span, "unexpanded macro");
}
}
}
match self.break_ln.find(&sc) {
Some(&b) => b,
None => self.tcx.sess.span_bug(expr.span,
- ~"Break to unknown label")
+ "Break to unknown label")
}
}
match self.cont_ln.find(&sc) {
Some(&b) => b,
None => self.tcx.sess.span_bug(expr.span,
- ~"Loop to unknown label")
+ "Loop to unknown label")
}
}
}
expr_mac(*) => {
- self.tcx.sess.span_bug(expr.span, ~"unexpanded macro");
+ self.tcx.sess.span_bug(expr.span, "unexpanded macro");
}
}
}
} else if ty::type_is_bot(t_ret) {
// for bot return types, not ok. Function should fail.
self.tcx.sess.span_err(
- sp, ~"some control paths may return");
+ sp, "some control paths may return");
} else {
self.tcx.sess.span_err(
- sp, ~"not all control paths return a value");
+ sp, "not all control paths return a value");
}
}
}
None => {
self.tcx.sess.span_err(
span,
- ~"re-assignment of immutable variable");
+ "re-assignment of immutable variable");
self.tcx.sess.span_note(
orig_span,
- ~"prior assignment occurs here");
+ "prior assignment occurs here");
}
}
}
_ => {
self.tcx.sess.span_bug(
pat.span,
- ~"enum pattern didn't resolve to enum or struct");
+ "enum pattern didn't resolve to enum or struct");
}
}
}
MoveInWhole => {
self.tcx.sess.span_bug(
expr.span,
- fmt!("Component mode can never be MoveInWhole"));
+ "Component mode can never be MoveInWhole");
}
}
}
expr_mac(*) => {
self.tcx.sess.span_bug(
expr.span,
- ~"macro expression remains after expansion");
+ "macro expression remains after expansion");
}
}
}
parental_privacy == Public)
== Private {
tcx.sess.span_err(span,
- ~"can only dereference enums \
- with a single, public variant");
+ "can only dereference enums \
+ with a single, public variant");
}
};
tcx.sess.parse_sess.interner)));
}
None => {
- tcx.sess.span_bug(span, ~"method not found in \
- AST map?!");
+ tcx.sess.span_bug(span, "method not found in \
+ AST map?!");
}
}
};
// Look up the enclosing impl.
if container_id.crate != local_crate {
tcx.sess.span_bug(span,
- ~"local method isn't in local \
- impl?!");
+ "local method isn't in local \
+ impl?!");
}
match tcx.items.find(&container_id.node) {
}
}
Some(_) => {
- tcx.sess.span_bug(span, ~"impl wasn't an item?!");
+ tcx.sess.span_bug(span, "impl wasn't an item?!");
}
None => {
- tcx.sess.span_bug(span, ~"impl wasn't in AST map?!");
+ tcx.sess.span_bug(span, "impl wasn't in AST map?!");
}
}
}
tcx.sess.parse_sess.interner)));
}
None => {
- tcx.sess.span_bug(span, ~"method not found in \
- AST map?!");
+ tcx.sess.span_bug(span, "method not found in \
+ AST map?!");
}
}
};
.interner)));
}
None => {
- tcx.sess.span_bug(span, ~"item not found in AST map?!");
+ tcx.sess.span_bug(span, "item not found in AST map?!");
}
}
};
match item.node {
item_trait(_, _, ref methods) => {
if method_num >= (*methods).len() {
- tcx.sess.span_bug(span, ~"method \
- number \
- out of \
- range?!");
+ tcx.sess.span_bug(span, "method \
+ number \
+ out of \
+ range?!");
}
match (*methods)[method_num] {
provided(method)
}
}
_ => {
- tcx.sess.span_bug(span, ~"trait wasn't \
- actually a \
- trait?!");
+ tcx.sess.span_bug(span, "trait wasn't \
+ actually a \
+ trait?!");
}
}
}
Some(_) => {
- tcx.sess.span_bug(span, ~"trait wasn't an \
- item?!");
+ tcx.sess.span_bug(span, "trait wasn't an \
+ item?!");
}
None => {
- tcx.sess.span_bug(span, ~"trait item wasn't \
- found in the AST \
- map?!");
+ tcx.sess.span_bug(span, "trait item wasn't \
+ found in the AST \
+ map?!");
}
}
} else {
match method_map.find(&expr.id) {
None => {
tcx.sess.span_bug(expr.span,
- ~"method call not in \
- method map");
+ "method call not in \
+ method map");
}
Some(ref entry) => {
debug!("(privacy checking) checking \
}
_ => {
tcx.sess.span_bug(expr.span,
- ~"resolve didn't \
- map enum struct \
- constructor to a \
- variant def");
+ "resolve didn't \
+ map enum struct \
+ constructor to a \
+ variant def");
}
}
}
}
_ => {
- tcx.sess.span_bug(expr.span, ~"struct expr \
- didn't have \
- struct type?!");
+ tcx.sess.span_bug(expr.span, "struct expr \
+ didn't have \
+ struct type?!");
}
}
}
}
_ => {
tcx.sess.span_bug(pattern.span,
- ~"resolve didn't \
- map enum struct \
- pattern to a \
- variant def");
+ "resolve didn't \
+ map enum struct \
+ pattern to a \
+ variant def");
}
}
}
}
_ => {
tcx.sess.span_bug(pattern.span,
- ~"struct pattern didn't have \
- struct type?!");
+ "struct pattern didn't have \
+ struct type?!");
}
}
}
pub fn parent_id(cx: ctxt, span: span) -> ast::node_id {
match cx.parent {
None => {
- cx.sess.span_bug(span, ~"crate should not be parent here");
+ cx.sess.span_bug(span, "crate should not be parent here");
}
Some(parent_id) => {
parent_id
ast::expr_mac(*) => {
tcx.sess.span_bug(
expr.span,
- ~"macro expression remains after expansion");
+ "macro expression remains after expansion");
}
}
}
const_eval::const_uint(count) => return count as uint,
const_eval::const_float(count) => {
tcx.sess.span_err(count_expr.span,
- ~"expected signed or unsigned integer for \
- repeat count but found float");
+ "expected signed or unsigned integer for \
+ repeat count but found float");
return count as uint;
}
const_eval::const_str(_) => {
tcx.sess.span_err(count_expr.span,
- ~"expected signed or unsigned integer for \
- repeat count but found string");
+ "expected signed or unsigned integer for \
+ repeat count but found string");
return 0;
}
const_eval::const_bool(_) => {
tcx.sess.span_err(count_expr.span,
- ~"expected signed or unsigned integer for \
- repeat count but found boolean");
+ "expected signed or unsigned integer for \
+ repeat count but found boolean");
return 0;
}
},
Err(*) => {
tcx.sess.span_err(count_expr.span,
- ~"expected constant integer for repeat count \
- but found variable");
+ "expected constant integer for repeat count \
+ but found variable");
return 0;
}
}