From 439afaa329751b3dfd6735862cd2645705598909 Mon Sep 17 00:00:00 2001 From: Lindsey Kuper Date: Tue, 31 Jul 2012 10:27:51 -0700 Subject: [PATCH] Change remaining "iface" occurrences to "trait"; deprecate "iface" --- src/fuzzer/cycles.rs | 2 +- src/libcore/float.rs | 2 +- src/libcore/future.rs | 4 +-- src/libcore/hash.rs | 2 +- src/libcore/int-template.rs | 2 +- src/libcore/io.rs | 10 +++---- src/libcore/iter.rs | 6 ++-- src/libcore/num.rs | 4 +-- src/libcore/rand.rs | 2 +- src/libcore/run.rs | 2 +- src/libcore/task.rs | 2 +- src/libcore/to_bytes.rs | 2 +- src/libcore/to_str.rs | 2 +- src/libstd/base64.rs | 4 +-- src/libstd/deque.rs | 2 +- src/libstd/json.rs | 2 +- src/libstd/map.rs | 2 +- src/libstd/net_tcp.rs | 10 +++---- src/libstd/serialization.rs | 4 +-- src/libstd/sha1.rs | 2 +- src/libsyntax/diagnostic.rs | 4 +-- src/libsyntax/ext/base.rs | 2 +- src/libsyntax/ext/pipes/pipec.rs | 2 +- src/libsyntax/ext/qquote.rs | 2 +- src/libsyntax/fold.rs | 2 +- src/libsyntax/parse/lexer.rs | 2 +- src/libsyntax/parse/parser.rs | 1 + src/libsyntax/print/pprust.rs | 2 +- src/libsyntax/util/interner.rs | 2 +- src/rt/rust_box_annihilator.cpp | 2 +- src/rt/rust_cc.cpp | 4 +-- src/rt/rust_shape.cpp | 2 +- src/rt/rust_shape.h | 18 ++++++------ src/rustc/front/intrinsic.rs | 2 +- src/rustc/metadata/filesearch.rs | 2 +- src/rustc/middle/astencode.rs | 4 +-- src/rustc/middle/borrowck.rs | 2 +- src/rustc/middle/resolve3.rs | 28 +++++++++---------- src/rustc/middle/ty.rs | 8 +++--- src/rustc/middle/typeck.rs | 2 +- src/rustc/middle/typeck/astconv.rs | 4 +-- src/rustc/middle/typeck/check/method.rs | 2 +- src/rustc/middle/typeck/check/vtable.rs | 4 +-- src/rustc/middle/typeck/collect.rs | 2 +- src/rustc/middle/typeck/infer.rs | 16 +++++------ src/rustc/middle/typeck/rscope.rs | 2 +- src/rustdoc/attr_pass.rs | 4 +-- src/rustdoc/demo.rs | 2 +- src/rustdoc/desc_to_brief_pass.rs | 2 +- src/rustdoc/doc.rs | 2 +- src/rustdoc/markdown_pass.rs | 8 +++--- src/rustdoc/sectionalize_pass.rs | 2 +- src/rustdoc/sort_item_type_pass.rs | 4 +-- src/rustdoc/text_pass.rs | 12 ++++---- src/rustdoc/tystr_pass.rs | 2 +- src/test/auxiliary/cci_class_iface.rs | 2 +- src/test/auxiliary/issue-2380.rs | 2 +- src/test/auxiliary/issue_2242_a.rs | 2 +- src/test/compile-fail/ambig_impl_bounds.rs | 4 +-- src/test/compile-fail/class-cast-to-iface.rs | 2 +- src/test/compile-fail/class-method-missing.rs | 2 +- src/test/compile-fail/iface-cast.rs | 2 +- .../iface-impl-different-num-params.rs | 2 +- src/test/compile-fail/iface-keyword.rs | 5 ++++ src/test/compile-fail/iface-test-2.rs | 2 +- src/test/compile-fail/iface-test.rs | 2 +- .../compile-fail/infinite-instantiation.rs | 2 +- src/test/compile-fail/issue-2330.rs | 2 +- src/test/compile-fail/issue-3021-d.rs | 2 +- src/test/compile-fail/issue-3021.rs | 2 +- .../kindck-owned-trait-contains.rs | 4 +-- .../compile-fail/kindck-owned-trait-scoped.rs | 4 +-- src/test/compile-fail/kindck-owned-trait.rs | 2 +- src/test/compile-fail/map-types.rs | 2 +- src/test/compile-fail/qquote-1.rs | 2 +- src/test/compile-fail/qquote-2.rs | 2 +- src/test/compile-fail/regions-bounds.rs | 6 ++-- .../regions-escape-via-iface-or-not.rs | 2 +- src/test/compile-fail/regions-iface-1.rs | 2 +- src/test/compile-fail/regions-iface-2.rs | 2 +- src/test/compile-fail/regions-iface-3.rs | 2 +- .../regions-infer-paramd-method.rs | 4 +-- src/test/compile-fail/selftype-astparam.rs | 2 +- src/test/compile-fail/selftype-ifacetype.rs | 2 +- src/test/compile-fail/seq-args.rs | 2 +- src/test/compile-fail/tps-invariant-iface.rs | 8 +++--- src/test/run-fail/unwind-box-iface.rs | 2 +- src/test/run-pass-fulldeps/issue-1926.rs | 2 +- src/test/run-pass-fulldeps/qquote.rs | 2 +- src/test/run-pass/assignability-iface.rs | 2 +- .../class-cast-to-iface-multiple-types.rs | 2 +- src/test/run-pass/class-cast-to-iface.rs | 2 +- .../class-impl-very-parameterized-iface.rs | 2 +- src/test/run-pass/class-implement-ifaces.rs | 2 +- .../class-implements-multiple-ifaces.rs | 6 ++-- src/test/run-pass/iface-cast.rs | 4 +-- src/test/run-pass/iface-generic.rs | 4 +-- src/test/run-pass/iface-to-str.rs | 2 +- src/test/run-pass/issue-2185.rs | 4 +-- src/test/run-pass/issue-2288.rs | 2 +- src/test/run-pass/issue-2311-2.rs | 2 +- src/test/run-pass/issue-2311.rs | 4 +-- src/test/run-pass/issue-2734.rs | 2 +- src/test/run-pass/issue-2735.rs | 2 +- .../run-pass/kindck-owned-trait-contains-1.rs | 4 +-- src/test/run-pass/method-attributes.rs | 2 +- .../run-pass/monomorphize-iface-in-fn-at.rs | 2 +- src/test/run-pass/reflect-visit-data.rs | 4 +-- src/test/run-pass/regions-iface.rs | 2 +- src/test/run-pass/traits.rs | 6 ++-- src/test/run-pass/use-iface-before-def.rs | 2 +- 111 files changed, 194 insertions(+), 188 deletions(-) create mode 100644 src/test/compile-fail/iface-keyword.rs diff --git a/src/fuzzer/cycles.rs b/src/fuzzer/cycles.rs index 9ccef3227fc..dbb4ecdbaef 100644 --- a/src/fuzzer/cycles.rs +++ b/src/fuzzer/cycles.rs @@ -36,7 +36,7 @@ type pointy = { mut n : ~[mut maybe_pointy], mut o : {x : int, y : maybe_pointy} }; -// To add: objects; ifaces; anything type-parameterized? +// To add: objects; traits; anything type-parameterized? fn empty_pointy() -> @pointy { ret @{ diff --git a/src/libcore/float.rs b/src/libcore/float.rs index 8b8cc4664dc..d2efba51131 100644 --- a/src/libcore/float.rs +++ b/src/libcore/float.rs @@ -525,7 +525,7 @@ fn test_to_str_inf() { } #[test] -fn test_ifaces() { +fn test_traits() { fn test(ten: U) { assert (ten.to_int() == 10); diff --git a/src/libcore/future.rs b/src/libcore/future.rs index 83dc6b7178b..7dfafd499a4 100644 --- a/src/libcore/future.rs +++ b/src/libcore/future.rs @@ -158,7 +158,7 @@ fn test_from_fn() { } #[test] -fn test_iface_get() { +fn test_interface_get() { let f = from_value(~"fail"); assert f.get() == ~"fail"; } @@ -170,7 +170,7 @@ fn test_with() { } #[test] -fn test_iface_with() { +fn test_interface_with() { let f = from_value(~"kale"); assert f.with(|v| v) == ~"kale"; } diff --git a/src/libcore/hash.rs b/src/libcore/hash.rs index 1445c43df79..71b5660c672 100644 --- a/src/libcore/hash.rs +++ b/src/libcore/hash.rs @@ -79,7 +79,7 @@ pure fn hash_bytes_keyed(buf: &[const u8], k0: u64, k1: u64) -> u64 { } -iface streaming { +trait streaming { fn input(~[u8]); fn input_str(~str); fn result() -> ~[u8]; diff --git a/src/libcore/int-template.rs b/src/libcore/int-template.rs index acde4ad4265..b58e00d2e9c 100644 --- a/src/libcore/int-template.rs +++ b/src/libcore/int-template.rs @@ -230,7 +230,7 @@ fn test_to_str() { } #[test] -fn test_ifaces() { +fn test_interfaces() { fn test(ten: U) { assert (ten.to_int() == 10); diff --git a/src/libcore/io.rs b/src/libcore/io.rs index e83842232e6..510be3f89b9 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -27,8 +27,8 @@ extern mod rustrt { enum seek_style { seek_set, seek_end, seek_cur, } -// The raw underlying reader iface. All readers must implement this. -iface reader { +// The raw underlying reader trait. All readers must implement this. +trait reader { // FIXME (#2004): Seekable really should be orthogonal. // FIXME (#2982): This should probably return an error. @@ -250,7 +250,7 @@ fn FILE_reader(f: *libc::FILE, cleanup: bool) -> reader { } } -// FIXME (#2004): this should either be an iface-less impl, a set of +// FIXME (#2004): this should either be an trait-less impl, a set of // top-level functions that take a reader, or a set of default methods on // reader (which can then be called reader) @@ -335,7 +335,7 @@ enum writer_type { screen, file } // FIXME (#2004): Seekable really should be orthogonal. // FIXME (#2004): eventually u64 -iface writer { +trait writer { fn write(v: &[const u8]); fn seek(int, seek_style); fn tell() -> uint; @@ -781,7 +781,7 @@ mod fsync { } // Type of objects that may want to fsync - iface t { fn fsync(l: level) -> int; } + trait t { fn fsync(l: level) -> int; } // Call o.fsync after executing blk fn obj_sync(&&o: t, opt_level: option, blk: fn(&&res)) { diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index e54fbabb0aa..092f69cd47a 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1,4 +1,4 @@ -iface base_iter { +trait base_iter { fn each(blk: fn(A) -> bool); fn size_hint() -> option; } @@ -13,10 +13,10 @@ trait extended_iter { fn position(f: fn(A) -> bool) -> option; } -iface times { +trait times { fn times(it: fn() -> bool); } -iface timesi{ +trait timesi{ fn timesi(it: fn(uint) -> bool); } diff --git a/src/libcore/num.rs b/src/libcore/num.rs index 03868527655..e8a36f38842 100644 --- a/src/libcore/num.rs +++ b/src/libcore/num.rs @@ -2,7 +2,7 @@ trait num { // FIXME: Cross-crate overloading doesn't work yet. (#2615) - // FIXME: Interface inheritance. (#2616) + // FIXME: Trait composition. (#2616) pure fn add(&&other: self) -> self; pure fn sub(&&other: self) -> self; pure fn mul(&&other: self) -> self; @@ -12,6 +12,6 @@ trait num { pure fn to_int() -> int; pure fn from_int(n: int) -> self; // FIXME (#2376) Static functions. - // n.b. #2376 is for classes, not ifaces, but it could be generalized... + // n.b. #2376 is for classes, not traits, but it could be generalized... } diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs index 85e5b43a998..cda205a98b5 100644 --- a/src/libcore/rand.rs +++ b/src/libcore/rand.rs @@ -15,7 +15,7 @@ extern mod rustrt { } /// A random number generator -iface rng { +trait rng { /// Return the next random integer fn next() -> u32; } diff --git a/src/libcore/run.rs b/src/libcore/run.rs index f2e3981fd87..09dbf2c37c3 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -19,7 +19,7 @@ extern mod rustrt { } /// A value representing a child process -iface program { +trait program { /// Returns the process id of the program fn get_id() -> pid_t; diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 9b86a100289..6b356819340 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -955,7 +955,7 @@ fn spawn_raw(opts: task_opts, +f: fn~()) { */ type local_data_key = fn@(+@T); -iface local_data { } +trait local_data { } impl of local_data for @T { } // We use dvec because it's the best data structure in core. If TLS is used diff --git a/src/libcore/to_bytes.rs b/src/libcore/to_bytes.rs index 0daeff81975..3e463653a43 100644 --- a/src/libcore/to_bytes.rs +++ b/src/libcore/to_bytes.rs @@ -1,4 +1,4 @@ -iface to_bytes { +trait to_bytes { fn to_bytes() -> ~[u8]; } diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs index 138a408435a..76b0694d3d8 100644 --- a/src/libcore/to_str.rs +++ b/src/libcore/to_str.rs @@ -1,4 +1,4 @@ -iface to_str { fn to_str() -> ~str; } +trait to_str { fn to_str() -> ~str; } impl of to_str for int { fn to_str() -> ~str { int::str(self) } diff --git a/src/libstd/base64.rs b/src/libstd/base64.rs index e2c8ad31344..7a8946d02a6 100644 --- a/src/libstd/base64.rs +++ b/src/libstd/base64.rs @@ -1,6 +1,6 @@ import io::{reader, reader_util}; -iface to_base64 { +trait to_base64 { fn to_base64() -> ~str; } @@ -58,7 +58,7 @@ impl of to_base64 for ~str { } } -iface from_base64 { +trait from_base64 { fn from_base64() -> ~[u8]; } diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index f71f991c9f8..408a8ca20c2 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -3,7 +3,7 @@ import option::{some, none}; import dvec::{dvec, extensions}; -iface t { +trait t { fn size() -> uint; fn add_front(T); fn add_back(T); diff --git a/src/libstd/json.rs b/src/libstd/json.rs index ee265269872..6a08bb5d9e1 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -510,7 +510,7 @@ fn eq(value0: json, value1: json) -> bool { } } -iface to_json { fn to_json() -> json; } +trait to_json { fn to_json() -> json; } impl of to_json for json { fn to_json() -> json { self } diff --git a/src/libstd/map.rs b/src/libstd/map.rs index c660adc527f..846a2bfc700 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -24,7 +24,7 @@ type set = hashmap; type hashmap = chained::t; -iface map { +trait map { /// Return the number of elements in the map fn size() -> uint; diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs index d70d9b40de8..8bf35c8ee16 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -54,7 +54,7 @@ class tcp_socket { * A buffered wrapper for `net::tcp::tcp_socket` * * It is created with a call to `net::tcp::socket_buf()` and has impls that - * satisfy both the `io::reader` and `io::writer` ifaces. + * satisfy both the `io::reader` and `io::writer` traits. */ class tcp_socket_buf { let data: @tcp_buffered_socket_data; @@ -764,7 +764,7 @@ impl tcp_socket for tcp_socket { } } -/// Implementation of `io::reader` iface for a buffered `net::tcp::tcp_socket` +/// Implementation of `io::reader` trait for a buffered `net::tcp::tcp_socket` impl tcp_socket_buf of io::reader for @tcp_socket_buf { fn read(buf: &[mut u8], len: uint) -> uint { // Loop until our buffer has enough data in it for us to read from. @@ -817,7 +817,7 @@ impl tcp_socket_buf of io::reader for @tcp_socket_buf { } } -/// Implementation of `io::reader` iface for a buffered `net::tcp::tcp_socket` +/// Implementation of `io::reader` trait for a buffered `net::tcp::tcp_socket` impl tcp_socket_buf of io::writer for @tcp_socket_buf { fn write(data: &[const u8]) unsafe { let socket_data_ptr = @@ -1083,11 +1083,11 @@ enum tcp_read_result { tcp_read_err(tcp_err_data) } -iface to_tcp_err_iface { +trait to_tcp_err { fn to_tcp_err() -> tcp_err_data; } -impl of to_tcp_err_iface for uv::ll::uv_err_data { +impl of to_tcp_err for uv::ll::uv_err_data { fn to_tcp_err() -> tcp_err_data { { err_name: self.err_name, err_msg: self.err_msg } } diff --git a/src/libstd/serialization.rs b/src/libstd/serialization.rs index ed9cf5570ce..5be0ac26d23 100644 --- a/src/libstd/serialization.rs +++ b/src/libstd/serialization.rs @@ -6,7 +6,7 @@ use core; Core serialization interfaces. */ -iface serializer { +trait serializer { // Primitive types: fn emit_nil(); fn emit_uint(v: uint); @@ -39,7 +39,7 @@ iface serializer { fn emit_tup_elt(idx: uint, f: fn()); } -iface deserializer { +trait deserializer { // Primitive types: fn read_nil() -> (); diff --git a/src/libstd/sha1.rs b/src/libstd/sha1.rs index 71f8fff2857..eef757f4516 100644 --- a/src/libstd/sha1.rs +++ b/src/libstd/sha1.rs @@ -20,7 +20,7 @@ export sha1; /// The SHA-1 interface -iface sha1 { +trait sha1 { /// Provide message input as bytes fn input(~[u8]); /// Provide message input as string diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 4a6935f7fc8..d9292afc96a 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -13,7 +13,7 @@ type emitter = fn@(cmsp: option<(codemap::codemap, span)>, msg: ~str, lvl: level); -iface span_handler { +trait span_handler { fn span_fatal(sp: span, msg: ~str) -> !; fn span_err(sp: span, msg: ~str); fn span_warn(sp: span, msg: ~str); @@ -23,7 +23,7 @@ iface span_handler { fn handler() -> handler; } -iface handler { +trait handler { fn fatal(msg: ~str) -> !; fn err(msg: ~str); fn bump_err_count(); diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index c6889eb9c1d..a51bc8a994c 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -114,7 +114,7 @@ fn syntax_expander_table() -> hashmap<~str, syntax_extension> { // One of these is made during expansion and incrementally updated as we go; // when a macro expansion occurs, the resulting nodes have the backtrace() // -> expn_info of their expansion context stored into their span. -iface ext_ctxt { +trait ext_ctxt { fn codemap() -> codemap; fn parse_sess() -> parse::parse_sess; fn cfg() -> ast::crate_cfg; diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index 32df5ed472a..00fd5d41f93 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -383,7 +383,7 @@ impl compile of gen_init for protocol { } } -iface to_source { +trait to_source { // Takes a thing and generates a string containing rust code for it. fn to_source() -> ~str; } diff --git a/src/libsyntax/ext/qquote.rs b/src/libsyntax/ext/qquote.rs index c027963cefa..9dcb4da14fa 100644 --- a/src/libsyntax/ext/qquote.rs +++ b/src/libsyntax/ext/qquote.rs @@ -22,7 +22,7 @@ enum fragment { from_ty(@ast::ty) } -iface qq_helper { +trait qq_helper { fn span() -> span; fn visit(aq_ctxt, vt); fn extract_mac() -> option; diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index d1fea34513b..dd051564cf4 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -18,7 +18,7 @@ export fold_ty_params; export fold_fn_decl; export extensions; -iface ast_fold { +trait ast_fold { fn fold_crate(crate) -> crate; fn fold_crate_directive(&&@crate_directive) -> @crate_directive; fn fold_view_item(&&@view_item) -> @view_item; diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index f14dd7df9d2..5a343f370f3 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -9,7 +9,7 @@ export tt_reader, new_tt_reader; export nextch, is_eof, bump, get_str_from, new_low_level_string_reader; export string_reader_as_reader, tt_reader_as_reader; -iface reader { +trait reader { fn is_eof() -> bool; fn next_token() -> {tok: token::token, sp: span}; fn fatal(~str) -> !; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 594ec844bd3..17370628db9 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2702,6 +2702,7 @@ class parser { } else if self.eat_keyword(~"enum") { self.parse_item_enum(vis) } else if self.eat_keyword(~"iface") { + self.warn(~"`iface` is deprecated; use `trait`"); self.parse_item_trait() } else if self.eat_keyword(~"trait") { self.parse_item_trait() diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index cf97bd7c692..a169c4e7256 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -588,7 +588,7 @@ fn print_item(s: ps, &&item: @ast::item) { bclose(s, item.span); } ast::item_trait(tps, methods) { - head(s, ~"iface"); + head(s, ~"trait"); word(s.s, *item.ident); print_type_params(s, tps); word(s.s, ~" "); diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index b6320b4f9cb..4886b903d73 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -19,7 +19,7 @@ fn mk(hasher: hashfn, eqer: eqfn) -> interner { } /* when traits can extend traits, we should extend index to get [] */ -iface interner { +trait interner { fn intern(T) -> uint; pure fn get(uint) -> T; fn len() -> uint; diff --git a/src/rt/rust_box_annihilator.cpp b/src/rt/rust_box_annihilator.cpp index 1ac0ac78ca7..ce4dc55cd70 100644 --- a/src/rt/rust_box_annihilator.cpp +++ b/src/rt/rust_box_annihilator.cpp @@ -120,7 +120,7 @@ class annihilator : public shape::data { return; } - void walk_iface2() { + void walk_trait2() { walk_box2(); } diff --git a/src/rt/rust_cc.cpp b/src/rt/rust_cc.cpp index 1d3ae3ccccf..0106b468c90 100644 --- a/src/rt/rust_cc.cpp +++ b/src/rt/rust_cc.cpp @@ -140,7 +140,7 @@ class irc : public shape::data { } } - void walk_iface2() { + void walk_trait2() { walk_box2(); } @@ -400,7 +400,7 @@ class mark : public shape::data { } } - void walk_iface2() { + void walk_trait2() { walk_box2(); } diff --git a/src/rt/rust_shape.cpp b/src/rt/rust_shape.cpp index bfe4b97936a..ae578081164 100644 --- a/src/rt/rust_shape.cpp +++ b/src/rt/rust_shape.cpp @@ -290,7 +290,7 @@ public: data::walk_rptr_contents1(); } - void walk_iface2() { + void walk_trait2() { data::walk_box_contents1(); } diff --git a/src/rt/rust_shape.h b/src/rt/rust_shape.h index ffbe6117422..fffbfad1d81 100644 --- a/src/rt/rust_shape.h +++ b/src/rt/rust_shape.h @@ -544,7 +544,7 @@ public: default: abort(); } } - void walk_iface1() { DPRINT("iface"); } + void walk_trait1() { DPRINT("trait"); } void walk_tydesc1(char kind) { switch(kind) { @@ -598,7 +598,7 @@ public: { sa.set(sizeof(void *)*2, sizeof(void *)); } void walk_box1() { sa.set(sizeof(void *), sizeof(void *)); } void walk_fn1(char) { sa.set(sizeof(void *)*2, sizeof(void *)); } - void walk_iface1() { sa.set(sizeof(void *), sizeof(void *)); } + void walk_trait1() { sa.set(sizeof(void *), sizeof(void *)); } void walk_tydesc1(char) { sa.set(sizeof(void *), sizeof(void *)); } void walk_closure1(); @@ -851,7 +851,7 @@ protected: void walk_uniq_contents1(); void walk_rptr_contents1(); void walk_fn_contents1(); - void walk_iface_contents1(); + void walk_trait_contents1(); void walk_variant1(tag_info &tinfo, tag_variant_t variant); static std::pair get_vec_data_range(ptr dp); @@ -927,10 +927,10 @@ public: dp = next_dp; } - void walk_iface1() { + void walk_trait1() { ALIGN_TO(rust_alignof()); U next_dp = dp + sizeof(void *); - static_cast(this)->walk_iface2(); + static_cast(this)->walk_trait2(); dp = next_dp; } @@ -1137,7 +1137,7 @@ void template void -data::walk_iface_contents1() { +data::walk_trait_contents1() { walk_box_contents1(); } @@ -1234,10 +1234,10 @@ private: data::walk_fn_contents1(); } - void walk_iface2() { - out << prefix << "iface("; + void walk_trait2() { + out << prefix << "trait("; prefix = ""; - data::walk_iface_contents1(); + data::walk_trait_contents1(); out << prefix << ")"; } diff --git a/src/rustc/front/intrinsic.rs b/src/rustc/front/intrinsic.rs index b980aff822c..1fc320a8311 100644 --- a/src/rustc/front/intrinsic.rs +++ b/src/rustc/front/intrinsic.rs @@ -19,7 +19,7 @@ mod intrinsic { // Remaining fields not listed }; - iface ty_visitor { + trait ty_visitor { fn visit_bot() -> bool; fn visit_nil() -> bool; fn visit_bool() -> bool; diff --git a/src/rustc/metadata/filesearch.rs b/src/rustc/metadata/filesearch.rs index 9e68ce12a3c..6bd002c356e 100644 --- a/src/rustc/metadata/filesearch.rs +++ b/src/rustc/metadata/filesearch.rs @@ -23,7 +23,7 @@ fn pick_file(file: path, path: path) -> option { else { option::none } } -iface filesearch { +trait filesearch { fn sysroot() -> path; fn lib_search_paths() -> ~[path]; fn get_target_lib_path() -> path; diff --git a/src/rustc/middle/astencode.rs b/src/rustc/middle/astencode.rs index bbbf8947792..5ec3c3882ac 100644 --- a/src/rustc/middle/astencode.rs +++ b/src/rustc/middle/astencode.rs @@ -77,7 +77,7 @@ enum extended_decode_ctxt { extended_decode_ctxt_(@extended_decode_ctxt_) } -iface tr { +trait tr { fn tr(xcx: extended_decode_ctxt) -> self; } @@ -910,7 +910,7 @@ fn decode_item_ast(par_doc: ebml::doc) -> @ast::item { } #[cfg(test)] -iface fake_ext_ctxt { +trait fake_ext_ctxt { fn cfg() -> ast::crate_cfg; fn parse_sess() -> parse::parse_sess; } diff --git a/src/rustc/middle/borrowck.rs b/src/rustc/middle/borrowck.rs index 2c326aa68ef..c94326d668a 100644 --- a/src/rustc/middle/borrowck.rs +++ b/src/rustc/middle/borrowck.rs @@ -429,7 +429,7 @@ fn root_map() -> root_map { // ___________________________________________________________________________ // Misc -iface ast_node { +trait ast_node { fn id() -> ast::node_id; fn span() -> span; } diff --git a/src/rustc/middle/resolve3.rs b/src/rustc/middle/resolve3.rs index 1965d5289be..13019f19a8a 100644 --- a/src/rustc/middle/resolve3.rs +++ b/src/rustc/middle/resolve3.rs @@ -3059,7 +3059,7 @@ class Resolver { self_type_rib.bindings.insert(self.self_atom, dl_def(def_self(item.id))); - // Create a new rib for the interface-wide type parameters. + // Create a new rib for the trait-wide type parameters. do self.with_type_parameter_rib (HasTypeParameters(&type_parameters, item.id, 0u, NormalRibKind)) { @@ -3106,12 +3106,12 @@ class Resolver { (*self.type_ribs).pop(); } - item_class(ty_params, interfaces, class_members, + item_class(ty_params, traits, class_members, optional_constructor, optional_destructor) { self.resolve_class(item.id, @copy ty_params, - interfaces, + traits, class_members, optional_constructor, optional_destructor, @@ -3330,8 +3330,8 @@ class Resolver { bound_copy | bound_send | bound_const | bound_owned { // Nothing to do. } - bound_trait(interface_type) { - self.resolve_type(interface_type, visitor); + bound_trait(trait_type) { + self.resolve_type(trait_type, visitor); } } } @@ -3340,7 +3340,7 @@ class Resolver { fn resolve_class(id: node_id, type_parameters: @~[ty_param], - interfaces: ~[@trait_ref], + traits: ~[@trait_ref], class_members: ~[@class_member], optional_constructor: option, optional_destructor: option, @@ -3359,22 +3359,22 @@ class Resolver { // Resolve the type parameters. self.resolve_type_parameters(*type_parameters, visitor); - // Resolve implemented interfaces. - for interfaces.each |interface| { - alt self.resolve_path(interface.path, TypeNS, true, visitor) { + // Resolve implemented traits. + for traits.each |trt| { + alt self.resolve_path(trt.path, TypeNS, true, visitor) { none { - self.session.span_err(interface.path.span, + self.session.span_err(trt.path.span, ~"attempt to implement a \ nonexistent trait"); } some(def) { - // Write a mapping from the interface ID to the - // definition of the interface into the definition + // Write a mapping from the trait ID to the + // definition of the trait into the definition // map. debug!{"(resolving class) found trait def: %?", def}; - self.record_def(interface.ref_id, def); + self.record_def(trt.ref_id, def); // XXX: This is wrong but is needed for tests to // pass. @@ -3475,7 +3475,7 @@ class Resolver { // Resolve the type parameters. self.resolve_type_parameters(type_parameters, visitor); - // Resolve the interface reference, if necessary. + // Resolve the trait reference, if necessary. let original_trait_refs = self.current_trait_refs; if trait_references.len() >= 1 { let mut new_trait_refs = @dvec(); diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index bae5b34f5a1..f2903232400 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -392,8 +392,8 @@ type opt_region = option; /// appear within a region-parameterized type is `self`. /// /// `self_ty` is the type to which `self` should be remapped, if any. The -/// `self` type is rather funny in that it can only appear on interfaces and -/// is always substituted away to the implementing type for an interface. +/// `self` type is rather funny in that it can only appear on traits and +/// is always substituted away to the implementing type for a trait. type substs = { self_r: opt_region, self_ty: option, @@ -477,7 +477,7 @@ enum tv_vid = uint; enum tvi_vid = uint; enum region_vid = uint; -iface vid { +trait vid { fn to_uint() -> uint; fn to_str() -> ~str; } @@ -2633,7 +2633,7 @@ fn trait_methods(cx: ctxt, id: ast::def_id) -> @~[method] { some(ms) { ret ms; } _ {} } - // Local interfaces are supposed to have been added explicitly. + // Local traits are supposed to have been added explicitly. assert id.crate != ast::local_crate; let result = csearch::get_trait_methods(cx, id); cx.trait_method_cache.insert(id, result); diff --git a/src/rustc/middle/typeck.rs b/src/rustc/middle/typeck.rs index 2338aa6368c..bf7069f87e2 100644 --- a/src/rustc/middle/typeck.rs +++ b/src/rustc/middle/typeck.rs @@ -142,7 +142,7 @@ enum vtable_origin { */ vtable_param(uint, uint), /* - Dynamic vtable, comes from something known to have an interface + Dynamic vtable, comes from something known to have a trait type. def_id refers to the trait item, tys are the substs */ vtable_trait(ast::def_id, ~[ty::t]), diff --git a/src/rustc/middle/typeck/astconv.rs b/src/rustc/middle/typeck/astconv.rs index 341d9460c4b..1dd8cde5084 100644 --- a/src/rustc/middle/typeck/astconv.rs +++ b/src/rustc/middle/typeck/astconv.rs @@ -13,7 +13,7 @@ * used as the `ast_conv`, `get_item_ty()` just looks up the item type in * `tcx.tcache`. * - * The `region_scope` interface controls how region references are + * The `region_scope` trait controls how region references are * handled. It has two methods which are used to resolve anonymous * region references (e.g., `&T`) and named region references (e.g., * `&a.T`). There are numerous region scopes that can be used, but most @@ -46,7 +46,7 @@ import check::fn_ctxt; import rscope::{anon_rscope, binding_rscope, empty_rscope, in_anon_rscope}; import rscope::{in_binding_rscope, region_scope, type_rscope}; -iface ast_conv { +trait ast_conv { fn tcx() -> ty::ctxt; fn ccx() -> @crate_ctxt; fn get_item_ty(id: ast::def_id) -> ty::ty_param_bounds_and_ty; diff --git a/src/rustc/middle/typeck/check/method.rs b/src/rustc/middle/typeck/check/method.rs index 277891c4eff..ac18b8ccad6 100644 --- a/src/rustc/middle/typeck/check/method.rs +++ b/src/rustc/middle/typeck/check/method.rs @@ -85,7 +85,7 @@ class lookup { } loop { - // First, see whether this is an interface-bounded parameter. + // First, see whether this is a bounded parameter. alt ty::get(self.self_ty).struct { ty::ty_param(p) { self.add_candidates_from_param(p.idx, p.def_id); diff --git a/src/rustc/middle/typeck/check/vtable.rs b/src/rustc/middle/typeck/check/vtable.rs index 70fddb190fb..6baa89e0638 100644 --- a/src/rustc/middle/typeck/check/vtable.rs +++ b/src/rustc/middle/typeck/check/vtable.rs @@ -189,7 +189,7 @@ fn lookup_vtable(fcx: @fn_ctxt, sp: span, ty: ty::t, trait_ty: ty::t, } tcx.sess.span_fatal( - sp, ~"failed to find an implementation of interface " + + sp, ~"failed to find an implementation of trait " + ty_to_str(tcx, trait_ty) + ~" for " + ty_to_str(tcx, ty)); } @@ -291,7 +291,7 @@ fn resolve_expr(ex: @ast::expr, &&fcx: @fn_ctxt, v: visit::vt<@fn_ctxt>) { visit::visit_expr(ex, fcx, v); } -// Detect points where an interface-bounded type parameter is +// Detect points where a trait-bounded type parameter is // instantiated, resolve the impls for the parameters. fn resolve_in_block(fcx: @fn_ctxt, bl: ast::blk) { visit::visit_block(bl, fcx, visit::mk_vt(@{ diff --git a/src/rustc/middle/typeck/collect.rs b/src/rustc/middle/typeck/collect.rs index 83bc02a3755..22063051dce 100644 --- a/src/rustc/middle/typeck/collect.rs +++ b/src/rustc/middle/typeck/collect.rs @@ -587,7 +587,7 @@ fn ty_param_bounds(ccx: @crate_ctxt, _ { ccx.tcx.sess.span_err( t.span, ~"type parameter bounds must be \ - interface types"); + trait types"); ~[] } } diff --git a/src/rustc/middle/typeck/infer.rs b/src/rustc/middle/typeck/infer.rs index e3075ff0058..68420c32de4 100644 --- a/src/rustc/middle/typeck/infer.rs +++ b/src/rustc/middle/typeck/infer.rs @@ -476,7 +476,7 @@ impl methods of cres_helpers for cres { } } -iface to_str { +trait to_str { fn to_str(cx: infer_ctxt) -> ~str; } @@ -533,7 +533,7 @@ impl of to_str for var_value { } } -iface st { +trait st { fn sub(infcx: infer_ctxt, b: self) -> ures; fn lub(infcx: infer_ctxt, b: self) -> cres; fn glb(infcx: infer_ctxt, b: self) -> cres; @@ -1506,7 +1506,7 @@ impl assignment for infer_ctxt { // Type combining // // There are three type combiners: sub, lub, and glb. Each implements -// the interface `combine` and contains methods for combining two +// the trait `combine` and contains methods for combining two // instances of various things and yielding a new instance. These // combiner methods always yield a `result`---failure is propagated // upward using `chain()` methods. @@ -1520,9 +1520,9 @@ impl assignment for infer_ctxt { // to the `super` routine or to do other things. // // In reality, the sub operation is rather different from lub/glb, but -// they are combined into one interface to avoid duplication (they -// used to be separate but there were many bugs because there were two -// copies of most routines). +// they are combined into one trait to avoid duplication (they used to +// be separate but there were many bugs because there were two copies +// of most routines). // // The differences are: // @@ -1548,7 +1548,7 @@ impl assignment for infer_ctxt { type cres = result; -iface combine { +trait combine { fn infcx() -> infer_ctxt; fn tag() -> ~str; @@ -2457,7 +2457,7 @@ impl of combine for glb { // This is common code used by both LUB and GLB to compute the LUB/GLB // for pairs of variables or for variables and values. -iface lattice_ops { +trait lattice_ops { fn bnd(b: bounds) -> option; fn with_bnd(b: bounds, t: T) -> bounds; fn ty_bot(t: ty::t) -> cres; diff --git a/src/rustc/middle/typeck/rscope.rs b/src/rustc/middle/typeck/rscope.rs index 2c2db4a9c3c..d76f62e17a9 100644 --- a/src/rustc/middle/typeck/rscope.rs +++ b/src/rustc/middle/typeck/rscope.rs @@ -1,6 +1,6 @@ import result::result; -iface region_scope { +trait region_scope { fn anon_region() -> result; fn named_region(id: ast::ident) -> result; } diff --git a/src/rustdoc/attr_pass.rs b/src/rustdoc/attr_pass.rs index 8214e8ffc98..a5c41d23574 100644 --- a/src/rustdoc/attr_pass.rs +++ b/src/rustdoc/attr_pass.rs @@ -242,14 +242,14 @@ fn merge_method_attrs( #[test] fn should_extract_trait_docs() { - let doc = test::mk_doc(~"#[doc = \"whatever\"] iface i { fn a(); }"); + let doc = test::mk_doc(~"#[doc = \"whatever\"] trait i { fn a(); }"); assert doc.cratemod().traits()[0].desc() == some(~"whatever"); } #[test] fn should_extract_trait_method_docs() { let doc = test::mk_doc( - ~"iface i {\ + ~"trait i {\ #[doc = \"desc\"]\ fn f(a: bool) -> bool;\ }"); diff --git a/src/rustdoc/demo.rs b/src/rustdoc/demo.rs index 8fcea20989d..0a46d7e7195 100644 --- a/src/rustdoc/demo.rs +++ b/src/rustdoc/demo.rs @@ -133,7 +133,7 @@ class bored { * neighboring hillside churchyard of St. John's, whose hidden expanse of * Eighteenth Century gravestones had for him a peculiar fascination. */ -iface the_shunned_house { +trait the_shunned_house { /** * Now the irony is this. In this walk, so many times repeated, the * world's greatest master of the terrible and the bizarre was diff --git a/src/rustdoc/desc_to_brief_pass.rs b/src/rustdoc/desc_to_brief_pass.rs index 92078bb7d9a..c047530fec2 100644 --- a/src/rustdoc/desc_to_brief_pass.rs +++ b/src/rustdoc/desc_to_brief_pass.rs @@ -70,7 +70,7 @@ fn should_promote_desc() { #[test] fn should_promote_trait_method_desc() { - let doc = test::mk_doc(~"iface i { #[doc = \"desc\"] fn a(); }"); + let doc = test::mk_doc(~"trait i { #[doc = \"desc\"] fn a(); }"); assert doc.cratemod().traits()[0].methods[0].brief == some(~"desc"); } diff --git a/src/rustdoc/doc.rs b/src/rustdoc/doc.rs index e6c780e6e08..52a2faf5bb7 100644 --- a/src/rustdoc/doc.rs +++ b/src/rustdoc/doc.rs @@ -315,7 +315,7 @@ impl util of page_utils for ~[page] { } } -iface item { +trait item { fn item() -> itemdoc; } diff --git a/src/rustdoc/markdown_pass.rs b/src/rustdoc/markdown_pass.rs index beed9c27602..a880c510b89 100644 --- a/src/rustdoc/markdown_pass.rs +++ b/src/rustdoc/markdown_pass.rs @@ -666,28 +666,28 @@ fn write_method(ctxt: ctxt, doc: doc::methoddoc) { #[test] fn should_write_trait_header() { - let markdown = test::render(~"iface i { fn a(); }"); + let markdown = test::render(~"trait i { fn a(); }"); assert str::contains(markdown, ~"## Interface `i`"); } #[test] fn should_write_trait_desc() { let markdown = test::render( - ~"#[doc = \"desc\"] iface i { fn a(); }"); + ~"#[doc = \"desc\"] trait i { fn a(); }"); assert str::contains(markdown, ~"desc"); } #[test] fn should_write_trait_method_header() { let markdown = test::render( - ~"iface i { fn a(); }"); + ~"trait i { fn a(); }"); assert str::contains(markdown, ~"### Method `a`"); } #[test] fn should_write_trait_method_signature() { let markdown = test::render( - ~"iface i { fn a(); }"); + ~"trait i { fn a(); }"); assert str::contains(markdown, ~"\n fn a()"); } diff --git a/src/rustdoc/sectionalize_pass.rs b/src/rustdoc/sectionalize_pass.rs index a06ace65450..1ca660a3488 100644 --- a/src/rustdoc/sectionalize_pass.rs +++ b/src/rustdoc/sectionalize_pass.rs @@ -206,7 +206,7 @@ fn should_eliminate_desc_if_it_is_just_whitespace() { #[test] fn should_sectionalize_trait_methods() { let doc = test::mk_doc( - ~"iface i { + ~"trait i { #[doc = \"\ # Header\n\ Body\"]\ diff --git a/src/rustdoc/sort_item_type_pass.rs b/src/rustdoc/sort_item_type_pass.rs index 43b197fb015..74a6000db66 100644 --- a/src/rustdoc/sort_item_type_pass.rs +++ b/src/rustdoc/sort_item_type_pass.rs @@ -31,7 +31,7 @@ fn test() { const iconst: int = 0; \ fn ifn() { } \ enum ienum { ivar } \ - iface iiface { fn a(); } \ + trait itrait { fn a(); } \ impl iimpl for int { fn a() { } } \ type itype = int;"; do astsrv::from_str(source) |srv| { @@ -40,7 +40,7 @@ fn test() { assert doc.cratemod().items[0].name() == ~"iconst"; assert doc.cratemod().items[1].name() == ~"itype"; assert doc.cratemod().items[2].name() == ~"ienum"; - assert doc.cratemod().items[3].name() == ~"iiface"; + assert doc.cratemod().items[3].name() == ~"itrait"; assert doc.cratemod().items[4].name() == ~"iimpl"; assert doc.cratemod().items[5].name() == ~"ifn"; assert doc.cratemod().items[6].name() == ~"imod"; diff --git a/src/rustdoc/text_pass.rs b/src/rustdoc/text_pass.rs index c98b1fd7e84..adf5029989e 100644 --- a/src/rustdoc/text_pass.rs +++ b/src/rustdoc/text_pass.rs @@ -117,28 +117,28 @@ fn should_execute_op_on_variant_desc() { #[test] fn should_execute_op_on_trait_brief() { let doc = test::mk_doc( - ~"#[doc = \" a \"] iface i { fn a(); }"); + ~"#[doc = \" a \"] trait i { fn a(); }"); assert doc.cratemod().traits()[0].brief() == some(~"a"); } #[test] fn should_execute_op_on_trait_desc() { let doc = test::mk_doc( - ~"#[doc = \" a \"] iface i { fn a(); }"); + ~"#[doc = \" a \"] trait i { fn a(); }"); assert doc.cratemod().traits()[0].desc() == some(~"a"); } #[test] fn should_execute_op_on_trait_method_brief() { let doc = test::mk_doc( - ~"iface i { #[doc = \" a \"] fn a(); }"); + ~"trait i { #[doc = \" a \"] fn a(); }"); assert doc.cratemod().traits()[0].methods[0].brief == some(~"a"); } #[test] fn should_execute_op_on_trait_method_desc() { let doc = test::mk_doc( - ~"iface i { #[doc = \" a \"] fn a(); }"); + ~"trait i { #[doc = \" a \"] fn a(); }"); assert doc.cratemod().traits()[0].methods[0].desc == some(~"a"); } @@ -207,7 +207,7 @@ fn should_execute_on_item_section_bodies() { #[test] fn should_execute_on_trait_method_section_headers() { let doc = test::mk_doc( - ~"iface i { + ~"trait i { #[doc = \"\ # Header \n\ Body\"]\ @@ -219,7 +219,7 @@ fn should_execute_on_trait_method_section_headers() { #[test] fn should_execute_on_trait_method_section_bodies() { let doc = test::mk_doc( - ~"iface i { + ~"trait i { #[doc = \"\ # Header\n\ Body \"]\ diff --git a/src/rustdoc/tystr_pass.rs b/src/rustdoc/tystr_pass.rs index a6bbfae1df6..865a4361aac 100644 --- a/src/rustdoc/tystr_pass.rs +++ b/src/rustdoc/tystr_pass.rs @@ -218,7 +218,7 @@ fn get_method_sig( #[test] fn should_add_trait_method_sigs() { - let doc = test::mk_doc(~"iface i { fn a() -> int; }"); + let doc = test::mk_doc(~"trait i { fn a() -> int; }"); assert doc.cratemod().traits()[0].methods[0].sig == some(~"fn a() -> int"); } diff --git a/src/test/auxiliary/cci_class_iface.rs b/src/test/auxiliary/cci_class_iface.rs index 61f22d47290..94535f0a2c0 100644 --- a/src/test/auxiliary/cci_class_iface.rs +++ b/src/test/auxiliary/cci_class_iface.rs @@ -1,6 +1,6 @@ mod animals { -iface noisy { +trait noisy { fn speak(); } diff --git a/src/test/auxiliary/issue-2380.rs b/src/test/auxiliary/issue-2380.rs index b7f7004600e..6749998c612 100644 --- a/src/test/auxiliary/issue-2380.rs +++ b/src/test/auxiliary/issue-2380.rs @@ -1,7 +1,7 @@ #[link(name = "a", vers = "0.0")]; #[crate_type = "lib"]; -iface i { } +trait i { } fn f() -> i { impl of i for () { } diff --git a/src/test/auxiliary/issue_2242_a.rs b/src/test/auxiliary/issue_2242_a.rs index e7947cf583a..54ae3cba785 100644 --- a/src/test/auxiliary/issue_2242_a.rs +++ b/src/test/auxiliary/issue_2242_a.rs @@ -1,7 +1,7 @@ #[link(name = "a", vers = "0.1")]; #[crate_type = "lib"]; -iface to_str { +trait to_str { fn to_str() -> str; } diff --git a/src/test/compile-fail/ambig_impl_bounds.rs b/src/test/compile-fail/ambig_impl_bounds.rs index 9d7a9634a07..21399eab729 100644 --- a/src/test/compile-fail/ambig_impl_bounds.rs +++ b/src/test/compile-fail/ambig_impl_bounds.rs @@ -1,5 +1,5 @@ -iface A { fn foo(); } -iface B { fn foo(); } +trait A { fn foo(); } +trait B { fn foo(); } fn foo(t: T) { t.foo(); //~ ERROR multiple applicable methods in scope diff --git a/src/test/compile-fail/class-cast-to-iface.rs b/src/test/compile-fail/class-cast-to-iface.rs index 72e215688fd..fb35b788779 100644 --- a/src/test/compile-fail/class-cast-to-iface.rs +++ b/src/test/compile-fail/class-cast-to-iface.rs @@ -1,5 +1,5 @@ // error-pattern: attempted access of field `eat` on type `noisy` -iface noisy { +trait noisy { fn speak(); } diff --git a/src/test/compile-fail/class-method-missing.rs b/src/test/compile-fail/class-method-missing.rs index 788baa73c34..b49fa62577d 100644 --- a/src/test/compile-fail/class-method-missing.rs +++ b/src/test/compile-fail/class-method-missing.rs @@ -1,5 +1,5 @@ // error-pattern:missing method `eat` -iface animal { +trait animal { fn eat(); } diff --git a/src/test/compile-fail/iface-cast.rs b/src/test/compile-fail/iface-cast.rs index a82bb0b80d2..f6642ec1b62 100644 --- a/src/test/compile-fail/iface-cast.rs +++ b/src/test/compile-fail/iface-cast.rs @@ -1,4 +1,4 @@ -iface foo { } +trait foo { } fn bar(x: foo) -> foo { ret (x as foo::); 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 9c51f56e54c..0ac42fe52eb 100644 --- a/src/test/compile-fail/iface-impl-different-num-params.rs +++ b/src/test/compile-fail/iface-impl-different-num-params.rs @@ -1,4 +1,4 @@ -iface foo { +trait foo { fn bar(x: uint) -> self; } impl of foo for int { diff --git a/src/test/compile-fail/iface-keyword.rs b/src/test/compile-fail/iface-keyword.rs new file mode 100644 index 00000000000..a2ae5a42849 --- /dev/null +++ b/src/test/compile-fail/iface-keyword.rs @@ -0,0 +1,5 @@ +iface foo { } //~ WARN `iface` is deprecated; use `trait` + +fn main() { + x //~ ERROR unresolved name: x +} \ No newline at end of file diff --git a/src/test/compile-fail/iface-test-2.rs b/src/test/compile-fail/iface-test-2.rs index dc1b9501df0..b53f1972b72 100644 --- a/src/test/compile-fail/iface-test-2.rs +++ b/src/test/compile-fail/iface-test-2.rs @@ -1,4 +1,4 @@ -iface bar { fn dup() -> self; fn blah(); } +trait bar { fn dup() -> self; fn blah(); } impl of bar for int { fn dup() -> int { self } fn blah() {} } impl of bar for uint { fn dup() -> uint { self } fn blah() {} } diff --git a/src/test/compile-fail/iface-test.rs b/src/test/compile-fail/iface-test.rs index 1523c4d9b96..3084c0f4e57 100644 --- a/src/test/compile-fail/iface-test.rs +++ b/src/test/compile-fail/iface-test.rs @@ -1,4 +1,4 @@ -iface foo { fn foo(); } +trait foo { fn foo(); } impl of int for uint { fn foo() {} } //~ ERROR trait diff --git a/src/test/compile-fail/infinite-instantiation.rs b/src/test/compile-fail/infinite-instantiation.rs index fa49f605306..7d019461b48 100644 --- a/src/test/compile-fail/infinite-instantiation.rs +++ b/src/test/compile-fail/infinite-instantiation.rs @@ -1,7 +1,7 @@ // error-pattern: overly deep expansion // issue 2258 -iface to_opt { +trait to_opt { fn to_option() -> option; } diff --git a/src/test/compile-fail/issue-2330.rs b/src/test/compile-fail/issue-2330.rs index 9bbba8f5caf..8ae1cdbe18a 100644 --- a/src/test/compile-fail/issue-2330.rs +++ b/src/test/compile-fail/issue-2330.rs @@ -1,6 +1,6 @@ enum chan { } -iface channel { +trait channel { fn send(v: T); } diff --git a/src/test/compile-fail/issue-3021-d.rs b/src/test/compile-fail/issue-3021-d.rs index 85a8fb8a091..145cce00839 100644 --- a/src/test/compile-fail/issue-3021-d.rs +++ b/src/test/compile-fail/issue-3021-d.rs @@ -1,6 +1,6 @@ use std; -iface siphash { +trait siphash { fn result() -> u64; fn reset(); } diff --git a/src/test/compile-fail/issue-3021.rs b/src/test/compile-fail/issue-3021.rs index 5895f8413ea..89fe96b7302 100644 --- a/src/test/compile-fail/issue-3021.rs +++ b/src/test/compile-fail/issue-3021.rs @@ -1,6 +1,6 @@ use std; -iface siphash { +trait siphash { fn reset(); } diff --git a/src/test/compile-fail/kindck-owned-trait-contains.rs b/src/test/compile-fail/kindck-owned-trait-contains.rs index 8383a500e80..00d5f8e9901 100644 --- a/src/test/compile-fail/kindck-owned-trait-contains.rs +++ b/src/test/compile-fail/kindck-owned-trait-contains.rs @@ -1,11 +1,11 @@ -iface repeat { fn get() -> A; } +trait repeat { fn get() -> A; } impl of repeat for @A { fn get() -> A { *self } } fn repeater(v: @A) -> repeat { - // Note: owned kind is not necessary as A appears in the iface type + // Note: owned kind is not necessary as A appears in the trait type v as repeat:: // No } diff --git a/src/test/compile-fail/kindck-owned-trait-scoped.rs b/src/test/compile-fail/kindck-owned-trait-scoped.rs index 26570868c5f..888e75a4f32 100644 --- a/src/test/compile-fail/kindck-owned-trait-scoped.rs +++ b/src/test/compile-fail/kindck-owned-trait-scoped.rs @@ -1,7 +1,7 @@ -// A dummy iface/impl that work close over any type. The iface will +// A dummy trait/impl that work close over any type. The trait will // be parameterized by a region due to the &self/int constraint. -iface foo { +trait foo { fn foo(i: &self/int) -> int; } diff --git a/src/test/compile-fail/kindck-owned-trait.rs b/src/test/compile-fail/kindck-owned-trait.rs index e1cebb46c47..35009847c73 100644 --- a/src/test/compile-fail/kindck-owned-trait.rs +++ b/src/test/compile-fail/kindck-owned-trait.rs @@ -1,4 +1,4 @@ -iface foo { fn foo(); } +trait foo { fn foo(); } fn to_foo(t: T) -> foo { t as foo //~ ERROR value may contain borrowed pointers; use `owned` bound diff --git a/src/test/compile-fail/map-types.rs b/src/test/compile-fail/map-types.rs index 4b3649e30e8..0a506367341 100644 --- a/src/test/compile-fail/map-types.rs +++ b/src/test/compile-fail/map-types.rs @@ -3,7 +3,7 @@ import std::map; import std::map::hashmap; import std::map::map; -// Test that iface types printed in error msgs include the type arguments. +// Test that trait types printed in error msgs include the type arguments. fn main() { let x: map<~str,~str> = map::str_hash::<~str>() as map::<~str,~str>; diff --git a/src/test/compile-fail/qquote-1.rs b/src/test/compile-fail/qquote-1.rs index 43a3536ed16..a1211e1b09f 100644 --- a/src/test/compile-fail/qquote-1.rs +++ b/src/test/compile-fail/qquote-1.rs @@ -15,7 +15,7 @@ fn new_parse_sess() -> parse::parse_sess { fail; } -iface fake_ext_ctxt { +trait fake_ext_ctxt { fn session() -> fake_session; } diff --git a/src/test/compile-fail/qquote-2.rs b/src/test/compile-fail/qquote-2.rs index 80b42622ffd..6469e046229 100644 --- a/src/test/compile-fail/qquote-2.rs +++ b/src/test/compile-fail/qquote-2.rs @@ -15,7 +15,7 @@ fn new_parse_sess() -> parser::parse_sess { fail; } -iface fake_ext_ctxt { +trait fake_ext_ctxt { fn session() -> fake_session; } diff --git a/src/test/compile-fail/regions-bounds.rs b/src/test/compile-fail/regions-bounds.rs index 59e8af556de..e62b702e53f 100644 --- a/src/test/compile-fail/regions-bounds.rs +++ b/src/test/compile-fail/regions-bounds.rs @@ -3,15 +3,15 @@ // checked. enum an_enum = ∫ -iface an_iface { fn foo() -> &self/int; } +trait a_trait { fn foo() -> &self/int; } class a_class { let x:&self/int; new(x:&self/int) { self.x = x; } } fn a_fn1(e: an_enum/&a) -> an_enum/&b { ret e; //~ ERROR mismatched types: expected `an_enum/&b` but found `an_enum/&a` } -fn a_fn2(e: an_iface/&a) -> an_iface/&b { - ret e; //~ ERROR mismatched types: expected `an_iface/&b` but found `an_iface/&a` +fn a_fn2(e: a_trait/&a) -> a_trait/&b { + ret e; //~ ERROR mismatched types: expected `a_trait/&b` but found `a_trait/&a` } fn a_fn3(e: a_class/&a) -> a_class/&b { diff --git a/src/test/compile-fail/regions-escape-via-iface-or-not.rs b/src/test/compile-fail/regions-escape-via-iface-or-not.rs index 297b183a1b4..ef5f3463e8e 100644 --- a/src/test/compile-fail/regions-escape-via-iface-or-not.rs +++ b/src/test/compile-fail/regions-escape-via-iface-or-not.rs @@ -1,4 +1,4 @@ -iface deref { +trait deref { fn get() -> int; } diff --git a/src/test/compile-fail/regions-iface-1.rs b/src/test/compile-fail/regions-iface-1.rs index 230bf150a1c..71081ac37fb 100644 --- a/src/test/compile-fail/regions-iface-1.rs +++ b/src/test/compile-fail/regions-iface-1.rs @@ -1,6 +1,6 @@ type ctxt = { v: uint }; -iface get_ctxt { +trait get_ctxt { // Here the `&` is bound in the method definition: fn get_ctxt() -> &ctxt; } diff --git a/src/test/compile-fail/regions-iface-2.rs b/src/test/compile-fail/regions-iface-2.rs index 7ea17cea45a..c034f8a753a 100644 --- a/src/test/compile-fail/regions-iface-2.rs +++ b/src/test/compile-fail/regions-iface-2.rs @@ -1,6 +1,6 @@ type ctxt = { v: uint }; -iface get_ctxt { +trait get_ctxt { fn get_ctxt() -> &self/ctxt; } diff --git a/src/test/compile-fail/regions-iface-3.rs b/src/test/compile-fail/regions-iface-3.rs index ff6d7b42a53..78e77d66def 100644 --- a/src/test/compile-fail/regions-iface-3.rs +++ b/src/test/compile-fail/regions-iface-3.rs @@ -1,4 +1,4 @@ -iface get_ctxt { +trait get_ctxt { fn get_ctxt() -> &self/uint; } diff --git a/src/test/compile-fail/regions-infer-paramd-method.rs b/src/test/compile-fail/regions-infer-paramd-method.rs index 33c699c0c86..ea62d72cd66 100644 --- a/src/test/compile-fail/regions-infer-paramd-method.rs +++ b/src/test/compile-fail/regions-infer-paramd-method.rs @@ -1,7 +1,7 @@ // Here: foo is parameterized because it contains a method that // refers to self. -iface foo { +trait foo { fn self_int() -> &self/int; fn any_int() -> ∫ @@ -21,7 +21,7 @@ impl methods of set_foo_foo for with_foo { // Bar is not region parameterized. -iface bar { +trait bar { fn any_int() -> ∫ } diff --git a/src/test/compile-fail/selftype-astparam.rs b/src/test/compile-fail/selftype-astparam.rs index 64699267c4d..25dd29300e5 100644 --- a/src/test/compile-fail/selftype-astparam.rs +++ b/src/test/compile-fail/selftype-astparam.rs @@ -1,4 +1,4 @@ -iface add { +trait add { fn plus(++x: self) -> self; } diff --git a/src/test/compile-fail/selftype-ifacetype.rs b/src/test/compile-fail/selftype-ifacetype.rs index c4ba8093886..09fc12fda1e 100644 --- a/src/test/compile-fail/selftype-ifacetype.rs +++ b/src/test/compile-fail/selftype-ifacetype.rs @@ -1,4 +1,4 @@ -iface add { +trait add { fn plus(x: self) -> self; } diff --git a/src/test/compile-fail/seq-args.rs b/src/test/compile-fail/seq-args.rs index db2cb9b7a17..4d9eadf65ed 100644 --- a/src/test/compile-fail/seq-args.rs +++ b/src/test/compile-fail/seq-args.rs @@ -1,6 +1,6 @@ use std; fn main() { -iface seq { } +trait seq { } impl of seq for ~[T] { //~ ERROR wrong number of type arguments /* ... */ diff --git a/src/test/compile-fail/tps-invariant-iface.rs b/src/test/compile-fail/tps-invariant-iface.rs index 81caef856c2..82fbd5f1163 100644 --- a/src/test/compile-fail/tps-invariant-iface.rs +++ b/src/test/compile-fail/tps-invariant-iface.rs @@ -1,4 +1,4 @@ -iface box_iface { +trait box_trait { fn get() -> T; fn set(t: T); } @@ -7,12 +7,12 @@ enum box_impl = { mut f: T }; -impl of box_iface for box_impl { +impl of box_trait for box_impl { fn get() -> T { ret self.f; } fn set(t: T) { self.f = t; } } -fn set_box_iface(b: box_iface<@const T>, v: @const T) { +fn set_box_trait(b: box_trait<@const T>, v: @const T) { b.set(v); } @@ -22,7 +22,7 @@ fn set_box_impl(b: box_impl<@const T>, v: @const T) { fn main() { let b = box_impl::<@int>({mut f: @3}); - set_box_iface(b as box_iface::<@int>, @mut 5); + set_box_trait(b as box_trait::<@int>, @mut 5); //~^ ERROR values differ in mutability set_box_impl(b, @mut 5); //~^ ERROR values differ in mutability diff --git a/src/test/run-fail/unwind-box-iface.rs b/src/test/run-fail/unwind-box-iface.rs index b9c674bd008..f56cc13273b 100644 --- a/src/test/run-fail/unwind-box-iface.rs +++ b/src/test/run-fail/unwind-box-iface.rs @@ -4,7 +4,7 @@ fn failfn() { fail; } -iface i { +trait i { fn foo(); } diff --git a/src/test/run-pass-fulldeps/issue-1926.rs b/src/test/run-pass-fulldeps/issue-1926.rs index f4dbf24f005..5a19fb96464 100644 --- a/src/test/run-pass-fulldeps/issue-1926.rs +++ b/src/test/run-pass-fulldeps/issue-1926.rs @@ -21,7 +21,7 @@ fn new_parse_sess() -> parser::parse_sess { ret sess; } -iface fake_ext_ctxt { +trait fake_ext_ctxt { fn session() -> fake_session; fn cfg() -> ast::crate_cfg; fn parse_sess() -> parser::parse_sess; diff --git a/src/test/run-pass-fulldeps/qquote.rs b/src/test/run-pass-fulldeps/qquote.rs index 173884d1d66..bdf1cb63f99 100644 --- a/src/test/run-pass-fulldeps/qquote.rs +++ b/src/test/run-pass-fulldeps/qquote.rs @@ -11,7 +11,7 @@ import syntax::codemap; import syntax::parse; import syntax::print::*; -iface fake_ext_ctxt { +trait fake_ext_ctxt { fn cfg() -> ast::crate_cfg; fn parse_sess() -> parse::parse_sess; } diff --git a/src/test/run-pass/assignability-iface.rs b/src/test/run-pass/assignability-iface.rs index b0d0f3074d0..f555f61f5b8 100644 --- a/src/test/run-pass/assignability-iface.rs +++ b/src/test/run-pass/assignability-iface.rs @@ -2,7 +2,7 @@ // making method calls, but only if there aren't any matches without // it. -iface iterable { +trait iterable { fn iterate(blk: fn(A) -> bool); } diff --git a/src/test/run-pass/class-cast-to-iface-multiple-types.rs b/src/test/run-pass/class-cast-to-iface-multiple-types.rs index a55ef9f8bd7..d28c60dd291 100644 --- a/src/test/run-pass/class-cast-to-iface-multiple-types.rs +++ b/src/test/run-pass/class-cast-to-iface-multiple-types.rs @@ -1,4 +1,4 @@ -iface noisy { +trait noisy { fn speak() -> int; } diff --git a/src/test/run-pass/class-cast-to-iface.rs b/src/test/run-pass/class-cast-to-iface.rs index bba7540d22b..0fba6a7b74b 100644 --- a/src/test/run-pass/class-cast-to-iface.rs +++ b/src/test/run-pass/class-cast-to-iface.rs @@ -1,4 +1,4 @@ -iface noisy { +trait noisy { fn speak(); } diff --git a/src/test/run-pass/class-impl-very-parameterized-iface.rs b/src/test/run-pass/class-impl-very-parameterized-iface.rs index 4126df0f5b7..2a5bcc98f06 100644 --- a/src/test/run-pass/class-impl-very-parameterized-iface.rs +++ b/src/test/run-pass/class-impl-very-parameterized-iface.rs @@ -6,7 +6,7 @@ enum cat_type { tuxedo, tabby, tortoiseshell } // Very silly -- this just returns the value of the name field // for any int value that's less than the meows field -// ok: T should be in scope when resolving the iface ref for map +// ok: T should be in scope when resolving the trait ref for map class cat : map { priv { // Yes, you can have negative meows diff --git a/src/test/run-pass/class-implement-ifaces.rs b/src/test/run-pass/class-implement-ifaces.rs index eedc308a460..73a2e685af1 100644 --- a/src/test/run-pass/class-implement-ifaces.rs +++ b/src/test/run-pass/class-implement-ifaces.rs @@ -1,4 +1,4 @@ -iface noisy { +trait noisy { fn speak(); } diff --git a/src/test/run-pass/class-implements-multiple-ifaces.rs b/src/test/run-pass/class-implements-multiple-ifaces.rs index b8fd1dd2f27..968dfb07bf9 100644 --- a/src/test/run-pass/class-implements-multiple-ifaces.rs +++ b/src/test/run-pass/class-implements-multiple-ifaces.rs @@ -8,15 +8,15 @@ import dvec::{dvec, extensions}; enum furniture { chair, couch, bed } enum body_part { finger, toe, nose, ear } -iface noisy { +trait noisy { fn speak() -> int; } -iface scratchy { +trait scratchy { fn scratch() -> option; } -iface bitey { +trait bitey { fn bite() -> body_part; } diff --git a/src/test/run-pass/iface-cast.rs b/src/test/run-pass/iface-cast.rs index ce1147dd176..919c53d32b2 100644 --- a/src/test/run-pass/iface-cast.rs +++ b/src/test/run-pass/iface-cast.rs @@ -1,4 +1,4 @@ -// Test cyclic detector when using iface instances. +// Test cyclic detector when using trait instances. enum Tree = TreeR; type TreeR = @{ @@ -7,7 +7,7 @@ type TreeR = @{ val: to_str }; -iface to_str { +trait to_str { fn to_str() -> ~str; } diff --git a/src/test/run-pass/iface-generic.rs b/src/test/run-pass/iface-generic.rs index f60dd6e1f18..d6b1aa4ee1f 100644 --- a/src/test/run-pass/iface-generic.rs +++ b/src/test/run-pass/iface-generic.rs @@ -1,4 +1,4 @@ -iface to_str { +trait to_str { fn to_str() -> ~str; } impl of to_str for int { @@ -11,7 +11,7 @@ impl of to_str for () { fn to_str() -> ~str { ~"()" } } -iface map { +trait map { fn map(f: fn(T) -> U) -> ~[U]; } impl of map for ~[T] { diff --git a/src/test/run-pass/iface-to-str.rs b/src/test/run-pass/iface-to-str.rs index 71d25b4efd5..29d17cc7c7d 100644 --- a/src/test/run-pass/iface-to-str.rs +++ b/src/test/run-pass/iface-to-str.rs @@ -1,4 +1,4 @@ -iface to_str { +trait to_str { fn to_str() -> ~str; } diff --git a/src/test/run-pass/issue-2185.rs b/src/test/run-pass/issue-2185.rs index 104ea37588b..67f90d6e3d6 100644 --- a/src/test/run-pass/issue-2185.rs +++ b/src/test/run-pass/issue-2185.rs @@ -1,8 +1,8 @@ -// This test had to do with an outdated version of the iterable iface. +// This test had to do with an outdated version of the iterable trait. // However, the condition it was testing seemed complex enough to // warrant still having a test, so I inlined the old definitions. -iface iterable { +trait iterable { fn iter(blk: fn(A)); } diff --git a/src/test/run-pass/issue-2288.rs b/src/test/run-pass/issue-2288.rs index e2db655ca5d..559edf37956 100644 --- a/src/test/run-pass/issue-2288.rs +++ b/src/test/run-pass/issue-2288.rs @@ -1,4 +1,4 @@ -iface clam { +trait clam { fn chowder(y: A); } class foo : clam { diff --git a/src/test/run-pass/issue-2311-2.rs b/src/test/run-pass/issue-2311-2.rs index d9a68bcf7a0..328b6b3b4c3 100644 --- a/src/test/run-pass/issue-2311-2.rs +++ b/src/test/run-pass/issue-2311-2.rs @@ -1,4 +1,4 @@ -iface clam { } +trait clam { } class foo { let x: A; new(b: A) { self.x = b; } diff --git a/src/test/run-pass/issue-2311.rs b/src/test/run-pass/issue-2311.rs index f46228e9846..267fd08d123 100644 --- a/src/test/run-pass/issue-2311.rs +++ b/src/test/run-pass/issue-2311.rs @@ -1,5 +1,5 @@ -iface clam { } -iface foo { +trait clam { } +trait foo { fn bar>(c: C) -> B; } diff --git a/src/test/run-pass/issue-2734.rs b/src/test/run-pass/issue-2734.rs index 9c655c5954a..d466265cf7a 100644 --- a/src/test/run-pass/issue-2734.rs +++ b/src/test/run-pass/issue-2734.rs @@ -1,4 +1,4 @@ -iface hax { } +trait hax { } impl of hax for A { } fn perform_hax(x: @T) -> hax { diff --git a/src/test/run-pass/issue-2735.rs b/src/test/run-pass/issue-2735.rs index 2ff4aa77856..7a5479ac3fa 100644 --- a/src/test/run-pass/issue-2735.rs +++ b/src/test/run-pass/issue-2735.rs @@ -1,4 +1,4 @@ -iface hax { } +trait hax { } impl of hax for A { } fn perform_hax(x: @T) -> hax { diff --git a/src/test/run-pass/kindck-owned-trait-contains-1.rs b/src/test/run-pass/kindck-owned-trait-contains-1.rs index 4b7f01e39de..e69714e5aa7 100644 --- a/src/test/run-pass/kindck-owned-trait-contains-1.rs +++ b/src/test/run-pass/kindck-owned-trait-contains-1.rs @@ -1,11 +1,11 @@ -iface repeat { fn get() -> A; } +trait repeat { fn get() -> A; } impl of repeat for @A { fn get() -> A { *self } } fn repeater(v: @A) -> repeat { - // Note: owned kind is not necessary as A appears in the iface type + // Note: owned kind is not necessary as A appears in the trait type v as repeat:: // No } diff --git a/src/test/run-pass/method-attributes.rs b/src/test/run-pass/method-attributes.rs index 0b711682b0a..b48d3887379 100644 --- a/src/test/run-pass/method-attributes.rs +++ b/src/test/run-pass/method-attributes.rs @@ -1,7 +1,7 @@ // pp-exact - Make sure we print all the attributes #[frobable] -iface frobable { +trait frobable { #[frob_attr] fn frob(); #[defrob_attr] diff --git a/src/test/run-pass/monomorphize-iface-in-fn-at.rs b/src/test/run-pass/monomorphize-iface-in-fn-at.rs index 3530426de70..bc782d44416 100644 --- a/src/test/run-pass/monomorphize-iface-in-fn-at.rs +++ b/src/test/run-pass/monomorphize-iface-in-fn-at.rs @@ -6,7 +6,7 @@ fn mk_nil(cx: C) -> uint { cx.mk() } -iface ty_ops { +trait ty_ops { fn mk() -> uint; } diff --git a/src/test/run-pass/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs index 356be35b1f8..2e38cc4b348 100644 --- a/src/test/run-pass/reflect-visit-data.rs +++ b/src/test/run-pass/reflect-visit-data.rs @@ -11,8 +11,8 @@ type unboxed_vec_repr = { #[doc = "High-level interfaces to `intrinsic::visit_ty` reflection system."] -/// Iface for visitor that wishes to reflect on data. -iface movable_ptr { +/// Trait for visitor that wishes to reflect on data. +trait movable_ptr { fn move_ptr(adjustment: fn(*c_void) -> *c_void); } diff --git a/src/test/run-pass/regions-iface.rs b/src/test/run-pass/regions-iface.rs index 619d2cdeaeb..1d264b706ed 100644 --- a/src/test/run-pass/regions-iface.rs +++ b/src/test/run-pass/regions-iface.rs @@ -1,6 +1,6 @@ type ctxt = { v: uint }; -iface get_ctxt { +trait get_ctxt { fn get_ctxt() -> &self/ctxt; } diff --git a/src/test/run-pass/traits.rs b/src/test/run-pass/traits.rs index c50d9bf96ac..8b1ea84ba0d 100644 --- a/src/test/run-pass/traits.rs +++ b/src/test/run-pass/traits.rs @@ -8,7 +8,7 @@ trait Eq { fn eq(a: self) -> bool; fn neq(a: self) -> bool { - !self.neq(a) + !self.eq(a) } } @@ -34,12 +34,12 @@ trait Ord < Eq { // pronounced "impl of Ord for int" -- not sold on this yet impl int: Ord { - fn lt(a: self) -> bool { + fn lt(a: int) -> bool { self < a } // is this the place to put this? - fn eq(a: self) -> bool { + fn eq(a: int) -> bool { self == a } } diff --git a/src/test/run-pass/use-iface-before-def.rs b/src/test/run-pass/use-iface-before-def.rs index aa981e2fb4b..6687c61ce45 100644 --- a/src/test/run-pass/use-iface-before-def.rs +++ b/src/test/run-pass/use-iface-before-def.rs @@ -1,5 +1,5 @@ // Issue #1761 impl of foo for int { fn foo() -> int { 10 } } -iface foo { fn foo() -> int; } +trait foo { fn foo() -> int; } fn main() {} \ No newline at end of file