Skip to content

Use adjustments table for allocation lint #6703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libextra/bitv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ pub impl Bitv {
*/
fn to_str(&self) -> ~str {
let mut rs = ~"";
for self.each() |i| { if i { rs += ~"1"; } else { rs += ~"0"; } };
for self.each() |i| { if i { rs += "1"; } else { rs += "0"; } };
rs
}

Expand Down
18 changes: 9 additions & 9 deletions src/libextra/getopts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,19 +193,19 @@ pub enum Fail_ {
pub fn fail_str(f: Fail_) -> ~str {
return match f {
ArgumentMissing(ref nm) => {
~"Argument to option '" + *nm + ~"' missing."
~"Argument to option '" + *nm + "' missing."
}
UnrecognizedOption(ref nm) => {
~"Unrecognized option: '" + *nm + ~"'."
~"Unrecognized option: '" + *nm + "'."
}
OptionMissing(ref nm) => {
~"Required option '" + *nm + ~"' missing."
~"Required option '" + *nm + "' missing."
}
OptionDuplicated(ref nm) => {
~"Option '" + *nm + ~"' given more than once."
~"Option '" + *nm + "' given more than once."
}
UnexpectedArgument(ref nm) => {
~"Option " + *nm + ~" does not take an argument."
~"Option " + *nm + " does not take an argument."
}
};
}
Expand Down Expand Up @@ -618,7 +618,7 @@ pub mod groups {
row += match hasarg {
No => ~"",
Yes => hint,
Maybe => ~"[" + hint + ~"]",
Maybe => ~"[" + hint + "]",
};

// FIXME: #5516
Expand Down Expand Up @@ -650,10 +650,10 @@ pub mod groups {
row
});

return str::to_owned(brief) +
~"\n\nOptions:\n" +
return str::to_owned(brief) +
"\n\nOptions:\n" +
str::connect(rows, "\n") +
~"\n\n";
"\n\n";
}
} // end groups module

Expand Down
16 changes: 8 additions & 8 deletions src/libextra/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ fn escape_str(s: &str) -> ~str {
let mut escaped = ~"\"";
for str::each_char(s) |c| {
match c {
'"' => escaped += ~"\\\"",
'\\' => escaped += ~"\\\\",
'\x08' => escaped += ~"\\b",
'\x0c' => escaped += ~"\\f",
'\n' => escaped += ~"\\n",
'\r' => escaped += ~"\\r",
'\t' => escaped += ~"\\t",
'"' => escaped += "\\\"",
'\\' => escaped += "\\\\",
'\x08' => escaped += "\\b",
'\x0c' => escaped += "\\f",
'\n' => escaped += "\\n",
'\r' => escaped += "\\r",
'\t' => escaped += "\\t",
_ => escaped += str::from_char(c)
}
};

escaped += ~"\"";
escaped += "\"";

escaped
}
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/md4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub fn md4_str(msg: &[u8]) -> ~str {
let mut i = 0u32;
while i < 4u32 {
let byte = (u >> (i * 8u32)) as u8;
if byte <= 16u8 { result += ~"0"; }
if byte <= 16u8 { result += "0"; }
result += uint::to_str_radix(byte as uint, 16u);
i += 1u32;
}
Expand Down
40 changes: 20 additions & 20 deletions src/librustc/back/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,42 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
data_layout: match target_os {
session::os_macos => {
~"e-p:32:32:32" +
~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
~"-f32:32:32-f64:64:64" +
~"-v64:64:64-v128:64:128" +
~"-a0:0:64-n32"
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
"-v64:64:64-v128:64:128" +
"-a0:0:64-n32"
}

session::os_win32 => {
~"e-p:32:32:32" +
~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
~"-f32:32:32-f64:64:64" +
~"-v64:64:64-v128:64:128" +
~"-a0:0:64-n32"
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
"-v64:64:64-v128:64:128" +
"-a0:0:64-n32"
}

session::os_linux => {
~"e-p:32:32:32" +
~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
~"-f32:32:32-f64:64:64" +
~"-v64:64:64-v128:64:128" +
~"-a0:0:64-n32"
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
"-v64:64:64-v128:64:128" +
"-a0:0:64-n32"
}

session::os_android => {
~"e-p:32:32:32" +
~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
~"-f32:32:32-f64:64:64" +
~"-v64:64:64-v128:64:128" +
~"-a0:0:64-n32"
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
"-v64:64:64-v128:64:128" +
"-a0:0:64-n32"
}

session::os_freebsd => {
~"e-p:32:32:32" +
~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
~"-f32:32:32-f64:64:64" +
~"-v64:64:64-v128:64:128" +
~"-a0:0:64-n32"
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
"-v64:64:64-v128:64:128" +
"-a0:0:64-n32"
}
},

Expand Down
16 changes: 8 additions & 8 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn llvm_err(sess: Session, msg: ~str) -> ! {
if cstr == ptr::null() {
sess.fatal(msg);
} else {
sess.fatal(msg + ~": " + str::raw::from_c_str(cstr));
sess.fatal(msg + ": " + str::raw::from_c_str(cstr));
}
}
}
Expand Down Expand Up @@ -653,13 +653,13 @@ pub fn sanitize(s: &str) -> ~str {
let mut result = ~"";
for str::each_char(s) |c| {
match c {
'@' => result += ~"_sbox_",
'~' => result += ~"_ubox_",
'*' => result += ~"_ptr_",
'&' => result += ~"_ref_",
',' => result += ~"_",
'@' => result += "_sbox_",
'~' => result += "_ubox_",
'*' => result += "_ptr_",
'&' => result += "_ref_",
',' => result += "_",

'{' | '(' => result += ~"_of_",
'{' | '(' => result += "_of_",
'a' .. 'z'
| 'A' .. 'Z'
| '0' .. '9'
Expand Down Expand Up @@ -693,7 +693,7 @@ pub fn mangle(sess: Session, ss: path) -> ~str {
n += fmt!("%u%s", str::len(sani), sani);
} }
}
n += ~"E"; // End name-sequence.
n += "E"; // End name-sequence.
n
}

