mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
auto merge of #17866 : jgallagher/rust/reserve-inheritance-keywords, r=huonw
Closes #17862
This commit is contained in:
commit
c588e407b9
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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));
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
13
src/test/compile-fail/keyword-abstract.rs
Normal file
13
src/test/compile-fail/keyword-abstract.rs
Normal file
@ -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
src/test/compile-fail/keyword-final.rs
Normal file
13
src/test/compile-fail/keyword-final.rs
Normal file
@ -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
src/test/compile-fail/keyword-override.rs
Normal file
13
src/test/compile-fail/keyword-override.rs
Normal file
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user