auto merge of #8162 : thestinger/rust/no-copy, r=brson

This commit is contained in:
bors 2013-07-31 22:52:31 -07:00
commit 8ec70ae5de
33 changed files with 242 additions and 285 deletions

View file

@ -65,7 +65,7 @@ pub trait DigestUtil {
* *
* * in The string to feed into the digest * * in The string to feed into the digest
*/ */
fn input_str(&mut self, in: &str); fn input_str(&mut self, input: &str);
/** /**
* Convenience functon that retrieves the result of a digest as a * Convenience functon that retrieves the result of a digest as a
@ -75,8 +75,8 @@ pub trait DigestUtil {
} }
impl<D: Digest> DigestUtil for D { impl<D: Digest> DigestUtil for D {
fn input_str(&mut self, in: &str) { fn input_str(&mut self, input: &str) {
self.input(in.as_bytes()); self.input(input.as_bytes());
} }
fn result_str(&mut self) -> ~str { fn result_str(&mut self) -> ~str {

View file

@ -66,34 +66,34 @@ struct Engine512 {
} }
// Convert a [u8] to a u64 in big-endian format // Convert a [u8] to a u64 in big-endian format
fn to_u64(in: &[u8]) -> u64 { fn to_u64(input: &[u8]) -> u64 {
(in[0] as u64) << 56 | (input[0] as u64) << 56 |
(in[1] as u64) << 48 | (input[1] as u64) << 48 |
(in[2] as u64) << 40 | (input[2] as u64) << 40 |
(in[3] as u64) << 32 | (input[3] as u64) << 32 |
(in[4] as u64) << 24 | (input[4] as u64) << 24 |
(in[5] as u64) << 16 | (input[5] as u64) << 16 |
(in[6] as u64) << 8 | (input[6] as u64) << 8 |
(in[7] as u64) (input[7] as u64)
} }
// Convert a u64 to a [u8] in big endian format // Convert a u64 to a [u8] in big endian format
fn from_u64(in: u64, out: &mut [u8]) { fn from_u64(input: u64, out: &mut [u8]) {
out[0] = (in >> 56) as u8; out[0] = (input >> 56) as u8;
out[1] = (in >> 48) as u8; out[1] = (input >> 48) as u8;
out[2] = (in >> 40) as u8; out[2] = (input >> 40) as u8;
out[3] = (in >> 32) as u8; out[3] = (input >> 32) as u8;
out[4] = (in >> 24) as u8; out[4] = (input >> 24) as u8;
out[5] = (in >> 16) as u8; out[5] = (input >> 16) as u8;
out[6] = (in >> 8) as u8; out[6] = (input >> 8) as u8;
out[7] = in as u8; out[7] = input as u8;
} }
impl Engine512 { impl Engine512 {
fn input_byte(&mut self, in: u8) { fn input_byte(&mut self, input: u8) {
assert!(!self.finished) assert!(!self.finished)
self.input_buffer[self.input_buffer_idx] = in; self.input_buffer[self.input_buffer_idx] = input;
self.input_buffer_idx += 1; self.input_buffer_idx += 1;
if (self.input_buffer_idx == 8) { if (self.input_buffer_idx == 8) {
@ -105,25 +105,25 @@ impl Engine512 {
self.bit_counter.add_bytes(1); self.bit_counter.add_bytes(1);
} }
fn input_vec(&mut self, in: &[u8]) { fn input_vec(&mut self, input: &[u8]) {
assert!(!self.finished) assert!(!self.finished)
let mut i = 0; let mut i = 0;
while i < in.len() && self.input_buffer_idx != 0 { while i < input.len() && self.input_buffer_idx != 0 {
self.input_byte(in[i]); self.input_byte(input[i]);
i += 1; i += 1;
} }
while in.len() - i >= 8 { while input.len() - i >= 8 {
let w = to_u64(in.slice(i, i + 8)); let w = to_u64(input.slice(i, i + 8));
self.process_word(w); self.process_word(w);
self.bit_counter.add_bytes(8); self.bit_counter.add_bytes(8);
i += 8; i += 8;
} }
while i < in.len() { while i < input.len() {
self.input_byte(in[i]); self.input_byte(input[i]);
i += 1; i += 1;
} }
} }
@ -135,8 +135,8 @@ impl Engine512 {
self.W_idx = 0; self.W_idx = 0;
} }
fn process_word(&mut self, in: u64) { fn process_word(&mut self, input: u64) {
self.W[self.W_idx] = in; self.W[self.W_idx] = input;
self.W_idx += 1; self.W_idx += 1;
if (self.W_idx == 16) { if (self.W_idx == 16) {
self.W_idx = 0; self.W_idx = 0;
@ -356,26 +356,26 @@ struct Engine256 {
} }
// Convert a [u8] to a u32 in big endian format // Convert a [u8] to a u32 in big endian format
fn to_u32(in: &[u8]) -> u32 { fn to_u32(input: &[u8]) -> u32 {
(in[0] as u32) << 24 | (input[0] as u32) << 24 |
(in[1] as u32) << 16 | (input[1] as u32) << 16 |
(in[2] as u32) << 8 | (input[2] as u32) << 8 |
(in[3] as u32) (input[3] as u32)
} }
// Convert a u32 to a [u8] in big endian format // Convert a u32 to a [u8] in big endian format
fn from_u32(in: u32, out: &mut [u8]) { fn from_u32(input: u32, out: &mut [u8]) {
out[0] = (in >> 24) as u8; out[0] = (input >> 24) as u8;
out[1] = (in >> 16) as u8; out[1] = (input >> 16) as u8;
out[2] = (in >> 8) as u8; out[2] = (input >> 8) as u8;
out[3] = in as u8; out[3] = input as u8;
} }
impl Engine256 { impl Engine256 {
fn input_byte(&mut self, in: u8) { fn input_byte(&mut self, input: u8) {
assert!(!self.finished) assert!(!self.finished)
self.input_buffer[self.input_buffer_idx] = in; self.input_buffer[self.input_buffer_idx] = input;
self.input_buffer_idx += 1; self.input_buffer_idx += 1;
if (self.input_buffer_idx == 4) { if (self.input_buffer_idx == 4) {
@ -387,25 +387,25 @@ impl Engine256 {
self.length_bytes += 1; self.length_bytes += 1;
} }
fn input_vec(&mut self, in: &[u8]) { fn input_vec(&mut self, input: &[u8]) {
assert!(!self.finished) assert!(!self.finished)
let mut i = 0; let mut i = 0;
while i < in.len() && self.input_buffer_idx != 0 { while i < input.len() && self.input_buffer_idx != 0 {
self.input_byte(in[i]); self.input_byte(input[i]);
i += 1; i += 1;
} }
while in.len() - i >= 4 { while input.len() - i >= 4 {
let w = to_u32(in.slice(i, i + 4)); let w = to_u32(input.slice(i, i + 4));
self.process_word(w); self.process_word(w);
self.length_bytes += 4; self.length_bytes += 4;
i += 4; i += 4;
} }
while i < in.len() { while i < input.len() {
self.input_byte(in[i]); self.input_byte(input[i]);
i += 1; i += 1;
} }
@ -418,8 +418,8 @@ impl Engine256 {
self.W_idx = 0; self.W_idx = 0;
} }
fn process_word(&mut self, in: u32) { fn process_word(&mut self, input: u32) {
self.W[self.W_idx] = in; self.W[self.W_idx] = input;
self.W_idx += 1; self.W_idx += 1;
if (self.W_idx == 16) { if (self.W_idx == 16) {
self.W_idx = 0; self.W_idx = 0;

View file

@ -72,10 +72,10 @@ input, skips the current file and then numbers the remaining lines
(where the numbers are from the start of each file, rather than the (where the numbers are from the start of each file, rather than the
total line count). total line count).
let in = FileInput::from_vec(pathify([~"a.txt", ~"b.txt", ~"c.txt"], let input = FileInput::from_vec(pathify([~"a.txt", ~"b.txt", ~"c.txt"],
true)); true));
for in.each_line |line| { for input.each_line |line| {
if line.is_empty() { if line.is_empty() {
break break
} }
@ -85,9 +85,9 @@ total line count).
io::println("Continue?"); io::println("Continue?");
if io::stdin().read_line() == ~"yes" { if io::stdin().read_line() == ~"yes" {
in.next_file(); // skip! input.next_file(); // skip!
for in.each_line_state |line, state| { for input.each_line_state |line, state| {
io::println(fmt!("%u: %s", state.line_num_file, io::println(fmt!("%u: %s", state.line_num_file,
line)) line))
} }
@ -589,29 +589,29 @@ mod test {
make_file(filename.get_ref(), contents); make_file(filename.get_ref(), contents);
} }
let in = FileInput::from_vec(filenames); let input = FileInput::from_vec(filenames);
// read once from 0 // read once from 0
assert_eq!(in.read_line(), ~"0 1"); assert_eq!(input.read_line(), ~"0 1");
in.next_file(); // skip the rest of 1 input.next_file(); // skip the rest of 1
// read all lines from 1 (but don't read any from 2), // read all lines from 1 (but don't read any from 2),
for uint::range(1, 4) |i| { for uint::range(1, 4) |i| {
assert_eq!(in.read_line(), fmt!("1 %u", i)); assert_eq!(input.read_line(), fmt!("1 %u", i));
} }
// 1 is finished, but 2 hasn't been started yet, so this will // 1 is finished, but 2 hasn't been started yet, so this will
// just "skip" to the beginning of 2 (Python's fileinput does // just "skip" to the beginning of 2 (Python's fileinput does
// the same) // the same)
in.next_file(); input.next_file();
assert_eq!(in.read_line(), ~"2 1"); assert_eq!(input.read_line(), ~"2 1");
} }
#[test] #[test]
#[should_fail] #[should_fail]
fn test_input_vec_missing_file() { fn test_input_vec_missing_file() {
for input_vec(pathify([~"this/file/doesnt/exist"], true)) |line| { for input_vec(pathify([~"this/file/doesnt/exist"], true)) |line| {
io::println(line); println(line);
} }
} }
} }

View file

@ -95,18 +95,18 @@ mod tests {
words.push(r.gen_bytes(range)); words.push(r.gen_bytes(range));
} }
for 20.times { for 20.times {
let mut in = ~[]; let mut input = ~[];
for 2000.times { for 2000.times {
in.push_all(r.choose(words)); input.push_all(r.choose(words));
} }
debug!("de/inflate of %u bytes of random word-sequences", debug!("de/inflate of %u bytes of random word-sequences",
in.len()); input.len());
let cmp = deflate_bytes(in); let cmp = deflate_bytes(input);
let out = inflate_bytes(cmp); let out = inflate_bytes(cmp);
debug!("%u bytes deflated to %u (%.1f%% size)", debug!("%u bytes deflated to %u (%.1f%% size)",
in.len(), cmp.len(), input.len(), cmp.len(),
100.0 * ((cmp.len() as float) / (in.len() as float))); 100.0 * ((cmp.len() as float) / (input.len() as float)));
assert_eq!(in, out); assert_eq!(input, out);
} }
} }
} }

View file

@ -221,7 +221,7 @@ pub fn parse(s: &str) -> Option<Version> {
} }
let s = s.trim(); let s = s.trim();
let mut bad = false; let mut bad = false;
do bad_parse::cond.trap(|_| { debug!("bad"); bad = true }).in { do bad_parse::cond.trap(|_| { debug!("bad"); bad = true }).inside {
do io::with_str_reader(s) |rdr| { do io::with_str_reader(s) |rdr| {
let v = parse_reader(rdr); let v = parse_reader(rdr);
if bad || v.to_str() != s.to_owned() { if bad || v.to_str() != s.to_owned() {

View file

@ -407,7 +407,7 @@ fn get_authority(rawurl: &str) ->
let len = rawurl.len(); let len = rawurl.len();
let mut st = Start; let mut st = Start;
let mut in = Digit; // most restricted, start here. let mut input = Digit; // most restricted, start here.
let mut userinfo = None; let mut userinfo = None;
let mut host = ~""; let mut host = ~"";
@ -425,13 +425,13 @@ fn get_authority(rawurl: &str) ->
match c { match c {
'0' .. '9' => (), '0' .. '9' => (),
'A' .. 'F' | 'a' .. 'f' => { 'A' .. 'F' | 'a' .. 'f' => {
if in == Digit { if input == Digit {
in = Hex; input = Hex;
} }
} }
'G' .. 'Z' | 'g' .. 'z' | '-' | '.' | '_' | '~' | '%' | 'G' .. 'Z' | 'g' .. 'z' | '-' | '.' | '_' | '~' | '%' |
'&' |'\'' | '(' | ')' | '+' | '!' | '*' | ',' | ';' | '=' => { '&' |'\'' | '(' | ')' | '+' | '!' | '*' | ',' | ';' | '=' => {
in = Unreserved; input = Unreserved;
} }
':' | '@' | '?' | '#' | '/' => { ':' | '@' | '?' | '#' | '/' => {
// separators, don't change anything // separators, don't change anything
@ -452,7 +452,7 @@ fn get_authority(rawurl: &str) ->
} }
PassHostPort => { PassHostPort => {
// multiple colons means ipv6 address. // multiple colons means ipv6 address.
if in == Unreserved { if input == Unreserved {
return Err( return Err(
~"Illegal characters in IPv6 address."); ~"Illegal characters in IPv6 address.");
} }
@ -461,13 +461,13 @@ fn get_authority(rawurl: &str) ->
InHost => { InHost => {
pos = i; pos = i;
// can't be sure whether this is an ipv6 address or a port // can't be sure whether this is an ipv6 address or a port
if in == Unreserved { if input == Unreserved {
return Err(~"Illegal characters in authority."); return Err(~"Illegal characters in authority.");
} }
st = Ip6Port; st = Ip6Port;
} }
Ip6Port => { Ip6Port => {
if in == Unreserved { if input == Unreserved {
return Err(~"Illegal characters in authority."); return Err(~"Illegal characters in authority.");
} }
st = Ip6Host; st = Ip6Host;
@ -483,11 +483,11 @@ fn get_authority(rawurl: &str) ->
return Err(~"Invalid ':' in authority."); return Err(~"Invalid ':' in authority.");
} }
} }
in = Digit; // reset input class input = Digit; // reset input class
} }
'@' => { '@' => {
in = Digit; // reset input class input = Digit; // reset input class
colon_count = 0; // reset count colon_count = 0; // reset count
match st { match st {
Start => { Start => {
@ -535,7 +535,7 @@ fn get_authority(rawurl: &str) ->
} }
} }
PassHostPort | Ip6Port => { PassHostPort | Ip6Port => {
if in != Digit { if input != Digit {
return Err(~"Non-digit characters in port."); return Err(~"Non-digit characters in port.");
} }
host = rawurl.slice(begin, pos).to_owned(); host = rawurl.slice(begin, pos).to_owned();
@ -545,7 +545,7 @@ fn get_authority(rawurl: &str) ->
host = rawurl.slice(begin, end).to_owned(); host = rawurl.slice(begin, end).to_owned();
} }
InPort => { InPort => {
if in != Digit { if input != Digit {
return Err(~"Non-digit characters in port."); return Err(~"Non-digit characters in port.");
} }
port = Some(rawurl.slice(pos+1, end).to_owned()); port = Some(rawurl.slice(pos+1, end).to_owned());

View file

@ -706,8 +706,8 @@ fn check_item_ctypes(cx: &Context, it: &ast::item) {
} }
fn check_foreign_fn(cx: &Context, decl: &ast::fn_decl) { fn check_foreign_fn(cx: &Context, decl: &ast::fn_decl) {
for decl.inputs.iter().advance |in| { for decl.inputs.iter().advance |input| {
check_ty(cx, &in.ty); check_ty(cx, &input.ty);
} }
check_ty(cx, &decl.output) check_ty(cx, &decl.output)
} }

View file

@ -1461,8 +1461,8 @@ fn check_expr(expr: @expr, (this, vt): (@Liveness, vt<@Liveness>)) {
} }
expr_inline_asm(ref ia) => { expr_inline_asm(ref ia) => {
for ia.inputs.iter().advance |&(_, in)| { for ia.inputs.iter().advance |&(_, input)| {
(vt.visit_expr)(in, (this, vt)); (vt.visit_expr)(input, (this, vt));
} }
// Output operands must be lvalues // Output operands must be lvalues

View file

@ -68,14 +68,14 @@ pub fn trans_inline_asm(bcx: @mut Block, ia: &ast::inline_asm) -> @mut Block {
cleanups.clear(); cleanups.clear();
// Now the input operands // Now the input operands
let inputs = do ia.inputs.map |&(c, in)| { let inputs = do ia.inputs.map |&(c, input)| {
constraints.push(c); constraints.push(c);
unpack_result!(bcx, { unpack_result!(bcx, {
callee::trans_arg_expr(bcx, callee::trans_arg_expr(bcx,
expr_ty(bcx, in), expr_ty(bcx, input),
ty::ByCopy, ty::ByCopy,
in, input,
&mut cleanups, &mut cleanups,
None, None,
callee::DontAutorefArg) callee::DontAutorefArg)

View file

@ -388,8 +388,8 @@ pub fn mark_for_expr(cx: &Context, e: &expr) {
} }
expr_inline_asm(ref ia) => { expr_inline_asm(ref ia) => {
for ia.inputs.iter().advance |&(_, in)| { for ia.inputs.iter().advance |&(_, input)| {
node_type_needs(cx, use_repr, in.id); node_type_needs(cx, use_repr, input.id);
} }
for ia.outputs.iter().advance |&(_, out)| { for ia.outputs.iter().advance |&(_, out)| {
node_type_needs(cx, use_repr, out.id); node_type_needs(cx, use_repr, out.id);

View file

@ -2478,8 +2478,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
fcx.write_ty(id, ty_param_bounds_and_ty.ty); fcx.write_ty(id, ty_param_bounds_and_ty.ty);
} }
ast::expr_inline_asm(ref ia) => { ast::expr_inline_asm(ref ia) => {
for ia.inputs.iter().advance |&(_, in)| { for ia.inputs.iter().advance |&(_, input)| {
check_expr(fcx, in); check_expr(fcx, input);
} }
for ia.outputs.iter().advance |&(_, out)| { for ia.outputs.iter().advance |&(_, out)| {
check_expr(fcx, out); check_expr(fcx, out);

View file

@ -447,7 +447,7 @@ fn run_cmd(repl: &mut Repl, _in: @io::Reader, _out: @io::Writer,
/// Executes a line of input, which may either be rust code or a /// Executes a line of input, which may either be rust code or a
/// :command. Returns a new Repl if it has changed. /// :command. Returns a new Repl if it has changed.
pub fn run_line(repl: &mut Repl, in: @io::Reader, out: @io::Writer, line: ~str, pub fn run_line(repl: &mut Repl, input: @io::Reader, out: @io::Writer, line: ~str,
use_rl: bool) -> bool use_rl: bool) -> bool
{ {
if line.starts_with(":") { if line.starts_with(":") {
@ -464,11 +464,11 @@ pub fn run_line(repl: &mut Repl, in: @io::Reader, out: @io::Writer, line: ~str,
split.slice(1, len).to_owned() split.slice(1, len).to_owned()
} else { ~[] }; } else { ~[] };
match run_cmd(repl, in, out, cmd, args, use_rl) { match run_cmd(repl, input, out, cmd, args, use_rl) {
action_none => { } action_none => { }
action_run_line(multiline_cmd) => { action_run_line(multiline_cmd) => {
if !multiline_cmd.is_empty() { if !multiline_cmd.is_empty() {
return run_line(repl, in, out, multiline_cmd, use_rl); return run_line(repl, input, out, multiline_cmd, use_rl);
} }
} }
} }
@ -500,7 +500,7 @@ pub fn run_line(repl: &mut Repl, in: @io::Reader, out: @io::Writer, line: ~str,
pub fn main() { pub fn main() {
let args = os::args(); let args = os::args();
let in = io::stdin(); let input = io::stdin();
let out = io::stdout(); let out = io::stdout();
let mut repl = Repl { let mut repl = Repl {
prompt: ~"rusti> ", prompt: ~"rusti> ",
@ -542,7 +542,7 @@ pub fn main() {
} }
loop; loop;
} }
run_line(&mut repl, in, out, line, istty); run_line(&mut repl, input, out, line, istty);
} }
} }
} }

View file

@ -485,11 +485,11 @@ fn test_install_invalid() {
let mut error1_occurred = false; let mut error1_occurred = false;
do cond1.trap(|_| { do cond1.trap(|_| {
error1_occurred = true; error1_occurred = true;
}).in { }).inside {
do cond.trap(|_| { do cond.trap(|_| {
error_occurred = true; error_occurred = true;
temp_workspace.clone() temp_workspace.clone()
}).in { }).inside {
ctxt.install(&temp_workspace, &pkgid); ctxt.install(&temp_workspace, &pkgid);
} }
} }
@ -573,7 +573,7 @@ fn test_package_ids_must_be_relative_path_like() {
assert!("" == p.to_str()); assert!("" == p.to_str());
assert!("0-length pkgid" == e); assert!("0-length pkgid" == e);
whatever.clone() whatever.clone()
}).in { }).inside {
let x = PkgId::new("", &os::getcwd()); let x = PkgId::new("", &os::getcwd());
assert_eq!(~"foo-0.1", x.to_str()); assert_eq!(~"foo-0.1", x.to_str());
} }
@ -582,7 +582,7 @@ fn test_package_ids_must_be_relative_path_like() {
assert_eq!(p.to_str(), os::make_absolute(&Path("foo/bar/quux")).to_str()); assert_eq!(p.to_str(), os::make_absolute(&Path("foo/bar/quux")).to_str());
assert!("absolute pkgid" == e); assert!("absolute pkgid" == e);
whatever.clone() whatever.clone()
}).in { }).inside {
let z = PkgId::new(os::make_absolute(&Path("foo/bar/quux")).to_str(), let z = PkgId::new(os::make_absolute(&Path("foo/bar/quux")).to_str(),
&os::getcwd()); &os::getcwd());
assert_eq!(~"foo-0.1", z.to_str()); assert_eq!(~"foo-0.1", z.to_str());

View file

@ -73,7 +73,7 @@ struct Trap<'self, T, U> {
} }
impl<'self, T, U> Trap<'self, T, U> { impl<'self, T, U> Trap<'self, T, U> {
pub fn in<V>(&self, inner: &'self fn() -> V) -> V { pub fn inside<V>(&self, inner: &'self fn() -> V) -> V {
let _g = Guard { cond: self.cond }; let _g = Guard { cond: self.cond };
debug!("Trap: pushing handler to TLS"); debug!("Trap: pushing handler to TLS");
local_data::set(self.cond.key, self.handler); local_data::set(self.cond.key, self.handler);
@ -119,7 +119,7 @@ mod test {
debug!("nested_trap_test_inner: in handler"); debug!("nested_trap_test_inner: in handler");
inner_trapped = true; inner_trapped = true;
0 0
}).in { }).inside {
debug!("nested_trap_test_inner: in protected block"); debug!("nested_trap_test_inner: in protected block");
trouble(1); trouble(1);
} }
@ -134,7 +134,7 @@ mod test {
do sadness::cond.trap(|_j| { do sadness::cond.trap(|_j| {
debug!("nested_trap_test_outer: in handler"); debug!("nested_trap_test_outer: in handler");
outer_trapped = true; 0 outer_trapped = true; 0
}).in { }).inside {
debug!("nested_guard_test_outer: in protected block"); debug!("nested_guard_test_outer: in protected block");
nested_trap_test_inner(); nested_trap_test_inner();
trouble(1); trouble(1);
@ -152,7 +152,7 @@ mod test {
let i = 10; let i = 10;
debug!("nested_reraise_trap_test_inner: handler re-raising"); debug!("nested_reraise_trap_test_inner: handler re-raising");
sadness::cond.raise(i) sadness::cond.raise(i)
}).in { }).inside {
debug!("nested_reraise_trap_test_inner: in protected block"); debug!("nested_reraise_trap_test_inner: in protected block");
trouble(1); trouble(1);
} }
@ -167,7 +167,7 @@ mod test {
do sadness::cond.trap(|_j| { do sadness::cond.trap(|_j| {
debug!("nested_reraise_trap_test_outer: in handler"); debug!("nested_reraise_trap_test_outer: in handler");
outer_trapped = true; 0 outer_trapped = true; 0
}).in { }).inside {
debug!("nested_reraise_trap_test_outer: in protected block"); debug!("nested_reraise_trap_test_outer: in protected block");
nested_reraise_trap_test_inner(); nested_reraise_trap_test_inner();
} }
@ -182,7 +182,7 @@ mod test {
do sadness::cond.trap(|j| { do sadness::cond.trap(|j| {
debug!("test_default: in handler"); debug!("test_default: in handler");
sadness::cond.raise_default(j, || { trapped=true; 5 }) sadness::cond.raise_default(j, || { trapped=true; 5 })
}).in { }).inside {
debug!("test_default: in protected block"); debug!("test_default: in protected block");
trouble(1); trouble(1);
} }
@ -205,7 +205,7 @@ mod test {
do sadness::cond.trap(|_| { do sadness::cond.trap(|_| {
trapped = true; trapped = true;
0 0
}).in { }).inside {
sadness::cond.raise(0); sadness::cond.raise(0);
} }
assert!(trapped); assert!(trapped);

View file

@ -389,17 +389,17 @@ pub fn fsync_fd(fd: c_int, _l: io::fsync::Level) -> c_int {
} }
pub struct Pipe { pub struct Pipe {
in: c_int, input: c_int,
out: c_int out: c_int
} }
#[cfg(unix)] #[cfg(unix)]
pub fn pipe() -> Pipe { pub fn pipe() -> Pipe {
unsafe { unsafe {
let mut fds = Pipe {in: 0 as c_int, let mut fds = Pipe {input: 0 as c_int,
out: 0 as c_int }; out: 0 as c_int };
assert_eq!(libc::pipe(&mut fds.in), (0 as c_int)); assert_eq!(libc::pipe(&mut fds.input), (0 as c_int));
return Pipe {in: fds.in, out: fds.out}; return Pipe {input: fds.input, out: fds.out};
} }
} }
@ -413,14 +413,14 @@ pub fn pipe() -> Pipe {
// fully understand. Here we explicitly make the pipe non-inheritable, // fully understand. Here we explicitly make the pipe non-inheritable,
// which means to pass it to a subprocess they need to be duplicated // which means to pass it to a subprocess they need to be duplicated
// first, as in core::run. // first, as in core::run.
let mut fds = Pipe {in: 0 as c_int, let mut fds = Pipe {input: 0 as c_int,
out: 0 as c_int }; out: 0 as c_int };
let res = libc::pipe(&mut fds.in, 1024 as ::libc::c_uint, let res = libc::pipe(&mut fds.input, 1024 as ::libc::c_uint,
(libc::O_BINARY | libc::O_NOINHERIT) as c_int); (libc::O_BINARY | libc::O_NOINHERIT) as c_int);
assert_eq!(res, 0 as c_int); assert_eq!(res, 0 as c_int);
assert!((fds.in != -1 as c_int && fds.in != 0 as c_int)); assert!((fds.input != -1 as c_int && fds.input != 0 as c_int));
assert!((fds.out != -1 as c_int && fds.in != 0 as c_int)); assert!((fds.out != -1 as c_int && fds.input != 0 as c_int));
return Pipe {in: fds.in, out: fds.out}; return Pipe {input: fds.input, out: fds.out};
} }
} }
@ -1931,11 +1931,11 @@ mod tests {
let tempdir = getcwd(); // would like to use $TMPDIR, let tempdir = getcwd(); // would like to use $TMPDIR,
// doesn't seem to work on Linux // doesn't seem to work on Linux
assert!((tempdir.to_str().len() > 0u)); assert!((tempdir.to_str().len() > 0u));
let in = tempdir.push("in.txt"); let input = tempdir.push("in.txt");
let out = tempdir.push("out.txt"); let out = tempdir.push("out.txt");
/* Write the temp input file */ /* Write the temp input file */
let ostream = do in.to_str().as_c_str |fromp| { let ostream = do input.to_str().as_c_str |fromp| {
do "w+b".as_c_str |modebuf| { do "w+b".as_c_str |modebuf| {
libc::fopen(fromp, modebuf) libc::fopen(fromp, modebuf)
} }
@ -1950,16 +1950,16 @@ mod tests {
len as size_t) len as size_t)
} }
assert_eq!(libc::fclose(ostream), (0u as c_int)); assert_eq!(libc::fclose(ostream), (0u as c_int));
let in_mode = in.get_mode(); let in_mode = input.get_mode();
let rs = os::copy_file(&in, &out); let rs = os::copy_file(&input, &out);
if (!os::path_exists(&in)) { if (!os::path_exists(&input)) {
fail!("%s doesn't exist", in.to_str()); fail!("%s doesn't exist", input.to_str());
} }
assert!((rs)); assert!((rs));
let rslt = run::process_status("diff", [in.to_str(), out.to_str()]); let rslt = run::process_status("diff", [input.to_str(), out.to_str()]);
assert_eq!(rslt, 0); assert_eq!(rslt, 0);
assert_eq!(out.get_mode(), in_mode); assert_eq!(out.get_mode(), in_mode);
assert!((remove_file(&in))); assert!((remove_file(&input)));
assert!((remove_file(&out))); assert!((remove_file(&out)));
} }
} }