Expand Down
40 changes: 20 additions & 20 deletions src/librustc/back/mips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,42 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
data_layout: match target_os {
session::os_macos => {
~"e-p:32:32:32" +
~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
~"-f32:32:32-f64:64:64" +
~"-v64:64:64-v128:64:128" +
~"-a0:0:64-n32"
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
"-v64:64:64-v128:64:128" +
"-a0:0:64-n32"
}

session::os_win32 => {
~"e-p:32:32:32" +
~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
~"-f32:32:32-f64:64:64" +
~"-v64:64:64-v128:64:128" +
~"-a0:0:64-n32"
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
"-v64:64:64-v128:64:128" +
"-a0:0:64-n32"
}

session::os_linux => {
~"e-p:32:32:32" +
~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
~"-f32:32:32-f64:64:64" +
~"-v64:64:64-v128:64:128" +
~"-a0:0:64-n32"
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
"-v64:64:64-v128:64:128" +
"-a0:0:64-n32"
}

session::os_android => {
~"e-p:32:32:32" +
~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
~"-f32:32:32-f64:64:64" +
~"-v64:64:64-v128:64:128" +
~"-a0:0:64-n32"
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
"-v64:64:64-v128:64:128" +
"-a0:0:64-n32"
}

session::os_freebsd => {
~"e-p:32:32:32" +
~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
~"-f32:32:32-f64:64:64" +
~"-v64:64:64-v128:64:128" +
~"-a0:0:64-n32"
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
"-v64:64:64-v128:64:128" +
"-a0:0:64-n32"
}
},

