diff --git a/src/etc/vim/syntax/rust.vim b/src/etc/vim/syntax/rust.vim index 93931246a0240..407742b9c346e 100644 --- a/src/etc/vim/syntax/rust.vim +++ b/src/etc/vim/syntax/rust.vim @@ -54,7 +54,7 @@ syn match rustMacroRepeatCount ".\?[*+]" contained syn match rustMacroVariable "$\w\+" " Reserved (but not yet used) keywords {{{2 -syn keyword rustReservedKeyword alignof be do offsetof priv pure sizeof typeof unsized yield +syn keyword rustReservedKeyword alignof be do offsetof priv pure sizeof typeof unsized yield abstract final override " Built-in types {{{2 syn keyword rustType int uint float char bool u8 u16 u32 u64 f32 diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs index bff1a0400a9d1..ebdd2eb6354b1 100644 --- a/src/librustc/middle/trans/reflect.rs +++ b/src/librustc/middle/trans/reflect.rs @@ -436,20 +436,20 @@ pub fn emit_calls_to_trait_visit_ty<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, visitor_trait_id: DefId) -> Block<'blk, 'tcx> { let fcx = bcx.fcx; - let final = fcx.new_temp_block("final"); + let final_bcx = fcx.new_temp_block("final"); let tydesc_ty = ty::get_tydesc_ty(bcx.tcx()).unwrap(); let tydesc_ty = type_of(bcx.ccx(), tydesc_ty); let visitor_items = ty::trait_items(bcx.tcx(), visitor_trait_id); let mut r = Reflector { visitor_val: visitor_val, visitor_items: visitor_items.as_slice(), - final_bcx: final, + final_bcx: final_bcx, tydesc_ty: tydesc_ty, bcx: bcx }; r.visit_ty(t); - Br(r.bcx, final.llbb); - return final; + Br(r.bcx, final_bcx.llbb); + return final_bcx; } pub fn ast_fn_style_constant(fn_style: ast::FnStyle) -> uint { diff --git a/src/libstd/io/timer.rs b/src/libstd/io/timer.rs index 55d4073154eea..e7df02855406a 100644 --- a/src/libstd/io/timer.rs +++ b/src/libstd/io/timer.rs @@ -308,7 +308,7 @@ mod test { } #[test] - fn override() { + fn test_override() { let mut timer = Timer::new().unwrap(); let orx = timer.oneshot(Duration::milliseconds(100)); let prx = timer.periodic(Duration::milliseconds(100)); diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index a8c827439cc60..7cc78891d91d1 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -520,6 +520,9 @@ declare_special_idents_and_keywords! { (54, Unsized, "unsized"); (55, Yield, "yield"); (56, Do, "do"); + (57, Abstract, "abstract"); + (58, Final, "final"); + (59, Override, "override"); } } diff --git a/src/test/compile-fail/keyword-abstract.rs b/src/test/compile-fail/keyword-abstract.rs new file mode 100644 index 0000000000000..1f1360eac0078 --- /dev/null +++ b/src/test/compile-fail/keyword-abstract.rs @@ -0,0 +1,13 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let abstract = (); //~ ERROR `abstract` is a reserved keyword +} diff --git a/src/test/compile-fail/keyword-final.rs b/src/test/compile-fail/keyword-final.rs new file mode 100644 index 0000000000000..305ef0ef075f7 --- /dev/null +++ b/src/test/compile-fail/keyword-final.rs @@ -0,0 +1,13 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let final = (); //~ ERROR `final` is a reserved keyword +} diff --git a/src/test/compile-fail/keyword-override.rs b/src/test/compile-fail/keyword-override.rs new file mode 100644 index 0000000000000..f70e6b9261053 --- /dev/null +++ b/src/test/compile-fail/keyword-override.rs @@ -0,0 +1,13 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let override = (); //~ ERROR `override` is a reserved keyword +}