Remove every mention of "onceness".

This commit is contained in:
Eduard Burtescu 2015-01-24 22:13:24 +02:00
parent 50a370aa2d
commit e0afa82c67
8 changed files with 6 additions and 66 deletions

View file

@ -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.

View file

@ -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>)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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.

View file

@ -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<T> {
pub enum type_err<'tcx> {
terr_mismatch,
terr_unsafety_mismatch(expected_found<ast::Unsafety>),
terr_onceness_mismatch(expected_found<Onceness>),
terr_abi_mismatch(expected_found<abi::Abi>),
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()

View file

@ -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,