View file

@ -330,7 +330,7 @@ impl<T: Reader> ReaderUtil for T {
} else { } else {
read_error::cond.raise(e) read_error::cond.raise(e)
} }
}).in { }).inside {
while keep_reading { while keep_reading {
self.push_bytes(&mut buf, DEFAULT_BUF_SIZE) self.push_bytes(&mut buf, DEFAULT_BUF_SIZE)
} }
@ -640,7 +640,7 @@ mod test {
None None
}; };
do read_error::cond.trap(|_| { do read_error::cond.trap(|_| {
}).in { }).inside {
let byte = reader.read_byte(); let byte = reader.read_byte();
assert!(byte == None); assert!(byte == None);
} }
@ -679,7 +679,7 @@ mod test {
fn read_bytes_eof() { fn read_bytes_eof() {
let mut reader = MemReader::new(~[10, 11]); let mut reader = MemReader::new(~[10, 11]);
do read_error::cond.trap(|_| { do read_error::cond.trap(|_| {
}).in { }).inside {
assert!(reader.read_bytes(4) == ~[10, 11]); assert!(reader.read_bytes(4) == ~[10, 11]);
} }
} }
@ -720,7 +720,7 @@ mod test {
let mut reader = MemReader::new(~[10, 11]); let mut reader = MemReader::new(~[10, 11]);
let mut buf = ~[8, 9]; let mut buf = ~[8, 9];
do read_error::cond.trap(|_| { do read_error::cond.trap(|_| {
}).in { }).inside {
reader.push_bytes(&mut buf, 4); reader.push_bytes(&mut buf, 4);
assert!(buf == ~[8, 9, 10, 11]); assert!(buf == ~[8, 9, 10, 11]);
} }
@ -743,7 +743,7 @@ mod test {
} }
}; };
let mut buf = ~[8, 9]; let mut buf = ~[8, 9];
do read_error::cond.trap(|_| { } ).in { do read_error::cond.trap(|_| { } ).inside {
reader.push_bytes(&mut buf, 4); reader.push_bytes(&mut buf, 4);
} }
assert!(buf == ~[8, 9, 10]); assert!(buf == ~[8, 9, 10]);

