Skip to content
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

Reserve inheritance keywords abstract, final, override #17866

Merged
merged 4 commits into from
Oct 8, 2014
Merged
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/etc/vim/syntax/rust.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/middle/trans/reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/io/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
3 changes: 3 additions & 0 deletions src/libsyntax/parse/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

Expand Down
13 changes: 13 additions & 0 deletions src/test/compile-fail/keyword-abstract.rs
Original file line number Diff line number Diff line change
@@ -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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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
}
13 changes: 13 additions & 0 deletions src/test/compile-fail/keyword-final.rs
Original file line number Diff line number Diff line change
@@ -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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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
}
13 changes: 13 additions & 0 deletions src/test/compile-fail/keyword-override.rs
Original file line number Diff line number Diff line change
@@ -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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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
}