Skip to content

Commit e0afa82

Browse files
committed
Remove every mention of "onceness".
1 parent 50a370a commit e0afa82

File tree

8 files changed

+6
-66
lines changed

8 files changed

+6
-66
lines changed

src/doc/reference.md

-4
Original file line numberDiff line numberDiff line change
@@ -2489,10 +2489,6 @@ The currently implemented features of the reference compiler are:
24892489
for now until the specification of identifiers is fully
24902490
fleshed out.
24912491

2492-
* `once_fns` - Onceness guarantees a closure is only executed once. Defining a
2493-
closure as `once` is unlikely to be supported going forward. So
2494-
they are hidden behind this feature until they are to be removed.
2495-
24962492
* `plugin` - Usage of [compiler plugins][plugin] for custom lints or syntax extensions.
24972493
These depend on compiler internals and are subject to change.
24982494

src/librustc/middle/infer/combine.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ use middle::ty_fold::{TypeFoldable};
5252
use util::ppaux::Repr;
5353

5454
use std::rc::Rc;
55-
use syntax::ast::{Onceness, Unsafety};
55+
use syntax::ast::Unsafety;
5656
use syntax::ast;
5757
use syntax::abi;
5858
use syntax::codemap::Span;
@@ -254,8 +254,6 @@ pub trait Combine<'tcx> : Sized {
254254
}
255255
}
256256

257-
fn oncenesses(&self, a: Onceness, b: Onceness) -> cres<'tcx, Onceness>;
258-
259257
fn projection_tys(&self,
260258
a: &ty::ProjectionTy<'tcx>,
261259
b: &ty::ProjectionTy<'tcx>)

src/librustc/middle/infer/equate.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use middle::infer::{TypeTrace, Subtype};
2121
use middle::infer::type_variable::{EqTo};
2222
use util::ppaux::{Repr};
2323

24-
use syntax::ast::{Onceness, Unsafety};
24+
use syntax::ast::Unsafety;
2525

2626
pub struct Equate<'f, 'tcx: 'f> {
2727
fields: CombineFields<'f, 'tcx>
@@ -78,14 +78,6 @@ impl<'f, 'tcx> Combine<'tcx> for Equate<'f, 'tcx> {
7878
}
7979
}
8080

81-
fn oncenesses(&self, a: Onceness, b: Onceness) -> cres<'tcx, Onceness> {
82-
if a != b {
83-
Err(ty::terr_onceness_mismatch(expected_found(self, a, b)))
84-
} else {
85-
Ok(a)
86-
}
87-
}
88-
8981
fn builtin_bounds(&self,
9082
a: BuiltinBounds,
9183
b: BuiltinBounds)

src/librustc/middle/infer/glb.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ use super::{TypeTrace, Subtype};
1919

2020
use middle::ty::{BuiltinBounds};
2121
use middle::ty::{self, Ty};
22-
use syntax::ast::{Many, Once, MutImmutable, MutMutable};
23-
use syntax::ast::{Onceness, Unsafety};
22+
use syntax::ast::{MutImmutable, MutMutable, Unsafety};
2423
use util::ppaux::mt_to_string;
2524
use util::ppaux::Repr;
2625

@@ -87,13 +86,6 @@ impl<'f, 'tcx> Combine<'tcx> for Glb<'f, 'tcx> {
8786
}
8887
}
8988

90-
fn oncenesses(&self, a: Onceness, b: Onceness) -> cres<'tcx, Onceness> {
91-
match (a, b) {
92-
(Many, _) | (_, Many) => Ok(Many),
93-
(Once, Once) => Ok(Once)
94-
}
95-
}
96-
9789
fn builtin_bounds(&self,
9890
a: ty::BuiltinBounds,
9991
b: ty::BuiltinBounds)

src/librustc/middle/infer/lub.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ use super::{TypeTrace, Subtype};
1919

2020
use middle::ty::{BuiltinBounds};
2121
use middle::ty::{self, Ty};
22-
use syntax::ast::{Many, Once};
23-
use syntax::ast::{Onceness, Unsafety};
24-
use syntax::ast::{MutMutable, MutImmutable};
22+
use syntax::ast::{MutMutable, MutImmutable, Unsafety};
2523
use util::ppaux::mt_to_string;
2624
use util::ppaux::Repr;
2725

