diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index e1ed9fe396a..6f4716208a2 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -421,7 +421,7 @@ fn encode_info_for_mod(ecx: @encode_ctxt, ebml_w: ebml::writer, md: _mod, } _ { // Must be a re-export, then! - // ...or an iface ref + // ...or a trait ref ebml_w.wr_str(def_to_str(did)); } }; diff --git a/src/rustc/middle/kind.rs b/src/rustc/middle/kind.rs index 81d87e9d291..34529710825 100644 --- a/src/rustc/middle/kind.rs +++ b/src/rustc/middle/kind.rs @@ -466,7 +466,7 @@ fn check_owned(tcx: ty::ctxt, ty: ty::t, sp: span) -> bool { } /// This is rather subtle. When we are casting a value to a -/// instantiated iface like `a as iface/&r`, regionck already ensures +/// instantiated trait like `a as trait/&r`, regionck already ensures /// that any borrowed pointers that appear in the type of `a` are /// bounded by `&r`. However, it is possible that there are *type /// parameters* in the type of `a`, and those *type parameters* may @@ -475,14 +475,14 @@ fn check_owned(tcx: ty::ctxt, ty: ty::t, sp: span) -> bool { /// /// Therefore, we ensure that one of three conditions holds: /// -/// (1) The iface instance cannot escape the current fn. This is +/// (1) The trait instance cannot escape the current fn. This is /// guaranteed if the region bound `&r` is some scope within the fn /// itself. This case is safe because whatever borrowed pointers are /// found within the type parameter, they must enclose the fn body /// itself. /// -/// (2) The type parameter appears in the type of the iface. For -/// example, if the type parameter is `T` and the iface type is +/// (2) The type parameter appears in the type of the trait. For +/// example, if the type parameter is `T` and the trait type is /// `deque`, then whatever borrowed ptrs may appear in `T` also /// appear in `deque`. /// @@ -493,7 +493,7 @@ fn check_cast_for_escaping_regions( source: @expr, target: @expr) { - // Determine what type we are casting to; if it is not an iface, then no + // Determine what type we are casting to; if it is not an trait, then no // worries. let target_ty = ty::expr_ty(cx.tcx, target); let target_substs = alt ty::get(target_ty).struct { @@ -501,7 +501,7 @@ fn check_cast_for_escaping_regions( _ => { ret; /* not a cast to a trait */ } }; - // Check, based on the region associated with the iface, whether it can + // Check, based on the region associated with the trait, whether it can // possibly escape the enclosing fn item (note that all type parameters // must have been declared on the enclosing fn item): alt target_substs.self_r { @@ -514,8 +514,8 @@ fn check_cast_for_escaping_regions( } } - // Assuming the iface instance can escape, then ensure that each parameter - // either appears in the iface type or is owned: + // Assuming the trait instance can escape, then ensure that each parameter + // either appears in the trait type or is owned: let target_params = ty::param_tys_in_type(target_ty); let source_ty = ty::expr_ty(cx.tcx, source); do ty::walk_ty(source_ty) |ty| { diff --git a/src/rustc/middle/resolve3.rs b/src/rustc/middle/resolve3.rs index 8b40d8136ab..c49a6889f05 100644 --- a/src/rustc/middle/resolve3.rs +++ b/src/rustc/middle/resolve3.rs @@ -3365,7 +3365,7 @@ class Resolver { none { self.session.span_err(interface.path.span, ~"attempt to implement a \ - nonexistent interface"); + nonexistent trait"); } some(def) { // Write a mapping from the interface ID to the diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index e58de56703a..a2ba9277fd0 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -1611,7 +1611,7 @@ fn type_kind(cx: ctxt, ty: t) -> kind { remove_send(mutable_type_kind(cx, tm) | kind_safe_for_default_mode()) } - // Iface instances are (for now) like shared boxes, basically + // Trait instances are (for now) like shared boxes, basically ty_trait(_, _) { kind_safe_for_default_mode() | kind_owned() } // Region pointers are copyable but NOT owned nor sendable @@ -1711,7 +1711,7 @@ fn type_kind(cx: ctxt, ty: t) -> kind { param_bounds_to_kind(cx.ty_param_bounds.get(p.def_id.node)) } - // self is a special type parameter that can only appear in ifaces; it + // self is a special type parameter that can only appear in traits; it // is never bounded in any way, hence it has the bottom kind. ty_self { kind_noncopyable() } diff --git a/src/rustc/middle/typeck/check/method.rs b/src/rustc/middle/typeck/check/method.rs index 6f1e97bc342..585d0ccf5cf 100644 --- a/src/rustc/middle/typeck/check/method.rs +++ b/src/rustc/middle/typeck/check/method.rs @@ -258,7 +258,7 @@ class lookup { self.tcx().sess.span_err( self.expr.span, ~"can not call a method that contains a \ - self type through a boxed iface"); + self type through a boxed trait"); } if (*m.tps).len() > 0u { diff --git a/src/rustc/middle/typeck/check/regionck.rs b/src/rustc/middle/typeck/check/regionck.rs index b307460628a..850181576ab 100644 --- a/src/rustc/middle/typeck/check/regionck.rs +++ b/src/rustc/middle/typeck/check/regionck.rs @@ -137,9 +137,9 @@ fn visit_expr(e: @ast::expr, &&rcx: @rcx, v: rvt) { } ast::expr_cast(source, _) { - // Determine if we are casting `source` to an iface instance. + // Determine if we are casting `source` to an trait instance. // If so, we have to be sure that the type of the source obeys - // the iface's region bound. + // the trait's region bound. // // Note: there is a subtle point here concerning type // parameters. It is possible that the type of `source` @@ -155,12 +155,12 @@ fn visit_expr(e: @ast::expr, &&rcx: @rcx, v: rvt) { result::ok(target_ty) => { alt ty::get(target_ty).struct { ty::ty_trait(_, substs) { - let iface_region = alt substs.self_r { + let trait_region = alt substs.self_r { some(r) => {r} none => {ty::re_static} }; let source_ty = rcx.fcx.expr_ty(source); - constrain_regions_in_type(rcx, iface_region, + constrain_regions_in_type(rcx, trait_region, e.span, source_ty); } _ { } diff --git a/src/rustc/middle/typeck/check/vtable.rs b/src/rustc/middle/typeck/check/vtable.rs index 51a412be718..f023f3aeae7 100644 --- a/src/rustc/middle/typeck/check/vtable.rs +++ b/src/rustc/middle/typeck/check/vtable.rs @@ -100,11 +100,11 @@ fn lookup_vtable(fcx: @fn_ctxt, sp: span, ty: ty::t, trait_ty: ty::t, for vec::each(*ty::trait_methods(tcx, did)) |m| { if ty::type_has_self(ty::mk_fn(tcx, m.fty)) { tcx.sess.span_err( - sp, ~"a boxed iface with self types may not be \ + sp, ~"a boxed trait with self types may not be \ passed as a bounded type"); } else if (*m.tps).len() > 0u { tcx.sess.span_err( - sp, ~"a boxed iface with generic methods may not \ + sp, ~"a boxed trait with generic methods may not \ be passed as a bounded type"); } diff --git a/src/rustc/middle/typeck/collect.rs b/src/rustc/middle/typeck/collect.rs index 60c79407e6d..d695101f877 100644 --- a/src/rustc/middle/typeck/collect.rs +++ b/src/rustc/middle/typeck/collect.rs @@ -195,7 +195,7 @@ fn compare_impl_method(tcx: ty::ctxt, sp: span, if vec::len(impl_m.fty.inputs) != vec::len(if_m.fty.inputs) { tcx.sess.span_err(sp,#fmt["method `%s` has %u parameters \ - but the iface has %u", + but the trait has %u", *if_m.ident, vec::len(impl_m.fty.inputs), vec::len(if_m.fty.inputs)]); @@ -398,7 +398,7 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) { let cms = convert_methods(ccx, methods, rp, bounds, selfty); for traits.each |trt| { check_methods_against_trait(ccx, tps, rp, selfty, trt, cms); - // trt.impl_id represents (class, iface) pair + // trt.impl_id represents (class, trait) pair write_ty_to_tcx(tcx, trt.impl_id, tpt.ty); tcx.tcache.insert(local_def(trt.impl_id), tpt); } @@ -455,7 +455,7 @@ fn ty_of_ty_method(self: @crate_ctxt, fn instantiate_trait_ref(ccx: @crate_ctxt, t: @ast::trait_ref, rp: bool) -> (ast::def_id, ty_param_substs_and_ty) { - let sp = t.path.span, err = ~"can only implement interface types", + let sp = t.path.span, err = ~"can only implement trait types", sess = ccx.tcx.sess; let rscope = type_rscope(rp); diff --git a/src/test/compile-fail/class-implements-int.rs b/src/test/compile-fail/class-implements-int.rs index 513b539a45e..ccc821ce78a 100644 --- a/src/test/compile-fail/class-implements-int.rs +++ b/src/test/compile-fail/class-implements-int.rs @@ -1,4 +1,4 @@ -class cat : int { //~ ERROR interface +class cat : int { //~ ERROR trait let meows: uint; new(in_x : uint) { self.meows = in_x; } } diff --git a/src/test/compile-fail/iface-impl-different-num-params.rs b/src/test/compile-fail/iface-impl-different-num-params.rs index 094dc7ac062..9c51f56e54c 100644 --- a/src/test/compile-fail/iface-impl-different-num-params.rs +++ b/src/test/compile-fail/iface-impl-different-num-params.rs @@ -3,7 +3,7 @@ iface foo { } impl of foo for int { fn bar() -> int { - //~^ ERROR method `bar` has 0 parameters but the iface has 1 + //~^ ERROR method `bar` has 0 parameters but the trait has 1 self } } diff --git a/src/test/compile-fail/issue-2330.rs b/src/test/compile-fail/issue-2330.rs index b0b21051714..9bbba8f5caf 100644 --- a/src/test/compile-fail/issue-2330.rs +++ b/src/test/compile-fail/issue-2330.rs @@ -4,8 +4,8 @@ iface channel { fn send(v: T); } -// `chan` is not an iface, it's an enum -impl of chan for int { //~ ERROR can only implement interface types +// `chan` is not a trait, it's an enum +impl of chan for int { //~ ERROR can only implement trait types fn send(v: int) { fail } } diff --git a/src/test/compile-fail/selftype-astparam.rs b/src/test/compile-fail/selftype-astparam.rs index df7f8cd6cad..64699267c4d 100644 --- a/src/test/compile-fail/selftype-astparam.rs +++ b/src/test/compile-fail/selftype-astparam.rs @@ -11,5 +11,5 @@ fn do_add(x: A, y: A) -> A { x.plus(y) } fn main() { let x = 3 as add; let y = 4 as add; - do_add(x, y); //~ ERROR a boxed iface with self types may not be passed as a bounded type + do_add(x, y); //~ ERROR a boxed trait with self types may not be passed as a bounded type } diff --git a/src/test/compile-fail/selftype-ifacetype.rs b/src/test/compile-fail/selftype-ifacetype.rs index a4bd394d529..c4ba8093886 100644 --- a/src/test/compile-fail/selftype-ifacetype.rs +++ b/src/test/compile-fail/selftype-ifacetype.rs @@ -3,7 +3,7 @@ iface add { } fn do_add(x: add, y: add) -> add { - x.plus(y) //~ ERROR can not call a method that contains a self type through a boxed iface + x.plus(y) //~ ERROR can not call a method that contains a self type through a boxed trait } fn main() {}