]> git.lizzy.rs Git - rust.git/commitdiff
Purge the old `once_fns`, which are not coming back
authorNiko Matsakis <niko@alum.mit.edu>
Fri, 7 Nov 2014 20:48:55 +0000 (15:48 -0500)
committerNiko Matsakis <niko@alum.mit.edu>
Fri, 7 Nov 2014 20:51:30 +0000 (15:51 -0500)
src/libsyntax/feature_gate.rs
src/libsyntax/parse/token.rs
src/libsyntax/print/pprust.rs
src/test/compile-fail/once-cant-call-twice-on-stack.rs [deleted file]
src/test/compile-fail/once-cant-move-out-of-non-once-on-stack.rs [deleted file]
src/test/compile-fail/once-fn-subtyping.rs [deleted file]
src/test/run-pass/once-move-out-on-heap.rs
src/test/run-pass/once-move-out-on-stack.rs [deleted file]

index 80b158a54d36cf90dd8d20fc473044134e3c89fd..c38fea9b3d58a2b9576ea5e8fcd249ed1b182eb8 100644 (file)
@@ -38,7 +38,6 @@
     ("globs", Active),
     ("macro_rules", Active),
     ("struct_variant", Active),
-    ("once_fns", Active),
     ("asm", Active),
     ("managed_boxes", Removed),
     ("non_ascii_idents", Active),
@@ -307,11 +306,10 @@ fn visit_foreign_item(&mut self, i: &ast::ForeignItem) {
 
     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);
             },
             _ => {}
         }
index b0cca5e14de15448bcf603e4be57c97bbafd8b40..f501a5831d2ad533cfe630136806c6f25d596385 100644 (file)
@@ -503,42 +503,41 @@ pub mod 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");
     }
 }
 
index 5b57a875c4afb2d36dcf8d07fa6c2d72964958c5..c1515a36bec6897a982445e5fbecee5ab4442952 100644 (file)
@@ -2663,12 +2663,10 @@ pub fn print_ty_fn(&mut self,
         } 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 @@ pub fn print_fn_style(&mut self, s: ast::FnStyle) -> IoResult<()> {
             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)]
diff --git a/src/test/compile-fail/once-cant-call-twice-on-stack.rs b/src/test/compile-fail/once-cant-call-twice-on-stack.rs
deleted file mode 100644 (file)
index 1796819..0000000
+++ /dev/null
@@ -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);
-    })
-}
diff --git a/src/test/compile-fail/once-cant-move-out-of-non-once-on-stack.rs b/src/test/compile-fail/once-cant-move-out-of-non-once-on-stack.rs
deleted file mode 100644 (file)
index 3efebf6..0000000
+++ /dev/null
@@ -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
-    })
-}
diff --git a/src/test/compile-fail/once-fn-subtyping.rs b/src/test/compile-fail/once-fn-subtyping.rs
deleted file mode 100644 (file)
index 7594ded..0000000
+++ /dev/null
@@ -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
-}
index dfd5992a40675b0d10171d5bfbbd27309d651d05..e24e809ed018a9416ade45f491318d0c3c34cbeb 100644 (file)
@@ -11,7 +11,6 @@
 // Testing guarantees provided by once functions.
 
 
-#![feature(once_fns)]
 use std::sync::Arc;
 
 fn foo(blk: proc()) {
diff --git a/src/test/run-pass/once-move-out-on-stack.rs b/src/test/run-pass/once-move-out-on-stack.rs
deleted file mode 100644 (file)
index 0419fc5..0000000
+++ /dev/null
@@ -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);
-    })
-}