Expand Down
6 changes: 3 additions & 3 deletions src/librustc/back/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
data_layout: match target_os {
session::os_macos => {
~"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16" +
~"-i32:32:32-i64:32:64" +
~"-f32:32:32-f64:32:64-v64:64:64" +
~"-v128:128:128-a0:0:64-f80:128:128" + ~"-n8:16:32"
"-i32:32:32-i64:32:64" +
"-f32:32:32-f64:32:64-v64:64:64" +
"-v128:128:128-a0:0:64-f80:128:128" + "-n8:16:32"
}

session::os_win32 => {
Expand Down
20 changes: 10 additions & 10 deletions src/librustc/back/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,32 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
data_layout: match target_os {
session::os_macos => {
~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+
~"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
~"s0:64:64-f80:128:128-n8:16:32:64"
"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
"s0:64:64-f80:128:128-n8:16:32:64"
}

session::os_win32 => {
// FIXME: Test this. Copied from linux (#2398)
~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+
~"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
~"s0:64:64-f80:128:128-n8:16:32:64-S128"
"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
"s0:64:64-f80:128:128-n8:16:32:64-S128"
}

session::os_linux => {
~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+
~"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
~"s0:64:64-f80:128:128-n8:16:32:64-S128"
"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
"s0:64:64-f80:128:128-n8:16:32:64-S128"
}
session::os_android => {
~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+
~"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
~"s0:64:64-f80:128:128-n8:16:32:64-S128"
"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
"s0:64:64-f80:128:128-n8:16:32:64-S128"
}

session::os_freebsd => {
~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+
~"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
~"s0:64:64-f80:128:128-n8:16:32:64-S128"
"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
"s0:64:64-f80:128:128-n8:16:32:64-S128"
}
},

Expand Down
6 changes: 3 additions & 3 deletions src/librustc/metadata/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ fn visit_item(e: @mut Env, i: @ast::item) {
if *nn == ~"" {
e.diag.span_fatal(
i.span,
~"empty #[link_name] not allowed; use " +
~"#[nolink].");
"empty #[link_name] not allowed; use \
#[nolink].");
}
nn
}
Expand All @@ -183,7 +183,7 @@ fn visit_item(e: @mut Env, i: @ast::item) {
}
if !link_args.is_empty() && already_added {
e.diag.span_fatal(i.span, ~"library '" + *foreign_name +
~"' already added: can't specify link_args.");
"' already added: can't specify link_args.");
}
}
ast::anonymous => { /* do nothing */ }
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ pub fn _each_path(intr: @ident_interner,
if path_is_empty {
reexport_path = reexport_name;
} else {
reexport_path = path + ~"::" + reexport_name;
reexport_path = path + "::" + reexport_name;
}

// This reexport may be in yet another crate
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ fn encode_info_for_item(ecx: @EncodeContext,

// >:-<
let mut impl_path = vec::append(~[], path);
impl_path += ~[ast_map::path_name(item.ident)];
impl_path += [ast_map::path_name(item.ident)];

for methods.each |m| {
index.push(entry {val: m.id, pos: ebml_w.writer.tell()});
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/metadata/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fn find_library_crate_aux(
filesearch: @filesearch::FileSearch
) -> Option<(~str, @~[u8])> {
let crate_name = crate_name_from_metas(cx.metas);
let prefix: ~str = prefix + *crate_name + ~"-";
let prefix: ~str = prefix + *crate_name + "-";
let suffix: ~str = /*bad*/copy suffix;

let mut matches = ~[];
Expand Down Expand Up @@ -262,7 +262,7 @@ pub fn list_file_metadata(intr: @ident_interner,
option::Some(bytes) => decoder::list_crate_metadata(intr, bytes, out),
option::None => {
out.write_str(~"could not find metadata in "
+ path.to_str() + ~".\n");
+ path.to_str() + ".\n");
}
}
}
4 changes: 2 additions & 2 deletions src/librustc/metadata/tyencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ pub fn enc_ty(w: @io::Writer, cx: @ctxt, t: ty::t) {
let abbrev_len = 3u + estimate_sz(pos) + estimate_sz(len);
if abbrev_len < len {
// I.e. it's actually an abbreviation.
let s = ~"#" + uint::to_str_radix(pos, 16u) + ~":" +
uint::to_str_radix(len, 16u) + ~"#";
let s = ~"#" + uint::to_str_radix(pos, 16u) + ":" +
uint::to_str_radix(len, 16u) + "#";
let a = ty_abbrev { pos: pos, len: len, s: @s };
abbrevs.insert(t, a);
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/check_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub fn check_expr(sess: Session,
if !ty::type_is_numeric(ety) && !ty::type_is_unsafe_ptr(ety) {
sess.span_err(e.span, ~"can not cast to `" +
ppaux::ty_to_str(tcx, ety) +
~"` in a constant expression");
"` in a constant expression");
}
}
expr_path(pth) => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub fn check_exhaustive(cx: @MatchCheckCtxt, sp: span, pats: ~[@pat]) {
}
};
let msg = ~"non-exhaustive patterns" + match ext {
Some(ref s) => ~": " + **s + ~" not covered",
Some(ref s) => ~": " + **s + " not covered",
None => ~""
};
cx.tcx.sess.span_err(sp, msg);
Expand Down
Loading