From a277081ee481174cd28f7e85aaf1c4de912cbf4f Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 11 Dec 2012 11:59:45 -0800 Subject: [PATCH] Rename Owned trait to Durable --- src/libcore/core.rc | 2 +- src/libcore/kinds.rs | 15 +++-- src/libcore/task/local_data.rs | 10 +-- src/libcore/task/local_data_priv.rs | 16 ++--- src/librustc/metadata/tydecode.rs | 2 +- src/librustc/metadata/tyencode.rs | 2 +- src/librustc/middle/kind.rs | 14 ++-- src/librustc/middle/lang_items.rs | 6 +- src/librustc/middle/ty.rs | 64 +++++++++---------- src/librustc/middle/typeck/astconv.rs | 16 ++--- src/librustc/middle/typeck/check/method.rs | 2 +- src/librustc/middle/typeck/check/regionck.rs | 1 - src/librustc/middle/typeck/collect.rs | 8 +-- src/librustc/middle/typeck/rscope.rs | 4 +- src/librustc/util/ppaux.rs | 2 +- src/libstd/deque.rs | 2 +- src/test/compile-fail/issue-2548.rs | 2 +- .../compile-fail/kindck-owned-trait-scoped.rs | 4 +- src/test/compile-fail/kindck-owned-trait.rs | 4 +- src/test/compile-fail/kindck-owned.rs | 8 +-- src/test/run-pass/alignment-gep-tup-like-1.rs | 2 +- .../close-over-big-then-small-data.rs | 2 +- src/test/run-pass/fixed-point-bind-unique.rs | 4 +- src/test/run-pass/issue-2734.rs | 2 +- src/test/run-pass/issue-2735.rs | 2 +- src/test/run-pass/issue-2904.rs | 2 +- 26 files changed, 102 insertions(+), 96 deletions(-) diff --git a/src/libcore/core.rc b/src/libcore/core.rc index bfdc0a6eb0d..853597164d2 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -167,7 +167,7 @@ pub mod util; /* Reexported core operators */ -pub use kinds::{Const, Copy, Send, Owned}; +pub use kinds::{Const, Copy, Send, Durable}; pub use ops::{Drop}; pub use ops::{Add, Sub, Mul, Div, Modulo, Neg}; pub use ops::{BitAnd, BitOr, BitXor}; diff --git a/src/libcore/kinds.rs b/src/libcore/kinds.rs index c5a4a3a9dac..52a6539077d 100644 --- a/src/libcore/kinds.rs +++ b/src/libcore/kinds.rs @@ -30,9 +30,7 @@ * Const - types that are deeply immutable. Const types are used for freezable data structures. -* Owned - types that do not contain borrowed pointers. Note that this - meaning of 'owned' conflicts with 'owned pointers'. The two notions - of ownership are different. +* Durable - types that do not contain borrowed pointers. `Copy` types include both implicitly copyable types that the compiler will copy automatically and non-implicitly copyable types that require @@ -56,7 +54,16 @@ pub trait Const { // Empty. } +#[cfg(stage0)] #[lang="owned"] -pub trait Owned { +pub trait Durable { + // Empty. +} + +#[cfg(stage1)] +#[cfg(stage2)] +#[cfg(stage3)] +#[lang="durable"] +pub trait Durable { // Empty. } diff --git a/src/libcore/task/local_data.rs b/src/libcore/task/local_data.rs index ca8cc67dc4a..d321966ac5e 100644 --- a/src/libcore/task/local_data.rs +++ b/src/libcore/task/local_data.rs @@ -47,13 +47,13 @@ * * These two cases aside, the interface is safe. */ -pub type LocalDataKey = &fn(v: @T); +pub type LocalDataKey = &fn(v: @T); /** * Remove a task-local data value from the table, returning the * reference that was originally created to insert it. */ -pub unsafe fn local_data_pop( +pub unsafe fn local_data_pop( key: LocalDataKey) -> Option<@T> { local_pop(rt::rust_get_task(), key) @@ -62,7 +62,7 @@ pub unsafe fn local_data_pop( * Retrieve a task-local data value. It will also be kept alive in the * table until explicitly removed. */ -pub unsafe fn local_data_get( +pub unsafe fn local_data_get( key: LocalDataKey) -> Option<@T> { local_get(rt::rust_get_task(), key) @@ -71,7 +71,7 @@ pub unsafe fn local_data_get( * Store a value in task-local data. If this key already has a value, * that value is overwritten (and its destructor is run). */ -pub unsafe fn local_data_set( +pub unsafe fn local_data_set( key: LocalDataKey, data: @T) { local_set(rt::rust_get_task(), key, data) @@ -80,7 +80,7 @@ pub unsafe fn local_data_set( * Modify a task-local data value. If the function returns 'None', the * data is removed (and its reference dropped). */ -pub unsafe fn local_data_modify( +pub unsafe fn local_data_modify( key: LocalDataKey, modify_fn: fn(Option<@T>) -> Option<@T>) { diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs index a5ae3291b87..634101ea717 100644 --- a/src/libcore/task/local_data_priv.rs +++ b/src/libcore/task/local_data_priv.rs @@ -19,7 +19,7 @@ type rust_task = libc::c_void; pub trait LocalData { } -impl @T: LocalData { } +impl @T: LocalData { } impl LocalData: Eq { pure fn eq(&self, other: &@LocalData) -> bool unsafe { @@ -67,7 +67,7 @@ unsafe fn get_task_local_map(task: *rust_task) -> TaskLocalMap { } } -unsafe fn key_to_key_value( +unsafe fn key_to_key_value( key: LocalDataKey) -> *libc::c_void { // Keys are closures, which are (fnptr,envptr) pairs. Use fnptr. @@ -77,7 +77,7 @@ unsafe fn key_to_key_value( } // If returning Some(..), returns with @T with the map's reference. Careful! -unsafe fn local_data_lookup( +unsafe fn local_data_lookup( map: TaskLocalMap, key: LocalDataKey) -> Option<(uint, *libc::c_void)> { @@ -95,7 +95,7 @@ unsafe fn local_data_lookup( } } -unsafe fn local_get_helper( +unsafe fn local_get_helper( task: *rust_task, key: LocalDataKey, do_pop: bool) -> Option<@T> { @@ -117,21 +117,21 @@ unsafe fn local_get_helper( } -pub unsafe fn local_pop( +pub unsafe fn local_pop( task: *rust_task, key: LocalDataKey) -> Option<@T> { local_get_helper(task, key, true) } -pub unsafe fn local_get( +pub unsafe fn local_get( task: *rust_task, key: LocalDataKey) -> Option<@T> { local_get_helper(task, key, false) } -pub unsafe fn local_set( +pub unsafe fn local_set( task: *rust_task, key: LocalDataKey, data: @T) { let map = get_task_local_map(task); @@ -163,7 +163,7 @@ pub unsafe fn local_set( } } -pub unsafe fn local_modify( +pub unsafe fn local_modify( task: *rust_task, key: LocalDataKey, modify_fn: fn(Option<@T>) -> Option<@T>) { diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 9289e17eeb2..f30acfdbdd2 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -487,7 +487,7 @@ fn parse_bounds(st: @pstate, conv: conv_did) -> @~[ty::param_bound] { 'S' => ty::bound_send, 'C' => ty::bound_copy, 'K' => ty::bound_const, - 'O' => ty::bound_owned, + 'O' => ty::bound_durable, 'I' => ty::bound_trait(parse_ty(st, conv)), '.' => break, _ => fail ~"parse_bounds: bad bounds" diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index d4abf099e6e..0a095421bd6 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -395,7 +395,7 @@ fn enc_bounds(w: io::Writer, cx: @ctxt, bs: @~[ty::param_bound]) { ty::bound_send => w.write_char('S'), ty::bound_copy => w.write_char('C'), ty::bound_const => w.write_char('K'), - ty::bound_owned => w.write_char('O'), + ty::bound_durable => w.write_char('O'), ty::bound_trait(tp) => { w.write_char('I'); enc_ty(w, cx, tp); diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index 8075fdfe65e..fa4614d52aa 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -64,8 +64,8 @@ fn kind_to_str(k: Kind) -> ~str { if ty::kind_can_be_sent(k) { kinds.push(~"send"); - } else if ty::kind_is_owned(k) { - kinds.push(~"owned"); + } else if ty::kind_is_durable(k) { + kinds.push(~"durable"); } str::connect(kinds, ~" ") @@ -136,7 +136,7 @@ fn check_for_uniq(cx: ctx, id: node_id, fv: Option<@freevar_entry>, fn check_for_box(cx: ctx, id: node_id, fv: Option<@freevar_entry>, is_move: bool, var_t: ty::t, sp: span) { // all captured data must be owned - if !check_owned(cx.tcx, var_t, sp) { return; } + if !check_durable(cx.tcx, var_t, sp) { return; } // copied in data must be copyable, but moved in data can be anything let is_implicit = fv.is_some(); @@ -555,12 +555,12 @@ fn check_send(cx: ctx, ty: ty::t, sp: span) -> bool { } // note: also used from middle::typeck::regionck! -fn check_owned(tcx: ty::ctxt, ty: ty::t, sp: span) -> bool { - if !ty::kind_is_owned(ty::type_kind(tcx, ty)) { +fn check_durable(tcx: ty::ctxt, ty: ty::t, sp: span) -> bool { + if !ty::kind_is_durable(ty::type_kind(tcx, ty)) { match ty::get(ty).sty { ty::ty_param(*) => { tcx.sess.span_err(sp, ~"value may contain borrowed \ - pointers; use `owned` bound"); + pointers; use `durable` bound"); } _ => { tcx.sess.span_err(sp, ~"value may contain borrowed \ @@ -632,7 +632,7 @@ fn check_cast_for_escaping_regions( if target_params.contains(&source_param) { /* case (2) */ } else { - check_owned(cx.tcx, ty, source.span); /* case (3) */ + check_durable(cx.tcx, ty, source.span); /* case (3) */ } } _ => {} diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 2841c791d48..aa72ae1d4e2 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -36,7 +36,7 @@ struct LanguageItems { mut const_trait: Option, mut copy_trait: Option, mut send_trait: Option, - mut owned_trait: Option, + mut durable_trait: Option, mut drop_trait: Option, @@ -69,7 +69,7 @@ fn make() -> LanguageItems { const_trait: None, copy_trait: None, send_trait: None, - owned_trait: None, + durable_trait: None, drop_trait: None, @@ -106,7 +106,7 @@ fn LanguageItemCollector(crate: @crate, session: Session, item_refs.insert(~"const", &mut items.const_trait); item_refs.insert(~"copy", &mut items.copy_trait); item_refs.insert(~"send", &mut items.send_trait); - item_refs.insert(~"owned", &mut items.owned_trait); + item_refs.insert(~"durable", &mut items.durable_trait); item_refs.insert(~"drop", &mut items.drop_trait); diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 1ef91bfda88..561ca37774b 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -140,7 +140,7 @@ export kind_can_be_copied, kind_can_be_sent, kind_can_be_implicitly_copied; export type_implicitly_moves; export kind_is_safe_for_default_mode; -export kind_is_owned; +export kind_is_durable; export meta_kind, kind_lteq, type_kind; export operators; export type_err, terr_vstore_kind; @@ -176,7 +176,7 @@ export walk_ty, maybe_walk_ty; export occurs_check; export param_ty; -export param_bound, param_bounds, bound_copy, bound_owned; +export param_bound, param_bounds, bound_copy, bound_durable; export param_bounds_to_str, param_bound_to_str; export bound_send, bound_trait; export param_bounds_to_kind; @@ -702,7 +702,7 @@ enum type_err { enum param_bound { bound_copy, - bound_owned, + bound_durable, bound_send, bound_const, bound_trait(t), @@ -769,7 +769,7 @@ impl param_bound : to_bytes::IterBytes { pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { match *self { bound_copy => 0u8.iter_bytes(lsb0, f), - bound_owned => 1u8.iter_bytes(lsb0, f), + bound_durable => 1u8.iter_bytes(lsb0, f), bound_send => 2u8.iter_bytes(lsb0, f), bound_const => 3u8.iter_bytes(lsb0, f), bound_trait(ref t) => @@ -873,11 +873,11 @@ fn param_bounds_to_kind(bounds: param_bounds) -> Kind { bound_copy => { kind = raise_kind(kind, kind_implicitly_copyable()); } - bound_owned => { - kind = raise_kind(kind, kind_owned()); + bound_durable => { + kind = raise_kind(kind, kind_durable()); } bound_send => { - kind = raise_kind(kind, kind_send_only() | kind_owned()); + kind = raise_kind(kind, kind_send_only() | kind_durable()); } bound_const => { kind = raise_kind(kind, kind_const()); @@ -1549,7 +1549,7 @@ fn substs_to_str(cx: ctxt, substs: &substs) -> ~str { fn param_bound_to_str(cx: ctxt, pb: ¶m_bound) -> ~str { match *pb { bound_copy => ~"copy", - bound_owned => ~"owned", + bound_durable => ~"durable", bound_send => ~"send", bound_const => ~"const", bound_trait(t) => ty_to_str(cx, t) @@ -1908,11 +1908,11 @@ enum Kind { kind_(u32) } /// can be copied (implicitly or explicitly) const KIND_MASK_COPY : u32 = 0b000000000000000000000000001_u32; -/// can be sent: no shared box, borrowed ptr (must imply OWNED) +/// can be sent: no shared box, borrowed ptr (must imply DURABLE) const KIND_MASK_SEND : u32 = 0b000000000000000000000000010_u32; -/// is owned (no borrowed ptrs) -const KIND_MASK_OWNED : u32 = 0b000000000000000000000000100_u32; +/// is durable (no borrowed ptrs) +const KIND_MASK_DURABLE : u32 = 0b000000000000000000000000100_u32; /// is deeply immutable const KIND_MASK_CONST : u32 = 0b000000000000000000000001000_u32; @@ -1963,8 +1963,8 @@ fn kind_const() -> Kind { kind_(KIND_MASK_CONST) } -fn kind_owned() -> Kind { - kind_(KIND_MASK_OWNED) +fn kind_durable() -> Kind { + kind_(KIND_MASK_DURABLE) } fn kind_top() -> Kind { @@ -1983,8 +1983,8 @@ fn remove_send(k: Kind) -> Kind { k - kind_(KIND_MASK_SEND) } -fn remove_owned_send(k: Kind) -> Kind { - k - kind_(KIND_MASK_OWNED) - kind_(KIND_MASK_SEND) +fn remove_durable_send(k: Kind) -> Kind { + k - kind_(KIND_MASK_DURABLE) - kind_(KIND_MASK_SEND) } fn remove_copyable(k: Kind) -> Kind { @@ -2034,23 +2034,23 @@ impl Kind : ops::Sub { *k & KIND_MASK_SEND == KIND_MASK_SEND } -pure fn kind_is_owned(k: Kind) -> bool { - *k & KIND_MASK_OWNED == KIND_MASK_OWNED +pure fn kind_is_durable(k: Kind) -> bool { + *k & KIND_MASK_DURABLE == KIND_MASK_DURABLE } fn meta_kind(p: FnMeta) -> Kind { match p.proto { // XXX consider the kind bounds! ast::ProtoBare => { - kind_safe_for_default_mode_send() | kind_const() | kind_owned() + kind_safe_for_default_mode_send() | kind_const() | kind_durable() } ast::ProtoBorrowed => { kind_noncopyable() | kind_(KIND_MASK_DEFAULT_MODE) } ast::ProtoBox => { - kind_safe_for_default_mode() | kind_owned() + kind_safe_for_default_mode() | kind_durable() } ast::ProtoUniq => { - kind_send_copy() | kind_owned() + kind_send_copy() | kind_durable() } } } @@ -2113,15 +2113,15 @@ fn type_kind(cx: ctxt, ty: t) -> Kind { // Scalar and unique types are sendable, constant, and owned ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) | ty_ptr(_) => { - kind_safe_for_default_mode_send() | kind_const() | kind_owned() + kind_safe_for_default_mode_send() | kind_const() | kind_durable() } // Implicit copyability of strs is configurable ty_estr(vstore_uniq) => { if cx.vecs_implicitly_copyable { - kind_implicitly_sendable() | kind_const() | kind_owned() + kind_implicitly_sendable() | kind_const() | kind_durable() } else { - kind_send_copy() | kind_const() | kind_owned() + kind_send_copy() | kind_const() | kind_durable() } } @@ -2135,7 +2135,7 @@ fn type_kind(cx: ctxt, ty: t) -> Kind { } // Trait instances are (for now) like shared boxes, basically - ty_trait(_, _, _) => kind_safe_for_default_mode() | kind_owned(), + ty_trait(_, _, _) => kind_safe_for_default_mode() | kind_durable(), // Static region pointers are copyable and sendable, but not owned ty_rptr(re_static, mt) => @@ -2167,8 +2167,8 @@ fn type_kind(cx: ctxt, ty: t) -> Kind { kind_safe_for_default_mode() | mutable_type_kind(cx, tm) } ty_evec(tm, vstore_slice(_)) => { - remove_owned_send(kind_safe_for_default_mode() | - mutable_type_kind(cx, tm)) + remove_durable_send(kind_safe_for_default_mode() | + mutable_type_kind(cx, tm)) } ty_evec(tm, vstore_fixed(_)) => { mutable_type_kind(cx, tm) @@ -2176,7 +2176,7 @@ fn type_kind(cx: ctxt, ty: t) -> Kind { // All estrs are copyable; uniques and interiors are sendable. ty_estr(vstore_box) => { - kind_safe_for_default_mode() | kind_const() | kind_owned() + kind_safe_for_default_mode() | kind_const() | kind_durable() } ty_estr(vstore_slice(re_static)) => { kind_safe_for_default_mode() | kind_send_copy() | kind_const() @@ -2185,7 +2185,7 @@ fn type_kind(cx: ctxt, ty: t) -> Kind { kind_safe_for_default_mode() | kind_const() } ty_estr(vstore_fixed(_)) => { - kind_safe_for_default_mode_send() | kind_const() | kind_owned() + kind_safe_for_default_mode_send() | kind_const() | kind_durable() } // Records lower to the lowest of their members. @@ -2226,7 +2226,7 @@ fn type_kind(cx: ctxt, ty: t) -> Kind { let mut lowest = kind_top(); let variants = enum_variants(cx, did); if vec::len(*variants) == 0u { - lowest = kind_send_only() | kind_owned(); + lowest = kind_send_only() | kind_durable(); } else { for vec::each(*variants) |variant| { for variant.args.each |aty| { @@ -4237,7 +4237,7 @@ fn iter_bound_traits_and_supertraits(tcx: ctxt, ty::bound_trait(bound_t) => bound_t, ty::bound_copy | ty::bound_send | - ty::bound_const | ty::bound_owned => { + ty::bound_const | ty::bound_durable => { loop; // skip non-trait bounds } }; @@ -4647,9 +4647,9 @@ impl param_bound : cmp::Eq { _ => false } } - bound_owned => { + bound_durable => { match (*other) { - bound_owned => true, + bound_durable => true, _ => false } } diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index ab0fedb5e6b..4c44642b325 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -80,7 +80,7 @@ fn get_region_reporting_err(tcx: ty::ctxt, } } -fn ast_region_to_region( +fn ast_region_to_region( self: AC, rscope: RS, span: span, a_r: @ast::region) -> ty::Region { let res = match a_r.node { @@ -93,7 +93,7 @@ fn ast_region_to_region( get_region_reporting_err(self.tcx(), span, res) } -fn ast_path_to_substs_and_ty( +fn ast_path_to_substs_and_ty( self: AC, rscope: RS, did: ast::def_id, path: @ast::path) -> ty_param_substs_and_ty { @@ -142,7 +142,7 @@ fn ast_path_to_substs_and_ty( {substs: substs, ty: ty::subst(tcx, &substs, decl_ty)} } -pub fn ast_path_to_ty( +pub fn ast_path_to_ty( self: AC, rscope: RS, did: ast::def_id, @@ -165,10 +165,10 @@ pub fn ast_path_to_ty( // Parses the programmer's textual representation of a type into our // internal notion of a type. `getter` is a function that returns the type // corresponding to a definition ID: -fn ast_ty_to_ty( +fn ast_ty_to_ty( self: AC, rscope: RS, &&ast_ty: @ast::Ty) -> ty::t { - fn ast_mt_to_mt( + fn ast_mt_to_mt( self: AC, rscope: RS, mt: ast::mt) -> ty::mt { return {ty: ast_ty_to_ty(self, rscope, mt.ty), mutbl: mt.mutbl}; @@ -177,7 +177,7 @@ fn ast_mt_to_mt( // Handle @, ~, and & being able to mean estrs and evecs. // If a_seq_ty is a str or a vec, make it an estr/evec. // Also handle function sigils and first-class trait types. - fn mk_pointer( + fn mk_pointer( self: AC, rscope: RS, a_seq_ty: ast::mt, @@ -390,7 +390,7 @@ fn check_path_args(tcx: ty::ctxt, return typ; } -fn ty_of_arg( +fn ty_of_arg( self: AC, rscope: RS, a: ast::arg, expected_ty: Option) -> ty::arg { @@ -439,7 +439,7 @@ fn ty_of_arg( type expected_tys = Option<{inputs: ~[ty::arg], output: ty::t}>; -fn ty_of_fn_decl( +fn ty_of_fn_decl( self: AC, rscope: RS, ast_proto: ast::Proto, purity: ast::purity, diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index aa3f5ad39c4..845c13f3879 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -343,7 +343,7 @@ fn push_inherent_candidates_from_param(&self, ty::bound_trait(bound_t) => bound_t, ty::bound_copy | ty::bound_send | - ty::bound_const | ty::bound_owned => { + ty::bound_const | ty::bound_durable => { loop; // skip non-trait bounds } }; diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs index 41918d42da4..5467eae8266 100644 --- a/src/librustc/middle/typeck/check/regionck.rs +++ b/src/librustc/middle/typeck/check/regionck.rs @@ -28,7 +28,6 @@ */ use middle::freevars::get_freevars; -use middle::kind::check_owned; use middle::pat_util::pat_bindings; use middle::ty::{encl_region, re_scope}; use middle::ty::{ty_fn_proto, vstore_box, vstore_fixed, vstore_slice}; diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 8e8d7380f8f..d14646fa220 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -88,7 +88,7 @@ fn collect_item_types(ccx: @crate_ctxt, crate: @ast::crate) { } impl @crate_ctxt { - fn to_ty( + fn to_ty( rs: RS, ast_ty: @ast::Ty) -> ty::t { ast_ty_to_ty(self, rs, ast_ty) @@ -863,7 +863,7 @@ fn ty_of_foreign_item(ccx: @crate_ctxt, it: @ast::foreign_item) // Translate the AST's notion of ty param bounds (which are just newtyped Tys) // to ty's notion of ty param bounds, which can either be user-defined traits, // or one of the four built-in traits (formerly known as kinds): Const, Copy, -// Owned, and Send. +// Durable, and Send. fn compute_bounds(ccx: @crate_ctxt, ast_bounds: @~[ast::ty_param_bound]) -> ty::param_bounds { @do vec::flat_map(*ast_bounds) |b| { @@ -881,8 +881,8 @@ fn compute_bounds(ccx: @crate_ctxt, else if d == li.const_trait { ~[ty::bound_const] } - else if d == li.owned_trait { - ~[ty::bound_owned] + else if d == li.durable_trait { + ~[ty::bound_durable] } else { // Must be a user-defined trait diff --git a/src/librustc/middle/typeck/rscope.rs b/src/librustc/middle/typeck/rscope.rs index cbbb417eae6..5fba2b7e6fa 100644 --- a/src/librustc/middle/typeck/rscope.rs +++ b/src/librustc/middle/typeck/rscope.rs @@ -60,7 +60,7 @@ fn bound_self_region(rp: Option) -> Option { } enum anon_rscope = {anon: ty::Region, base: region_scope}; -fn in_anon_rscope(self: RS, r: ty::Region) +fn in_anon_rscope(self: RS, r: ty::Region) -> @anon_rscope { @anon_rscope({anon: r, base: self as region_scope}) } @@ -80,7 +80,7 @@ struct binding_rscope { base: region_scope, mut anon_bindings: uint, } -fn in_binding_rscope(self: RS) +fn in_binding_rscope(self: RS) -> @binding_rscope { let base = self as region_scope; @binding_rscope { base: base, anon_bindings: 0 } diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 069a9c2875d..b5494c35a83 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -11,7 +11,7 @@ use std::map::HashMap; use middle::ty; use middle::ty::{arg, canon_mode}; -use middle::ty::{bound_copy, bound_const, bound_owned, bound_send, +use middle::ty::{bound_copy, bound_const, bound_durable, bound_send, bound_trait}; use middle::ty::{bound_region, br_anon, br_named, br_self, br_cap_avoid}; use middle::ty::{ctxt, field, method}; diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index 96d57297cf7..687eff887c8 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -210,7 +210,7 @@ fn test_boxes() { assert (deq.get(3) == d); } - fn test_parameterized(a: T, b: T, c: T, d: T) { + fn test_parameterized(a: T, b: T, c: T, d: T) { let deq: deque::Deque = deque::create::(); assert (deq.size() == 0u); deq.add_front(a); diff --git a/src/test/compile-fail/issue-2548.rs b/src/test/compile-fail/issue-2548.rs index abf70a4995f..16b6360b559 100644 --- a/src/test/compile-fail/issue-2548.rs +++ b/src/test/compile-fail/issue-2548.rs @@ -34,7 +34,7 @@ fn main() { let mut res = foo(x); let mut v = ~[mut]; - v = move ~[mut (move res)] + v; //~ ERROR instantiating a type parameter with an incompatible type (needs `copy`, got `owned`, missing `copy`) + v = move ~[mut (move res)] + v; //~ ERROR instantiating a type parameter with an incompatible type (needs `copy`, got `durable`, missing `copy`) assert (v.len() == 2); } diff --git a/src/test/compile-fail/kindck-owned-trait-scoped.rs b/src/test/compile-fail/kindck-owned-trait-scoped.rs index 3b2e8e53aaa..d1eae60ac9d 100644 --- a/src/test/compile-fail/kindck-owned-trait-scoped.rs +++ b/src/test/compile-fail/kindck-owned-trait-scoped.rs @@ -32,10 +32,10 @@ fn to_foo(t: T) { fn to_foo_2(t: T) -> foo { // Not OK---T may contain borrowed ptrs and it is going to escape // as part of the returned foo value - {f:t} as foo //~ ERROR value may contain borrowed pointers; use `owned` bound + {f:t} as foo //~ ERROR value may contain borrowed pointers; use `durable` bound } -fn to_foo_3(t: T) -> foo { +fn to_foo_3(t: T) -> foo { // OK---T may escape as part of the returned foo value, but it is // owned and hence does not contain borrowed ptrs {f:t} as foo diff --git a/src/test/compile-fail/kindck-owned-trait.rs b/src/test/compile-fail/kindck-owned-trait.rs index 249c786c424..35dc066e320 100644 --- a/src/test/compile-fail/kindck-owned-trait.rs +++ b/src/test/compile-fail/kindck-owned-trait.rs @@ -11,10 +11,10 @@ trait foo { fn foo(); } fn to_foo(t: T) -> foo { - t as foo //~ ERROR value may contain borrowed pointers; use `owned` bound + t as foo //~ ERROR value may contain borrowed pointers; use `durable` bound } -fn to_foo2(t: T) -> foo { +fn to_foo2(t: T) -> foo { t as foo } diff --git a/src/test/compile-fail/kindck-owned.rs b/src/test/compile-fail/kindck-owned.rs index 788c211e272..111b621c5a0 100644 --- a/src/test/compile-fail/kindck-owned.rs +++ b/src/test/compile-fail/kindck-owned.rs @@ -12,18 +12,18 @@ fn copy1(t: T) -> fn@() -> T { fn@() -> T { t } //~ ERROR value may contain borrowed pointers } -fn copy2(t: T) -> fn@() -> T { +fn copy2(t: T) -> fn@() -> T { fn@() -> T { t } } fn main() { let x = &3; - copy2(&x); //~ ERROR missing `owned` + copy2(&x); //~ ERROR missing `durable` copy2(@3); - copy2(@&x); //~ ERROR missing `owned` + copy2(@&x); //~ ERROR missing `durable` copy2(fn@() {}); copy2(fn~() {}); //~ WARNING instantiating copy type parameter with a not implicitly copyable type - copy2(fn&() {}); //~ ERROR missing `copy owned` + copy2(fn&() {}); //~ ERROR missing `copy durable` } diff --git a/src/test/run-pass/alignment-gep-tup-like-1.rs b/src/test/run-pass/alignment-gep-tup-like-1.rs index 7bc7e3a97c8..8acbee4400c 100644 --- a/src/test/run-pass/alignment-gep-tup-like-1.rs +++ b/src/test/run-pass/alignment-gep-tup-like-1.rs @@ -12,7 +12,7 @@ a: A, b: B }; -fn f(a: A, b: u16) -> fn@() -> (A, u16) { +fn f(a: A, b: u16) -> fn@() -> (A, u16) { fn@() -> (A, u16) { (a, b) } } diff --git a/src/test/run-pass/close-over-big-then-small-data.rs b/src/test/run-pass/close-over-big-then-small-data.rs index 025e874ce48..a0b55a1ea8d 100644 --- a/src/test/run-pass/close-over-big-then-small-data.rs +++ b/src/test/run-pass/close-over-big-then-small-data.rs @@ -16,7 +16,7 @@ a: A, b: B }; -fn f(a: A, b: u16) -> fn@() -> (A, u16) { +fn f(a: A, b: u16) -> fn@() -> (A, u16) { fn@() -> (A, u16) { (a, b) } } diff --git a/src/test/run-pass/fixed-point-bind-unique.rs b/src/test/run-pass/fixed-point-bind-unique.rs index 69f7fa0a81f..80109170ac6 100644 --- a/src/test/run-pass/fixed-point-bind-unique.rs +++ b/src/test/run-pass/fixed-point-bind-unique.rs @@ -11,11 +11,11 @@ // xfail-fast #[legacy_modes]; -fn fix_help(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B { +fn fix_help(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B { return f({|a|fix_help(f, a)}, x); } -fn fix(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B { +fn fix(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B { return {|a|fix_help(f, a)}; } diff --git a/src/test/run-pass/issue-2734.rs b/src/test/run-pass/issue-2734.rs index ff773d9ae17..7156e015473 100644 --- a/src/test/run-pass/issue-2734.rs +++ b/src/test/run-pass/issue-2734.rs @@ -11,7 +11,7 @@ trait hax { } impl A: hax { } -fn perform_hax(x: @T) -> hax { +fn perform_hax(x: @T) -> hax { x as hax } diff --git a/src/test/run-pass/issue-2735.rs b/src/test/run-pass/issue-2735.rs index 4b45d4dcc74..360e7b3c241 100644 --- a/src/test/run-pass/issue-2735.rs +++ b/src/test/run-pass/issue-2735.rs @@ -11,7 +11,7 @@ trait hax { } impl A: hax { } -fn perform_hax(x: @T) -> hax { +fn perform_hax(x: @T) -> hax { x as hax } diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index 506f9dfa64e..33e5e386e39 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -59,7 +59,7 @@ fn square_from_char(c: char) -> square { } } -fn read_board_grid(+in: rdr) -> ~[~[square]] { +fn read_board_grid(+in: rdr) -> ~[~[square]] { let in = (move in) as io::Reader; let mut grid = ~[]; for in.each_line |line| { -- GitLab