View file

@ -156,7 +156,7 @@ mod test {
do io_error::cond.trap(|e| { do io_error::cond.trap(|e| {
assert!(e.kind == PermissionDenied); assert!(e.kind == PermissionDenied);
called = true; called = true;
}).in { }).inside {
let addr = Ipv4(0, 0, 0, 0, 1); let addr = Ipv4(0, 0, 0, 0, 1);
let listener = TcpListener::bind(addr); let listener = TcpListener::bind(addr);
assert!(listener.is_none()); assert!(listener.is_none());
@ -172,7 +172,7 @@ mod test {
do io_error::cond.trap(|e| { do io_error::cond.trap(|e| {
assert!(e.kind == ConnectionRefused); assert!(e.kind == ConnectionRefused);
called = true; called = true;
}).in { }).inside {
let addr = Ipv4(0, 0, 0, 0, 1); let addr = Ipv4(0, 0, 0, 0, 1);
let stream = TcpStream::connect(addr); let stream = TcpStream::connect(addr);
assert!(stream.is_none()); assert!(stream.is_none());
@ -320,7 +320,7 @@ mod test {
// NB: ECONNRESET on linux, EPIPE on mac // NB: ECONNRESET on linux, EPIPE on mac
assert!(e.kind == ConnectionReset || e.kind == BrokenPipe); assert!(e.kind == ConnectionReset || e.kind == BrokenPipe);
stop = true; stop = true;
}).in { }).inside {
stream.write(buf); stream.write(buf);
} }
if stop { break } if stop { break }
@ -349,7 +349,7 @@ mod test {
// NB: ECONNRESET on linux, EPIPE on mac // NB: ECONNRESET on linux, EPIPE on mac
assert!(e.kind == ConnectionReset || e.kind == BrokenPipe); assert!(e.kind == ConnectionReset || e.kind == BrokenPipe);
stop = true; stop = true;
}).in { }).inside {
stream.write(buf); stream.write(buf);
} }
if stop { break } if stop { break }

