auto merge of #6174 : sanxiyn/rust/static-string, r=brson
This commit is contained in:
commit
b42ea7f9ef
@ -175,16 +175,16 @@ pub struct Session_ {
|
|||||||
pub type Session = @Session_;
|
pub type Session = @Session_;
|
||||||
|
|
||||||
pub impl Session_ {
|
pub impl Session_ {
|
||||||
fn span_fatal(@self, sp: span, msg: ~str) -> ! {
|
fn span_fatal(@self, sp: span, msg: &str) -> ! {
|
||||||
self.span_diagnostic.span_fatal(sp, msg)
|
self.span_diagnostic.span_fatal(sp, msg)
|
||||||
}
|
}
|
||||||
fn fatal(@self, msg: ~str) -> ! {
|
fn fatal(@self, msg: &str) -> ! {
|
||||||
self.span_diagnostic.handler().fatal(msg)
|
self.span_diagnostic.handler().fatal(msg)
|
||||||
}
|
}
|
||||||
fn span_err(@self, sp: span, msg: ~str) {
|
fn span_err(@self, sp: span, msg: &str) {
|
||||||
self.span_diagnostic.span_err(sp, msg)
|
self.span_diagnostic.span_err(sp, msg)
|
||||||
}
|
}
|
||||||
fn err(@self, msg: ~str) {
|
fn err(@self, msg: &str) {
|
||||||
self.span_diagnostic.handler().err(msg)
|
self.span_diagnostic.handler().err(msg)
|
||||||
}
|
}
|
||||||
fn has_errors(@self) -> bool {
|
fn has_errors(@self) -> bool {
|
||||||
@ -193,31 +193,31 @@ pub impl Session_ {
|
|||||||
fn abort_if_errors(@self) {
|
fn abort_if_errors(@self) {
|
||||||
self.span_diagnostic.handler().abort_if_errors()
|
self.span_diagnostic.handler().abort_if_errors()
|
||||||
}
|
}
|
||||||
fn span_warn(@self, sp: span, msg: ~str) {
|
fn span_warn(@self, sp: span, msg: &str) {
|
||||||
self.span_diagnostic.span_warn(sp, msg)
|
self.span_diagnostic.span_warn(sp, msg)
|
||||||
}
|
}
|
||||||
fn warn(@self, msg: ~str) {
|
fn warn(@self, msg: &str) {
|
||||||
self.span_diagnostic.handler().warn(msg)
|
self.span_diagnostic.handler().warn(msg)
|
||||||
}
|
}
|
||||||
fn span_note(@self, sp: span, msg: ~str) {
|
fn span_note(@self, sp: span, msg: &str) {
|
||||||
self.span_diagnostic.span_note(sp, msg)
|
self.span_diagnostic.span_note(sp, msg)
|
||||||
}
|
}
|
||||||
fn note(@self, msg: ~str) {
|
fn note(@self, msg: &str) {
|
||||||
self.span_diagnostic.handler().note(msg)
|
self.span_diagnostic.handler().note(msg)
|
||||||
}
|
}
|
||||||
fn span_bug(@self, sp: span, msg: ~str) -> ! {
|
fn span_bug(@self, sp: span, msg: &str) -> ! {
|
||||||
self.span_diagnostic.span_bug(sp, msg)
|
self.span_diagnostic.span_bug(sp, msg)
|
||||||
}
|
}
|
||||||
fn bug(@self, msg: ~str) -> ! {
|
fn bug(@self, msg: &str) -> ! {
|
||||||
self.span_diagnostic.handler().bug(msg)
|
self.span_diagnostic.handler().bug(msg)
|
||||||
}
|
}
|
||||||
fn span_unimpl(@self, sp: span, msg: ~str) -> ! {
|
fn span_unimpl(@self, sp: span, msg: &str) -> ! {
|
||||||
self.span_diagnostic.span_unimpl(sp, msg)
|
self.span_diagnostic.span_unimpl(sp, msg)
|
||||||
}
|
}
|
||||||
fn unimpl(@self, msg: ~str) -> ! {
|
fn unimpl(@self, msg: &str) -> ! {
|
||||||
self.span_diagnostic.handler().unimpl(msg)
|
self.span_diagnostic.handler().unimpl(msg)
|
||||||
}
|
}
|
||||||
fn span_lint_level(@self, level: lint::level, sp: span, msg: ~str) {
|
fn span_lint_level(@self, level: lint::level, sp: span, msg: &str) {
|
||||||
match level {
|
match level {
|
||||||
lint::allow => { },
|
lint::allow => { },
|
||||||
lint::warn => self.span_warn(sp, msg),
|
lint::warn => self.span_warn(sp, msg),
|
||||||
@ -230,7 +230,7 @@ pub impl Session_ {
|
|||||||
expr_id: ast::node_id,
|
expr_id: ast::node_id,
|
||||||
item_id: ast::node_id,
|
item_id: ast::node_id,
|
||||||
span: span,
|
span: span,
|
||||||
msg: ~str) {
|
msg: &str) {
|
||||||
let level = lint::get_lint_settings_level(
|
let level = lint::get_lint_settings_level(
|
||||||
self.lint_settings, lint_mode, expr_id, item_id);
|
self.lint_settings, lint_mode, expr_id, item_id);
|
||||||
self.span_lint_level(level, span, msg);
|
self.span_lint_level(level, span, msg);
|
||||||
|
@ -92,13 +92,13 @@ pub fn check_expr(sess: Session,
|
|||||||
expr_unary(deref, _) => { }
|
expr_unary(deref, _) => { }
|
||||||
expr_unary(box(_), _) | expr_unary(uniq(_), _) => {
|
expr_unary(box(_), _) | expr_unary(uniq(_), _) => {
|
||||||
sess.span_err(e.span,
|
sess.span_err(e.span,
|
||||||
~"disallowed operator in constant expression");
|
"disallowed operator in constant expression");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
expr_lit(@codemap::spanned {node: lit_str(_), _}) => { }
|
expr_lit(@codemap::spanned {node: lit_str(_), _}) => { }
|
||||||
expr_binary(_, _, _) | expr_unary(_, _) => {
|
expr_binary(_, _, _) | expr_unary(_, _) => {
|
||||||
if method_map.contains_key(&e.id) {
|
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");
|
allowed in constant expressions");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,8 +118,8 @@ pub fn check_expr(sess: Session,
|
|||||||
// a path in trans::callee that only works in block contexts.
|
// a path in trans::callee that only works in block contexts.
|
||||||
if pth.types.len() != 0 {
|
if pth.types.len() != 0 {
|
||||||
sess.span_err(
|
sess.span_err(
|
||||||
e.span, ~"paths in constants may only refer to \
|
e.span, "paths in constants may only refer to \
|
||||||
items without type parameters");
|
items without type parameters");
|
||||||
}
|
}
|
||||||
match def_map.find(&e.id) {
|
match def_map.find(&e.id) {
|
||||||
Some(&def_const(_)) |
|
Some(&def_const(_)) |
|
||||||
@ -131,11 +131,11 @@ pub fn check_expr(sess: Session,
|
|||||||
debug!("(checking const) found bad def: %?", def);
|
debug!("(checking const) found bad def: %?", def);
|
||||||
sess.span_err(
|
sess.span_err(
|
||||||
e.span,
|
e.span,
|
||||||
fmt!("paths in constants may only refer to \
|
"paths in constants may only refer to \
|
||||||
constants or functions"));
|
constants or functions");
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
sess.span_bug(e.span, ~"unbound path in const?!");
|
sess.span_bug(e.span, "unbound path in const?!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,8 +146,8 @@ pub fn check_expr(sess: Session,
|
|||||||
_ => {
|
_ => {
|
||||||
sess.span_err(
|
sess.span_err(
|
||||||
e.span,
|
e.span,
|
||||||
~"function calls in constants are limited to \
|
"function calls in constants are limited to \
|
||||||
struct and enum constructors");
|
struct and enum constructors");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,12 +163,12 @@ pub fn check_expr(sess: Session,
|
|||||||
expr_addr_of(*) => {
|
expr_addr_of(*) => {
|
||||||
sess.span_err(
|
sess.span_err(
|
||||||
e.span,
|
e.span,
|
||||||
~"borrowed pointers in constants may only refer to \
|
"borrowed pointers in constants may only refer to \
|
||||||
immutable values");
|
immutable values");
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
sess.span_err(e.span,
|
sess.span_err(e.span,
|
||||||
~"constant contains unimplemented expression type");
|
"constant contains unimplemented expression type");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,14 +178,14 @@ pub fn check_expr(sess: Session,
|
|||||||
if t != ty_char {
|
if t != ty_char {
|
||||||
if (v as u64) > ast_util::int_ty_max(
|
if (v as u64) > ast_util::int_ty_max(
|
||||||
if t == ty_i { sess.targ_cfg.int_type } else { t }) {
|
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), _}) => {
|
expr_lit(@codemap::spanned {node: lit_uint(v, t), _}) => {
|
||||||
if v > ast_util::uint_ty_max(
|
if v > ast_util::uint_ty_max(
|
||||||
if t == ty_u { sess.targ_cfg.uint_type } else { t }) {
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
@ -224,7 +224,7 @@ pub fn check_item_recursion(sess: Session,
|
|||||||
|
|
||||||
fn visit_item(it: @item, env: env, v: visit::vt<env>) {
|
fn visit_item(it: @item, env: env, v: visit::vt<env>) {
|
||||||
if env.idstack.contains(&(it.id)) {
|
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);
|
env.idstack.push(it.id);
|
||||||
visit::visit_item(it, env, v);
|
visit::visit_item(it, env, v);
|
||||||
|
@ -54,17 +54,17 @@ pub fn check_crate(tcx: ty::ctxt, crate: @crate) {
|
|||||||
}
|
}
|
||||||
expr_break(_) => {
|
expr_break(_) => {
|
||||||
if !cx.in_loop {
|
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(_) => {
|
expr_again(_) => {
|
||||||
if !cx.in_loop {
|
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) => {
|
expr_ret(oe) => {
|
||||||
if !cx.can_ret {
|
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);
|
visit::visit_expr_opt(oe, cx, v);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ pub fn check_expr(cx: @MatchCheckCtxt, ex: @expr, s: (), v: visit::vt<()>) {
|
|||||||
}
|
}
|
||||||
let arms = vec::concat(arms.filter_mapped(unguarded_pat));
|
let arms = vec::concat(arms.filter_mapped(unguarded_pat));
|
||||||
if arms.is_empty() {
|
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 {
|
} else {
|
||||||
check_exhaustive(cx, ex.span, arms);
|
check_exhaustive(cx, ex.span, arms);
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ pub fn check_arms(cx: @MatchCheckCtxt, arms: &[arm]) {
|
|||||||
let v = ~[*pat];
|
let v = ~[*pat];
|
||||||
match is_useful(cx, &seen, v) {
|
match is_useful(cx, &seen, v) {
|
||||||
not_useful => {
|
not_useful => {
|
||||||
cx.tcx.sess.span_err(pat.span, ~"unreachable pattern");
|
cx.tcx.sess.span_err(pat.span, "unreachable pattern");
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
@ -685,7 +685,7 @@ pub fn check_local(cx: @MatchCheckCtxt,
|
|||||||
visit::visit_local(loc, s, v);
|
visit::visit_local(loc, s, v);
|
||||||
if is_refutable(cx, loc.node.pat) {
|
if is_refutable(cx, loc.node.pat) {
|
||||||
cx.tcx.sess.span_err(loc.node.pat.span,
|
cx.tcx.sess.span_err(loc.node.pat.span,
|
||||||
~"refutable pattern in local binding");
|
"refutable pattern in local binding");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check legality of move bindings.
|
// Check legality of move bindings.
|
||||||
@ -708,7 +708,7 @@ pub fn check_fn(cx: @MatchCheckCtxt,
|
|||||||
for decl.inputs.each |input| {
|
for decl.inputs.each |input| {
|
||||||
if is_refutable(cx, input.pat) {
|
if is_refutable(cx, input.pat) {
|
||||||
cx.tcx.sess.span_err(input.pat.span,
|
cx.tcx.sess.span_err(input.pat.span,
|
||||||
~"refutable pattern in function argument");
|
"refutable pattern in function argument");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -780,24 +780,24 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
|
|||||||
if sub.is_some() {
|
if sub.is_some() {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
p.span,
|
p.span,
|
||||||
~"cannot bind by-move with sub-bindings");
|
"cannot bind by-move with sub-bindings");
|
||||||
} else if has_guard {
|
} else if has_guard {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
p.span,
|
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() {
|
} else if by_ref_span.is_some() {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
p.span,
|
p.span,
|
||||||
~"cannot bind by-move and by-ref \
|
"cannot bind by-move and by-ref \
|
||||||
in the same pattern");
|
in the same pattern");
|
||||||
tcx.sess.span_note(
|
tcx.sess.span_note(
|
||||||
by_ref_span.get(),
|
by_ref_span.get(),
|
||||||
~"by-ref binding occurs here");
|
"by-ref binding occurs here");
|
||||||
} else if is_lvalue {
|
} else if is_lvalue {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
p.span,
|
p.span,
|
||||||
~"cannot bind by-move when \
|
"cannot bind by-move when \
|
||||||
matching an lvalue");
|
matching an lvalue");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -837,9 +837,9 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
|
|||||||
{
|
{
|
||||||
cx.tcx.sess.span_err(
|
cx.tcx.sess.span_err(
|
||||||
pat.span,
|
pat.span,
|
||||||
~"by-move pattern \
|
"by-move pattern \
|
||||||
bindings may not occur \
|
bindings may not occur \
|
||||||
behind @ or & bindings");
|
behind @ or & bindings");
|
||||||
}
|
}
|
||||||
|
|
||||||
match sub {
|
match sub {
|
||||||
|
@ -97,21 +97,21 @@ fn check_struct_safe_for_destructor(cx: Context,
|
|||||||
});
|
});
|
||||||
if !ty::type_is_owned(cx.tcx, struct_ty) {
|
if !ty::type_is_owned(cx.tcx, struct_ty) {
|
||||||
cx.tcx.sess.span_err(span,
|
cx.tcx.sess.span_err(span,
|
||||||
~"cannot implement a destructor on a struct \
|
"cannot implement a destructor on a struct \
|
||||||
that is not Owned");
|
that is not Owned");
|
||||||
cx.tcx.sess.span_note(span,
|
cx.tcx.sess.span_note(span,
|
||||||
~"use \"#[unsafe_destructor]\" on the \
|
"use \"#[unsafe_destructor]\" on the \
|
||||||
implementation to force the compiler to \
|
implementation to force the compiler to \
|
||||||
allow this");
|
allow this");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cx.tcx.sess.span_err(span,
|
cx.tcx.sess.span_err(span,
|
||||||
~"cannot implement a destructor on a struct \
|
"cannot implement a destructor on a struct \
|
||||||
with type parameters");
|
with type parameters");
|
||||||
cx.tcx.sess.span_note(span,
|
cx.tcx.sess.span_note(span,
|
||||||
~"use \"#[unsafe_destructor]\" on the \
|
"use \"#[unsafe_destructor]\" on the \
|
||||||
implementation to force the compiler to \
|
implementation to force the compiler to \
|
||||||
allow this");
|
allow this");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,10 +143,10 @@ fn check_item(item: @item, cx: Context, visitor: visit::vt<Context>) {
|
|||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
cx.tcx.sess.span_bug(self_type.span,
|
cx.tcx.sess.span_bug(self_type.span,
|
||||||
~"the self type for \
|
"the self type for \
|
||||||
the Drop trait \
|
the Drop trait \
|
||||||
impl is not a \
|
impl is not a \
|
||||||
path");
|
path");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ fn with_appropriate_checker(cx: Context, id: node_id, b: &fn(check_fn)) {
|
|||||||
fn check_for_bare(cx: Context, fv: @freevar_entry) {
|
fn check_for_bare(cx: Context, fv: @freevar_entry) {
|
||||||
cx.tcx.sess.span_err(
|
cx.tcx.sess.span_err(
|
||||||
fv.span,
|
fv.span,
|
||||||
~"attempted dynamic environment capture");
|
"attempted dynamic environment capture");
|
||||||
}
|
}
|
||||||
|
|
||||||
let fty = ty::node_id_to_type(cx.tcx, id);
|
let fty = ty::node_id_to_type(cx.tcx, id);
|
||||||
@ -409,7 +409,7 @@ fn check_imm_free_var(cx: Context, def: def, sp: span) {
|
|||||||
if is_mutbl {
|
if is_mutbl {
|
||||||
cx.tcx.sess.span_err(
|
cx.tcx.sess.span_err(
|
||||||
sp,
|
sp,
|
||||||
~"mutable variables cannot be implicitly captured");
|
"mutable variables cannot be implicitly captured");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def_arg(*) => { /* ok */ }
|
def_arg(*) => { /* ok */ }
|
||||||
@ -451,12 +451,12 @@ pub fn check_durable(tcx: ty::ctxt, ty: ty::t, sp: span) -> bool {
|
|||||||
if !ty::type_is_durable(tcx, ty) {
|
if !ty::type_is_durable(tcx, ty) {
|
||||||
match ty::get(ty).sty {
|
match ty::get(ty).sty {
|
||||||
ty::ty_param(*) => {
|
ty::ty_param(*) => {
|
||||||
tcx.sess.span_err(sp, ~"value may contain borrowed \
|
tcx.sess.span_err(sp, "value may contain borrowed \
|
||||||
pointers; use `'static` bound");
|
pointers; use `'static` bound");
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_err(sp, ~"value may contain borrowed \
|
tcx.sess.span_err(sp, "value may contain borrowed \
|
||||||
pointers");
|
pointers");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
@ -581,7 +581,7 @@ pub fn check_kind_bounds_of_cast(cx: Context, source: @expr, target: @expr) {
|
|||||||
if !ty::type_is_owned(cx.tcx, source_ty) {
|
if !ty::type_is_owned(cx.tcx, source_ty) {
|
||||||
cx.tcx.sess.span_err(
|
cx.tcx.sess.span_err(
|
||||||
target.span,
|
target.span,
|
||||||
~"uniquely-owned trait objects must be sendable");
|
"uniquely-owned trait objects must be sendable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {} // Nothing to do.
|
_ => {} // Nothing to do.
|
||||||
|
@ -338,14 +338,14 @@ pub impl Context {
|
|||||||
_ => {
|
_ => {
|
||||||
self.sess.span_err(
|
self.sess.span_err(
|
||||||
meta.span,
|
meta.span,
|
||||||
~"malformed lint attribute");
|
"malformed lint attribute");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
self.sess.span_err(meta.span,
|
self.sess.span_err(meta.span,
|
||||||
~"malformed lint attribute");
|
"malformed lint attribute");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -485,8 +485,8 @@ fn check_item_while_true(cx: ty::ctxt, it: @ast::item) {
|
|||||||
cx.sess.span_lint(
|
cx.sess.span_lint(
|
||||||
while_true, e.id, it.id,
|
while_true, e.id, it.id,
|
||||||
e.span,
|
e.span,
|
||||||
~"denote infinite loops \
|
"denote infinite loops \
|
||||||
with loop { ... }");
|
with loop { ... }");
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
@ -603,7 +603,7 @@ fn check_item_type_limits(cx: ty::ctxt, it: @ast::item) {
|
|||||||
&& !check_limits(cx, *binop, l, r) {
|
&& !check_limits(cx, *binop, l, r) {
|
||||||
cx.sess.span_lint(
|
cx.sess.span_lint(
|
||||||
type_limits, e.id, it.id, e.span,
|
type_limits, e.id, it.id, e.span,
|
||||||
~"comparison is useless due to type limits");
|
"comparison is useless due to type limits");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
@ -630,7 +630,7 @@ fn check_item_default_methods(cx: ty::ctxt, item: @ast::item) {
|
|||||||
item.id,
|
item.id,
|
||||||
item.id,
|
item.id,
|
||||||
item.span,
|
item.span,
|
||||||
~"default methods are experimental");
|
"default methods are experimental");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -649,7 +649,7 @@ fn check_item_deprecated_mutable_fields(cx: ty::ctxt, item: @ast::item) {
|
|||||||
item.id,
|
item.id,
|
||||||
item.id,
|
item.id,
|
||||||
field.span,
|
field.span,
|
||||||
~"mutable fields are deprecated");
|
"mutable fields are deprecated");
|
||||||
}
|
}
|
||||||
ast::named_field(*) | ast::unnamed_field => {}
|
ast::named_field(*) | ast::unnamed_field => {}
|
||||||
}
|
}
|
||||||
@ -672,14 +672,14 @@ fn check_item_ctypes(cx: ty::ctxt, it: @ast::item) {
|
|||||||
cx.sess.span_lint(
|
cx.sess.span_lint(
|
||||||
ctypes, id, fn_id,
|
ctypes, id, fn_id,
|
||||||
ty.span,
|
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");
|
libc::c_int or libc::c_long should be used");
|
||||||
}
|
}
|
||||||
ast::def_prim_ty(ast::ty_uint(ast::ty_u)) => {
|
ast::def_prim_ty(ast::ty_uint(ast::ty_u)) => {
|
||||||
cx.sess.span_lint(
|
cx.sess.span_lint(
|
||||||
ctypes, id, fn_id,
|
ctypes, id, fn_id,
|
||||||
ty.span,
|
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");
|
libc::c_uint or libc::c_ulong should be used");
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
@ -795,7 +795,7 @@ fn check_item_path_statement(cx: ty::ctxt, it: @ast::item) {
|
|||||||
cx.sess.span_lint(
|
cx.sess.span_lint(
|
||||||
path_statement, id, it.id,
|
path_statement, id, it.id,
|
||||||
s.span,
|
s.span,
|
||||||
~"path statement with no effect");
|
"path statement with no effect");
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
@ -835,8 +835,8 @@ fn check_item_non_camel_case_types(cx: ty::ctxt, it: @ast::item) {
|
|||||||
if !is_camel_case(cx, ident) {
|
if !is_camel_case(cx, ident) {
|
||||||
cx.sess.span_lint(
|
cx.sess.span_lint(
|
||||||
non_camel_case_types, expr_id, item_id, span,
|
non_camel_case_types, expr_id, item_id, span,
|
||||||
~"type, variant, or trait should have \
|
"type, variant, or trait should have \
|
||||||
a camel case identifier");
|
a camel case identifier");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,7 +863,7 @@ fn check_item_unused_unsafe(cx: ty::ctxt, it: @ast::item) {
|
|||||||
if !cx.used_unsafe.contains(&blk.node.id) {
|
if !cx.used_unsafe.contains(&blk.node.id) {
|
||||||
cx.sess.span_lint(unused_unsafe, blk.node.id, it.id,
|
cx.sess.span_lint(unused_unsafe, blk.node.id, it.id,
|
||||||
blk.span,
|
blk.span,
|
||||||
~"unnecessary `unsafe` block");
|
"unnecessary `unsafe` block");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
@ -888,9 +888,9 @@ fn check_item_unused_mut(tcx: ty::ctxt, it: @ast::item) {
|
|||||||
}
|
}
|
||||||
if !used {
|
if !used {
|
||||||
let msg = if bindings == 1 {
|
let msg = if bindings == 1 {
|
||||||
~"variable does not need to be mutable"
|
"variable does not need to be mutable"
|
||||||
} else {
|
} 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);
|
tcx.sess.span_lint(unused_mut, p.id, it.id, p.span, msg);
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,7 @@ pub impl IrMaps {
|
|||||||
match self.capture_info_map.find(&expr.id) {
|
match self.capture_info_map.find(&expr.id) {
|
||||||
Some(&caps) => caps,
|
Some(&caps) => caps,
|
||||||
None => {
|
None => {
|
||||||
self.tcx.sess.span_bug(expr.span, ~"no registered caps");
|
self.tcx.sess.span_bug(expr.span, "no registered caps");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -687,7 +687,7 @@ pub impl Liveness {
|
|||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
self.tcx.sess.span_bug(
|
self.tcx.sess.span_bug(
|
||||||
span, ~"Not present in def map")
|
span, "Not present in def map")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -804,15 +804,15 @@ pub impl Liveness {
|
|||||||
// to find with one
|
// to find with one
|
||||||
match self.tcx.def_map.find(&id) {
|
match self.tcx.def_map.find(&id) {
|
||||||
Some(&def_label(loop_id)) => loop_id,
|
Some(&def_label(loop_id)) => loop_id,
|
||||||
_ => self.tcx.sess.span_bug(sp, ~"Label on break/loop \
|
_ => self.tcx.sess.span_bug(sp, "Label on break/loop \
|
||||||
doesn't refer to a loop")
|
doesn't refer to a loop")
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
// Vanilla 'break' or 'loop', so use the enclosing
|
// Vanilla 'break' or 'loop', so use the enclosing
|
||||||
// loop scope
|
// loop scope
|
||||||
let loop_scope = &mut *self.loop_scope;
|
let loop_scope = &mut *self.loop_scope;
|
||||||
if loop_scope.len() == 0 {
|
if loop_scope.len() == 0 {
|
||||||
self.tcx.sess.span_bug(sp, ~"break outside loop");
|
self.tcx.sess.span_bug(sp, "break outside loop");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// FIXME(#5275): this shouldn't have to be a method...
|
// FIXME(#5275): this shouldn't have to be a method...
|
||||||
@ -994,7 +994,7 @@ pub impl Liveness {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stmt_mac(*) => {
|
stmt_mac(*) => {
|
||||||
self.tcx.sess.span_bug(stmt.span, ~"unexpanded macro");
|
self.tcx.sess.span_bug(stmt.span, "unexpanded macro");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1164,7 +1164,7 @@ pub impl Liveness {
|
|||||||
match self.break_ln.find(&sc) {
|
match self.break_ln.find(&sc) {
|
||||||
Some(&b) => b,
|
Some(&b) => b,
|
||||||
None => self.tcx.sess.span_bug(expr.span,
|
None => self.tcx.sess.span_bug(expr.span,
|
||||||
~"Break to unknown label")
|
"Break to unknown label")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1178,7 +1178,7 @@ pub impl Liveness {
|
|||||||
match self.cont_ln.find(&sc) {
|
match self.cont_ln.find(&sc) {
|
||||||
Some(&b) => b,
|
Some(&b) => b,
|
||||||
None => self.tcx.sess.span_bug(expr.span,
|
None => self.tcx.sess.span_bug(expr.span,
|
||||||
~"Loop to unknown label")
|
"Loop to unknown label")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1304,7 +1304,7 @@ pub impl Liveness {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expr_mac(*) => {
|
expr_mac(*) => {
|
||||||
self.tcx.sess.span_bug(expr.span, ~"unexpanded macro");
|
self.tcx.sess.span_bug(expr.span, "unexpanded macro");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1618,10 +1618,10 @@ pub impl Liveness {
|
|||||||
} else if ty::type_is_bot(t_ret) {
|
} else if ty::type_is_bot(t_ret) {
|
||||||
// for bot return types, not ok. Function should fail.
|
// for bot return types, not ok. Function should fail.
|
||||||
self.tcx.sess.span_err(
|
self.tcx.sess.span_err(
|
||||||
sp, ~"some control paths may return");
|
sp, "some control paths may return");
|
||||||
} else {
|
} else {
|
||||||
self.tcx.sess.span_err(
|
self.tcx.sess.span_err(
|
||||||
sp, ~"not all control paths return a value");
|
sp, "not all control paths return a value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1712,10 +1712,10 @@ pub impl Liveness {
|
|||||||
None => {
|
None => {
|
||||||
self.tcx.sess.span_err(
|
self.tcx.sess.span_err(
|
||||||
span,
|
span,
|
||||||
~"re-assignment of immutable variable");
|
"re-assignment of immutable variable");
|
||||||
self.tcx.sess.span_note(
|
self.tcx.sess.span_note(
|
||||||
orig_span,
|
orig_span,
|
||||||
~"prior assignment occurs here");
|
"prior assignment occurs here");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -928,7 +928,7 @@ pub impl mem_categorization_ctxt {
|
|||||||
_ => {
|
_ => {
|
||||||
self.tcx.sess.span_bug(
|
self.tcx.sess.span_bug(
|
||||||
pat.span,
|
pat.span,
|
||||||
~"enum pattern didn't resolve to enum or struct");
|
"enum pattern didn't resolve to enum or struct");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -424,7 +424,7 @@ pub impl VisitContext {
|
|||||||
MoveInWhole => {
|
MoveInWhole => {
|
||||||
self.tcx.sess.span_bug(
|
self.tcx.sess.span_bug(
|
||||||
expr.span,
|
expr.span,
|
||||||
fmt!("Component mode can never be MoveInWhole"));
|
"Component mode can never be MoveInWhole");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -647,7 +647,7 @@ pub impl VisitContext {
|
|||||||
expr_mac(*) => {
|
expr_mac(*) => {
|
||||||
self.tcx.sess.span_bug(
|
self.tcx.sess.span_bug(
|
||||||
expr.span,
|
expr.span,
|
||||||
~"macro expression remains after expansion");
|
"macro expression remains after expansion");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,8 +99,8 @@ pub fn check_crate(tcx: ty::ctxt,
|
|||||||
parental_privacy == Public)
|
parental_privacy == Public)
|
||||||
== Private {
|
== Private {
|
||||||
tcx.sess.span_err(span,
|
tcx.sess.span_err(span,
|
||||||
~"can only dereference enums \
|
"can only dereference enums \
|
||||||
with a single, public variant");
|
with a single, public variant");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -121,8 +121,8 @@ pub fn check_crate(tcx: ty::ctxt,
|
|||||||
tcx.sess.parse_sess.interner)));
|
tcx.sess.parse_sess.interner)));
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
tcx.sess.span_bug(span, ~"method not found in \
|
tcx.sess.span_bug(span, "method not found in \
|
||||||
AST map?!");
|
AST map?!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -140,8 +140,8 @@ pub fn check_crate(tcx: ty::ctxt,
|
|||||||
// Look up the enclosing impl.
|
// Look up the enclosing impl.
|
||||||
if container_id.crate != local_crate {
|
if container_id.crate != local_crate {
|
||||||
tcx.sess.span_bug(span,
|
tcx.sess.span_bug(span,
|
||||||
~"local method isn't in local \
|
"local method isn't in local \
|
||||||
impl?!");
|
impl?!");
|
||||||
}
|
}
|
||||||
|
|
||||||
match tcx.items.find(&container_id.node) {
|
match tcx.items.find(&container_id.node) {
|
||||||
@ -155,10 +155,10 @@ pub fn check_crate(tcx: ty::ctxt,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
tcx.sess.span_bug(span, ~"impl wasn't an item?!");
|
tcx.sess.span_bug(span, "impl wasn't an item?!");
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
tcx.sess.span_bug(span, ~"impl wasn't in AST map?!");
|
tcx.sess.span_bug(span, "impl wasn't in AST map?!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,8 +185,8 @@ pub fn check_crate(tcx: ty::ctxt,
|
|||||||
tcx.sess.parse_sess.interner)));
|
tcx.sess.parse_sess.interner)));
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
tcx.sess.span_bug(span, ~"method not found in \
|
tcx.sess.span_bug(span, "method not found in \
|
||||||
AST map?!");
|
AST map?!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -219,7 +219,7 @@ pub fn check_crate(tcx: ty::ctxt,
|
|||||||
.interner)));
|
.interner)));
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
tcx.sess.span_bug(span, ~"item not found in AST map?!");
|
tcx.sess.span_bug(span, "item not found in AST map?!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -333,10 +333,10 @@ pub fn check_crate(tcx: ty::ctxt,
|
|||||||
match item.node {
|
match item.node {
|
||||||
item_trait(_, _, ref methods) => {
|
item_trait(_, _, ref methods) => {
|
||||||
if method_num >= (*methods).len() {
|
if method_num >= (*methods).len() {
|
||||||
tcx.sess.span_bug(span, ~"method \
|
tcx.sess.span_bug(span, "method \
|
||||||
number \
|
number \
|
||||||
out of \
|
out of \
|
||||||
range?!");
|
range?!");
|
||||||
}
|
}
|
||||||
match (*methods)[method_num] {
|
match (*methods)[method_num] {
|
||||||
provided(method)
|
provided(method)
|
||||||
@ -363,20 +363,20 @@ pub fn check_crate(tcx: ty::ctxt,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_bug(span, ~"trait wasn't \
|
tcx.sess.span_bug(span, "trait wasn't \
|
||||||
actually a \
|
actually a \
|
||||||
trait?!");
|
trait?!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
tcx.sess.span_bug(span, ~"trait wasn't an \
|
tcx.sess.span_bug(span, "trait wasn't an \
|
||||||
item?!");
|
item?!");
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
tcx.sess.span_bug(span, ~"trait item wasn't \
|
tcx.sess.span_bug(span, "trait item wasn't \
|
||||||
found in the AST \
|
found in the AST \
|
||||||
map?!");
|
map?!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -465,8 +465,8 @@ pub fn check_crate(tcx: ty::ctxt,
|
|||||||
match method_map.find(&expr.id) {
|
match method_map.find(&expr.id) {
|
||||||
None => {
|
None => {
|
||||||
tcx.sess.span_bug(expr.span,
|
tcx.sess.span_bug(expr.span,
|
||||||
~"method call not in \
|
"method call not in \
|
||||||
method map");
|
method map");
|
||||||
}
|
}
|
||||||
Some(ref entry) => {
|
Some(ref entry) => {
|
||||||
debug!("(privacy checking) checking \
|
debug!("(privacy checking) checking \
|
||||||
@ -512,18 +512,18 @@ pub fn check_crate(tcx: ty::ctxt,
|
|||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_bug(expr.span,
|
tcx.sess.span_bug(expr.span,
|
||||||
~"resolve didn't \
|
"resolve didn't \
|
||||||
map enum struct \
|
map enum struct \
|
||||||
constructor to a \
|
constructor to a \
|
||||||
variant def");
|
variant def");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_bug(expr.span, ~"struct expr \
|
tcx.sess.span_bug(expr.span, "struct expr \
|
||||||
didn't have \
|
didn't have \
|
||||||
struct type?!");
|
struct type?!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -579,18 +579,18 @@ pub fn check_crate(tcx: ty::ctxt,
|
|||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_bug(pattern.span,
|
tcx.sess.span_bug(pattern.span,
|
||||||
~"resolve didn't \
|
"resolve didn't \
|
||||||
map enum struct \
|
map enum struct \
|
||||||
pattern to a \
|
pattern to a \
|
||||||
variant def");
|
variant def");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_bug(pattern.span,
|
tcx.sess.span_bug(pattern.span,
|
||||||
~"struct pattern didn't have \
|
"struct pattern didn't have \
|
||||||
struct type?!");
|
struct type?!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ pub impl RegionMaps {
|
|||||||
pub fn parent_id(cx: ctxt, span: span) -> ast::node_id {
|
pub fn parent_id(cx: ctxt, span: span) -> ast::node_id {
|
||||||
match cx.parent {
|
match cx.parent {
|
||||||
None => {
|
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) => {
|
Some(parent_id) => {
|
||||||
parent_id
|
parent_id
|
||||||
|
@ -3261,7 +3261,7 @@ pub fn expr_kind(tcx: ctxt,
|
|||||||
ast::expr_mac(*) => {
|
ast::expr_mac(*) => {
|
||||||
tcx.sess.span_bug(
|
tcx.sess.span_bug(
|
||||||
expr.span,
|
expr.span,
|
||||||
~"macro expression remains after expansion");
|
"macro expression remains after expansion");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4242,27 +4242,27 @@ pub fn eval_repeat_count(tcx: ctxt, count_expr: @ast::expr) -> uint {
|
|||||||
const_eval::const_uint(count) => return count as uint,
|
const_eval::const_uint(count) => return count as uint,
|
||||||
const_eval::const_float(count) => {
|
const_eval::const_float(count) => {
|
||||||
tcx.sess.span_err(count_expr.span,
|
tcx.sess.span_err(count_expr.span,
|
||||||
~"expected signed or unsigned integer for \
|
"expected signed or unsigned integer for \
|
||||||
repeat count but found float");
|
repeat count but found float");
|
||||||
return count as uint;
|
return count as uint;
|
||||||
}
|
}
|
||||||
const_eval::const_str(_) => {
|
const_eval::const_str(_) => {
|
||||||
tcx.sess.span_err(count_expr.span,
|
tcx.sess.span_err(count_expr.span,
|
||||||
~"expected signed or unsigned integer for \
|
"expected signed or unsigned integer for \
|
||||||
repeat count but found string");
|
repeat count but found string");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const_eval::const_bool(_) => {
|
const_eval::const_bool(_) => {
|
||||||
tcx.sess.span_err(count_expr.span,
|
tcx.sess.span_err(count_expr.span,
|
||||||
~"expected signed or unsigned integer for \
|
"expected signed or unsigned integer for \
|
||||||
repeat count but found boolean");
|
repeat count but found boolean");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(*) => {
|
Err(*) => {
|
||||||
tcx.sess.span_err(count_expr.span,
|
tcx.sess.span_err(count_expr.span,
|
||||||
~"expected constant integer for repeat count \
|
"expected constant integer for repeat count \
|
||||||
but found variable");
|
but found variable");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user