@@ -83,13 +81,6 @@ impl<'f, 'tcx> Combine<'tcx> for Lub<'f, 'tcx> {
8381
}
8482
}
8583

86-
fn oncenesses(&self, a: Onceness, b: Onceness) -> cres<'tcx, Onceness> {
87-
match (a, b) {
88-
(Once, _) | (_, Once) => Ok(Once),
89-
(Many, Many) => Ok(Many)
90-
}
91-
}
92-
9384
fn builtin_bounds(&self,
9485
a: ty::BuiltinBounds,
9586
b: ty::BuiltinBounds)

src/librustc/middle/infer/sub.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use middle::ty::{self, Ty};
2323
use middle::ty::TyVar;
2424
use util::ppaux::{Repr};
2525

26-
use syntax::ast::{Onceness, MutImmutable, MutMutable, Unsafety};
26+
use syntax::ast::{MutImmutable, MutMutable, Unsafety};
2727

2828

2929
/// "Greatest lower bound" (common subtype)
@@ -99,12 +99,6 @@ impl<'f, 'tcx> Combine<'tcx> for Sub<'f, 'tcx> {
9999
})
100100
}
101101

102-
fn oncenesses(&self, a: Onceness, b: Onceness) -> cres<'tcx, Onceness> {
103-
self.lub().oncenesses(a, b).compare(b, || {
104-
ty::terr_onceness_mismatch(expected_found(self, a, b))
105-
})
106-
}
107-
108102
fn builtin_bounds(&self, a: BuiltinBounds, b: BuiltinBounds)
109103
-> cres<'tcx, BuiltinBounds> {
110104
// More bounds is a subtype of fewer bounds.

src/librustc/middle/ty.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ use std::collections::{HashMap, HashSet};
8181
use syntax::abi;
8282
use syntax::ast::{CrateNum, DefId, Ident, ItemTrait, LOCAL_CRATE};
8383
use syntax::ast::{MutImmutable, MutMutable, Name, NamedField, NodeId};
84-
use syntax::ast::{Onceness, StmtExpr, StmtSemi, StructField, UnnamedField};
85-
use syntax::ast::{Visibility};
84+
use syntax::ast::{StmtExpr, StmtSemi, StructField, UnnamedField, Visibility};
8685
use syntax::ast_util::{self, is_local, lit_is_str, local_def, PostExpansionMethod};
8786
use syntax::attr::{self, AttrMetaMethods};
8887
use syntax::codemap::Span;
@@ -1535,7 +1534,6 @@ pub struct expected_found<T> {
15351534
pub enum type_err<'tcx> {
15361535
terr_mismatch,
15371536
terr_unsafety_mismatch(expected_found<ast::Unsafety>),
1538-
terr_onceness_mismatch(expected_found<Onceness>),
15391537
terr_abi_mismatch(expected_found<abi::Abi>),
15401538
terr_mutability,
15411539
terr_box_mutability,
@@ -4737,11 +4735,6 @@ pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String {
47374735
values.expected,
47384736
values.found)
47394737
}
4740-
terr_onceness_mismatch(values) => {
4741-
format!("expected {} fn, found {} fn",
4742-
values.expected,
4743-
values.found)
4744-
}
47454738
terr_mutability => "values differ in mutability".to_string(),
47464739
terr_box_mutability => {
47474740
"boxed values differ in mutability".to_string()

src/libsyntax/ast.rs

-16
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ pub use self::MacStmtStyle::*;
3535
pub use self::MetaItem_::*;
3636
pub use self::Method_::*;
3737
pub use self::Mutability::*;
38-
pub use self::Onceness::*;
3938
pub use self::Pat_::*;
4039
pub use self::PathListItem_::*;
4140
pub use self::PatWildKind::*;
@@ -1222,21 +1221,6 @@ pub enum PrimTy {
12221221
TyChar
12231222
}
12241223

1225-
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy, Show)]
1226-
pub enum Onceness {
1227-
Once,
1228-
Many
1229-
}
1230-
1231-
impl fmt::Display for Onceness {
1232-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1233-
fmt::Display::fmt(match *self {
1234-
Once => "once",
1235-
Many => "many",
1236-
}, f)
1237-
}
1238-
}
1239-
12401224
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
12411225
pub struct BareFnTy {
12421226
pub unsafety: Unsafety,

0 commit comments

Comments
 (0)