Purge the old once_fns, which are not coming back

This commit is contained in:
Niko Matsakis 2014-11-07 15:48:55 -05:00
parent 3112771001
commit 091dc6e98a
8 changed files with 33 additions and 145 deletions

View File

@ -38,7 +38,6 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
("globs", Active),
("macro_rules", Active),
("struct_variant", Active),
("once_fns", Active),
("asm", Active),
("managed_boxes", Removed),
("non_ascii_idents", Active),
@ -307,11 +306,10 @@ impl<'a, 'v> Visitor<'v> for Context<'a> {
fn visit_ty(&mut self, t: &ast::Ty) {
match t.node {
ast::TyClosure(ref closure) if closure.onceness == ast::Once => {
self.gate_feature("once_fns", t.span,
"once functions are \
experimental and likely to be removed");
ast::TyClosure(ref closure) => {
// this used to be blocked by a feature gate, but it should just
// be plain impossible right now
assert!(closure.onceness != ast::Once);
},
_ => {}
}

View File

@ -503,42 +503,41 @@ declare_special_idents_and_keywords! {
(27, Mod, "mod");
(28, Move, "move");
(29, Mut, "mut");
(30, Once, "once");
(31, Pub, "pub");
(32, Ref, "ref");
(33, Return, "return");
(30, Pub, "pub");
(31, Ref, "ref");
(32, Return, "return");
// Static and Self are also special idents (prefill de-dupes)
(super::STATIC_KEYWORD_NAME_NUM, Static, "static");
(super::SELF_KEYWORD_NAME_NUM, Self, "self");
(34, Struct, "struct");
(33, Struct, "struct");
(super::SUPER_KEYWORD_NAME_NUM, Super, "super");
(35, True, "true");
(36, Trait, "trait");
(37, Type, "type");
(38, Unsafe, "unsafe");
(39, Use, "use");
(40, Virtual, "virtual");
(41, While, "while");
(42, Continue, "continue");
(43, Proc, "proc");
(44, Box, "box");
(45, Const, "const");
(46, Where, "where");
(34, True, "true");
(35, Trait, "trait");
(36, Type, "type");
(37, Unsafe, "unsafe");
(38, Use, "use");
(39, Virtual, "virtual");
(40, While, "while");
(41, Continue, "continue");
(42, Proc, "proc");
(43, Box, "box");
(44, Const, "const");
(45, Where, "where");
'reserved:
(47, Alignof, "alignof");
(48, Be, "be");
(49, Offsetof, "offsetof");
(50, Priv, "priv");
(51, Pure, "pure");
(52, Sizeof, "sizeof");
(53, Typeof, "typeof");
(54, Unsized, "unsized");
(55, Yield, "yield");
(56, Do, "do");
(57, Abstract, "abstract");
(58, Final, "final");
(59, Override, "override");
(46, Alignof, "alignof");
(47, Be, "be");
(48, Offsetof, "offsetof");
(49, Priv, "priv");
(50, Pure, "pure");
(51, Sizeof, "sizeof");
(52, Typeof, "typeof");
(53, Unsized, "unsized");
(54, Yield, "yield");
(55, Do, "do");
(56, Abstract, "abstract");
(57, Final, "final");
(58, Override, "override");
}
}

View File

@ -2663,12 +2663,10 @@ impl<'a> State<'a> {
} else if opt_sigil == Some('&') {
try!(self.print_fn_style(fn_style));
try!(self.print_extern_opt_abi(opt_abi));
try!(self.print_onceness(onceness));
} else {
assert!(opt_sigil.is_none());
try!(self.print_fn_style(fn_style));
try!(self.print_opt_abi_and_extern_if_nondefault(opt_abi));
try!(self.print_onceness(onceness));
try!(word(&mut self.s, "fn"));
}
@ -2987,13 +2985,6 @@ impl<'a> State<'a> {
ast::UnsafeFn => self.word_nbsp("unsafe"),
}
}
pub fn print_onceness(&mut self, o: ast::Onceness) -> IoResult<()> {
match o {
ast::Once => self.word_nbsp("once"),
ast::Many => Ok(())
}
}
}
#[cfg(test)]

View File

@ -1,28 +0,0 @@
// Copyright 2013 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.
// Testing guarantees provided by once functions.
// This program would segfault if it were legal.
#![feature(once_fns)]
use std::sync::Arc;
fn foo(blk: once ||) {
blk();
blk(); //~ ERROR use of moved value
}
fn main() {
let x = Arc::new(true);
foo(|| {
assert!(*x);
drop(x);
})
}

View File

@ -1,27 +0,0 @@
// Copyright 2013 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.
// Testing guarantees provided by once functions.
// This program would segfault if it were legal.
use std::sync::Arc;
fn foo(blk: ||) {
blk();
blk();
}
fn main() {
let x = Arc::new(true);
foo(|| {
assert!(*x);
drop(x); //~ ERROR cannot move out of captured outer variable
})
}

View File

@ -1,17 +0,0 @@
// Copyright 2012-2013 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.
#![feature(once_fns)]
fn main() {
let f: once || = ||();
let g: || = f; //~ ERROR mismatched types
let h: || = ||();
let i: once || = h; // ok
}

View File

@ -11,7 +11,6 @@
// Testing guarantees provided by once functions.
#![feature(once_fns)]
use std::sync::Arc;
fn foo(blk: proc()) {

View File

@ -1,27 +0,0 @@
// Copyright 2013-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.
// Testing guarantees provided by once functions.
#![feature(once_fns)]
use std::sync::Arc;
fn foo(blk: once ||) {
blk();
}
pub fn main() {
let x = Arc::new(true);
foo(|| {
assert!(*x);
drop(x);
})
}