View file

@ -117,7 +117,7 @@ mod test {
do io_error::cond.trap(|e| { do io_error::cond.trap(|e| {
assert!(e.kind == PermissionDenied); assert!(e.kind == PermissionDenied);
called = true; called = true;
}).in { }).inside {
let addr = Ipv4(0, 0, 0, 0, 1); let addr = Ipv4(0, 0, 0, 0, 1);
let socket = UdpSocket::bind(addr); let socket = UdpSocket::bind(addr);
assert!(socket.is_none()); assert!(socket.is_none());

View file

@ -100,7 +100,7 @@ mod test {
do io_error::cond.trap(|err| { do io_error::cond.trap(|err| {
assert_eq!(err.kind, PreviousIoError); assert_eq!(err.kind, PreviousIoError);
called = true; called = true;
}).in { }).inside {
writer.write([0, 0, 0]); writer.write([0, 0, 0]);
} }
assert!(called); assert!(called);
@ -109,7 +109,7 @@ mod test {
do io_error::cond.trap(|err| { do io_error::cond.trap(|err| {
assert_eq!(err.kind, PreviousIoError); assert_eq!(err.kind, PreviousIoError);
called = true; called = true;
}).in { }).inside {
writer.flush(); writer.flush();
} }
assert!(called); assert!(called);
@ -136,7 +136,7 @@ mod test {
do read_error::cond.trap(|err| { do read_error::cond.trap(|err| {
assert_eq!(err.kind, PreviousIoError); assert_eq!(err.kind, PreviousIoError);
called = true; called = true;
}).in { }).inside {
reader.read(buf); reader.read(buf);
} }
assert!(called); assert!(called);
@ -145,7 +145,7 @@ mod test {
do io_error::cond.trap(|err| { do io_error::cond.trap(|err| {
assert_eq!(err.kind, PreviousIoError); assert_eq!(err.kind, PreviousIoError);
called = true; called = true;
}).in { }).inside {
assert!(reader.eof()); assert!(reader.eof());
} }
assert!(called); assert!(called);

View file

@ -152,7 +152,7 @@ impl Process {
let (in_pipe, in_fd) = match options.in_fd { let (in_pipe, in_fd) = match options.in_fd {
None => { None => {
let pipe = os::pipe(); let pipe = os::pipe();
(Some(pipe), pipe.in) (Some(pipe), pipe.input)
}, },
Some(fd) => (None, fd) Some(fd) => (None, fd)
}; };
@ -175,7 +175,7 @@ impl Process {
in_fd, out_fd, err_fd); in_fd, out_fd, err_fd);
unsafe { unsafe {
for in_pipe.iter().advance |pipe| { libc::close(pipe.in); } for in_pipe.iter().advance |pipe| { libc::close(pipe.input); }
for out_pipe.iter().advance |pipe| { libc::close(pipe.out); } for out_pipe.iter().advance |pipe| { libc::close(pipe.out); }
for err_pipe.iter().advance |pipe| { libc::close(pipe.out); } for err_pipe.iter().advance |pipe| { libc::close(pipe.out); }
} }
@ -184,8 +184,8 @@ impl Process {
pid: res.pid, pid: res.pid,
handle: res.handle, handle: res.handle,
input: in_pipe.map(|pipe| pipe.out), input: in_pipe.map(|pipe| pipe.out),
output: out_pipe.map(|pipe| os::fdopen(pipe.in)), output: out_pipe.map(|pipe| os::fdopen(pipe.input)),
error: err_pipe.map(|pipe| os::fdopen(pipe.in)), error: err_pipe.map(|pipe| os::fdopen(pipe.input)),
exit_code: None, exit_code: None,
} }
} }
@ -1025,7 +1025,7 @@ mod tests {
let mut proc = run::Process::new("cat", [], run::ProcessOptions { let mut proc = run::Process::new("cat", [], run::ProcessOptions {
dir: None, dir: None,
env: None, env: None,
in_fd: Some(pipe_in.in), in_fd: Some(pipe_in.input),
out_fd: Some(pipe_out.out), out_fd: Some(pipe_out.out),
err_fd: Some(pipe_err.out) err_fd: Some(pipe_err.out)
}); });
@ -1034,14 +1034,14 @@ mod tests {
assert!(proc.output_redirected()); assert!(proc.output_redirected());
assert!(proc.error_redirected()); assert!(proc.error_redirected());
os::close(pipe_in.in); os::close(pipe_in.input);
os::close(pipe_out.out); os::close(pipe_out.out);
os::close(pipe_err.out); os::close(pipe_err.out);
let expected = ~"test"; let expected = ~"test";
writeclose(pipe_in.out, expected); writeclose(pipe_in.out, expected);
let actual = readclose(pipe_out.in); let actual = readclose(pipe_out.input);
readclose(pipe_err.in); readclose(pipe_err.input);
proc.finish(); proc.finish();
assert_eq!(expected, actual); assert_eq!(expected, actual);

View file

@ -2863,7 +2863,7 @@ mod tests {
assert_eq!(err, ~"from_bytes: input is not UTF-8; first bad byte is 255"); assert_eq!(err, ~"from_bytes: input is not UTF-8; first bad byte is 255");
error_happened = true; error_happened = true;
~"" ~""
}).in { }).inside {
from_bytes(bb) from_bytes(bb)
}; };
assert!(error_happened); assert!(error_happened);

View file

@ -95,10 +95,10 @@ pub fn expand_asm(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
let constraint = p.parse_str(); let constraint = p.parse_str();
p.expect(&token::LPAREN); p.expect(&token::LPAREN);
let in = p.parse_expr(); let input = p.parse_expr();
p.expect(&token::RPAREN); p.expect(&token::RPAREN);
inputs.push((constraint, in)); inputs.push((constraint, input));
} }
} }
Clobbers => { Clobbers => {

View file

@ -750,16 +750,16 @@ pub fn std_macros() -> @str {
macro_rules! condition ( macro_rules! condition (
{ pub $c:ident: $in:ty -> $out:ty; } => { { pub $c:ident: $input:ty -> $out:ty; } => {
pub mod $c { pub mod $c {
#[allow(non_uppercase_statics)]; #[allow(non_uppercase_statics)];
static key: ::std::local_data::Key< static key: ::std::local_data::Key<
@::std::condition::Handler<$in, $out>> = @::std::condition::Handler<$input, $out>> =
&::std::local_data::Key; &::std::local_data::Key;
pub static cond : pub static cond :
::std::condition::Condition<$in,$out> = ::std::condition::Condition<$input,$out> =
::std::condition::Condition { ::std::condition::Condition {
name: stringify!($c), name: stringify!($c),
key: key key: key
@ -767,17 +767,17 @@ pub fn std_macros() -> @str {
} }
}; };
{ $c:ident: $in:ty -> $out:ty; } => { { $c:ident: $input:ty -> $out:ty; } => {
// FIXME (#6009): remove mod's `pub` below once variant above lands. // FIXME (#6009): remove mod's `pub` below once variant above lands.
pub mod $c { pub mod $c {
#[allow(non_uppercase_statics)]; #[allow(non_uppercase_statics)];
static key: ::std::local_data::Key< static key: ::std::local_data::Key<
@::std::condition::Handler<$in, $out>> = @::std::condition::Handler<$input, $out>> =
&::std::local_data::Key; &::std::local_data::Key;
pub static cond : pub static cond :
::std::condition::Condition<$in,$out> = ::std::condition::Condition<$input,$out> =
::std::condition::Condition { ::std::condition::Condition {
name: stringify!($c), name: stringify!($c),
key: key key: key

View file

@ -626,7 +626,7 @@ pub fn noop_fold_expr(e: &expr_, fld: @ast_fold) -> expr_ {
} }
expr_inline_asm(ref a) => { expr_inline_asm(ref a) => {
expr_inline_asm(inline_asm { expr_inline_asm(inline_asm {
inputs: a.inputs.map(|&(c, in)| (c, fld.fold_expr(in))), inputs: a.inputs.map(|&(c, input)| (c, fld.fold_expr(input))),
outputs: a.outputs.map(|&(c, out)| (c, fld.fold_expr(out))), outputs: a.outputs.map(|&(c, out)| (c, fld.fold_expr(out))),
.. (*a).clone() .. (*a).clone()
}) })

View file

@ -30,7 +30,6 @@ use std::to_bytes;
/// The specific types of unsupported syntax /// The specific types of unsupported syntax
#[deriving(Eq)] #[deriving(Eq)]
pub enum ObsoleteSyntax { pub enum ObsoleteSyntax {
ObsoleteLowerCaseKindBounds,
ObsoleteLet, ObsoleteLet,
ObsoleteFieldTerminator, ObsoleteFieldTerminator,
ObsoleteStructCtor, ObsoleteStructCtor,
@ -96,12 +95,6 @@ impl ParserObsoleteMethods for Parser {
/// Reports an obsolete syntax non-fatal error. /// Reports an obsolete syntax non-fatal error.
pub fn obsolete(&self, sp: span, kind: ObsoleteSyntax) { pub fn obsolete(&self, sp: span, kind: ObsoleteSyntax) {
let (kind_str, desc) = match kind { let (kind_str, desc) = match kind {
ObsoleteLowerCaseKindBounds => (
"lower-case kind bounds",
"the `send`, `copy`, `const`, and `owned` \
kinds are represented as traits now, and \
should be camel cased"
),
ObsoleteLet => ( ObsoleteLet => (
"`let` in field declaration", "`let` in field declaration",
"declare fields as `field: Type`" "declare fields as `field: Type`"

View file

@ -71,7 +71,7 @@ use parse::lexer::TokenAndSpan;
use parse::obsolete::{ObsoleteClassTraits}; use parse::obsolete::{ObsoleteClassTraits};
use parse::obsolete::{ObsoleteLet, ObsoleteFieldTerminator}; use parse::obsolete::{ObsoleteLet, ObsoleteFieldTerminator};
use parse::obsolete::{ObsoleteMoveInit, ObsoleteBinaryMove, ObsoleteSwap}; use parse::obsolete::{ObsoleteMoveInit, ObsoleteBinaryMove, ObsoleteSwap};
use parse::obsolete::{ObsoleteSyntax, ObsoleteLowerCaseKindBounds}; use parse::obsolete::ObsoleteSyntax;
use parse::obsolete::{ObsoleteUnsafeBlock, ObsoleteImplSyntax}; use parse::obsolete::{ObsoleteUnsafeBlock, ObsoleteImplSyntax};
use parse::obsolete::{ObsoleteMutOwnedPointer}; use parse::obsolete::{ObsoleteMutOwnedPointer};
use parse::obsolete::{ObsoleteMutVector, ObsoleteImplVisibility}; use parse::obsolete::{ObsoleteMutVector, ObsoleteImplVisibility};
@ -3309,30 +3309,8 @@ impl Parser {
self.bump(); self.bump();
} }
token::MOD_SEP | token::IDENT(*) => { token::MOD_SEP | token::IDENT(*) => {
let obsolete_bound = match *self.token { let tref = self.parse_trait_ref();
token::MOD_SEP => false, result.push(TraitTyParamBound(tref));
token::IDENT(sid, _) => {
match self.id_to_str(sid).as_slice() {
"send" |
"copy" |
"const" |
"owned" => {
self.obsolete(
*self.span,
ObsoleteLowerCaseKindBounds);
self.bump();
true
}
_ => false
}
}
_ => fail!()
};
if !obsolete_bound {
let tref = self.parse_trait_ref();
result.push(TraitTyParamBound(tref));
}
} }
_ => break, _ => break,
} }

View file

@ -125,7 +125,7 @@ pub fn binop_to_str(o: binop) -> ~str {
} }
} }
pub fn to_str(in: @ident_interner, t: &Token) -> ~str { pub fn to_str(input: @ident_interner, t: &Token) -> ~str {
match *t { match *t {
EQ => ~"=", EQ => ~"=",
LT => ~"<", LT => ~"<",
@ -195,8 +195,8 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str {
LIT_STR(ref s) => { fmt!("\"%s\"", ident_to_str(s).escape_default()) } LIT_STR(ref s) => { fmt!("\"%s\"", ident_to_str(s).escape_default()) }
/* Name components */ /* Name components */
IDENT(s, _) => in.get(s.name).to_owned(), IDENT(s, _) => input.get(s.name).to_owned(),
LIFETIME(s) => fmt!("'%s", in.get(s.name)), LIFETIME(s) => fmt!("'%s", input.get(s.name)),
UNDERSCORE => ~"_", UNDERSCORE => ~"_",
/* Other */ /* Other */
@ -204,7 +204,7 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str {
EOF => ~"<eof>", EOF => ~"<eof>",
INTERPOLATED(ref nt) => { INTERPOLATED(ref nt) => {
match nt { match nt {
&nt_expr(e) => ::print::pprust::expr_to_str(e, in), &nt_expr(e) => ::print::pprust::expr_to_str(e, input),
_ => { _ => {
~"an interpolated " + ~"an interpolated " +
match (*nt) { match (*nt) {
@ -440,42 +440,41 @@ fn mk_fresh_ident_interner() -> @ident_interner {
"as", // 32 "as", // 32
"break", // 33 "break", // 33
"const", // 34 "const", // 34
"copy", // 35 "do", // 35
"do", // 36 "else", // 36
"else", // 37 "enum", // 37
"enum", // 38 "extern", // 38
"extern", // 39 "false", // 39
"false", // 40 "fn", // 40
"fn", // 41 "for", // 41
"for", // 42 "if", // 42
"if", // 43 "impl", // 43
"impl", // 44 "let", // 44
"let", // 45 "__log", // 45
"__log", // 46 "loop", // 46
"loop", // 47 "match", // 47
"match", // 48 "mod", // 48
"mod", // 49 "mut", // 49
"mut", // 50 "once", // 50
"once", // 51 "priv", // 51
"priv", // 52 "pub", // 52
"pub", // 53 "ref", // 53
"pure", // 54 "return", // 54
"ref", // 55
"return", // 56
"static", // 27 -- also a special ident "static", // 27 -- also a special ident
"self", // 8 -- also a special ident "self", // 8 -- also a special ident
"struct", // 57 "struct", // 55
"super", // 58 "super", // 56
"true", // 59 "true", // 57
"trait", // 60 "trait", // 58
"type", // 61 "type", // 59
"unsafe", // 62 "unsafe", // 60
"use", // 63 "use", // 61
"while", // 64 "while", // 62
"in", // 63
"foreach", // 64
"be", // 65 "be", // 65
"in", // 66 "pure", // 66
"foreach", // 67
]; ];
@ident_interner { @ident_interner {
@ -609,39 +608,39 @@ pub mod keywords {
As => ident { name: 32, ctxt: 0 }, As => ident { name: 32, ctxt: 0 },
Break => ident { name: 33, ctxt: 0 }, Break => ident { name: 33, ctxt: 0 },
Const => ident { name: 34, ctxt: 0 }, Const => ident { name: 34, ctxt: 0 },
Do => ident { name: 36, ctxt: 0 }, Do => ident { name: 35, ctxt: 0 },
Else => ident { name: 37, ctxt: 0 }, Else => ident { name: 36, ctxt: 0 },
Enum => ident { name: 38, ctxt: 0 }, Enum => ident { name: 37, ctxt: 0 },
Extern => ident { name: 39, ctxt: 0 }, Extern => ident { name: 38, ctxt: 0 },
False => ident { name: 40, ctxt: 0 }, False => ident { name: 39, ctxt: 0 },
Fn => ident { name: 41, ctxt: 0 }, Fn => ident { name: 40, ctxt: 0 },
For => ident { name: 42, ctxt: 0 }, For => ident { name: 41, ctxt: 0 },
ForEach => ident { name: 67, ctxt: 0 }, ForEach => ident { name: 64, ctxt: 0 },
If => ident { name: 43, ctxt: 0 }, If => ident { name: 42, ctxt: 0 },
Impl => ident { name: 44, ctxt: 0 }, Impl => ident { name: 43, ctxt: 0 },
In => ident { name: 66, ctxt: 0 }, In => ident { name: 63, ctxt: 0 },
Let => ident { name: 45, ctxt: 0 }, Let => ident { name: 44, ctxt: 0 },
__Log => ident { name: 46, ctxt: 0 }, __Log => ident { name: 45, ctxt: 0 },
Loop => ident { name: 47, ctxt: 0 }, Loop => ident { name: 46, ctxt: 0 },
Match => ident { name: 48, ctxt: 0 }, Match => ident { name: 47, ctxt: 0 },
Mod => ident { name: 49, ctxt: 0 }, Mod => ident { name: 48, ctxt: 0 },
Mut => ident { name: 50, ctxt: 0 }, Mut => ident { name: 49, ctxt: 0 },
Once => ident { name: 51, ctxt: 0 }, Once => ident { name: 50, ctxt: 0 },
Priv => ident { name: 52, ctxt: 0 }, Priv => ident { name: 51, ctxt: 0 },
Pub => ident { name: 53, ctxt: 0 }, Pub => ident { name: 52, ctxt: 0 },
Pure => ident { name: 54, ctxt: 0 }, Pure => ident { name: 66, ctxt: 0 },
Ref => ident { name: 55, ctxt: 0 }, Ref => ident { name: 53, ctxt: 0 },
Return => ident { name: 56, ctxt: 0 }, Return => ident { name: 54, ctxt: 0 },
Static => ident { name: 27, ctxt: 0 }, Static => ident { name: 27, ctxt: 0 },
Self => ident { name: 8, ctxt: 0 }, Self => ident { name: 8, ctxt: 0 },
Struct => ident { name: 57, ctxt: 0 }, Struct => ident { name: 55, ctxt: 0 },
Super => ident { name: 58, ctxt: 0 }, Super => ident { name: 56, ctxt: 0 },
True => ident { name: 59, ctxt: 0 }, True => ident { name: 57, ctxt: 0 },
Trait => ident { name: 60, ctxt: 0 }, Trait => ident { name: 58, ctxt: 0 },
Type => ident { name: 61, ctxt: 0 }, Type => ident { name: 59, ctxt: 0 },
Unsafe => ident { name: 62, ctxt: 0 }, Unsafe => ident { name: 60, ctxt: 0 },
Use => ident { name: 63, ctxt: 0 }, Use => ident { name: 61, ctxt: 0 },
While => ident { name: 64, ctxt: 0 }, While => ident { name: 62, ctxt: 0 },
Be => ident { name: 65, ctxt: 0 }, Be => ident { name: 65, ctxt: 0 },
} }
} }
@ -658,7 +657,7 @@ pub fn is_keyword(kw: keywords::Keyword, tok: &Token) -> bool {
pub fn is_any_keyword(tok: &Token) -> bool { pub fn is_any_keyword(tok: &Token) -> bool {
match *tok { match *tok {
token::IDENT(sid, false) => match sid.name { token::IDENT(sid, false) => match sid.name {
8 | 27 | 32 .. 65 => true, 8 | 27 | 32 .. 66 => true,
_ => false, _ => false,
}, },
_ => false _ => false
@ -678,14 +677,13 @@ pub fn is_strict_keyword(tok: &Token) -> bool {
pub fn is_reserved_keyword(tok: &Token) -> bool { pub fn is_reserved_keyword(tok: &Token) -> bool {
match *tok { match *tok {
token::IDENT(sid, false) => match sid.name { token::IDENT(sid, false) => match sid.name {
65 => true, 65 .. 66 => true,
_ => false, _ => false,
}, },
_ => false, _ => false,
} }
} }
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;

View file

@ -108,14 +108,14 @@ pub fn print_crate(cm: @CodeMap,
span_diagnostic: @diagnostic::span_handler, span_diagnostic: @diagnostic::span_handler,
crate: &ast::Crate, crate: &ast::Crate,
filename: @str, filename: @str,
in: @io::Reader, input: @io::Reader,
out: @io::Writer, out: @io::Writer,
ann: pp_ann, ann: pp_ann,
is_expanded: bool) { is_expanded: bool) {
let (cmnts, lits) = comments::gather_comments_and_literals( let (cmnts, lits) = comments::gather_comments_and_literals(
span_diagnostic, span_diagnostic,
filename, filename,
in input
); );
let s = @ps { let s = @ps {
s: pp::mk_printer(out, default_columns), s: pp::mk_printer(out, default_columns),

View file

@ -563,8 +563,8 @@ pub fn visit_expr<E:Clone>(ex: @expr, (e, v): (E, vt<E>)) {
expr_mac(ref mac) => visit_mac(mac, (e.clone(), v)), expr_mac(ref mac) => visit_mac(mac, (e.clone(), v)),
expr_paren(x) => (v.visit_expr)(x, (e.clone(), v)), expr_paren(x) => (v.visit_expr)(x, (e.clone(), v)),
expr_inline_asm(ref a) => { expr_inline_asm(ref a) => {
for a.inputs.iter().advance |&(_, in)| { for a.inputs.iter().advance |&(_, input)| {
(v.visit_expr)(in, (e.clone(), v)); (v.visit_expr)(input, (e.clone(), v));
} }
for a.outputs.iter().advance |&(_, out)| { for a.outputs.iter().advance |&(_, out)| {
(v.visit_expr)(out, (e.clone(), v)); (v.visit_expr)(out, (e.clone(), v));

View file

@ -8,18 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
fn f1<T:copy>() -> T { }
//~^ ERROR obsolete syntax: lower-case kind bounds
fn f1<T:send>() -> T { }
//~^ ERROR obsolete syntax: lower-case kind bounds
fn f1<T:const>() -> T { }
//~^ ERROR obsolete syntax: lower-case kind bounds
fn f1<T:owned>() -> T { }
//~^ ERROR obsolete syntax: lower-case kind bounds
struct s { struct s {
let foo: (), let foo: (),
//~^ ERROR obsolete syntax: `let` in field declaration //~^ ERROR obsolete syntax: `let` in field declaration

View file

@ -62,10 +62,10 @@ fn square_from_char(c: char) -> square {
} }
} }
fn read_board_grid<rdr:'static + io::Reader>(in: rdr) -> ~[~[square]] { fn read_board_grid<rdr:'static + io::Reader>(input: rdr) -> ~[~[square]] {
let in = @in as @io::Reader; let input = @input as @io::Reader;
let mut grid = ~[]; let mut grid = ~[];
for in.each_line |line| { for input.each_line |line| {
let mut row = ~[]; let mut row = ~[];
for line.iter().advance |c| { for line.iter().advance |c| {
row.push(square_from_char(c)) row.push(square_from_char(c))

View file

@ -27,11 +27,11 @@ pub fn main() {
assert_eq!(foobar, somefoobar.get()); assert_eq!(foobar, somefoobar.get());
} }
fn optint(in: int) -> Option<int> { fn optint(input: int) -> Option<int> {
if in == 0 { if input == 0 {
return None; return None;
} }
else { else {
return Some(in); return Some(input);
} }
} }

View file

@ -12,8 +12,8 @@ enum t1 { a(int), b(uint), }
struct T2 {x: t1, y: int} struct T2 {x: t1, y: int}
enum t3 { c(T2, uint), } enum t3 { c(T2, uint), }
fn m(in: t3) -> int { fn m(input: t3) -> int {
match in { match input {
c(T2 {x: a(m), _}, _) => { return m; } c(T2 {x: a(m), _}, _) => { return m; }
c(T2 {x: b(m), y: y}, z) => { return ((m + z) as int) + y; } c(T2 {x: b(m), y: y}, z) => { return ((m + z) as int) + y; }
} }