diff --git a/src/doc/reference.md b/src/doc/reference.md index 3cbd71a1eb3..cb64220424f 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -2489,10 +2489,6 @@ The currently implemented features of the reference compiler are: for now until the specification of identifiers is fully fleshed out. -* `once_fns` - Onceness guarantees a closure is only executed once. Defining a - closure as `once` is unlikely to be supported going forward. So - they are hidden behind this feature until they are to be removed. - * `plugin` - Usage of [compiler plugins][plugin] for custom lints or syntax extensions. These depend on compiler internals and are subject to change. diff --git a/src/librustc/middle/infer/combine.rs b/src/librustc/middle/infer/combine.rs index b445215182c..04b3b55df8d 100644 --- a/src/librustc/middle/infer/combine.rs +++ b/src/librustc/middle/infer/combine.rs @@ -52,7 +52,7 @@ use middle::ty_fold::{TypeFoldable}; use util::ppaux::Repr; use std::rc::Rc; -use syntax::ast::{Onceness, Unsafety}; +use syntax::ast::Unsafety; use syntax::ast; use syntax::abi; use syntax::codemap::Span; @@ -254,8 +254,6 @@ pub trait Combine<'tcx> : Sized { } } - fn oncenesses(&self, a: Onceness, b: Onceness) -> cres<'tcx, Onceness>; - fn projection_tys(&self, a: &ty::ProjectionTy<'tcx>, b: &ty::ProjectionTy<'tcx>) diff --git a/src/librustc/middle/infer/equate.rs b/src/librustc/middle/infer/equate.rs index f6ac7461567..f0bde222864 100644 --- a/src/librustc/middle/infer/equate.rs +++ b/src/librustc/middle/infer/equate.rs @@ -21,7 +21,7 @@ use middle::infer::{TypeTrace, Subtype}; use middle::infer::type_variable::{EqTo}; use util::ppaux::{Repr}; -use syntax::ast::{Onceness, Unsafety}; +use syntax::ast::Unsafety; pub struct Equate<'f, 'tcx: 'f> { fields: CombineFields<'f, 'tcx> @@ -78,14 +78,6 @@ impl<'f, 'tcx> Combine<'tcx> for Equate<'f, 'tcx> { } } - fn oncenesses(&self, a: Onceness, b: Onceness) -> cres<'tcx, Onceness> { - if a != b { - Err(ty::terr_onceness_mismatch(expected_found(self, a, b))) - } else { - Ok(a) - } - } - fn builtin_bounds(&self, a: BuiltinBounds, b: BuiltinBounds) diff --git a/src/librustc/middle/infer/glb.rs b/src/librustc/middle/infer/glb.rs index 2683d00b858..ff0c2d92f45 100644 --- a/src/librustc/middle/infer/glb.rs +++ b/src/librustc/middle/infer/glb.rs @@ -19,8 +19,7 @@ use super::{TypeTrace, Subtype}; use middle::ty::{BuiltinBounds}; use middle::ty::{self, Ty}; -use syntax::ast::{Many, Once, MutImmutable, MutMutable}; -use syntax::ast::{Onceness, Unsafety}; +use syntax::ast::{MutImmutable, MutMutable, Unsafety}; use util::ppaux::mt_to_string; use util::ppaux::Repr; @@ -87,13 +86,6 @@ impl<'f, 'tcx> Combine<'tcx> for Glb<'f, 'tcx> { } } - fn oncenesses(&self, a: Onceness, b: Onceness) -> cres<'tcx, Onceness> { - match (a, b) { - (Many, _) | (_, Many) => Ok(Many), - (Once, Once) => Ok(Once) - } - } - fn builtin_bounds(&self, a: ty::BuiltinBounds, b: ty::BuiltinBounds) diff --git a/src/librustc/middle/infer/lub.rs b/src/librustc/middle/infer/lub.rs index e4cab0f8899..204560e87ee 100644 --- a/src/librustc/middle/infer/lub.rs +++ b/src/librustc/middle/infer/lub.rs @@ -19,9 +19,7 @@ use super::{TypeTrace, Subtype}; use middle::ty::{BuiltinBounds}; use middle::ty::{self, Ty}; -use syntax::ast::{Many, Once}; -use syntax::ast::{Onceness, Unsafety}; -use syntax::ast::{MutMutable, MutImmutable}; +use syntax::ast::{MutMutable, MutImmutable, Unsafety}; use util::ppaux::mt_to_string; use util::ppaux::Repr; @@ -83,13 +81,6 @@ impl<'f, 'tcx> Combine<'tcx> for Lub<'f, 'tcx> { } } - fn oncenesses(&self, a: Onceness, b: Onceness) -> cres<'tcx, Onceness> { - match (a, b) { - (Once, _) | (_, Once) => Ok(Once), - (Many, Many) => Ok(Many) - } - } - fn builtin_bounds(&self, a: ty::BuiltinBounds, b: ty::BuiltinBounds) diff --git a/src/librustc/middle/infer/sub.rs b/src/librustc/middle/infer/sub.rs index 4f8364fa44a..1e0d14544ff 100644 --- a/src/librustc/middle/infer/sub.rs +++ b/src/librustc/middle/infer/sub.rs @@ -23,7 +23,7 @@ use middle::ty::{self, Ty}; use middle::ty::TyVar; use util::ppaux::{Repr}; -use syntax::ast::{Onceness, MutImmutable, MutMutable, Unsafety}; +use syntax::ast::{MutImmutable, MutMutable, Unsafety}; /// "Greatest lower bound" (common subtype) @@ -99,12 +99,6 @@ impl<'f, 'tcx> Combine<'tcx> for Sub<'f, 'tcx> { }) } - fn oncenesses(&self, a: Onceness, b: Onceness) -> cres<'tcx, Onceness> { - self.lub().oncenesses(a, b).compare(b, || { - ty::terr_onceness_mismatch(expected_found(self, a, b)) - }) - } - fn builtin_bounds(&self, a: BuiltinBounds, b: BuiltinBounds) -> cres<'tcx, BuiltinBounds> { // More bounds is a subtype of fewer bounds. diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 2407377a300..f6bc9d09872 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -81,8 +81,7 @@ use std::collections::{HashMap, HashSet}; use syntax::abi; use syntax::ast::{CrateNum, DefId, Ident, ItemTrait, LOCAL_CRATE}; use syntax::ast::{MutImmutable, MutMutable, Name, NamedField, NodeId}; -use syntax::ast::{Onceness, StmtExpr, StmtSemi, StructField, UnnamedField}; -use syntax::ast::{Visibility}; +use syntax::ast::{StmtExpr, StmtSemi, StructField, UnnamedField, Visibility}; use syntax::ast_util::{self, is_local, lit_is_str, local_def, PostExpansionMethod}; use syntax::attr::{self, AttrMetaMethods}; use syntax::codemap::Span; @@ -1535,7 +1534,6 @@ pub struct expected_found { pub enum type_err<'tcx> { terr_mismatch, terr_unsafety_mismatch(expected_found), - terr_onceness_mismatch(expected_found), terr_abi_mismatch(expected_found), terr_mutability, terr_box_mutability, @@ -4737,11 +4735,6 @@ pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String { values.expected, values.found) } - terr_onceness_mismatch(values) => { - format!("expected {} fn, found {} fn", - values.expected, - values.found) - } terr_mutability => "values differ in mutability".to_string(), terr_box_mutability => { "boxed values differ in mutability".to_string() diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 233197ccb5b..4f6cd8ad356 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -35,7 +35,6 @@ pub use self::MacStmtStyle::*; pub use self::MetaItem_::*; pub use self::Method_::*; pub use self::Mutability::*; -pub use self::Onceness::*; pub use self::Pat_::*; pub use self::PathListItem_::*; pub use self::PatWildKind::*; @@ -1222,21 +1221,6 @@ pub enum PrimTy { TyChar } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy, Show)] -pub enum Onceness { - Once, - Many -} - -impl fmt::Display for Onceness { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Display::fmt(match *self { - Once => "once", - Many => "many", - }, f) - } -} - #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] pub struct BareFnTy { pub unsafety: Unsafety,