]> git.lizzy.rs Git - rust.git/commitdiff
Fallout: tests. As tests frequently elide things, lots of changes
authorNiko Matsakis <niko@alum.mit.edu>
Thu, 12 Feb 2015 15:29:52 +0000 (10:29 -0500)
committerNiko Matsakis <niko@alum.mit.edu>
Wed, 18 Feb 2015 15:25:28 +0000 (10:25 -0500)
here.  Some of this may have been poorly rebased, though I tried to be
careful and preserve the spirit of the test.

306 files changed:
src/libcoretest/mem.rs
src/test/auxiliary/coherence-orphan-lib.rs
src/test/auxiliary/default_type_params_xc.rs
src/test/auxiliary/inner_static.rs
src/test/auxiliary/issue-14421.rs
src/test/auxiliary/issue-16643.rs
src/test/auxiliary/issue-17662.rs
src/test/auxiliary/issue-2380.rs
src/test/auxiliary/issue-2526.rs
src/test/auxiliary/issue_20389.rs
src/test/auxiliary/issue_3907.rs
src/test/auxiliary/issue_8401.rs
src/test/auxiliary/issue_9123.rs
src/test/auxiliary/lang-item-public.rs
src/test/auxiliary/lint_stability.rs
src/test/auxiliary/nested_item.rs
src/test/auxiliary/orphan_check_diagnostics.rs
src/test/auxiliary/overloaded_autoderef_xc.rs
src/test/auxiliary/private_trait_xc.rs
src/test/auxiliary/svh-a-base.rs
src/test/auxiliary/svh-a-change-lit.rs
src/test/auxiliary/svh-a-change-significant-cfg.rs
src/test/auxiliary/svh-a-change-trait-bound.rs
src/test/auxiliary/svh-a-change-type-arg.rs
src/test/auxiliary/svh-a-change-type-ret.rs
src/test/auxiliary/svh-a-change-type-static.rs
src/test/auxiliary/svh-a-comment.rs
src/test/auxiliary/svh-a-doc.rs
src/test/auxiliary/svh-a-macro.rs
src/test/auxiliary/svh-a-no-change.rs
src/test/auxiliary/svh-a-redundant-cfg.rs
src/test/auxiliary/svh-a-whitespace.rs
src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs
src/test/auxiliary/trait_impl_conflict.rs
src/test/auxiliary/use_from_trait_xc.rs
src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs
src/test/compile-fail/associated-types-coherence-failure.rs
src/test/compile-fail/associated-types-eq-expr-path.rs
src/test/compile-fail/associated-types-issue-17359.rs
src/test/compile-fail/associated-types-multiple-types-one-trait.rs
src/test/compile-fail/associated-types-no-suitable-supertrait.rs
src/test/compile-fail/associated-types-path-2.rs
src/test/compile-fail/associated-types-unconstrained.rs
src/test/compile-fail/bad-mid-path-type-params.rs
src/test/compile-fail/bad-sized.rs
src/test/compile-fail/coherence-blanket-conflicts-with-blanket-implemented.rs
src/test/compile-fail/coherence-blanket-conflicts-with-blanket-unimplemented.rs
src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs
src/test/compile-fail/cross-borrow-trait.rs
src/test/compile-fail/destructure-trait-ref.rs
src/test/compile-fail/dst-bad-coerce1.rs
src/test/compile-fail/dst-bad-coerce2.rs
src/test/compile-fail/dst-bad-coerce3.rs
src/test/compile-fail/dst-bad-coercions.rs
src/test/compile-fail/dst-object-from-unsized-type.rs
src/test/compile-fail/exclusive-drop-and-copy.rs
src/test/compile-fail/generic-impl-less-params-with-defaults.rs
src/test/compile-fail/generic-impl-more-params-with-defaults.rs
src/test/compile-fail/generic-lifetime-trait-impl.rs
src/test/compile-fail/generic-type-less-params-with-defaults.rs
src/test/compile-fail/generic-type-more-params-with-defaults.rs
src/test/compile-fail/generic-type-params-name-repr.rs
src/test/compile-fail/issue-11515.rs
src/test/compile-fail/issue-13853-2.rs
src/test/compile-fail/issue-13853-3.rs
src/test/compile-fail/issue-13853.rs
src/test/compile-fail/issue-14285.rs
src/test/compile-fail/issue-14853.rs
src/test/compile-fail/issue-16747.rs
src/test/compile-fail/issue-17431-4.rs
src/test/compile-fail/issue-17431-5.rs
src/test/compile-fail/issue-17551.rs
src/test/compile-fail/issue-18107.rs
src/test/compile-fail/issue-18611.rs
src/test/compile-fail/issue-18783.rs
src/test/compile-fail/issue-18819.rs
src/test/compile-fail/issue-19660.rs
src/test/compile-fail/issue-2063.rs
src/test/compile-fail/issue-20831-debruijn.rs
src/test/compile-fail/issue-2611-4.rs
src/test/compile-fail/issue-3008-3.rs
src/test/compile-fail/issue-4972.rs
src/test/compile-fail/issue-5035-2.rs
src/test/compile-fail/issue-5543.rs
src/test/compile-fail/issue-5883.rs
src/test/compile-fail/issue-6458.rs
src/test/compile-fail/issue-7575.rs
src/test/compile-fail/issue-8727.rs
src/test/compile-fail/kindck-copy.rs
src/test/compile-fail/kindck-impl-type-params-2.rs
src/test/compile-fail/kindck-impl-type-params.rs
src/test/compile-fail/kindck-send-object.rs
src/test/compile-fail/kindck-send-object1.rs
src/test/compile-fail/kindck-send-object2.rs
src/test/compile-fail/lifetime-inference-give-expl-lifetime-param-3.rs
src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs
src/test/compile-fail/lint-missing-doc.rs
src/test/compile-fail/lint-non-camel-case-types.rs
src/test/compile-fail/lint-stability.rs
src/test/compile-fail/lint-visible-private-types.rs
src/test/compile-fail/liveness-use-after-send.rs
src/test/compile-fail/map-types.rs
src/test/compile-fail/method-ambig-one-trait-coerce.rs [deleted file]
src/test/compile-fail/object-does-not-impl-trait.rs
src/test/compile-fail/object-lifetime-default-mybox.rs
src/test/compile-fail/object-safety-no-static.rs
src/test/compile-fail/on-unimplemented-bad-anno.rs
src/test/compile-fail/on-unimplemented.rs
src/test/compile-fail/orphan-check-diagnostics.rs
src/test/compile-fail/priv-in-bad-locations.rs
src/test/compile-fail/privacy-ns2.rs
src/test/compile-fail/privacy1.rs
src/test/compile-fail/privacy4.rs
src/test/compile-fail/region-object-lifetime-in-coercion.rs
src/test/compile-fail/regions-assoc-type-region-bound-in-trait-not-met.rs
src/test/compile-fail/regions-assoc-type-static-bound-in-trait-not-met.rs
src/test/compile-fail/regions-bound-missing-bound-in-impl.rs
src/test/compile-fail/regions-bounded-method-type-parameters-trait-bound.rs
src/test/compile-fail/regions-close-associated-type-into-object.rs
src/test/compile-fail/regions-close-object-into-object-1.rs
src/test/compile-fail/regions-close-object-into-object-2.rs
src/test/compile-fail/regions-close-object-into-object-3.rs
src/test/compile-fail/regions-close-object-into-object-4.rs
src/test/compile-fail/regions-close-over-borrowed-ref-in-obj.rs
src/test/compile-fail/regions-close-param-into-object.rs
src/test/compile-fail/regions-infer-contravariance-due-to-decl.rs
src/test/compile-fail/regions-infer-covariance-due-to-decl.rs
src/test/compile-fail/regions-infer-invariance-due-to-decl.rs
src/test/compile-fail/required-lang-item.rs
src/test/compile-fail/shadowed-type-parameter.rs
src/test/compile-fail/slightly-nice-generic-literal-messages.rs
src/test/compile-fail/staticness-mismatch.rs
src/test/compile-fail/trait-as-struct-constructor.rs
src/test/compile-fail/trait-bounds-cant-coerce.rs
src/test/compile-fail/trait-bounds-impl-comparison-1.rs
src/test/compile-fail/trait-bounds-impl-comparison-2.rs
src/test/compile-fail/trait-bounds-not-on-bare-trait.rs
src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs
src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs
src/test/compile-fail/trait-bounds-on-structs-and-enums.rs
src/test/compile-fail/trait-bounds-sugar.rs
src/test/compile-fail/trait-impl-1.rs
src/test/compile-fail/trait-object-safety.rs
src/test/compile-fail/trait-static-method-generic-inference.rs
src/test/compile-fail/typeck-negative-impls-builtin.rs
src/test/compile-fail/typeck_type_placeholder_mismatch.rs
src/test/compile-fail/unboxed-closure-feature-gate.rs
src/test/compile-fail/unboxed-closure-sugar-default.rs
src/test/compile-fail/unboxed-closure-sugar-equiv.rs
src/test/compile-fail/unboxed-closure-sugar-lifetime-elision.rs
src/test/compile-fail/unboxed-closure-sugar-region.rs
src/test/compile-fail/unboxed-closures-recursive-fn-using-fn-mut.rs
src/test/compile-fail/unnecessary-private.rs
src/test/compile-fail/unsized-inherent-impl-self-type.rs
src/test/compile-fail/unsized-trait-impl-self-type.rs
src/test/compile-fail/unsized-trait-impl-trait-arg.rs
src/test/compile-fail/unsized3.rs
src/test/compile-fail/unsized6.rs
src/test/compile-fail/unsized7.rs
src/test/compile-fail/unused-attr.rs
src/test/compile-fail/useless-priv.rs
src/test/compile-fail/useless-priv2.rs
src/test/compile-fail/variance-regions-direct.rs
src/test/compile-fail/variance-regions-indirect.rs
src/test/compile-fail/variance-trait-object-bound.rs
src/test/compile-fail/visible-private-types-generics.rs
src/test/compile-fail/visible-private-types-supertrait.rs
src/test/compile-fail/where-clause-method-substituion.rs
src/test/compile-fail/where-clauses-not-parameter.rs
src/test/debuginfo/type-names.rs
src/test/pretty/empty-impl.rs
src/test/pretty/path-type-bounds.rs
src/test/run-fail/bug-811.rs
src/test/run-make/rustdoc-json/foo.rs
src/test/run-make/rustdoc-negative-impl/foo.rs
src/test/run-make/rustdoc-search-index/index.rs
src/test/run-make/rustdoc-smoke/foo.rs
src/test/run-make/rustdoc-viewpath-self/foo.rs
src/test/run-make/rustdoc-where/foo.rs
src/test/run-make/save-analysis/foo.rs
src/test/run-make/simd-ffi/simd.rs
src/test/run-make/symbols-are-reasonable/lib.rs
src/test/run-make/target-specs/foo.rs
src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs
src/test/run-pass-valgrind/dst-dtor-1.rs
src/test/run-pass/associated-types-basic.rs
src/test/run-pass/associated-types-conditional-dispatch.rs
src/test/run-pass/associated-types-issue-20371.rs
src/test/run-pass/associated-types-issue-21212.rs
src/test/run-pass/associated-types-nested-projections.rs
src/test/run-pass/associated-types-normalize-in-bounds-binding.rs
src/test/run-pass/associated-types-normalize-in-bounds-ufcs.rs
src/test/run-pass/associated-types-normalize-in-bounds.rs
src/test/run-pass/associated-types-normalize-unifield-struct.rs
src/test/run-pass/associated-types-projection-from-known-type-in-impl.rs
src/test/run-pass/associated-types-projection-in-object-type.rs
src/test/run-pass/associated-types-projection-in-supertrait.rs
src/test/run-pass/associated-types-projection-in-where-clause.rs
src/test/run-pass/associated-types-ref-in-struct-literal.rs
src/test/run-pass/associated-types-resolve-lifetime.rs
src/test/run-pass/associated-types-struct-field-named.rs
src/test/run-pass/associated-types-struct-field-numbered.rs
src/test/run-pass/associated-types-sugar-path.rs
src/test/run-pass/borrowck-trait-lifetime.rs
src/test/run-pass/bug-7295.rs
src/test/run-pass/builtin-superkinds-in-metadata.rs
src/test/run-pass/builtin-superkinds-phantom-typaram.rs
src/test/run-pass/class-typarams.rs
src/test/run-pass/dst-coercions.rs
src/test/run-pass/enum-null-pointer-opt.rs
src/test/run-pass/explicit-self-generic.rs
src/test/run-pass/export-non-interference.rs [deleted file]
src/test/run-pass/generic-default-type-params-cross-crate.rs
src/test/run-pass/hrtb-opt-in-copy.rs
src/test/run-pass/inner-static.rs
src/test/run-pass/issue-10456.rs
src/test/run-pass/issue-10802.rs
src/test/run-pass/issue-10902.rs
src/test/run-pass/issue-11205.rs
src/test/run-pass/issue-11384.rs
src/test/run-pass/issue-11612.rs
src/test/run-pass/issue-11677.rs
src/test/run-pass/issue-13105.rs
src/test/run-pass/issue-14399.rs
src/test/run-pass/issue-14589.rs
src/test/run-pass/issue-14958.rs
src/test/run-pass/issue-14959.rs
src/test/run-pass/issue-15858.rs
src/test/run-pass/issue-16596.rs
src/test/run-pass/issue-16643.rs
src/test/run-pass/issue-17662.rs
src/test/run-pass/issue-17732.rs
src/test/run-pass/issue-17771.rs
src/test/run-pass/issue-17816.rs
src/test/run-pass/issue-17904.rs
src/test/run-pass/issue-18232.rs
src/test/run-pass/issue-18906.rs
src/test/run-pass/issue-19121.rs
src/test/run-pass/issue-19129-2.rs
src/test/run-pass/issue-19135.rs
src/test/run-pass/issue-19358.rs
src/test/run-pass/issue-19398.rs
src/test/run-pass/issue-19479.rs
src/test/run-pass/issue-19631.rs
src/test/run-pass/issue-19632.rs
src/test/run-pass/issue-20055-box-trait.rs
src/test/run-pass/issue-20343.rs
src/test/run-pass/issue-20763-1.rs
src/test/run-pass/issue-20763-2.rs
src/test/run-pass/issue-21363.rs
src/test/run-pass/issue-21909.rs
src/test/run-pass/issue-2311-2.rs
src/test/run-pass/issue-2311.rs
src/test/run-pass/issue-2312.rs
src/test/run-pass/issue-2611-3.rs
src/test/run-pass/issue-2734.rs
src/test/run-pass/issue-2735.rs
src/test/run-pass/issue-4107.rs
src/test/run-pass/issue-5192.rs
src/test/run-pass/issue-5708.rs
src/test/run-pass/issue-6128.rs
src/test/run-pass/issue-6318.rs
src/test/run-pass/issue-7575.rs
src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs
src/test/run-pass/issue-7911.rs
src/test/run-pass/issue-8248.rs
src/test/run-pass/issue-8249.rs
src/test/run-pass/issue-9719.rs
src/test/run-pass/lint-cstack.rs
src/test/run-pass/method-early-bound-lifetimes-on-self.rs
src/test/run-pass/method-recursive-blanket-impl.rs
src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs
src/test/run-pass/overloaded-autoderef-vtable.rs
src/test/run-pass/overloaded-calls-param-vtables.rs
src/test/run-pass/parameterized-trait-with-bounds.rs
src/test/run-pass/privacy-ns.rs
src/test/run-pass/regions-assoc-type-static-bound.rs
src/test/run-pass/regions-bound-lists-feature-gate-2.rs
src/test/run-pass/regions-bound-lists-feature-gate.rs
src/test/run-pass/regions-early-bound-lifetime-in-assoc-fn.rs
src/test/run-pass/regions-early-bound-trait-param.rs
src/test/run-pass/regions-infer-bivariance.rs [deleted file]
src/test/run-pass/regions-no-bound-in-argument-cleanup.rs
src/test/run-pass/regions-no-variance-from-fn-generics.rs
src/test/run-pass/self-impl.rs
src/test/run-pass/simple-match-generic-tag.rs
src/test/run-pass/syntax-trait-polarity.rs
src/test/run-pass/trailing-comma.rs
src/test/run-pass/trait-bounds-basic.rs
src/test/run-pass/trait-bounds-on-structs-and-enums.rs
src/test/run-pass/trait-bounds-recursion.rs
src/test/run-pass/trait-default-method-bound-subst4.rs
src/test/run-pass/trait-impl.rs
src/test/run-pass/trait-inheritance-num2.rs
src/test/run-pass/trait-inheritance-static2.rs
src/test/run-pass/trait-object-generics.rs
src/test/run-pass/trait-static-method-overwriting.rs
src/test/run-pass/unboxed-closures-infer-recursive-fn.rs
src/test/run-pass/unique-object-move.rs
src/test/run-pass/unsized.rs
src/test/run-pass/unsized2.rs
src/test/run-pass/visible-private-types-feature-gate.rs
src/test/run-pass/where-clause-bounds-inconsistency.rs
src/test/run-pass/where-clause-early-bound-lifetimes.rs
src/test/run-pass/where-clause-method-substituion.rs
src/test/run-pass/where-for-self.rs

index 421ce76caaf46e5ae9a1851555b867ddd093eafa..5aeb330b78b54023ac388d83d22f5eeff636b319 100644 (file)
@@ -92,7 +92,7 @@ fn test_transmute_copy() {
 
 #[test]
 fn test_transmute() {
-    trait Foo {}
+    trait Foo { fn dummy(&self) { } }
     impl Foo for int {}
 
     let a = box 100 as Box<Foo>;
index 2e5d18b58f22f4bbf9aa81c9f75018f625419b44..cc42b288e6638a0f7c36e385dbf25012c8ac791c 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub trait TheTrait<T> {
+pub trait TheTrait<T> : ::std::marker::PhantomFn<T> {
     fn the_fn(&self);
 }
 
index d12f716decf9925dfe4e53cb1e58f034dab283f8..0a65174911ec7149b473c4e9216bb35e2c173a27 100644 (file)
@@ -12,4 +12,5 @@
 
 pub struct FakeHeap;
 
-pub struct FakeVec<T, A = FakeHeap>;
+pub struct FakeVec<T, A = FakeHeap> { pub f: Option<(T,A)> }
+
index 94acea06618385a83e54a6a30afcaba468b474b8..ca5c6072cb371b98bd9ea096807f65abbb570944 100644 (file)
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub struct A<T>;
-pub struct B<T>;
+pub struct A<T> { pub v: T }
+pub struct B<T> { pub v: T }
 
 pub mod test {
-    pub struct A<T>;
+    pub struct A<T> { pub v: T }
 
     impl<T> A<T> {
         pub fn foo(&self) -> int {
@@ -52,9 +52,9 @@ pub fn bar(&self) -> int {
 }
 
 pub fn foo() -> int {
-    let a = A::<()>;
-    let b = B::<()>;
-    let c = test::A::<()>;
+    let a = A { v: () };
+    let b = B { v: () };
+    let c = test::A { v: () };
     return a.foo() + a.bar() +
            b.foo() + b.bar() +
            c.foo() + c.bar();
index 7c69cba179ca19bacabffc1a6e04b97fd7d909e0..a48088609f982ca7565fccde0828912430998f4c 100644 (file)
@@ -10,6 +10,7 @@
 
 #![crate_type="lib"]
 #![deny(warnings)]
+#![allow(dead_code)]
 
 pub use src::aliases::B;
 pub use src::hidden_core::make;
@@ -23,9 +24,9 @@ pub mod aliases {
     pub mod hidden_core {
         use super::aliases::B;
 
-        pub struct A<T>;
+        pub struct A<T> { t: T }
 
-        pub fn make() -> B { A }
+        pub fn make() -> B { A { t: 1.0 } }
 
         impl<T> A<T> {
             pub fn foo(&mut self) { println!("called foo"); }
index c5b3fceaf4a5febc01773f6a43254baf8f587e42..b590160a0c2ab5d8c1c467660a26dbc4818081a8 100644 (file)
@@ -10,7 +10,7 @@
 
 #![crate_type = "lib"]
 
-pub struct TreeBuilder<H>;
+pub struct TreeBuilder<H> { pub h: H }
 
 impl<H> TreeBuilder<H> {
     pub fn process_token(&mut self) {
index be10ca1dd8fd82c9cf00a8389bff6d3c45741629..fb55a077005eb8d9662a02f4e24f1b2f67900784 100644 (file)
@@ -11,7 +11,7 @@
 #![crate_type = "lib"]
 
 pub trait Foo<'a, T> {
-    fn foo(&self) -> T;
+    fn foo(&'a self) -> T;
 }
 
 pub fn foo<'a, T>(x: &'a Foo<'a, T>) -> T {
index 8eb6cd6e263182e9e48502566d0e0464804439fa..96f33f97a696973c891a36bbe0e0a742f5598bf9 100644 (file)
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-pub trait i<T> { }
+pub trait i<T>
+{
+    fn dummy(&self, t: T) -> T { panic!() }
+}
 
 pub fn f<T>() -> Box<i<T>+'static> {
     impl<T> i<T> for () { }
index e3ce4e8f6565a942f1d6ab4239cb4aa508d01dfa..89b3b56121a1614961297566eb8088c21a5808ef 100644 (file)
 
 #![feature(unsafe_destructor)]
 
+use std::marker;
+
 struct arc_destruct<T> {
-  _data: int,
+    _data: int,
+    _marker: marker::PhantomData<T>
 }
 
 #[unsafe_destructor]
@@ -24,7 +27,8 @@ fn drop(&mut self) {}
 
 fn arc_destruct<T: Sync>(data: int) -> arc_destruct<T> {
     arc_destruct {
-        _data: data
+        _data: data,
+        _marker: marker::PhantomData
     }
 }
 
index 7a378b06df9e175ceac52066671a93b94ce8825e..4ce7e3079e330a0a82f8b445076d55bf51ff4c92 100644 (file)
@@ -10,4 +10,5 @@
 
 pub trait T {
     type C;
+    fn dummy(&self) { }
 }
index 2e254e5431d53d8f9cfb7e79639b618c9106d0fd..545e15fe1664d657ef941e983f72dd1b6c66b4d9 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub trait Foo {
+use std::marker::MarkerTrait;
+
+pub trait Foo : MarkerTrait {
     fn bar();
 }
 
index 0831993119ae829b2b5c7959a2b3669741767b19..9006a5d1775f764eb7f569fa7f491b09dd7b27da 100644 (file)
@@ -12,7 +12,9 @@
 
 use std::mem;
 
-trait A {}
+trait A {
+    fn dummy(&self) { }
+}
 struct B;
 impl A for B {}
 
index 000cc100a12f32ffb4b519420a73717f8f3cca72..4f2792aebcd2408639256271ae4254015e744f07 100644 (file)
@@ -15,5 +15,6 @@ fn x() {
         fn f() { }
         f();
     }
+    fn dummy(&self) { }
 }
 
index 834667968c85bdd3cb623701249d3cf5bc6df2bc..b9cc20b63cc5640258ac6bc70afde33440a6d24a 100644 (file)
 #![no_std]
 #![feature(lang_items)]
 
+#[lang="phantom_fn"]
+pub trait PhantomFn<A:?Sized,R:?Sized=()> { }
+impl<A:?Sized, R:?Sized, U:?Sized> PhantomFn<A,R> for U { }
+
 #[lang="sized"]
-pub trait Sized {}
+pub trait Sized : PhantomFn<Self> {}
 
 #[lang="panic"]
 fn panic(_: &(&'static str, &'static str, uint)) -> ! { loop {} }
@@ -25,6 +29,8 @@ fn panic(_: &(&'static str, &'static str, uint)) -> ! { loop {} }
 extern fn eh_personality() {}
 
 #[lang="copy"]
-pub trait Copy {}
+pub trait Copy : PhantomFn<Self> {
+    // Empty.
+}
 
 
index 01b2b748ba9d83910105567c020b3fb8fd52d311..fb535eb8336f9b2df90d027c61cef3fb9f731097 100644 (file)
@@ -96,7 +96,7 @@ fn trait_stable_text(&self) {}
 impl Trait for MethodTester {}
 
 #[unstable(feature = "test_feature")]
-pub trait UnstableTrait {}
+pub trait UnstableTrait { fn dummy(&self) { } }
 
 #[stable(feature = "test_feature", since = "1.0.0")]
 #[deprecated(since = "1.0.0")]
index 21784bda27a8f14e5e3a0e37a4c8529548d257e4..fc1bea5a9fd41128c88b9a1b2506ed398cdb9477 100644 (file)
@@ -25,7 +25,7 @@ pub fn foo<T>(&self) {
 }
 
 // issue 8134
-pub struct Parser<T>;
+pub struct Parser<T>(T);
 impl<T: std::iter::Iterator<Item=char>> Parser<T> {
     fn in_doctype(&mut self) {
         static DOCTYPEPattern: [char; 6] = ['O', 'C', 'T', 'Y', 'P', 'E'];
index 7647f159401a74412b0590625e37d5102536f7d0..cf3e9903b5ad001e2bef688a792cfe8c5e630d07 100644 (file)
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub trait RemoteTrait {}
+pub trait RemoteTrait { fn dummy(&self) { } }
index caa9bbe5736e4adb55d0c7620dfe996b0feef5dc..3c8cba13ae73d07296407009850cd94adca716ed 100644 (file)
@@ -11,7 +11,8 @@
 use std::ops::Deref;
 
 struct DerefWithHelper<H, T> {
-    pub helper: H
+    pub helper: H,
+    pub value: Option<T>
 }
 
 trait Helper<T> {
@@ -34,6 +35,6 @@ fn deref(&self) -> &T {
 
 // Test cross-crate autoderef + vtable.
 pub fn check<T: PartialEq>(x: T, y: T) -> bool {
-    let d: DerefWithHelper<Option<T>, T> = DerefWithHelper { helper: Some(x) };
+    let d: DerefWithHelper<Option<T>, T> = DerefWithHelper { helper: Some(x), value: None };
     d.eq(&y)
 }
index 37ee10c8d37333ec6e64793919ab8a1f504e14ca..42691579491bbfb7e7abb069fd995bf62288e8f0 100644 (file)
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Foo {}
+trait Foo : ::std::marker::MarkerTrait {}
index 12833daf6045854990ba64e416c6670832e64876..04f1062c16f02a572e8f97c9345b2f6b99469983 100644 (file)
 
 #![crate_name = "a"]
 
+use std::marker::MarkerTrait;
+
 macro_rules! three {
     () => { 3 }
 }
 
-pub trait U {}
-pub trait V {}
+pub trait U : MarkerTrait {}
+pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
index 9e74bf281358faa1e582d81080183fb0fc38f392..fabd2289e9a44ea61c62f41c56fb5c41a7b2be99 100644 (file)
 
 #![crate_name = "a"]
 
+use std::marker::MarkerTrait;
+
 macro_rules! three {
     () => { 3 }
 }
 
-pub trait U {}
-pub trait V {}
+pub trait U : MarkerTrait {}
+pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
index c900550041b5c82a58d243ce64e67c18a1cf72d4..3fdb861bd40c178d430e26c4b51059b55debb0d8 100644 (file)
 
 #![crate_name = "a"]
 
+use std::marker::MarkerTrait;
+
 macro_rules! three {
     () => { 3 }
 }
 
-pub trait U {}
-pub trait V {}
+pub trait U : MarkerTrait {}
+pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
index 04f8eb3cf9bc0fd4121230931631fa66da136818..3116d24673d4847bef21ac198e648c5f098a4257 100644 (file)
 
 #![crate_name = "a"]
 
+use std::marker::MarkerTrait;
+
 macro_rules! three {
     () => { 3 }
 }
 
-pub trait U {}
-pub trait V {}
+pub trait U : MarkerTrait {}
+pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
index c7e0a18768a3d36ae7271d56bd00fd5bcd3ee9fb..b49a1533628f6f526225f062d21e06987dca295b 100644 (file)
 
 #![crate_name = "a"]
 
+use std::marker::MarkerTrait;
+
 macro_rules! three {
     () => { 3 }
 }
 
-pub trait U {}
-pub trait V {}
+pub trait U : MarkerTrait {}
+pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
index 5100af323183b18726535987931245f269798ed0..6562a93135f39740c5210eaa7824ed37668ffdd5 100644 (file)
 
 #![crate_name = "a"]
 
+use std::marker::MarkerTrait;
+
 macro_rules! three {
     () => { 3 }
 }
 
-pub trait U {}
-pub trait V {}
+pub trait U : MarkerTrait {}
+pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
index 077c33cb90d756f3555b64c1aa81c2b1f4a7b2a0..c7b392c6ee82b07b942cd7188a9fe316b8ad7579 100644 (file)
 
 #![crate_name = "a"]
 
+use std::marker::MarkerTrait;
+
 macro_rules! three {
     () => { 3 }
 }
 
-pub trait U {}
-pub trait V {}
+pub trait U : MarkerTrait {}
+pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
index d481fa5a1fa3b033d65967408d0f13e7209e53d2..450f61020260dd49416c27ea402223efd0c20157 100644 (file)
 
 #![crate_name = "a"]
 
+use std::marker::MarkerTrait;
+
 macro_rules! three {
     () => { 3 }
 }
 
-pub trait U {}
-pub trait V {}
+pub trait U : MarkerTrait {}
+pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
index 9e99a355ac1ee2a17df3d10d77ed5bb798e93a6d..c000737c854c6a85b1264f8a87c251ac718a9d40 100644 (file)
 
 #![crate_name = "a"]
 
+use std::marker::MarkerTrait;
+
 macro_rules! three {
     () => { 3 }
 }
 
-pub trait U {}
-pub trait V {}
+pub trait U : MarkerTrait {}
+pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
index b8dd497ac99c8e6fae182d27dd29d4a40d0491df..1e12659dc4b92f15dff148558217b6eb28ba4446 100644 (file)
 
 #![crate_name = "a"]
 
+use std::marker::MarkerTrait;
+
 macro_rules! three {
     () => { 3 }
 }
 
-pub trait U {}
-pub trait V {}
+pub trait U : MarkerTrait {}
+pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
index 12833daf6045854990ba64e416c6670832e64876..04f1062c16f02a572e8f97c9345b2f6b99469983 100644 (file)
 
 #![crate_name = "a"]
 
+use std::marker::MarkerTrait;
+
 macro_rules! three {
     () => { 3 }
 }
 
-pub trait U {}
-pub trait V {}
+pub trait U : MarkerTrait {}
+pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
index 690ddc670f5fa57bb919d670d9bf31c4b1d45a33..1e82b74f1ef2e5cd6240b735add8776a5a0d025f 100644 (file)
 
 #![crate_name = "a"]
 
+use std::marker::MarkerTrait;
+
 macro_rules! three {
     () => { 3 }
 }
 
-pub trait U {}
-pub trait V {}
+pub trait U : MarkerTrait {}
+pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
index 216e8e997f22de643e86f712dd718888965dd7a1..3c3dac9cdab96209dc789d35c42546ffd90ec6ef 100644 (file)
 
 #![crate_name = "a"]
 
+use std::marker::MarkerTrait;
+
 macro_rules! three {
     () => { 3 }
 }
 
-pub trait U {}
-pub trait V {}
+pub trait U : MarkerTrait {}
+pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
index 1695e474de9998c07dfda2d0b5c6849d4c29c7e0..a7c469fccaa5abbcba151be4cb6e579771fd3cae 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub trait Trait {}
+pub trait Trait {
+    fn dummy(&self) { }
+}
 
 pub struct Foo<T:Trait> {
     pub x: T,
index 990bc21604959366ab95ba497385fdf522085d1e..0982efbdbf47e4d8770a7adc1aa0aa4a78ac5071 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub trait Foo {
+pub trait Foo : ::std::marker::MarkerTrait {
 }
 
 impl Foo for int {
index 22e0d3168cadc69b5697fc43e0d66aacdfc701fb..56fb40bc0a469af3021f8e4a9346fb0a3161b197 100644 (file)
@@ -11,7 +11,7 @@
 pub use self::sub::{Bar, Baz};
 
 pub trait Trait {
-    fn foo();
+    fn foo(&self);
 }
 
 struct Foo;
index 621f5ec9660fca6aff50caf0bf144f62f0b0b008..edd1b8255ccdc38e6a4b1f7459443f0f0bda90e9 100644 (file)
 #![feature(no_std)]
 #![no_std]
 
+#[lang="phantom_fn"]
+pub trait PhantomFn<A:?Sized,R:?Sized=()> { }
+impl<A:?Sized, R:?Sized, U:?Sized> PhantomFn<A,R> for U { }
+
 #[lang="sized"]
-pub trait Sized {
+pub trait Sized : PhantomFn<Self> {
     // Empty.
 }
 
index 95a68dd66983672dfe537bf4f1bfc8bcee5c8d2d..b7a16c68a34e1a43fdbb1548dc903a80a3e740b8 100644 (file)
 // Test that coherence detects overlap when some of the types in the
 // impls are projections of associated type. Issue #20624.
 
+use std::marker::PhantomData;
 use std::ops::Deref;
 
-pub struct Cow<'a, B: ?Sized>;
+pub struct Cow<'a, B: ?Sized>(PhantomData<(&'a (),B)>);
 
 /// Trait for moving into a `Cow`
 pub trait IntoCow<'a, B: ?Sized> {
index 9baa7f1ad5a6901237f64cb4f1777590e47d638d..c48f9972ebc18765fca88e164449f57bb5a9ea11 100644 (file)
@@ -10,7 +10,7 @@
 
 // Check that an associated type cannot be bound in an expression path.
 
-trait Foo {
+trait Foo : ::std::marker::MarkerTrait {
     type A;
     fn bar() -> isize;
 }
index fa09ae793bf632c75198a0fad1b8d7056838040c..625f4cdb8ef3dbc3af68abee2124f51eefb1a5b2 100644 (file)
@@ -11,7 +11,7 @@
 // Test that we do not ICE when an impl is missing an associated type (and that we report
 // a useful error, of course).
 
-trait Trait {
+trait Trait : ::std::marker::MarkerTrait {
     type Type;
 }
 
index 9436f825de89dd4b95a51cc7e6f7ce4ad320bcdd..5632f148da67ce2e1d00f4f0738c07406c00f88d 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Foo {
+trait Foo : ::std::marker::MarkerTrait {
     type X;
     type Y;
 }
index a3f2850b29464589d86e4c28f38112be3065f0f2..2b84c38f80b542b309443d17c13a2f122383de9d 100644 (file)
@@ -11,7 +11,7 @@
 // Check that we get an error when you use `<Self as Get>::Value` in
 // the trait definition but `Self` does not, in fact, implement `Get`.
 
-trait Get {
+trait Get : ::std::marker::MarkerTrait {
     type Value;
 }
 
index 51a37b517ddebfb120ec63147dfa19829aaa3a79..b9a62ff4e417afd9d3840bdc836bb69ff8c53cd7 100644 (file)
@@ -12,6 +12,8 @@
 
 pub trait Foo {
     type A;
+
+    fn dummy(&self) { }
 }
 
 impl Foo for i32 {
index aecbf217a5b25e916155829b81188bf7401049ac..8832028f9aba1e87781545bb2426653882439b3c 100644 (file)
@@ -10,7 +10,7 @@
 
 // Check that an associated type cannot be bound in an expression path.
 
-trait Foo {
+trait Foo : ::std::marker::MarkerTrait {
     type A;
     fn bar() -> isize;
 }
index c91849ca53e1a780f2cba3bfafcf960ecc0a4ca5..3e02a11c378bd5a2292e8824c149cc4792479098 100644 (file)
 
 // ignore-tidy-linelength
 
-#![feature(no_std)]
-#![no_std]
-#![feature(lang_items)]
-
-#[lang="sized"]
-pub trait Sized {}
-
 struct S<T> {
     contents: T,
 }
index 69be6414e4c90e09657aba9d102e4dbf8f3ad69c..1944acbe1f34560115eb28ee004e6424d2e866de 100644 (file)
@@ -12,7 +12,7 @@
 
 use std::cell::RefCell;
 
-trait Trait {}
+trait Trait : ::std::marker::MarkerTrait {}
 
 pub fn main() {
     let x: Vec<Trait + Sized> = Vec::new();
index 27d97d18c949f16f0935f92de930368030e7f0f5..d4decb713498df2e3e35eff101178d59b87af488 100644 (file)
@@ -10,6 +10,7 @@
 
 use std::fmt::Show;
 use std::default::Default;
+use std::marker::MarkerTrait;
 
 // Test that two blanket impls conflict (at least without negative
 // bounds).  After all, some other crate could implement Even or Odd
@@ -19,9 +20,9 @@ trait MyTrait {
     fn get(&self) -> usize;
 }
 
-trait Even { }
+trait Even : MarkerTrait { }
 
-trait Odd { }
+trait Odd : MarkerTrait { }
 
 impl Even for isize { }
 
index 0f233b78c72160b2bc833bac871dba077622281d..b1ee1762b6e71ab2d9c722de3564acc3da722821 100644 (file)
@@ -19,9 +19,9 @@ trait MyTrait {
     fn get(&self) -> usize;
 }
 
-trait Even { }
+trait Even : ::std::marker::MarkerTrait { }
 
-trait Odd { }
+trait Odd : ::std::marker::MarkerTrait { }
 
 impl<T:Even> MyTrait for T { //~ ERROR E0119
     fn get(&self) -> usize { 0 }
index c9dfb8201a98acb968382bb4d87dfb7b35406436..a225f6cf473041387b09124fbe54803d4f65f645 100644 (file)
 
 #![feature(optin_builtin_traits)]
 
-trait MyTrait {}
+trait MyTrait : ::std::marker::MarkerTrait {}
 
-struct TestType<T>;
+struct TestType<T>(::std::marker::PhantomData<T>);
 
-unsafe impl<T: MyTrait> Send for TestType<T> {}
+unsafe impl<T: MyTrait+'static> Send for TestType<T> {}
 //~^ ERROR conflicting implementations for trait `core::marker::Send`
 //~^^ ERROR conflicting implementations for trait `core::marker::Send`
 
 impl<T: MyTrait> !Send for TestType<T> {}
 //~^ ERROR conflicting implementations for trait `core::marker::Send`
 
-unsafe impl<T> Send for TestType<T> {}
+unsafe impl<T:'static> Send for TestType<T> {}
 //~^ ERROR error: conflicting implementations for trait `core::marker::Send`
 
 impl !Send for TestType<i32> {}
index 86b7a8c89184abcbcd51e4bfe711360c61694f68..c97a9950d78d0ba6569dba1c89e4dc29dc7e445e 100644 (file)
@@ -14,7 +14,7 @@
 #![feature(box_syntax)]
 
 struct Foo;
-trait Trait {}
+trait Trait : ::std::marker::MarkerTrait {}
 impl Trait for Foo {}
 
 pub fn main() {
index f2e068cc4ff1b7d6856ceba972e3c1a92b1bab8d..d8b3f297a1123cb14372239888d2f75d03001cab 100644 (file)
@@ -14,7 +14,7 @@
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 
-trait T {}
+trait T : ::std::marker::MarkerTrait {}
 impl T for isize {}
 
 fn main() {
index 2b96c5ebe1284c1647e9aa991ecb03d651ddbb25..6d9ba8d44c089cead9ed0e1d687788448abd6994 100644 (file)
@@ -15,7 +15,7 @@ struct Fat<T: ?Sized> {
 }
 
 struct Foo;
-trait Bar {}
+trait Bar : ::std::marker::MarkerTrait {}
 
 pub fn main() {
     // With a vec of isize.
index 160197368d6d983c673f924eb1508fbd62e1a3b1..aa687266acb8f701c9bae3461bb8b71c1c63c3e8 100644 (file)
@@ -15,7 +15,7 @@ struct Fat<T: ?Sized> {
 }
 
 struct Foo;
-trait Bar {}
+trait Bar : ::std::marker::MarkerTrait {}
 impl Bar for Foo {}
 
 pub fn main() {
index 347a2d2ecbe68599cff25e0f6804a01c110d28eb..46b89e1122a2c0ddc7ada5caada90a2a87232d75 100644 (file)
@@ -15,7 +15,7 @@ struct Fat<T: ?Sized> {
 }
 
 struct Foo;
-trait Bar {}
+trait Bar : ::std::marker::MarkerTrait {}
 impl Bar for Foo {}
 
 fn baz<'a>() {
index b30eada162b84707134573888de917956f8ca50c..8ec1034bc4d28abda4abda17968fad6296a7f160 100644 (file)
 
 // Test implicit coercions involving DSTs and raw pointers.
 
+use std::marker::MarkerTrait;
+
 struct S;
-trait T {}
+trait T : MarkerTrait {}
 impl T for S {}
 
 struct Foo<T: ?Sized> {
index 87ff4291f50e2d8f3ad951f338b8452508f189e1..a1f0dda671e7de9b8b1d9a586d4696a2867f84e7 100644 (file)
@@ -10,7 +10,7 @@
 
 // Test that we cannot create objects from unsized types.
 
-trait Foo {}
+trait Foo : ::std::marker::MarkerTrait {}
 impl Foo for str {}
 
 fn test1<T: ?Sized + Foo>(t: &T) {
index 17453bc677f2bc0a61004533b39c432f3f98b654..f47f14d587992f83c2a95790130da77cf6651fdc 100644 (file)
@@ -20,7 +20,7 @@ fn drop(&mut self) {}
 }
 
 #[derive(Copy)] //~ ERROR the trait `Copy` may not be implemented
-struct Bar<T>;
+struct Bar<T>(::std::marker::PhantomData<T>);
 
 #[unsafe_destructor]
 impl<T> Drop for Bar<T> {
index 02f09749d614d359b49e2ac85093762bed9136a5..9fea5e609d1f4807812476ea8b2e53c5da09fcdf 100644 (file)
@@ -8,10 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct Foo<A, B, C = (A, B)>;
+use std::marker;
+
+struct Foo<A, B, C = (A, B)>(
+    marker::PhantomData<(A,B,C)>);
 
 impl<A, B, C = (A, B)> Foo<A, B, C> {
-    fn new() -> Foo<A, B, C> {Foo}
+    fn new() -> Foo<A, B, C> {Foo(marker::PhantomData)}
 }
 
 fn main() {
index d88da2625c187cba2fc872afec0620f37ce028ed..73c19aa012dcf67dd0d39d97f8a748f9cb1a436c 100644 (file)
@@ -8,12 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::marker;
+
 struct Heap;
 
-struct Vec<T, A = Heap>;
+struct Vec<T, A = Heap>(
+    marker::PhantomData<(T,A)>);
 
 impl<T, A = Heap> Vec<T, A> {
-    fn new() -> Vec<T, A> {Vec}
+    fn new() -> Vec<T, A> {Vec(marker::PhantomData)}
 }
 
 fn main() {
index fc54002820e012081807c43c78a6654c4284f6a1..9b9f09f47775741bc19a7cd3855678833983c8b6 100644 (file)
 //
 // Regression test for issue #16218.
 
-trait Bar<'a> {}
+trait Bar<'a> {
+    fn dummy(&'a self);
+}
 
 trait Foo<'a> {
+    fn dummy(&'a self) { }
     fn bar<'b, T: Bar<'b>>(self) -> &'b str;
 }
 
index f25d8f99b8d5449d45dcfa1c5734662a212ed92c..37737fda4749e5004ce1e666560e0da343143158 100644 (file)
@@ -8,9 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::marker;
+
 struct Heap;
 
-struct Vec<T, A = Heap>;
+struct Vec<T, A = Heap>(
+    marker::PhantomData<(T,A)>);
 
 fn main() {
     let _: Vec; //~ ERROR wrong number of type arguments: expected at least 1, found 0
index 19d303488acb0f6d077d56da7a8e4ba76af184c8..ad7e4f190c5b9df7fe358c88f9b51461e8024479 100644 (file)
@@ -8,9 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::marker;
+
 struct Heap;
 
-struct Vec<T, A = Heap>;
+struct Vec<T, A = Heap>(
+    marker::PhantomData<(T,A)>);
 
 fn main() {
     let _: Vec<isize, Heap, bool>;
index 3e34344d78b9dfbf9bd3da56caeefb116649af03..a452cd35f943fc4484b588d121e2ca9cb5538f29 100644 (file)
@@ -8,13 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::marker;
+
 struct A;
 struct B;
 struct C;
-struct Foo<T = A, U = B, V = C>;
+struct Foo<T = A, U = B, V = C>(marker::PhantomData<(T,U,V)>);
 
-struct Hash<T>;
-struct HashMap<K, V, H = Hash<K>>;
+struct Hash<T>(marker::PhantomData<T>);
+struct HashMap<K, V, H = Hash<K>>(marker::PhantomData<(K,V,H)>);
 
 fn main() {
     // Ensure that the printed type doesn't include the default type params...
index f0089b0ae5b348f91e0643fa64a3d11c7363d505..4ff574e939df649794a2b31bdd4f49a374ed3c05 100644 (file)
@@ -10,7 +10,7 @@
 
 #![feature(box_syntax)]
 
-struct Test<'s> {
+struct Test {
     func: Box<FnMut()+'static>
 }
 
index ea0d880f4a1cc6a04f9da5415257a3a780e97379..dc697e4784f854e1cc113e75d91ae1d3362bb818 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait FromStructReader<'a> { }
+use std::marker::PhantomFn;
+
+trait FromStructReader<'a> : PhantomFn<(Self,&'a ())> { }
 trait ResponseHook {
      fn get<'a, T: FromStructReader<'a>>(&'a self);
 }
index f10c47b594ea2c9edaa98b1f2191578d7256e583..7ca158c3e32045c31cbe5cb70ebaf94e1709845d 100644 (file)
@@ -10,6 +10,8 @@
 
 #![crate_type = "lib"]
 
+use std::marker::PhantomData;
+
 enum NodeContents<'a> {
     Children(Vec<Node<'a>>),
 }
@@ -22,11 +24,12 @@ fn drop( &mut self ) {
 
 struct Node<'a> {
     contents: NodeContents<'a>,
+    marker: PhantomData<&'a ()>,
 }
 
 impl<'a> Node<'a> {
     fn noName(contents: NodeContents<'a>) -> Node<'a> {
-        Node{  contents: contents,}
+        Node { contents: contents, marker: PhantomData }
     }
 }
 
index 251da2c6b3ee979c020bf7e21c55d490c5a4dadd..cd3f337c4ab658e2194dc2ab8686eaaac2105eb7 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Node {
+use std::marker::MarkerTrait;
+
+trait Node : MarkerTrait {
     fn zomg();
 }
 
index cbf4412a81df286d23ef2da9f2bb817e797adc63..3a5df9e805bdb7e3c066ea9123f96fb55afca95f 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Foo {}
+trait Foo {
+    fn dummy(&self) { }
+}
 
 struct A;
 
index 51deb99a4f2cda7747feae6e2df16f83c0f80e9e..0b846651acf46dbf0e51056e8d31742859ddeb4c 100644 (file)
@@ -9,8 +9,9 @@
 // except according to those terms.
 
 use std::fmt::Debug;
+use std::marker::MarkerTrait;
 
-trait Str {}
+trait Str : MarkerTrait {}
 
 trait Something {
     fn yay<T: Debug>(_: Option<Self>, thing: &[T]);
index 814b885e3aafc5c81f85e1b107076758fd50f19d..a213234b89b0ff247c73f9ac27cf1fc0dfce01d3 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait ListItem<'a> {
+use std::marker::MarkerTrait;
+
+trait ListItem<'a> : MarkerTrait {
     fn list_name() -> &'a str;
 }
 
index 1e27f02556470cccff1e6e1d01b0f57ecfc5abc8..22aaa796ad0f4a0d62186527181140e6d98c7f60 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct Foo<T> { foo: Option<Option<Foo<T>>> }
+use std::marker;
+
+struct Foo<T> { foo: Option<Option<Foo<T>>>, marker: marker::PhantomData<T> }
 //~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
 
 impl<T> Foo<T> { fn bar(&self) {} }
index d22d79ecaa5508d87ffbda69f54d8d6fa7017d57..cc9cc2e3c035c7ae6e4adb14e7ad9be7bb08414d 100644 (file)
@@ -8,8 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::marker;
+
 struct Foo { foo: Bar<Foo> }
-struct Bar<T> { x: Bar<Foo> }
+struct Bar<T> { x: Bar<Foo> , marker: marker::PhantomData<T> }
 //~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
 
 impl Foo { fn foo(&self) {} }
index e037ba92b4a6a02e749552bfb6b37b559e06be1f..5781cb74117438b628b074ca5a8a5a428733957b 100644 (file)
 
 #![feature(unboxed_closures)]
 
-struct B<T>;
+use std::marker;
+
+struct B<T>(marker::PhantomData<T>);
 
 fn main() {
-    let foo = B; //~ ERROR: unable to infer enough type information
+    let foo = B(marker::PhantomData); //~ ERROR unable to infer enough type information
     let closure = || foo;
 }
index 83427e8aa67f9d861bf561dda5c3b7aaf02aa31e..bdb5af0b8248966a7a325a2078725277c2512abe 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::marker::MarkerTrait;
 
-
-pub trait AbstractRenderer {}
+pub trait AbstractRenderer : MarkerTrait {}
 
 fn _create_render(_: &()) ->
     AbstractRenderer
index a662e9ca98ee812086e338e874234fd0a00a1f91..e81a576fa63d50d9267acf4e1eb82d70ba183fd0 100644 (file)
@@ -8,11 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::marker::MarkerTrait;
+
 fn add_state(op: <isize as HasState>::State) {
 //~^ ERROR the trait `HasState` is not implemented for the type `isize`
 }
 
-trait HasState {
+trait HasState : MarkerTrait {
     type State;
 }
 
index d26bf68cb5dfeb4a3fafe259ebb923ebd4e20cea..1bbbdf79d28b7ad3304174e52ca0b92c13afade0 100644 (file)
@@ -26,6 +26,7 @@ fn ufcs() {
 
     Push::push(&c, box || y = 0);
     Push::push(&c, box || y = 0);
+//~^ ERROR cannot borrow `y` as mutable more than once at a time
 }
 
 trait Push<'c> {
index 3a9de74104364156b4279f01008e421ff32ae11f..951d78410b814602391a7e0376bc1c20e83388c4 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Foo {
+use std::marker::MarkerTrait;
+
+trait Foo : MarkerTrait {
     type Item;
 }
 
index 14601e67a77c1c77a86391940ab74a47eb0e8820..77aba7335bdf996cc9165263e73c13d2073254cf 100644 (file)
 #![feature(lang_items, start, no_std)]
 #![no_std]
 
+#[lang="phantom_fn"]
+trait PhantomFn<A:?Sized,R:?Sized=()> { }
+impl<A:?Sized, R:?Sized, U:?Sized> PhantomFn<A,R> for U { }
+
 #[lang = "sized"]
-trait Sized {}
+trait Sized : PhantomFn<Self> {}
 
 #[start]
 fn main(_: int, _: *const *const u8) -> int {
index 00607f850347cc54c5b1c201d5c098e375470506..aed395d17ea9ce803da2803395b76ec21549c098 100644 (file)
 // cause compiler to loop.  Note that no instances
 // of such a type could ever be constructed.
 
+use std::marker::MarkerTrait;
 
 struct t(Box<t>); //~ ERROR this type cannot be instantiated
 
-trait to_str_2 {
+trait to_str_2 : MarkerTrait {
     fn my_to_string() -> String;
 }
 
index aaf45f27398914cdc84574b3c91c73fbb0ec22ac..5b623ac377b21260948f9ddbbb34a95dab1998f5 100644 (file)
 // below. Note that changing to a named lifetime made the problem go
 // away.
 
-use std::ops::{Shl, Shr};
 use std::cell::RefCell;
+use std::marker::MarkerTrait;
+use std::ops::{Shl, Shr};
 
-pub trait Subscriber {
+pub trait Subscriber : MarkerTrait {
     type Input;
 }
 
index 31796e5e20c4492e683642701852db9bc439bfdf..24cc0099b89a522a1b7ae2441dabc6663ba3ce1d 100644 (file)
@@ -12,7 +12,7 @@
 // than the trait method it's implementing
 
 trait A {
-  fn b<C,D>(x: C) -> C;
+  fn b<C,D>(&self, x: C) -> C;
 }
 
 struct E {
@@ -20,7 +20,7 @@ struct E {
 }
 
 impl A for E {
-    fn b<F: Sync, G>(_x: F) -> F { panic!() }
+    fn b<F: Sync, G>(&self, _x: F) -> F { panic!() }
     //~^ ERROR `F : core::marker::Sync` appears on the impl method
 }
 
index a338a01690dea0d8f412bbab471ef2adbc243d3e..af6cee1f10749f4aeb366fdfb7f6f6a04fedaed4 100644 (file)
@@ -8,8 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::marker;
+
 enum E1 { V1(E2<E1>), }
-enum E2<T> { V2(E2<E1>), }
+enum E2<T> { V2(E2<E1>, marker::PhantomData<T>), }
 //~^ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
 
 impl E1 { fn foo(&self) {} }
index 9a398796d2abf5cfb7dd7b5be7898ebe98839ebe..f384dba7c9e3d69d2738df91b8bd5809713edcf7 100644 (file)
@@ -11,7 +11,9 @@
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 
-trait MyTrait { }
+trait MyTrait {
+    fn dummy(&self) {}
+}
 
 pub enum TraitWrapper {
     A(Box<MyTrait+'static>),
index 9e324cdd61eb0e82f40308131b51c72d1d1ce360..d316b44794ad6e38c1a6749aad984e84060b8ace 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait I {}
+use std::marker::MarkerTrait;
+
+trait I : MarkerTrait {}
 type K = I+'static;
 
 fn foo(_x: K) {} //~ ERROR: the trait `core::marker::Sized` is not implemented
index cf98f1572e56049aaa48ae32626acb14e482228a..eccbc7896605e13106a72aaa467c9539254dca5f 100644 (file)
@@ -10,7 +10,9 @@
 
 #![feature(box_syntax)]
 
-trait Foo {}
+use std::marker::MarkerTrait;
+
+trait Foo : MarkerTrait {}
 impl Foo for u8 {}
 
 fn main() {
index 9ff957b6e6deac4904d0d5066390bd4dd53e2803..b0db990619535534dc4bf8b7c5baebef9bab6203 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait A {}
+use std::marker::MarkerTrait;
+
+trait A : MarkerTrait {}
 
 struct Struct {
     r: A+'static
@@ -20,6 +22,6 @@ fn new_struct(r: A+'static)
     Struct { r: r }
 }
 
-trait Curve {}
+trait Curve : MarkerTrait {}
 enum E {X(Curve+'static)}
 fn main() {}
index efa3100360b5c0e0c4c000ad09a1cd785ca22407..0bf9a3c2d4867e365bd57b9d560383f10c6d5406 100644 (file)
@@ -8,13 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub struct TypeWithState<State>;
+use std::marker;
+
+pub struct TypeWithState<State>(marker::PhantomData<State>);
 pub struct MyState;
 
 pub fn foo<State>(_: TypeWithState<State>) {}
 
 pub fn bar() {
-   foo(TypeWithState);  //~ ERROR type annotations required
+   foo(TypeWithState(marker::PhantomData));  //~ ERROR type annotations required
 }
 
 fn main() {
index 49e54f25bf64b5fd575d0b86faaa125a0011448d..7d65870e2dbcabc5a4bcce51457fc058faca64a6 100644 (file)
 
 // Test the mechanism for warning about possible missing `self` declarations.
 
+use std::marker::MarkerTrait;
+
 trait CtxtFn {
     fn f8(self, usize) -> usize;
     fn f9(usize) -> usize; //~ NOTE candidate
 }
 
-trait OtherTrait {
+trait OtherTrait : MarkerTrait {
     fn f9(usize) -> usize; //~ NOTE candidate
 }
 
@@ -24,7 +26,7 @@ trait OtherTrait {
 // declaration to match against, so we wind up prisizeing it as a
 // candidate. This seems not unreasonable -- perhaps the user meant to
 // implement it, after all.
-trait UnusedTrait {
+trait UnusedTrait : MarkerTrait {
     fn f9(usize) -> usize; //~ NOTE candidate
 }
 
@@ -52,7 +54,7 @@ fn fff(i: isize) -> isize { //~ NOTE candidate
     }
 }
 
-trait ManyImplTrait {
+trait ManyImplTrait : MarkerTrait {
     fn is_str() -> bool { //~ NOTE candidate
         false
     }
index d1a86d334cb44e631c7705f20fb61a0cf8570878..72da6dcaa6c45a22e76a62a97282c958d6273838 100644 (file)
 // Verify the compiler fails with an error on infinite function
 // recursions.
 
-struct Data(Box<Option<Data>>);
-
-fn generic<T>( _ : Vec<(Data,T)> ) {
-    let rec : Vec<(Data,(bool,T))> = Vec::new();
-    generic( rec );
+fn generic<T>() {
+    generic::<Option<T>>();
 }
 
 
 fn main () {
     // Use generic<T> at least once to trigger instantiation.
-    let input : Vec<(Data,())> = Vec::new();
-    generic(input);
+    generic::<i32>();
 }
index 56f83d9300861b353d2a0dd61196e0eebf8ce847..74e372e41eb0a1100821ef7fcaa9667a66932971 100644 (file)
 
 // Test which of the builtin types are considered POD.
 
-
+use std::marker::MarkerTrait;
 use std::rc::Rc;
 
 fn assert_copy<T:Copy>() { }
 
-trait Dummy { }
+trait Dummy : MarkerTrait { }
 
 #[derive(Copy)]
 struct MyStruct {
index 2731be7308a4a54de5ca5b38ec81be06dc219cbb..b575144f637f1e73629df653cb0ae1ea8a3974c2 100644 (file)
@@ -10,7 +10,9 @@
 
 #![feature(box_syntax)]
 
-trait Foo {
+use std::marker::MarkerTrait;
+
+trait Foo : MarkerTrait {
 }
 
 impl<T:Copy> Foo for T {
index d5276efa8be9812649f978f8ee7da58e6238faa3..dffc8fa2abd70d95def12e4df2eb40fdf247cea3 100644 (file)
 
 #![feature(box_syntax)]
 
-struct S<T>;
+use std::marker;
 
-trait Gettable<T> {}
+struct S<T>(marker::PhantomData<T>);
+
+trait Gettable<T> {
+    fn get(&self) -> T { panic!() }
+}
 
 impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
 
 fn f<T>(val: T) {
-    let t: S<T> = S;
+    let t: S<T> = S(marker::PhantomData);
     let a = &t as &Gettable<T>;
     //~^ ERROR the trait `core::marker::Send` is not implemented
     //~^^ ERROR the trait `core::marker::Copy` is not implemented
 }
 
 fn g<T>(val: T) {
-    let t: S<T> = S;
+    let t: S<T> = S(marker::PhantomData);
     let a: &Gettable<T> = &t;
     //~^ ERROR the trait `core::marker::Send` is not implemented
     //~^^ ERROR the trait `core::marker::Copy` is not implemented
 }
 
 fn foo<'a>() {
-    let t: S<&'a isize> = S;
+    let t: S<&'a isize> = S(marker::PhantomData);
     let a = &t as &Gettable<&'a isize>;
-    //~^ ERROR the type `&'a isize` does not fulfill the required lifetime
+    //~^ ERROR cannot infer
 }
 
 fn foo2<'a>() {
-    let t: Box<S<String>> = box S;
+    let t: Box<S<String>> = box S(marker::PhantomData);
     let a = t as Box<Gettable<String>>;
     //~^ ERROR the trait `core::marker::Copy` is not implemented
 }
 
 fn foo3<'a>() {
-    let t: Box<S<String>> = box S;
+    let t: Box<S<String>> = box S(marker::PhantomData);
     let a: Box<Gettable<String>> = t;
     //~^ ERROR the trait `core::marker::Copy` is not implemented
 }
index 570f7ad7fe3bf214adae00a7ac6644053305dd6c..0c68401bb2b955222bbd712a92ee02f8603ae50e 100644 (file)
 // in this file all test the "kind" violates detected during kindck.
 // See all `regions-bounded-by-send.rs`
 
+use std::marker::MarkerTrait;
+
 fn assert_send<T:Send>() { }
-trait Dummy { }
+trait Dummy : MarkerTrait { }
 trait Message : Send { }
 
 // careful with object types, who knows what they close over...
index 48d5215b7085be78f389d72df0139f2efa25130e..f86eac8b16bd2bcfdb158fbb58315b6dd1d4c2d8 100644 (file)
 // is broken into two parts because some errors occur in distinct
 // phases in the compiler. See kindck-send-object2.rs as well!
 
+use std::marker::MarkerTrait;
+
 fn assert_send<T:Send+'static>() { }
-trait Dummy { }
+trait Dummy : MarkerTrait { }
 
 // careful with object types, who knows what they close over...
 fn test51<'a>() {
index d3d166e2a6916181d24c32984ed212bca92a07e6..08516e67318ce2b5ff0e31efd4a9ef16a0eb8445 100644 (file)
 
 // Continue kindck-send-object1.rs.
 
+use std::marker::MarkerTrait;
+
 fn assert_send<T:Send>() { }
-trait Dummy { }
+trait Dummy : MarkerTrait { }
 
 fn test50() {
     assert_send::<&'static Dummy>(); //~ ERROR the trait `core::marker::Sync` is not implemented
index 04c5b223cb875a76fa10771a7c1cce51999fb032..66d8927ee51b7096b6cfa3826d1b6202dfe6b723 100644 (file)
@@ -10,7 +10,9 @@
 
 // ignore-tidy-linelength
 
-struct Bar<'x, 'y, 'z> { bar: &'y i32, baz: i32 }
+use std::marker::PhantomData;
+
+struct Bar<'x, 'y, 'z> { bar: &'y i32, baz: i32, marker: PhantomData<(&'x(),&'y(),&'z())> }
 fn bar1<'a>(x: &Bar) -> (&'a i32, &'a i32, &'a i32) {
 //~^ HELP: consider using an explicit lifetime parameter as shown: fn bar1<'b, 'c, 'a>(x: &'a Bar<'b, 'a, 'c>) -> (&'a i32, &'a i32, &'a i32)
     (x.bar, &x.baz, &x.baz)
index c60e321219bd266884261ff5034d01d6bd03d90c..a85776a938b44f189ab62db91ba6c9980175899d 100644 (file)
@@ -10,7 +10,9 @@
 
 // ignore-tidy-linelength
 
-struct Foo<'x> { bar: isize }
+use std::marker::PhantomData;
+
+struct Foo<'x> { bar: isize, marker: PhantomData<&'x ()> }
 fn foo1<'a>(x: &Foo) -> &'a isize {
 //~^ HELP: consider using an explicit lifetime parameter as shown: fn foo1<'a>(x: &'a Foo) -> &'a isize
     &x.bar //~ ERROR: cannot infer
index 3b96fd64fa200e8f3d397bd69e6283a4f066fdfc..73a58741bbbbc42ddbcf7efa384d9d578f86fed4 100644 (file)
@@ -47,20 +47,26 @@ fn foo3() {}
 /// dox
 pub trait A {
     /// dox
-    fn foo();
+    fn foo(&self);
     /// dox
-    fn foo_with_impl() {}
+    fn foo_with_impl(&self) {}
 }
+
 #[allow(missing_docs)]
 trait B {
-    fn foo();
-    fn foo_with_impl() {}
+    fn foo(&self);
+    fn foo_with_impl(&self) {}
 }
+
 pub trait C { //~ ERROR: missing documentation
-    fn foo(); //~ ERROR: missing documentation
-    fn foo_with_impl() {} //~ ERROR: missing documentation
+    fn foo(&self); //~ ERROR: missing documentation
+    fn foo_with_impl(&self) {} //~ ERROR: missing documentation
+}
+
+#[allow(missing_docs)]
+pub trait D {
+    fn dummy(&self) { }
 }
-#[allow(missing_docs)] pub trait D {}
 
 impl Foo {
     pub fn foo() {}
index 70d6b240985b041d739ec542b2be5d30ba04a80b..9f58d5791cb0bcbb07e14ad3ad0a2c1c93cc87e8 100644 (file)
@@ -30,6 +30,7 @@ enum Foo5 {
 }
 
 trait foo6 { //~ ERROR trait `foo6` should have a camel case name such as `Foo6`
+    fn dummy(&self) { }
 }
 
 fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name such as `Ty`
index f9cdfa4f7d685356f7b7d14f17494f796c7ca26b..88f2cbdea6d7bf81332f15efb3caf5e1dc4e6d47 100644 (file)
@@ -341,7 +341,9 @@ fn fn_in_body() {}
 
     #[unstable(feature = "test_feature")]
     #[deprecated(since = "1.0.0")]
-    pub trait DeprecatedTrait {}
+    pub trait DeprecatedTrait {
+        fn dummy(&self) { }
+    }
 
     struct S;
 
index 8cf375f80fbb1c092cf9ea06dea733257f120e15..918b4ee209ca7ac6106a3fcd18d3b7d17e7185ea 100644 (file)
 #![allow(dead_code)]
 #![crate_type="lib"]
 
-struct Private<T>;
-pub struct Public<T>;
+use std::marker;
+
+struct Private<T>(marker::PhantomData<T>);
+pub struct Public<T>(marker::PhantomData<T>);
 
 impl Private<Public<isize>> {
     pub fn a(&self) -> Private<isize> { panic!() }
@@ -103,7 +105,7 @@ impl PrivTrait for (Private<isize>,) {
     fn bar(&self) -> Private<isize> { panic!() }
 }
 
-pub trait ParamTrait<T> {
+pub trait ParamTrait<T> : marker::MarkerTrait {
     fn foo() -> T;
 }
 
index a49339ecd7f2811e169e2316856af749a233b84c..03d8d62e0b4d5c24aae817a0b9691dfb62b22de1 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::marker;
+
 fn send<T:Send + std::fmt::Debug>(ch: _chan<T>, data: T) {
     println!("{:?}", ch);
     println!("{:?}", data);
@@ -15,7 +17,7 @@ fn send<T:Send + std::fmt::Debug>(ch: _chan<T>, data: T) {
 }
 
 #[derive(Debug)]
-struct _chan<T>(isize);
+struct _chan<T>(isize, marker::PhantomData<T>);
 
 // Tests that "log(debug, message);" is flagged as using
 // message after the send deinitializes it
index ba2205f5868d4ccb22f09b8addaba1e9845110b6..6e8719eeaceda58e6ffce825b5805468cdc8f542 100644 (file)
 
 use std::collections::HashMap;
 
-trait Map<K, V> {}
+trait Map<K, V>
+{
+    fn get(&self, k: K) -> V { panic!() }
+}
 
 impl<K, V> Map<K, V> for HashMap<K, V> {}
 
diff --git a/src/test/compile-fail/method-ambig-one-trait-coerce.rs b/src/test/compile-fail/method-ambig-one-trait-coerce.rs
deleted file mode 100644 (file)
index cb5da4b..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that when we pick a trait based on coercion, versus subtyping,
-// we consider all possible coercions equivalent and don't try to pick
-// a best one.
-
-trait Object { }
-
-trait foo {
-    fn foo(self) -> isize;
-}
-
-impl foo for Box<Object+'static> {
-    fn foo(self) -> isize {1}
-}
-
-impl foo for Box<Object+Send> {
-    fn foo(self) -> isize {2}
-}
-
-fn test1(x: Box<Object+Send+Sync>) {
-    // FIXME(#18737) -- we ought to consider this to be ambiguous,
-    // since we could coerce to either impl. However, what actually
-    // happens is that we consider both impls applicable because of
-    // incorrect subtyping relation. We then decide to call this a
-    // call to the `foo` trait, leading to the following error
-    // message.
-
-    x.foo(); //~ ERROR `foo` is not implemented
-}
-
-fn test2(x: Box<Object+Send>) {
-    // Not ambiguous because it is a precise match:
-    x.foo();
-}
-
-fn test3(x: Box<Object+'static>) {
-    // Not ambiguous because it is a precise match:
-    x.foo();
-}
-
-fn main() { }
index cfaf149a49cac6f4d4d2b2f45897e4d63688dd0a..607ab13d122015d6f8ff42e92c56a5a3d5ed8062 100644 (file)
@@ -11,8 +11,9 @@
 // Test that an object type `Box<Foo>` is not considered to implement the
 // trait `Foo`. Issue #5087.
 
+use std::marker::MarkerTrait;
 
-trait Foo {}
+trait Foo : MarkerTrait {}
 fn take_foo<F:Foo>(f: F) {}
 fn take_object(f: Box<Foo>) { take_foo(f); }
 //~^ ERROR the trait `Foo` is not implemented
index c107c8d131d3a8f01672639bbfda0d7f810d0636..23ddea4499a728c51b1fa08bb416cb6a0de71b2c 100644 (file)
@@ -37,7 +37,6 @@ fn load1<'a,'b>(a: &'a MyBox<SomeTrait>,
     a
       //~^ ERROR cannot infer
       //~| ERROR mismatched types
-      //~| ERROR mismatched types
 }
 
 fn main() {
index 6a010d49692d26450a4d95225eb3695c4509b0cd..aae829ec7b5636c124b55bd953b59f78cbcff1fe 100644 (file)
@@ -11,7 +11,7 @@
 // Check that we correctly prevent users from making trait objects
 // from traits with static methods.
 
-trait Foo {
+trait Foo : ::std::marker::MarkerTrait {
     fn foo();
 }
 
index dda534cc489b522e12db13c208f11545abc0fc5c..7538b1c85e533fe610462dbf172433b8ef90442d 100644 (file)
 
 #![allow(unused)]
 
+use std::marker;
+
 #[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
-trait Foo<Bar, Baz, Quux>{}
+trait Foo<Bar, Baz, Quux>
+    : marker::PhantomFn<(Self,Bar,Baz,Quux)>
+{}
 
 #[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
 trait MyFromIterator<A> {
@@ -23,15 +27,21 @@ trait MyFromIterator<A> {
 }
 
 #[rustc_on_unimplemented] //~ ERROR this attribute must have a value
-trait BadAnnotation1 {}
+trait BadAnnotation1
+    : marker::MarkerTrait
+{}
 
 #[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{C}>`"]
 //~^ ERROR there is no type parameter C on trait BadAnnotation2
-trait BadAnnotation2<A,B> {}
+trait BadAnnotation2<A,B>
+    : marker::PhantomFn<(Self,A,B)>
+{}
 
 #[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{}>`"]
 //~^ only named substitution parameters are allowed
-trait BadAnnotation3<A,B> {}
+trait BadAnnotation3<A,B>
+    : marker::PhantomFn<(Self,A,B)>
+{}
 
 pub fn main() {
 }
index 7b406afcf1f5832dcd79890388076ff26b09da29..2447d0864226aee75dd0decae2bf692b5032104e 100644 (file)
 
 #![feature(on_unimplemented)]
 
+use std::marker;
+
 #[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
-trait Foo<Bar, Baz, Quux>{}
+trait Foo<Bar, Baz, Quux>
+    : marker::PhantomFn<(Self,Bar,Baz,Quux)>
+{}
 
 fn foobar<U: Clone, T: Foo<u8, U, u32>>() -> T {
 
index ff5c101b9178f60a5998d9e0fffb0142017fb1a9..8201565c3318dce282c41bbb57dcc458f34836b9 100644 (file)
@@ -15,7 +15,7 @@
 
 use orphan_check_diagnostics::RemoteTrait;
 
-trait LocalTrait {}
+trait LocalTrait { fn dummy(&self) { } }
 
 impl<T> RemoteTrait for T where T: LocalTrait {}
 //~^ ERROR type parameter `T` must be used as the type parameter for some local type
index db649ed0cc60632cbbbe59f49b624ed56b3d5b43..43d112b8aa0043aee7937ee05d0ecebc23d185e3 100644 (file)
@@ -14,7 +14,7 @@
 }
 
 trait A {
-    fn foo() {}
+    fn foo(&self) {}
 }
 
 struct B;
@@ -22,7 +22,7 @@ fn foo() {}
 pub impl B {} //~ ERROR: unnecessary visibility
 
 pub impl A for B { //~ ERROR: unnecessary visibility
-    pub fn foo() {} //~ ERROR: unnecessary visibility
+    pub fn foo(&self) {} //~ ERROR: unnecessary visibility
 }
 
 pub fn main() {}
index 7fe0574ab7d9a663902dd9433fcc6a01145f3b4c..67bb566ea682c07b1568202a6c213156d3a92d46 100644 (file)
@@ -17,7 +17,9 @@
 
 // public type, private value
 pub mod foo1 {
-    pub trait Bar {
+    use std::marker::MarkerTrait;
+
+    pub trait Bar : MarkerTrait {
     }
     pub struct Baz;
 
@@ -39,7 +41,7 @@ fn test_list1() {
 
 // private type, public value
 pub mod foo2 {
-    trait Bar {
+    trait Bar : ::std::marker::MarkerTrait {
     }
     pub struct Baz;
 
@@ -60,7 +62,7 @@ fn test_list2() {
 
 // neither public
 pub mod foo3 {
-    trait Bar {
+    trait Bar : ::std::marker::MarkerTrait {
     }
     pub struct Baz;
 
index 7ebbcc2809a5802a42cfc4d598ed1171c2038703..1ae79adbad76ae953da4cf7aa0045da158c03de5 100644 (file)
 #![feature(lang_items, start, no_std)]
 #![no_std] // makes debugging this test *a lot* easier (during resolve)
 
+#[lang="phantom_fn"]
+pub trait PhantomFn<A:?Sized,R:?Sized=()> { }
+impl<A:?Sized, R:?Sized, U:?Sized> PhantomFn<A,R> for U { }
+
 #[lang="sized"]
-pub trait Sized {}
+pub trait Sized : PhantomFn<Self> {}
 
 #[lang="copy"]
-pub trait Copy {}
+pub trait Copy : PhantomFn<Self> {}
 
 mod bar {
     // shouldn't bring in too much
index bcb46663aa849da96e36e45d9275453948cdbff0..adce93af0794f9a0f5d8cf0eae6aa95f6ec5f467 100644 (file)
 #![feature(lang_items, start, no_std)]
 #![no_std] // makes debugging this test *a lot* easier (during resolve)
 
-#[lang = "sized"] pub trait Sized {}
-#[lang="copy"] pub trait Copy {}
+#[lang="phantom_fn"]
+pub trait PhantomFn<A:?Sized,R:?Sized=()> { }
+impl<A:?Sized, R:?Sized, U:?Sized> PhantomFn<A,R> for U { }
+
+#[lang = "sized"] pub trait Sized : PhantomFn<Self> {}
+#[lang="copy"] pub trait Copy : PhantomFn<Self> {}
 
 // Test to make sure that private items imported through globs remain private
 // when  they're used.
index 20cc624ab19040aa421c7c8fdaab78562f247d8d..2da414befd8979312cc7b1c3e18466197d5f9f7a 100644 (file)
@@ -13,7 +13,7 @@
 
 #![feature(box_syntax)]
 
-trait Foo {}
+trait Foo : ::std::marker::MarkerTrait {}
 impl<'a> Foo for &'a [u8] {}
 
 fn a(v: &[u8]) -> Box<Foo + 'static> {
index f833361e3b505cc136f093ab56db2ae7b99419b0..f921eccef1f8cdc713d340b54f15251f4dadb40f 100644 (file)
 // Test that the compiler checks that arbitrary region bounds declared
 // in the trait must be satisfied on the impl. Issue #20890.
 
-trait Foo<'a> { type Value: 'a; }
+trait Foo<'a> {
+    type Value: 'a;
+    fn dummy(&'a self) { }
+}
 
 impl<'a> Foo<'a> for &'a i16 {
     // OK.
index 0871d8b01f6e49e324481cf3677fd5d4d16c25eb..1cf83b8ac585f75f2833480bb0535eb975fa4d54 100644 (file)
 // Test that the compiler checks that the 'static bound declared in
 // the trait must be satisfied on the impl. Issue #20890.
 
-trait Foo { type Value: 'static; }
+trait Foo {
+    type Value: 'static;
+    fn dummy(&self) { }
+}
 
 impl<'a> Foo for &'a i32 {
     //~^ ERROR cannot infer
index a3c38dff6b0f62f73275240d21286e2a1fdcc758..278ccd3c11936f3b931d0cd2ce64912ec55cc0c5 100644 (file)
@@ -21,10 +21,9 @@ pub trait Foo<'a, 't> {
     fn has_bound<'b:'a>(self, b: Inv<'b>);
     fn wrong_bound1<'b,'c,'d:'a+'b>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>);
     fn okay_bound<'b,'c,'d:'a+'b+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>);
-    fn another_bound<'x: 'a>(self, x: Inv<'x>);
+    fn another_bound<'x: 'a>(self, x: Inv<'x>, y: Inv<'t>);
 }
 
-
 impl<'a, 't> Foo<'a, 't> for &'a isize {
     fn no_bound<'b:'a>(self, b: Inv<'b>) {
         //~^ ERROR lifetime parameters or bounds on method `no_bound` do not match
@@ -51,7 +50,7 @@ fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) {
     fn okay_bound<'b,'c,'e:'b+'c>(self, b: Inv<'b>, c: Inv<'c>, e: Inv<'e>) {
     }
 
-    fn another_bound<'x: 't>(self, x: Inv<'x>) {}
+    fn another_bound<'x: 't>(self, x: Inv<'x>, y: Inv<'t>) {}
 }
 
 fn main() { }
index 74c2c6e584b437184c642b1d46e9d25b87dcc165..f13d8a60894cb6b7ae9e3f4162cd52b427e49167 100644 (file)
@@ -8,16 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(lang_items, no_std)]
-#![no_std]
-
 // Check that explicit region bounds are allowed on the various
 // nominal types (but not on other types) and that they are type
 // checked.
 
-#[lang="sized"]
-trait Sized { }
-
 struct Inv<'a> { // invariant w/r/t 'a
     x: &'a mut &'a isize
 }
index 8a03f36972dd187f96a7df753aa1562f7a7ead57..979c1e997d03c8b694c2bcb78605f5fcade1e610 100644 (file)
@@ -10,7 +10,9 @@
 
 #![feature(box_syntax)]
 
-trait X {}
+use std::marker::MarkerTrait;
+
+trait X : MarkerTrait {}
 
 trait Iter {
     type Item: X;
index 7a0e3cf4611c7156e0ef22218d2b3023a3449d2d..7bbce7dad530db4fc9a21ab9a947009c486d8b8a 100644 (file)
 #![feature(box_syntax)]
 #![allow(warnings)]
 
-trait A<T> {}
+use std::marker::PhantomFn;
+
+trait A<T> : PhantomFn<(Self,T)> { }
 struct B<'a, T>(&'a (A<T>+'a));
 
-trait X {}
+trait X : ::std::marker::MarkerTrait {}
+
 impl<'a, T> X for B<'a, T> {}
 
-fn f<'a, T, U>(v: Box<A<T>+'static>) -> Box<X+'static> {
+fn f<'a, T:'static, U>(v: Box<A<T>+'static>) -> Box<X+'static> {
     box B(&*v) as Box<X> //~ ERROR `*v` does not live long enough
 }
 
index 7861fb95fef666d315e46f2b989199eea7a8038c..6de49020a6fbbaff0d6b2b0d584d28deffcd5512 100644 (file)
 
 #![feature(box_syntax)]
 
-trait A<T> {}
+use std::marker::PhantomFn;
+
+trait A<T> : PhantomFn<(Self,T)> { }
 struct B<'a, T>(&'a (A<T>+'a));
 
-trait X {}
+trait X : PhantomFn<Self> {}
 impl<'a, T> X for B<'a, T> {}
 
 fn g<'a, T: 'static>(v: Box<A<T>+'a>) -> Box<X+'static> {
index 31354de2a27df7aac0a0ac73c4dbf7130a6daf46..e22d0c7d0a4f51bc9b14f95c53c90d077c3609b2 100644 (file)
 #![feature(box_syntax)]
 #![allow(warnings)]
 
-trait A<T> {}
+use std::marker::PhantomFn;
+
+trait A<T> : PhantomFn<(Self,T)> {}
 struct B<'a, T>(&'a (A<T>+'a));
 
-trait X {}
+trait X : PhantomFn<Self> {}
 impl<'a, T> X for B<'a, T> {}
 
 fn h<'a, T, U>(v: Box<A<U>+'static>) -> Box<X+'static> {
index c60975f97e13d5dd07e24c03ec7cfc542fc994f9..147a575d38caca1ce10c1e18d4925efa308b7236 100644 (file)
 
 #![feature(box_syntax)]
 
-trait A<T> {}
+use std::marker::PhantomFn;
+
+trait A<T> : PhantomFn<(Self,T)> {}
 struct B<'a, T>(&'a (A<T>+'a));
 
-trait X {}
+trait X : PhantomFn<Self> {}
 impl<'a, T> X for B<'a, T> {}
 
 fn i<'a, T, U>(v: Box<A<U>+'a>) -> Box<X+'static> {
index 25b8137d29cade512868ecfdaa54e2a228611ea8..2341d2397c9b04d5f635fe6ade7e86c675ae5853 100644 (file)
@@ -10,7 +10,9 @@
 
 #![feature(box_syntax)]
 
-trait Foo { }
+use std::marker::MarkerTrait;
+
+trait Foo : MarkerTrait { }
 
 impl<'a> Foo for &'a isize { }
 
index 74b36958c92f1166790972f6d80f7d7a0b6b6814..9ad49a6703ee3abc939afb4cabb84eba2b67d4c5 100644 (file)
@@ -10,7 +10,7 @@
 
 #![feature(box_syntax)]
 
-trait X {}
+trait X : ::std::marker::MarkerTrait {}
 
 fn p1<T>(v: T) -> Box<X+'static>
     where T : X
index 6c5e90a54de2b72ce5f319e52c2042e8e1d9377e..b7ef19d1e3bfc11be9c557cfc157ace2b5c160f8 100644 (file)
@@ -20,7 +20,7 @@
 // Contravariant<'foo> <: Contravariant<'static> because
 // 'foo <= 'static
 struct Contravariant<'a> {
-    marker: marker::ContravariantLifetime<'a>
+    marker: marker::PhantomData<&'a()>
 }
 
 fn use_<'short,'long>(c: Contravariant<'short>,
index d8e31fa1374a8ae07a4848b97d1baddbd08d37ab..0d3d9dacbd6f6c0a3517aed2045a09155c1b1931 100644 (file)
@@ -17,7 +17,7 @@
 use std::marker;
 
 struct Covariant<'a> {
-    marker: marker::CovariantLifetime<'a>
+    marker: marker::PhantomData<fn(&'a ())>
 }
 
 fn use_<'short,'long>(c: Covariant<'long>,
index 5f4a1af6bf90f1c4ea1f6c3e8e742c3e5265ea99..65decb4da1b9934344bbfcfaa5af0d10a2a6c34f 100644 (file)
@@ -11,7 +11,7 @@
 use std::marker;
 
 struct invariant<'a> {
-    marker: marker::InvariantLifetime<'a>
+    marker: marker::PhantomData<*mut &'a()>
 }
 
 fn to_same_lifetime<'r>(bi: invariant<'r>) {
index 7d252604883d6e12eb185e249389150a8c93ea2a..1b749faf1b8b92a50b0f86af687899ddceb4f40f 100644 (file)
 #![feature(lang_items, no_std)]
 #![no_std]
 
-#[lang="sized"] pub trait Sized {}
+#[lang="phantom_fn"]
+pub trait PhantomFn<T:?Sized> { }
+impl<T:?Sized, U:?Sized> PhantomFn<T> for U { }
+
+#[lang="sized"] pub trait Sized : PhantomFn<Self> {}
 
 // error-pattern:requires `start` lang_item
 
index 1a3d7821159c3fc5874697724a42866f31e72deb..1f72db1e894faa3d081728bc7505f3d6f10e0070 100644 (file)
 
 #![feature(box_syntax)]
 
-struct Foo<T>;
+struct Foo<T>(T);
 
 impl<T> Foo<T> {
     fn shadow_in_method<T>(&self) {}
     //~^ ERROR type parameter `T` shadows another type parameter
 
     fn not_shadow_in_item<U>(&self) {
-        struct Bar<T, U>; // not a shadow, separate item
+        struct Bar<T, U>(T,U); // not a shadow, separate item
         fn foo<T, U>() {} // same
     }
 }
 
 trait Bar<T> {
+    fn dummy(&self) -> T;
+
     fn shadow_in_required<T>(&self);
     //~^ ERROR type parameter `T` shadows another type parameter
 
index 1203d622348998d7044f724511726ec6d1456ed2..3c1c3796a246f172baef08c48c056dc541f0a923 100644 (file)
@@ -8,10 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct Foo<T,U>(T);
+use std::marker;
+
+struct Foo<T,U>(T, marker::PhantomData<U>);
 
 fn main() {
-    match Foo(1.1) {
+    match Foo(1.1, marker::PhantomData) {
         1 => {}
     //~^ ERROR mismatched types
     //~| expected `Foo<_, _>`
index bf4e46cace304dce9a5e62570046efbd44d34385..2dfc9b79ee20aca1e9a01a7b7307ed1cbb94634c 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
 trait foo {
+    fn dummy(&self) { }
     fn bar();
 }
 
index a1fcab002e138ccca33f3e6da65fb06cc35a08f2..fff144140947a11307157513cc8d4900e26444a0 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait TraitNotAStruct { }
+trait TraitNotAStruct : ::std::marker::MarkerTrait { }
 
 fn main() {
     TraitNotAStruct{ value: 0 };
index 79174552ae09c36f5ba136754f7a95cd7d6b6bc0..3129dceffbb664c3d2471ba61e3a38b7df2562b1 100644 (file)
@@ -10,6 +10,7 @@
 
 
 trait Foo {
+    fn dummy(&self) { }
 }
 
 fn a(_x: Box<Foo+Send>) {
index 477bd4f5be9a1a8a942acc1fd2b625b82c1fb5c6..34e06cc93658aedd3b0d4e4f22bfa79158710ef5 100644 (file)
 // Make sure rustc checks the type parameter bounds in implementations of traits,
 // see #2687
 
-trait A {}
+use std::marker;
+
+trait A : marker::PhantomFn<Self> {
+}
 
 trait B: A {}
 
@@ -62,15 +65,16 @@ fn test_error8_fn<T: C>(&self) {}
     //~^ ERROR the requirement `T : C` appears on the impl
 }
 
-
-trait Getter<T> { }
+trait Getter<T> {
+    fn get(&self) -> T { loop { } }
+}
 
 trait Trait {
-    fn method<G:Getter<isize>>();
+    fn method<G:Getter<isize>>(&self);
 }
 
 impl Trait for usize {
-    fn method<G: Getter<usize>>() {}
+    fn method<G: Getter<usize>>(&self) {}
     //~^ G : Getter<usize>` appears on the impl method but not on the corresponding trait method
 }
 
index 8ad19116e7bb13ba2b11af89f5121e45441c9949..284c4fac953f2302b81fcc9b9efa6a0ba7d9ead5 100644 (file)
@@ -14,7 +14,9 @@ trait Iterator<A> {
     fn next(&mut self) -> Option<A>;
 }
 
-trait IteratorUtil<A> {
+trait IteratorUtil<A>
+    : ::std::marker::PhantomFn<(),A>
+{
     fn zip<B, U: Iterator<U>>(self, other: U) -> ZipIterator<Self, U>;
 }
 
index 434d803d718e7bcc143339e29bdfcbfeb069b473..448b186f6a5c6de1cff16451a9ff6db965d8cb7e 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 trait Foo {
+    fn dummy(&self) { }
 }
 
 // This should emit the less confusing error, not the more confusing one.
index 118dfeb37c2516d7845af0799312bde338eb43f4..df44e847c50fd5ffca5d96fbad2edc875444fd8c 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Trait {}
+trait Trait {
+    fn dummy(&self) { }
+}
 
 struct Foo<T:Trait> {
     x: T,
index d5369817e9ac189aac608c37d2d47255866bc023..18871d0d386d77ec178838299a0861bbb8e7e338 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Trait {}
+trait Trait {
+    fn dummy(&self) { }
+}
 
 struct Foo<T:Trait> {
     x: T,
index 490ee0e8ad6f3fcae09e62e057a9b958a500a8b8..8dfdb2f205d6f27d7e423e7ea2cb471485d812f7 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Trait {}
+use std::marker::MarkerTrait;
+
+trait Trait : MarkerTrait {}
 
 struct Foo<T:Trait> {
     x: T,
@@ -51,15 +53,15 @@ enum MoreBadness<V> {
     EvenMoreBadness(Bar<V>),
 }
 
-trait PolyTrait<T> {
-    fn whatever() {}
+trait PolyTrait<T>
+{
+    fn whatever(&self, t: T) {}
 }
 
 struct Struct;
 
 impl PolyTrait<Foo<usize>> for Struct {
 //~^ ERROR not implemented
-    fn whatever() {}
 }
 
 fn main() {
index 3d264e681a3d25c6b0ea5d7f88e24068dcecdf38..e4058a0943aadb770f92e4edfe031b2fd91c18f7 100644 (file)
@@ -10,8 +10,9 @@
 
 // Tests for "default" bounds inferred for traits with no bounds list.
 
+use std::marker::MarkerTrait;
 
-trait Foo {}
+trait Foo : MarkerTrait {}
 
 fn a(_x: Box<Foo+Send>) {
 }
index dadcbd5bce710291c706ad4a4209374352549d1b..2f4793b4d888f094ea5eaf8fa4594608d640def9 100644 (file)
@@ -12,7 +12,9 @@
 // trait impl is only applied to a trait object, not concrete types which implement
 // the trait.
 
-trait T {}
+use std::marker::MarkerTrait;
+
+trait T : MarkerTrait {}
 
 impl<'a> T+'a {
     fn foo(&self) {}
index 761bcd4968abfba2459f2d06e6f40bd9df33091a..d45d13556e12188b91d70f2a21cca6aa1a057c5b 100644 (file)
@@ -12,6 +12,7 @@
 
 trait Tr {
     fn foo();
+    fn bar(&self) { }
 }
 
 struct St;
index 651f663fc991343fe35c2ec64877b5fba854f698..0e357d9d4d53147a0b3037fe8adc66cca0be36b8 100644 (file)
@@ -16,6 +16,7 @@
 mod base {
     pub trait HasNew<T> {
         fn new() -> T;
+        fn dummy(&self) { }
     }
 
     pub struct Foo {
index 9da79b11cf0b7f1229e6bcab83fc2a1c47920fbd..557fb2f4f8833ff18f775a5c654841ebf9760fcf 100644 (file)
@@ -12,7 +12,9 @@
 
 struct TestType;
 
-trait TestTrait {}
+trait TestTrait {
+    fn dummy(&self) { }
+}
 
 impl !TestTrait for TestType {}
 //~^ ERROR  negative impls are currently allowed just for `Send` and `Sync`
index a34be63ba6b3c906d5c54063b845999a78bee622..1daea8f915b3f192000223342b02f915492c35f3 100644 (file)
 // This test checks that genuine type errors with partial
 // type hints are understandable.
 
-struct Foo<T>;
-struct Bar<U>;
+use std::marker::PhantomData;
+
+struct Foo<T>(PhantomData<T>);
+struct Bar<U>(PhantomData<U>);
 
 pub fn main() {
 }
 
 fn test1() {
-    let x: Foo<_> = Bar::<usize>;
+    let x: Foo<_> = Bar::<usize>(PhantomData);
     //~^ ERROR mismatched types
     //~| expected `Foo<_>`
     //~| found `Bar<usize>`
@@ -28,7 +30,7 @@ fn test1() {
 }
 
 fn test2() {
-    let x: Foo<_> = Bar::<usize>;
+    let x: Foo<_> = Bar::<usize>(PhantomData);
     //~^ ERROR mismatched types
     //~| expected `Foo<_>`
     //~| found `Bar<usize>`
index 3536244f011654d482dc5f8544e5f01fa7e1a796..74a6f869f63fb78850c834566b6d9f3c26bd6e83 100644 (file)
 // Check that parenthetical notation is feature-gated except with the
 // `Fn` traits.
 
+use std::marker;
+
 trait Foo<A> {
     type Output;
+
+    fn dummy(&self, a: A) { }
 }
 
 fn main() {
index 870377bc1add760e811680f0e3e4740bbe549d6d..831db98941c6dc2ac9165eab6e987b3168dfdcd1 100644 (file)
@@ -19,7 +19,7 @@ trait Foo<T,V=T> {
     fn dummy(&self, t: T, v: V);
 }
 
-trait Eq<X: ?Sized> { }
+trait Eq<X: ?Sized> { fn same_types(&self, x: &X) -> bool { true } }
 impl<X: ?Sized> Eq<X> for X { }
 fn eq<A: ?Sized,B: ?Sized>() where A : Eq<B> { }
 
index dc5576aee650a56ed814b9bbcd9abc09d5f24723..6d315c1b7a99617828fe1fe084202f00944fccef 100644 (file)
 #![feature(unboxed_closures)]
 #![allow(dead_code)]
 
+use std::marker::PhantomFn;
+
 trait Foo<T> {
     type Output;
     fn dummy(&self, t: T, u: Self::Output);
 }
 
-trait Eq<X: ?Sized> { }
+trait Eq<X: ?Sized> : PhantomFn<(Self,X)> { }
 impl<X: ?Sized> Eq<X> for X { }
 fn eq<A: ?Sized,B: ?Sized +Eq<A>>() { }
 
index d2f781bba11eaa3d30d8c5121d05480a90540425..bd3530e6e3026414b6df8b46c3c4361a47e2f15b 100644 (file)
 #![feature(unboxed_closures)]
 #![allow(dead_code)]
 
+use std::marker;
+
 trait Foo<T> {
     type Output;
     fn dummy(&self, t: T);
 }
 
-trait Eq<X: ?Sized> { }
+trait Eq<X: ?Sized> : marker::PhantomFn<(Self, X)> { }
 impl<X: ?Sized> Eq<X> for X { }
 fn eq<A: ?Sized,B: ?Sized +Eq<A>>() { }
 
index 75688e44e80761c2758012316a6cb6e655602c8f..057b496bd43ebead9d4f321fd67692275a10cdd7 100644 (file)
@@ -22,7 +22,7 @@ trait Foo<'a,T> {
     fn dummy(&'a self) -> &'a (T,Self::Output);
 }
 
-trait Eq<X: ?Sized> { }
+trait Eq<X: ?Sized> { fn is_of_eq_type(&self, x: &X) -> bool { true } }
 impl<X: ?Sized> Eq<X> for X { }
 fn eq<A: ?Sized,B: ?Sized +Eq<A>>() { }
 
index 215b2c6798e40c80f30333dd4edbc1a34120b3b6..713b64b1349fcc5893ac455a2755aa9449a203ef 100644 (file)
@@ -10,7 +10,7 @@
 
 #![feature(core,unboxed_closures)]
 
-use std::marker::CovariantType;
+use std::marker::PhantomData;
 
 // A erroneous variant of `run-pass/unboxed_closures-infer-recursive-fn.rs`
 // where we attempt to perform mutation in the recursive function. This fails to compile
 
 struct YCombinator<F,A,R> {
     func: F,
-    marker: CovariantType<(A,R)>,
+    marker: PhantomData<(A,R)>,
 }
 
 impl<F,A,R> YCombinator<F,A,R> {
     fn new(f: F) -> YCombinator<F,A,R> {
-        YCombinator { func: f, marker: CovariantType }
+        YCombinator { func: f, marker: PhantomData }
     }
 }
 
index e3707292f2495e979f7029539de36b622ac34e13..964db6e9a4546bfb8b8ad18cfd80dc5af26110eb 100644 (file)
@@ -13,10 +13,10 @@ fn main() {
     pub struct A; //~ ERROR: visibility has no effect
     pub enum B {} //~ ERROR: visibility has no effect
     pub trait C { //~ ERROR: visibility has no effect
-        pub fn foo() {} //~ ERROR: visibility has no effect
+        pub fn foo(&self) {} //~ ERROR: visibility has no effect
     }
     impl A {
-        pub fn foo() {} //~ ERROR: visibility has no effect
+        pub fn foo(&self) {} //~ ERROR: visibility has no effect
     }
 
     struct D {
index 8740346a21750c8918af9545e4ceda6d20a0286b..a03c76b12dd8ea141dce5ddd1171b815590c3157 100644 (file)
@@ -12,7 +12,7 @@
 
 // impl - struct
 
-struct S5<Y>;
+struct S5<Y>(Y);
 
 impl<X: ?Sized> S5<X> { //~ ERROR not implemented
 }
index 3dd55b0ba7d23401d7c75e5922efd5c2f23038b5..08df1d9b7b8fb8a384912f0258e7bcbdfadb2b53 100644 (file)
 
 // impl - struct
 trait T3<Z: ?Sized> {
+    fn foo(&self, z: &Z);
 }
 
-struct S5<Y>;
+struct S5<Y>(Y);
 
 impl<X: ?Sized> T3<X> for S5<X> { //~ ERROR not implemented
 }
index ac8043d6852a9b37927cc1e5c787c502c6cfe14f..4723dfeaeb988393150e30af3cc515eef3806778 100644 (file)
@@ -12,8 +12,9 @@
 
 // impl - unbounded
 trait T2<Z> {
+    fn foo(&self, z: Z);
 }
-struct S4<Y: ?Sized>;
+struct S4<Y: ?Sized>(Box<Y>);
 impl<X: ?Sized> T2<X> for S4<X> {
     //~^ ERROR `core::marker::Sized` is not implemented for the type `X`
 }
index 4fc76c99c60b7ed737ba123696807a7893c4b2b9..de1cbab82b281e373002a1b2d4177a1ab1cd6791 100644 (file)
@@ -10,6 +10,7 @@
 
 // Test sized-ness checking in substitution within fn bodies..
 
+use std::marker;
 
 // Unbounded.
 fn f1<X: ?Sized>(x: &X) {
@@ -20,7 +21,9 @@ fn f2<X>(x: &X) {
 }
 
 // Bounded.
-trait T {}
+trait T {
+    fn foo(&self) { }
+}
 fn f3<X: ?Sized + T>(x: &X) {
     f4::<X>(x);
     //~^ ERROR the trait `core::marker::Sized` is not implemented
index 217d1f44d84613f9270ef4334b5cd62918c09c5f..f31a6ffdc0d7caed0084f23af4f661bd4df45f64 100644 (file)
@@ -10,8 +10,9 @@
 
 // Test `?Sized` local variables.
 
+use std::marker;
 
-trait T {}
+trait T : marker::MarkerTrait { }
 
 fn f1<X: ?Sized>(x: &X) {
     let _: X; // <-- this is OK, no bindings created, no initializer.
index 6fc547c0b8e8610b2c2d073fcf58182525b8fec9..6ea3d0720eeeb716e3ae07325963865ce5d70b0e 100644 (file)
 
 // Test sized-ness checking in substitution in impls.
 
-trait T {}
+use std::marker::MarkerTrait;
+
+trait T : MarkerTrait {}
 
 // I would like these to fail eventually.
 // impl - bounded
 trait T1<Z: T> {
+    fn dummy(&self) -> Z;
 }
-struct S3<Y: ?Sized>;
+
+struct S3<Y: ?Sized>(Box<Y>);
 impl<X: ?Sized + T> T1<X> for S3<X> {
     //~^ ERROR `core::marker::Sized` is not implemented for the type `X`
 }
index 2d4bc0c857a9a7ad7f8c77f05e77300e3346b644..af242b96a84a160d464c01a5176a3c4e6c2f0393 100644 (file)
@@ -52,9 +52,9 @@ struct Foo {
 #[foo] //~ ERROR unused attribute
 trait Baz {
     #[foo] //~ ERROR unused attribute
-    fn blah();
+    fn blah(&self);
     #[foo] //~ ERROR unused attribute
-    fn blah2() {}
+    fn blah2(&self) {}
 }
 
 fn main() {}
index d8531f4543dffad390dd3f855ca4c361a6ea72a0..b1120e54434eb1861c96d8459b449e7d49ddf708 100644 (file)
@@ -12,12 +12,14 @@ struct A { pub i: isize }
 pub enum C { pub Variant }      //~ ERROR: unnecessary `pub`
 
 pub trait E {
-    pub fn foo() {}             //~ ERROR: unnecessary visibility
+    pub fn foo(&self) {}         //~ ERROR: unnecessary visibility
+}
+trait F {
+    pub fn foo(&self) {}     //~ ERROR: unnecessary visibility
 }
-trait F { pub fn foo() {} }     //~ ERROR: unnecessary visibility
 
 impl E for A {
-    pub fn foo() {}             //~ ERROR: unnecessary visibility
+    pub fn foo(&self) {}             //~ ERROR: unnecessary visibility
 }
 
 fn main() {}
index 7125a66b294cee888ea7dbb62cb5fd12949db262..a404d09248f0192a8ed54268f3c960df4636b8e4 100644 (file)
@@ -9,8 +9,10 @@
 // except according to those terms.
 
 pub trait E {
-    pub fn foo();               //~ ERROR: unnecessary visibility
+    pub fn foo(&self);               //~ ERROR: unnecessary visibility
+}
+trait F {
+    pub fn foo(&self);               //~ ERROR: unnecessary visibility
 }
-trait F { pub fn foo(); }       //~ ERROR: unnecessary visibility
 
 fn main() {}
index d70305d1106ecd64c8a1535fddea6449fad35320..da4d6c75227fc609bba453dd222f52638b945fe2 100644 (file)
@@ -60,6 +60,7 @@
 
 #[rustc_variance]
 struct Test7<'a> { //~ ERROR regions=[[*];[];[]]
+    //~^ ERROR parameter `'a` is never used
     x: isize
 }
 
index 4bb329d6304cf3ec1333f980bde394d063ff5f16..9beb90d0b24835777550fc03adbda379e34faf9f 100644 (file)
@@ -16,6 +16,7 @@
 
 #[rustc_variance]
 enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR regions=[[+, -, o, *];[];[]]
+    //~^ ERROR parameter `'d` is never used
     Test8A(extern "Rust" fn(&'a isize)),
     Test8B(&'b [isize]),
     Test8C(&'b mut &'c str),
 
 #[rustc_variance]
 struct Derived1<'w, 'x:'y, 'y, 'z> { //~ ERROR regions=[[*, o, -, +];[];[]]
+    //~^ ERROR parameter `'w` is never used
     f: Base<'z, 'y, 'x, 'w>
 }
 
 #[rustc_variance] // Combine - and + to yield o
 struct Derived2<'a, 'b:'a, 'c> { //~ ERROR regions=[[o, o, *];[];[]]
+    //~^ ERROR parameter `'c` is never used
     f: Base<'a, 'a, 'b, 'c>
 }
 
 #[rustc_variance] // Combine + and o to yield o (just pay attention to 'a here)
 struct Derived3<'a:'b, 'b, 'c> { //~ ERROR regions=[[o, -, *];[];[]]
+    //~^ ERROR parameter `'c` is never used
     f: Base<'a, 'b, 'a, 'c>
 }
 
index 965b9430a5e2d44095266a7b08abf700728e2147..f0ca1edd5638718c50ace55b5dfb97571f520f39 100644 (file)
@@ -18,7 +18,7 @@
 
 use std::mem;
 
-trait T { fn foo(); }
+trait T { fn foo(&self); }
 
 #[rustc_variance]
 struct TOption<'a> { //~ ERROR regions=[[-];[];[]]
index 7ff18f8e0886c1d5826a5142228b9b872e610db2..1f2205b5c71983ee67a847d32b053c8365d15779 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Foo {}
+trait Foo {
+    fn dummy(&self) { }
+}
 
 pub fn f<
     T
index dc6d446154ac75b4045c7006e98b7a6f07134495..9d9eae4a0759bb7bdbcaa311e85e6e2614c2378f 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Foo {}
+trait Foo {
+    fn dummy(&self) { }
+}
 
 pub trait Bar : Foo {} //~ ERROR private trait in exported type
 
index a5108f005dc0e10533d7b4cddc830102f8235adc..bf614e6eb512bab429c2c5530e833fdc1f464c35 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Foo<T> {}
+trait Foo<T> {
+    fn dummy(&self, t: T) { }
+}
 
 trait Bar<A> {
     fn method<B>(&self) where A: Foo<B>;
index 313ae273c07fe94fd58f2affbf98454f0efc3b40..7968cc37090acffe1d09cc411bdd1c2fe813c5af 100644 (file)
@@ -21,7 +21,7 @@ fn test2() -> bool where Option<isize> : Eq {}
 
 #[derive(PartialEq)]
 //~^ ERROR cannot bound type `isize`, where clause bounds
-enum Foo<T> where isize : Eq { MkFoo }
+enum Foo<T> where isize : Eq { MkFoo(T) }
 //~^ ERROR cannot bound type `isize`, where clause bounds
 
 fn test3<T: Eq>() -> bool where Option<Foo<T>> : Eq {}
@@ -31,7 +31,7 @@ fn test4() -> bool where Option<Foo<isize>> : Eq {}
 
 trait Baz<T> where isize : Eq {
     //~^ ERROR cannot bound type `isize`, where clause bounds may only
-    fn baz() where String : Eq; //~ ERROR cannot bound type `collections::string::String`
+    fn baz(&self, t: T) where String : Eq; //~ ERROR cannot bound type `collections::string::String`
     //~^ ERROR cannot bound type `isize`, where clause
 }
 
index adc4711b49aa2367b040988f03b371e15bbd632f..cb1cf8c55579aacaa577cb63d90ff0d57188c4de 100644 (file)
 #![omit_gdb_pretty_printer_section]
 
 use self::Enum1::{Variant1_1, Variant1_2};
+use std::marker::PhantomData;
 use std::ptr;
 
 struct Struct1;
-struct GenericStruct<T1, T2>;
+struct GenericStruct<T1, T2>(PhantomData<(T1,T2)>);
 
 enum Enum1 {
     Variant1_1,
@@ -207,8 +208,8 @@ pub enum Enum3<T> {
     }
 }
 
-trait Trait1 { }
-trait Trait2<T1, T2> { }
+trait Trait1 { fn dummy(&self) { } }
+trait Trait2<T1, T2> { fn dummy(&self, _: T1, _:T2) { } }
 
 impl Trait1 for isize {}
 impl<T1, T2> Trait2<T1, T2> for isize {}
@@ -240,8 +241,10 @@ fn main() {
 
     // Structs
     let simple_struct = Struct1;
-    let generic_struct1: GenericStruct<Mod1::Struct2, Mod1::Mod2::Struct3> = GenericStruct;
-    let generic_struct2: GenericStruct<Struct1, extern "fastcall" fn(isize) -> usize> = GenericStruct;
+    let generic_struct1: GenericStruct<Mod1::Struct2, Mod1::Mod2::Struct3> =
+        GenericStruct(PhantomData);
+    let generic_struct2: GenericStruct<Struct1, extern "fastcall" fn(isize) -> usize> =
+        GenericStruct(PhantomData);
     let mod_struct = Mod1::Struct2;
 
     // Enums
@@ -262,10 +265,10 @@ fn main() {
 
     // References
     let ref1 = (&Struct1, 0i32);
-    let ref2 = (&GenericStruct::<char, Struct1>, 0i32);
+    let ref2 = (&GenericStruct::<char, Struct1>(PhantomData), 0i32);
 
     let mut mut_struct1 = Struct1;
-    let mut mut_generic_struct = GenericStruct::<Mod1::Enum2, f64>;
+    let mut mut_generic_struct = GenericStruct::<Mod1::Enum2, f64>(PhantomData);
     let mut_ref1 = (&mut mut_struct1, 0i32);
     let mut_ref2 = (&mut mut_generic_struct, 0i32);
 
index f22f1b409526900b3f1909221c9cf50ec1d667c0..f5205de5c1fcd3ee32661b60d821915bbd10efb7 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait X { }
+trait X { fn dummy(&self) { } }
 impl X for uint { }
 
-trait Y { }
+trait Y { fn dummy(&self) { } }
 impl Y for uint { }
index e27a3365a4105d1d7025eb002f6be59a3d14612c..9e1f2aa8bfe01e7729e5e71c30f76908082b918b 100644 (file)
@@ -11,7 +11,9 @@
 // pp-exact
 
 
-trait Tr { }
+trait Tr {
+    fn dummy(&self) { }
+}
 impl Tr for int { }
 
 fn foo<'a>(x: Box<Tr+ Sync + 'a>) -> Box<Tr+ Sync + 'a> { x }
index e46564f80760c6c62cc2b5d8ee474b65f7ea6b69..4ad81197286bb992734e8d8f24ae04fa74ad50c7 100644 (file)
@@ -9,6 +9,9 @@
 // except according to those terms.
 
 // error-pattern:quux
+
+use std::marker::PhantomData;
+
 fn test00_start(ch: chan_t<int>, message: int) { send(ch, message); }
 
 type task_id = int;
@@ -17,6 +20,7 @@
 struct chan_t<T> {
     task: task_id,
     port: port_id,
+    marker: PhantomData<*mut T>,
 }
 
 fn send<T:Send>(_ch: chan_t<T>, _data: T) { panic!(); }
index d57a7164cdbcea135ea7d41436f5d9909a8d9bc6..3bd56c14193a8524d7e4dc25cf2e474779e5181f 100644 (file)
@@ -21,5 +21,5 @@ pub fn baz() { }
     }
 
     /// *wow*
-    pub trait Doge { }
+    pub trait Doge { fn dummy(&self) { } }
 }
index b5fcbf46c5c98207eec54bd47fda67f5c2b4744d..6c56bcc9be67bc0a4817cd307e092facc44b48cd 100644 (file)
@@ -13,7 +13,7 @@
 // @matches foo/struct.Alpha.html '//pre' "pub struct Alpha"
 pub struct Alpha;
 // @matches foo/struct.Bravo.html '//pre' "pub struct Bravo<B>"
-pub struct Bravo<B>;
+pub struct Bravo<B>(B);
 
 // @matches foo/struct.Alpha.html '//*[@class="impl"]//code' "impl !Send for Alpha"
 impl !Send for Alpha {}
index dd68f2d6f1dee4c512c26d5c103e13511e1f5b88..42469a21f22d0abbf25f3bfc31e5c76e396efde7 100644 (file)
@@ -21,6 +21,6 @@ fn priv_method() {} // @!has - priv_method
     }
 
     pub trait PrivateTrait {
-        fn trait_method() {} // @!has - priv_method
+        fn trait_method(&self) {} // @!has - priv_method
     }
 }
index 0438c9aba3599f8238586fa75078f08759c15ede..f6b73021bebdfb0ffc70941642062208c65a8a9b 100644 (file)
@@ -26,7 +26,7 @@ pub fn baz() { }
 
     /// *wow*
     // @has foo/bar/trait.Doge.html
-    pub trait Doge { }
+    pub trait Doge { fn dummy(&self) { } }
 
     // @has foo/bar/struct.Foo.html
     pub struct Foo { x: int, y: uint }
index da8f73930239044a3141b7602e5e909667949019..6fd47d84c30fee93646688ba1bc1732003c46213 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 pub mod io {
-    pub trait Reader { }
+    pub trait Reader { fn dummy(&self) { } }
 }
 
 pub enum Maybe<A> {
index 68fde60564e2a8c96bdc25f29029eec503c42a73..91a7e1c9fd4aeb4554cdef802909b12cb4df35bb 100644 (file)
@@ -8,30 +8,33 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub trait MyTrait {}
+pub trait MyTrait { fn dummy(&self) { } }
 
 // @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A> where A: MyTrait"
-pub struct Alpha<A> where A: MyTrait;
+pub struct Alpha<A>(A) where A: MyTrait;
 // @has foo/trait.Bravo.html '//pre' "pub trait Bravo<B> where B: MyTrait"
-pub trait Bravo<B> where B: MyTrait {}
+pub trait Bravo<B> where B: MyTrait { fn get(&self, B: B); }
 // @has foo/fn.charlie.html '//pre' "pub fn charlie<C>() where C: MyTrait"
 pub fn charlie<C>() where C: MyTrait {}
 
-pub struct Delta<D>;
+pub struct Delta<D>(D);
+
 // @has foo/struct.Delta.html '//*[@class="impl"]//code' \
 //          "impl<D> Delta<D> where D: MyTrait"
 impl<D> Delta<D> where D: MyTrait {
     pub fn delta() {}
 }
 
-pub struct Echo<E>;
+pub struct Echo<E>(E);
+
 // @has foo/struct.Echo.html '//*[@class="impl"]//code' \
 //          "impl<E> MyTrait for Echo<E> where E: MyTrait"
 // @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//code' \
 //          "impl<E> MyTrait for Echo<E> where E: MyTrait"
 impl<E> MyTrait for Echo<E> where E: MyTrait {}
 
-pub enum Foxtrot<F> {}
+pub enum Foxtrot<F> { Foxtrot1(F) }
+
 // @has foo/enum.Foxtrot.html '//*[@class="impl"]//code' \
 //          "impl<F> MyTrait for Foxtrot<F> where F: MyTrait"
 // @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//code' \
index d90219b4221ebcc83a68a62abb6245a2b08c02a5..ffadc57d1b08e4e3a51f293b2acdeb70e07a0ee0 100644 (file)
@@ -99,6 +99,7 @@ struct some_fields {
 type SF = some_fields;
 
 trait SuperTrait {
+    fn dummy(&self) { }
 }
 
 trait SomeTrait: SuperTrait {
index 834a2adf01fd3075bfa44ef33454e2504f68f3fd..f418d5d1fb74f1435110ea0378df3f9e48ffa8ca 100755 (executable)
@@ -70,10 +70,14 @@ pub fn bar(a: i32x4, b: i32x4) -> i32x4 {
 }
 
 #[lang = "sized"]
-trait Sized {}
+pub trait Sized : PhantomFn<Self> {}
 
 #[lang = "copy"]
-trait Copy {}
+pub trait Copy : PhantomFn<Self> {}
+
+#[lang="phantom_fn"]
+pub trait PhantomFn<A:?Sized,R:?Sized=()> { }
+impl<A:?Sized, R:?Sized, U:?Sized> PhantomFn<A,R> for U { }
 
 mod core {
     pub mod marker {
index 7cfebb31b22905ade5038f05bb624427cf5fed4c..474a6782b616b3af1ea845be56b948c662cda0b6 100644 (file)
@@ -11,7 +11,7 @@
 pub static X: &'static str = "foobarbaz";
 pub static Y: &'static [u8] = include_bytes!("lib.rs");
 
-trait Foo {}
+trait Foo { fn dummy(&self) { } }
 impl Foo for uint {}
 
 pub fn dummy() {
index 365fc039a4ec37a6f8a2f93da4d6d437ecea7dc2..acda8705b19e30e22ad6b2cb662f9e74bb59d34c 100644 (file)
 #![feature(lang_items, no_std)]
 #![no_std]
 
+#[lang="phantom_fn"]
+trait PhantomFn<A:?Sized,R:?Sized=()> { }
+impl<A:?Sized, R:?Sized, U:?Sized> PhantomFn<A,R> for U { }
+
 #[lang="copy"]
-trait Copy { }
+trait Copy : PhantomFn<Self> { }
 
 #[lang="sized"]
-trait Sized { }
+trait Sized : PhantomFn<Self>  { }
 
 #[lang="start"]
 fn start(_main: *const u8, _argc: int, _argv: *const *const u8) -> int { 0 }
index 195055f12d1e4010aa7a6fb147a60b8f170a1036..aecec44f6fd3df0e4cd6cbdec45dbbd5dcff17b9 100644 (file)
@@ -25,7 +25,7 @@ fn drop(&mut self) {
 }
 
 
-trait Trait {}
+trait Trait { fn dummy(&self) { } }
 impl Trait for Foo {}
 
 pub fn main() {
index 47e2a18a9992a95192f3de4d5672fc535cbdd599..c49a684de945df046b3015e2cd5b0a35488b865e 100644 (file)
@@ -19,7 +19,7 @@ fn drop(&mut self) {
     }
 }
 
-trait Trait {}
+trait Trait { fn dummy(&self) { } }
 impl Trait for Foo {}
 
 struct Fat<T: ?Sized> {
index 3314b613201595442e4373c320795b189bc380ad..f5521f7da853bd025b017cac1cf7a3a4d8c463fd 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Foo {
+use std::marker::MarkerTrait;
+
+trait Foo : MarkerTrait {
     type T;
 }
 
index f21b7183d70c46c5445081f762ed18c55af6f41f..aa65b0ed10bafe93e5521d26a074cbf801a9f25d 100644 (file)
@@ -14,6 +14,7 @@
 // `Target=[A]`, then the impl marked with `(*)` is seen to conflict
 // with all the others.
 
+use std::marker::PhantomData;
 use std::ops::Deref;
 
 pub trait MyEq<U: ?Sized=Self> {
@@ -41,7 +42,8 @@ fn eq(&self, other: &[B]) -> bool {
 }
 
 struct DerefWithHelper<H, T> {
-    pub helper: H
+    pub helper: H,
+    pub marker: PhantomData<T>,
 }
 
 trait Helper<T> {
@@ -63,7 +65,8 @@ fn deref(&self) -> &T {
 }
 
 pub fn check<T: MyEq>(x: T, y: T) -> bool {
-    let d: DerefWithHelper<Option<T>, T> = DerefWithHelper { helper: Some(x) };
+    let d: DerefWithHelper<Option<T>, T> = DerefWithHelper { helper: Some(x),
+                                                             marker: PhantomData };
     d.eq(&y)
 }
 
index d35b7331d4dbfa757b68f2d072decf3dc1e0991f..40ef7f3531cb5caf17247568f52fbc1ccd8a1de0 100644 (file)
@@ -11,6 +11,8 @@
 // Test that we are able to have an impl that defines an associated type
 // before the actual trait.
 
+use std::marker::MarkerTrait;
+
 impl X for f64 { type Y = int; }
-trait X {type Y; }
+trait X : MarkerTrait { type Y; }
 fn main() {}
index ced44250e4d3907a75fd9ce6e60147eae1825508..3c91577362a7d4a27657ff5ebb20a72fa4990478 100644 (file)
@@ -20,7 +20,8 @@ fn parse(input: <Self as Parser>::Input) {
         panic!()
     }
 }
-impl <P> Parser for P  {
+
+impl <P> Parser for P {
     type Input = ();
 }
 
index e3227613159d1a2202ae09784268d3009fd96ddb..2ee8ef0d3ddac5a51267efcc4226697cf639bb28 100644 (file)
 
 // Test that we can resolve nested projection types. Issue #20666.
 
+use std::marker::MarkerTrait;
 use std::slice;
 
-trait Bound {}
+trait Bound : MarkerTrait {}
 
-impl<'a> Bound for &'a int {}
+impl<'a> Bound for &'a i32 {}
 
 trait IntoIterator {
     type Iter: Iterator;
index dd5814f875b0886e5490fed3a64bf567dc80a10e..de96af83f59171e040223af451d43f71d59b8f0d 100644 (file)
@@ -13,7 +13,9 @@
 
 #![allow(dead_code)]
 
-pub trait Integral {
+use std::marker::MarkerTrait;
+
+pub trait Integral : MarkerTrait {
     type Opposite;
 }
 
@@ -27,6 +29,8 @@ impl Integral for u32 {
 
 pub trait FnLike<A> {
     type R;
+
+    fn dummy(&self, a: A) -> Self::R { loop { } }
 }
 
 fn foo<T>()
index 1d264655bc479b03d0b70308627e54275c7e389c..8617750ca538ea02472b33bd0e77781960fba9df 100644 (file)
 // Test that we normalize associated types that appear in bounds; if
 // we didn't, the call to `self.split2()` fails to type check.
 
-struct Splits<'a, T, P>;
-struct SplitsN<I>;
+use std::marker::PhantomData;
+
+struct Splits<'a, T:'a, P>(PhantomData<(&'a T, P)>);
+struct SplitsN<I>(PhantomData<I>);
 
 trait SliceExt2 {
     type Item;
 
     fn split2<'a, P>(&'a self, pred: P) -> Splits<'a, Self::Item, P>
         where P: FnMut(&Self::Item) -> bool;
-    fn splitn2<'a, P>(&'a self, n: uint, pred: P) -> SplitsN<Splits<'a, Self::Item, P>>
+    fn splitn2<'a, P>(&'a self, n: u32, pred: P) -> SplitsN<Splits<'a, Self::Item, P>>
         where P: FnMut(&Self::Item) -> bool;
 }
 
@@ -30,7 +32,7 @@ fn split2<P>(&self, pred: P) -> Splits<T, P> where P: FnMut(&T) -> bool {
         loop {}
     }
 
-    fn splitn2<P>(&self, n: uint, pred: P) -> SplitsN<Splits<T, P>> where P: FnMut(&T) -> bool {
+    fn splitn2<P>(&self, n: u32, pred: P) -> SplitsN<Splits<T, P>> where P: FnMut(&T) -> bool {
         SliceExt2::split2(self, pred);
         loop {}
     }
index 742bab0578e9c2a9e3d25b47480583a4ed961327..94cfcb83653812347657560b6d6654cf16b65116 100644 (file)
 // Test that we normalize associated types that appear in bounds; if
 // we didn't, the call to `self.split2()` fails to type check.
 
-struct Splits<'a, T, P>;
-struct SplitsN<I>;
+use std::marker::PhantomData;
+
+struct Splits<'a, T, P>(PhantomData<(&'a(),T,P)>);
+struct SplitsN<I>(PhantomData<I>);
 
 trait SliceExt2 {
     type Item;
 
     fn split2<'a, P>(&'a self, pred: P) -> Splits<'a, Self::Item, P>
         where P: FnMut(&Self::Item) -> bool;
-    fn splitn2<'a, P>(&'a self, n: uint, pred: P) -> SplitsN<Splits<'a, Self::Item, P>>
+    fn splitn2<'a, P>(&'a self, n: usize, pred: P) -> SplitsN<Splits<'a, Self::Item, P>>
         where P: FnMut(&Self::Item) -> bool;
 }
 
@@ -30,7 +32,7 @@ fn split2<P>(&self, pred: P) -> Splits<T, P> where P: FnMut(&T) -> bool {
         loop {}
     }
 
-    fn splitn2<P>(&self, n: uint, pred: P) -> SplitsN<Splits<T, P>> where P: FnMut(&T) -> bool {
+    fn splitn2<P>(&self, n: usize, pred: P) -> SplitsN<Splits<T, P>> where P: FnMut(&T) -> bool {
         self.split2(pred);
         loop {}
     }
index 5aafe93067c138a058072ee94f3947e8c793826c..2288e19aae0bceaaa59131547736cc9cc3653fc9 100644 (file)
 
 
 pub trait OffsetState: Sized {}
-pub trait Offset { type State: OffsetState; }
+pub trait Offset {
+    type State: OffsetState;
+    fn dummy(&self) { }
+}
 
 #[derive(Copy)] pub struct X;
 impl Offset for X { type State = Y; }
index 0a1a8589dec82b55e56357d3bbf15fd0e01de2e6..c65d2db9b0cf0f3125849028aae506a4680827af 100644 (file)
@@ -13,6 +13,8 @@
 trait Int
 {
     type T;
+
+    fn dummy(&self) { }
 }
 
 trait NonZero
index 44dd49b72976edc3aafd4b3d859844ef903f32ee..a9c34a605ce163a5f2cfb842929ad6a3a7ce249d 100644 (file)
@@ -18,6 +18,8 @@
 
 pub trait Subscriber {
     type Input;
+
+    fn dummy(&self) { }
 }
 
 pub trait Publisher<'a> {
index e6fec675b03631a9f809487b2a0ca1fe62a70c8c..4d2358fae27b183f3440d83020b21563e4ee9139 100644 (file)
@@ -14,6 +14,8 @@
 trait A
 {
     type TA;
+
+    fn dummy(&self) { }
 }
 
 trait B<TB>
index 10a459f3c366268ba6dad0a4be210524b93c5495..3f3f4fbd1d628f46489096157ad484eb17cc8642 100644 (file)
@@ -13,6 +13,8 @@
 trait Int
 {
     type T;
+
+    fn dummy(&self) { }
 }
 
 trait NonZero
index 022c8f4cd013079fa62d997a86a65a7e3f0bf7de..67fe11d8feddec9cb3bd23833826746d2ce2b96b 100644 (file)
@@ -12,6 +12,8 @@
 
 pub trait Foo {
     type Bar;
+
+    fn dummy(&self) { }
 }
 
 impl Foo for int {
index e7a8061a3467aa4f6d8479fa2788829fccce42d4..a4b0b1a6e03af4281e88164f7b91e238250438e3 100644 (file)
@@ -15,6 +15,8 @@ trait Get<T> {
 trait Trait<'a> {
     type T: 'static;
     type U: Get<&'a int>;
+
+    fn dummy(&'a self) { }
 }
 
 fn main() {}
index 1ded34ff3ffe3bb3d588145ddef48a971bece42c..8667f6c8430aba03c706a9ae8d61bf273e920a5e 100644 (file)
@@ -13,6 +13,8 @@
 
 pub trait UnifyKey {
     type Value;
+
+    fn dummy(&self) { }
 }
 
 pub struct Node<K:UnifyKey> {
index 3669dec4fbdd469c2dc6e472547576a4f14cea47..9503f78a71b908ed469cfc109a4a11f89f9151b6 100644 (file)
@@ -13,6 +13,8 @@
 
 pub trait UnifyKey {
     type Value;
+
+    fn dummy(&self) { }
 }
 
 pub struct Node<K:UnifyKey>(K, K::Value);
index ea1df6658fd05b40cb6850b24d34a06dc3890608..b1878fa3558d639d1cf7ae1b6eead362e67ed4d2 100644 (file)
@@ -31,8 +31,9 @@ pub fn bar<T: Foo>(a: T, x: T::A) -> T::A {
 // Using a type via an impl.
 trait C {
     fn f();
+    fn g(&self) { }
 }
-struct B<X>;
+struct B<X>(X);
 impl<T: Foo> C for B<T> {
     fn f() {
         let x: T::A = panic!();
index b39f03a93c9fee75c56c9948dd5510d3ed2288fe..be0c88f557cc7e87bd01c3cc4efbbc9b1e4262d1 100644 (file)
 // to the same lifetime on a trait succeeds. See issue #10766.
 
 #![allow(dead_code)]
+
+use std::marker;
+
 fn main() {
-    trait T {}
+    trait T : marker::MarkerTrait {}
 
     fn f<'a, V: T>(v: &'a V) -> &'a T {
         v as &'a T
index ea711d78dd28e0bb890693b42e0b3d696739924a..143ebfdabfacefd6ce8cd1fdc05c430860e7f5a2 100644 (file)
@@ -9,10 +9,10 @@
 // except according to those terms.
 
 pub trait Foo<T> {
-    fn func1<U>(&self, t: U);
+    fn func1<U>(&self, t: U, w: T);
 
-    fn func2<U>(&self, t: U) {
-        self.func1(t);
+    fn func2<U>(&self, t: U, w: T) {
+        self.func1(t, w);
     }
 }
 
index c115415bb9b7b1739d1d12b1bc4b493586a8d1f0..7eaed910124d91ea2b31a1134f9ceb481e1d1994 100644 (file)
@@ -16,6 +16,7 @@
 extern crate trait_superkinds_in_metadata;
 use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare};
 use trait_superkinds_in_metadata::{RequiresCopy};
+use std::marker;
 
 #[derive(Copy)]
 struct X<T>(T);
index 7e1b28219373bf571d00b29f3b23fb12923072df..964c28dc94517a1d5da90bee404dcf02b0e4e236 100644 (file)
 // super-builtin-kind of a trait, if the type parameter is never used,
 // the type can implement the trait anyway.
 
+use std::marker;
+
 trait Foo : Send { }
 
-struct X<T>(());
+struct X<T> { marker: marker::PhantomData<T> }
 
-impl <T> Foo for X<T> { }
+impl<T:Send> Foo for X<T> { }
 
 pub fn main() { }
index 9d4e73da81304fee635ac2775ec4469995e78fc2..15e98519fbcd62c834ae4ff2d978c1b7d9fed39c 100644 (file)
@@ -8,10 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::marker::PhantomData;
+
 struct cat<U> {
     meows : uint,
-
     how_hungry : int,
+    m: PhantomData<U>
 }
 
 impl<U> cat<U> {
@@ -22,7 +24,8 @@ pub fn meow_count(&mut self) -> uint { self.meows }
 fn cat<U>(in_x : uint, in_y : int) -> cat<U> {
     cat {
         meows: in_x,
-        how_hungry: in_y
+        how_hungry: in_y,
+        m: PhantomData
     }
 }
 
index dbad546ce1ae3fd1a427b91afa99d06deecaed6f..30ed0b8e4024581b9f2c360208b4fb581bcd9cd2 100644 (file)
@@ -11,7 +11,7 @@
 // Test coercions involving DST and/or raw pointers
 
 struct S;
-trait T {}
+trait T { fn dummy(&self) { } }
 impl T for S {}
 
 pub fn main() {
index 797c26556aaa1aa3de97fa7521ad350764e1d73f..023376ce4736ee6833e205314e4017e885cd023e 100644 (file)
@@ -16,7 +16,7 @@
 use std::rc::Rc;
 use std::sync::Arc;
 
-trait Trait {}
+trait Trait { fn dummy(&self) { } }
 
 fn main() {
     // Functions
index 066a5f9580ac42756f3c476b9dc9621df6321d61..382c5c58e92ee70adfde48df8f9c2c248706f94b 100644 (file)
 struct LM { resize_at: uint, size: uint }
 
 enum HashMap<K,V> {
-    HashMap_(LM)
+    HashMap_(LM, Vec<(K,V)>)
 }
 
-impl<K,V> Copy for HashMap<K,V> {}
-
 fn linear_map<K,V>() -> HashMap<K,V> {
     HashMap::HashMap_(LM{
         resize_at: 32,
-        size: 0})
+        size: 0}, Vec::new())
 }
 
 impl<K,V> HashMap<K,V> {
     pub fn len(&mut self) -> uint {
         match *self {
-            HashMap::HashMap_(l) => l.size
+            HashMap::HashMap_(ref l, _) => l.size
         }
     }
 }
diff --git a/src/test/run-pass/export-non-interference.rs b/src/test/run-pass/export-non-interference.rs
deleted file mode 100644 (file)
index 94652e3..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-enum list_cell<T> { cons(Box<list_cell<T>>), nil }
-
-pub fn main() { }
index ed8c6e73255bb49dba6d56d7076a1798b1d5aceb..bf02b82d1a0754d5fbc8678965a4652417296aea 100644 (file)
 
 extern crate default_type_params_xc;
 
-struct Vec<T, A = default_type_params_xc::Heap>;
+struct Vec<T, A = default_type_params_xc::Heap>(Option<(T,A)>);
 
 struct Foo;
 
 fn main() {
-    let _a = Vec::<int>;
-    let _b = Vec::<int, default_type_params_xc::FakeHeap>;
-    let _c = default_type_params_xc::FakeVec::<int>;
-    let _d = default_type_params_xc::FakeVec::<int, Foo>;
+    let _a = Vec::<int>(None);
+    let _b = Vec::<int, default_type_params_xc::FakeHeap>(None);
+    let _c = default_type_params_xc::FakeVec::<int> { f: None };
+    let _d = default_type_params_xc::FakeVec::<int, Foo> { f: None };
 }
index 9c9f95f61e9be666c88d02f8bb38a03aa73ef416..7b16bb867e79c30004a1ac777e9a0c8fc2efe591 100644 (file)
@@ -18,7 +18,7 @@
 
 #![allow(dead_code)]
 
-use std::marker;
+use std::marker::PhantomData;
 
 #[derive(Copy)]
 struct Foo<T> { x: T }
@@ -26,7 +26,7 @@ struct Foo<T> { x: T }
 type Ty<'tcx> = &'tcx TyS<'tcx>;
 
 enum TyS<'tcx> {
-    Boop(marker::InvariantLifetime<'tcx>)
+    Boop(PhantomData<*mut &'tcx ()>)
 }
 
 #[derive(Copy)]
index f9b430c1553dd7b7b4ddfbcf95392bfef70e39ff..e4026a8fd0118a7fd5ea44920cabf0072ddb4548 100644 (file)
@@ -13,9 +13,9 @@
 extern crate inner_static;
 
 pub fn main() {
-    let a = inner_static::A::<()>;
-    let b = inner_static::B::<()>;
-    let c = inner_static::test::A::<()>;
+    let a = inner_static::A::<()> { v: () };
+    let b = inner_static::B::<()> { v: () };
+    let c = inner_static::test::A::<()> { v: () };
     assert_eq!(a.bar(), 2);
     assert_eq!(b.bar(), 4);
     assert_eq!(c.bar(), 6);
index b714d87f4ef20ded4df267149e55460e946622bc..da73c4b27ac4420e8b2145fc0b0a49c0e0f108c4 100644 (file)
@@ -14,7 +14,9 @@ pub trait Bar {
     fn bar(&self);
 }
 
-pub trait Baz {}
+pub trait Baz {
+    fn baz(&self) { }
+}
 
 impl<T: Baz> Bar for T {
     fn bar(&self) {}
index de2b4c51e52a96608cfdc1592a13b1b0d5075eac..174a69e1135cdf7a766ada2f71a70984dd537e7d 100644 (file)
@@ -29,7 +29,7 @@ fn drop(&mut self) {
     }
 }
 
-trait MyTrait { }
+trait MyTrait { fn dummy(&self) { } }
 impl MyTrait for Box<DroppableStruct> {}
 impl MyTrait for Box<DroppableEnum> {}
 
index 324a1701b2febdb4f4bb38d2fa360f06a22f5403..7fab6662ee01c3d3ee02d3bca9b5e9cf55228654 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 pub mod two_tuple {
-    pub trait T {}
+    pub trait T { fn dummy(&self) { } }
     pub struct P<'a>(&'a (T + 'a), &'a (T + 'a));
     pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> {
         P(car, cdr)
@@ -17,7 +17,7 @@ pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> {
 }
 
 pub mod two_fields {
-    pub trait T {}
+    pub trait T { fn dummy(&self) { } }
     pub struct P<'a> { car: &'a (T + 'a), cdr: &'a (T + 'a) }
     pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> {
         P{ car: car, cdr: cdr }
index d7c6c1b1bb2c2b65758865026a740e177059caee..1325b51a54ff2b6a4380f38bb7d64f8d9420846f 100644 (file)
@@ -12,7 +12,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-trait Foo {}
+trait Foo { fn dummy(&self) { } }
 impl Foo for int {}
 fn foo(_: [&Foo; 2]) {}
 fn foos(_: &[&Foo]) {}
index a511149b05e2ace11da32cc009b34a74a4009c1d..26634fabf5a1542f51726873c768f0689c67057b 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Common {}
+trait Common { fn dummy(&self) { } }
 
 impl<'t, T> Common for (T, &'t T) {}
 
index fa25d25df054e169d3a30bf79012bf08109b1d86..3c69377b375c6597cd865aa23f5af8cdb3ef1125 100644 (file)
@@ -12,7 +12,7 @@
 // We weren't updating the auto adjustments with all the resolved
 // type information after type check.
 
-trait A {}
+trait A { fn dummy(&self) { } }
 
 struct B<'a, T:'a> {
     f: &'a T
index 6fa450586947854cd806104820ab99d754273564..7cccac4483d49da1edfed2dd0c397493dc45c16d 100644 (file)
 
 // this code used to cause an ICE
 
-trait X<T> {}
+use std::marker;
+
+trait X<T> {
+    fn dummy(&self) -> T { panic!() }
+}
 
 struct S<T> {f: Box<X<T>+'static>,
              g: Box<X<T>+'static>}
 
 struct F;
-impl X<int> for F {}
+impl X<int> for F {
+}
 
 fn main() {
   S {f: box F, g: box F};
index 7fab36bd64ec7b2c6c40ab36d6ff174f267cb468..64807dc44e061002632daecc7ade4bcb8a94eb7c 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Foo {
+use std::marker::MarkerTrait;
+
+trait Foo : MarkerTrait {
     fn quux(u8) {}
 }
 
index 7e533c2cf86c116cdf8d1b01722c2335a21afe43..4f3db1352bbd234d66b6ab0380cc91fe50aaf991 100644 (file)
@@ -19,7 +19,7 @@
 #[derive(Clone)]
 struct B1;
 
-trait A {}
+trait A : std::marker::MarkerTrait {}
 impl A for B1 {}
 
 fn main() {
index d9763baa82657e10f0ff8030428ba062ef663d28..71d88ee6215103a991f81a0a2ea904f45ad3cf16 100644 (file)
 fn main() {
     send::<Box<Foo>>(box Output(0));
     Test::<Box<Foo>>::foo(box Output(0));
-    Test::<Box<Foo>>.send(box Output(0));
+    Test::<Box<Foo>>::new().send(box Output(0));
 }
 
 fn send<T>(_: T) {}
 
-struct Test<T>;
+struct Test<T> { marker: std::marker::PhantomData<T> }
 impl<T> Test<T> {
+    fn new() -> Test<T> { Test { marker: ::std::marker::PhantomData } }
     fn foo(_: T) {}
     fn send(&self, _: T) {}
 }
 
-trait Foo {}
+trait Foo { fn dummy(&self) { }}
 struct Output(int);
 impl Foo for Output {}
index 814a743648d3f6b0534f5af80551a326816ae6b3..6335f79be6c7aae7b547f67e33baa240f352fce9 100644 (file)
@@ -10,7 +10,7 @@
 
 #![feature(unboxed_closures)]
 
-trait Foo {}
+trait Foo { fn dummy(&self) { }}
 
 struct Bar;
 
index 33281d7d78ffb178b8bebb99ecf60ccab0eaaf24..53d0f7dae05773bf0c3f630d61114779c89d3c52 100644 (file)
@@ -12,8 +12,8 @@
 
 use std::ops::Fn;
 
-trait Response {}
-trait Request {}
+trait Response { fn dummy(&self) { } }
+trait Request { fn dummy(&self) { } }
 trait Ingot<R, S> {
     fn enter(&mut self, _: &mut R, _: &mut S, a: &mut Alloy) -> Status;
 }
@@ -21,7 +21,7 @@ trait Ingot<R, S> {
 #[allow(dead_code)]
 struct HelloWorld;
 
-struct SendFile<'a>;
+struct SendFile;
 struct Alloy;
 enum Status {
     Continue
@@ -33,7 +33,7 @@ fn find<T>(&self) -> Option<T> {
     }
 }
 
-impl<'a, 'b> Fn<(&'b mut (Response+'b),)> for SendFile<'a> {
+impl<'b> Fn<(&'b mut (Response+'b),)> for SendFile {
     type Output = ();
 
     extern "rust-call" fn call(&self, (_res,): (&'b mut (Response+'b),)) {}
index c75c672546125bbbbef280a344252e4cb2d45b7f..6a4f78442d149943ded6817b5663f3580dbf339c 100644 (file)
 
 static mut DROP_RAN: bool = false;
 
-trait Bar<'b> {
+trait Bar {
     fn do_something(&mut self);
 }
 
-struct BarImpl<'b>;
+struct BarImpl;
 
-impl<'b> Bar<'b> for BarImpl<'b> {
+impl Bar for BarImpl {
     fn do_something(&mut self) {}
 }
 
 
-struct Foo<B>;
+struct Foo<B>(B);
 
 #[unsafe_destructor]
-impl<'b, B: Bar<'b>> Drop for Foo<B> {
+impl<B: Bar> Drop for Foo<B> {
     fn drop(&mut self) {
         unsafe {
             DROP_RAN = true;
@@ -37,7 +37,7 @@ fn drop(&mut self) {
 
 fn main() {
     {
-       let _x: Foo<BarImpl> = Foo;
+       let _x: Foo<BarImpl> = Foo(BarImpl);
     }
     unsafe {
         assert_eq!(DROP_RAN, true);
index e01de3a3262edefbe1f725de31b0c2839ee95f18..1ba7b142e5e15c957f35d44fd3de35ebc9f36f70 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait MatrixRow {}
+trait MatrixRow { fn dummy(&self) { }}
 
 struct Mat;
 
index b118c9573cdcf751c9949b6e4ab0c603fad9d374..4e57c55c5f755fd994b1b416f79dd3c6263a8016 100644 (file)
@@ -13,5 +13,5 @@
 extern crate "issue-16643" as i;
 
 pub fn main() {
-    i::TreeBuilder::<uint>.process_token();
+    i::TreeBuilder { h: 3u }.process_token();
 }
index 34bcfeb10dec37bbf905188faecbe36f9d03b9d4..196c148f19331d4ed5d82f33b0dc0da565583936 100644 (file)
 
 extern crate "issue-17662" as i;
 
-struct Bar<'a>;
+use std::marker;
+
+struct Bar<'a> { m: marker::PhantomData<&'a ()> }
 
 impl<'a> i::Foo<'a, uint> for Bar<'a> {
     fn foo(&self) -> uint { 5u }
 }
 
 pub fn main() {
-    assert_eq!(i::foo(&Bar), 5);
+    assert_eq!(i::foo(&Bar { m: marker::PhantomData }), 5);
 }
index b4bd55da597578a8b2ca860b3eba0137406b7489..de9611f259227caf28b801016b3fec51c246774c 100644 (file)
@@ -10,8 +10,9 @@
 
 trait Person {
     type string;
+    fn dummy(&self) { }
 }
 
-struct Someone<P: Person>;
+struct Someone<P: Person>(std::marker::PhantomData<P>);
 
 fn main() {}
index 1e9550acef4cb52483ac1894494c060c0118c71f..2f1b0342b8e04ad599d56f9ee164aa53b569a6f3 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Aaa {}
+trait Aaa { fn dummy(&self) { } }
 
 impl<'a> Aaa for &'a mut (Aaa + 'a) {}
 
index f8fbd680dcb9ecfddc59a9668fb9a5be4a065d8d..a976eccf89ec4c3166d9e366d66f1c4cc6635499 100644 (file)
 
 #![feature(unboxed_closures)]
 
+use std::marker::PhantomData;
+
 fn main() {
-    struct Symbol<'a, F: Fn(Vec<&'a str>) -> &'a str> { function: F }
+    struct Symbol<'a, F: Fn(Vec<&'a str>) -> &'a str> { function: F, marker: PhantomData<&'a ()> }
     let f = |x: Vec<&str>| -> &str "foobar";
-    let sym = Symbol { function: f };
+    let sym = Symbol { function: f, marker: PhantomData };
     (sym.function)(vec![]);
 }
index 3ce347d67e3d91f173ffbe55c69a5403dbac12f5..58a0872a5719b1ee2ef54d5ab7a338d3bf35ff95 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct Foo<T> where T: Copy;
+// Test that we can parse where clauses on various forms of tuple
+// structs.
+
 struct Bar<T>(T) where T: Copy;
 struct Bleh<T, U>(T, U) where T: Copy, U: Sized;
 struct Baz<T> where T: Copy {
index 15cf5870d40add681c7557ff6d52a0115960b9c5..67b3239d35197044725b5f79c1011e4b9ef40af5 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct Cursor<'a>;
+struct Cursor<'a>(::std::marker::PhantomData<&'a ()>);
 
 trait CursorNavigator {
     fn init_cursor<'a, 'b:'a>(&'a self, cursor: &mut Cursor<'b>) -> bool;
@@ -23,7 +23,7 @@ fn init_cursor<'a, 'b: 'a>(&'a self, _cursor: &mut Cursor<'b>) -> bool {
 }
 
 fn main() {
-    let mut c = Cursor;
+    let mut c = Cursor(::std::marker::PhantomData);
     let n = SimpleNavigator;
     n.init_cursor(&mut c);
 }
index 11ffb4198dad8c6b838a3ad1f0dcab79eb4ba9d5..16dd84315ed2cdadfcd1a7300b7ef1572aca864b 100644 (file)
@@ -24,7 +24,7 @@ fn bar<K, Q>(k: &K, q: &Q) where K: Borrow<Q>, Q: Foo {
     q.foo(k.borrow())
 }
 
-struct MyTree<K>;
+struct MyTree<K>(K);
 
 impl<K> MyTree<K> {
     // This caused a failure in #18906
index d95f74ef2a2ba8217c4b5ee48e5b5253240444b5..222f67af437ef327ad3232e8a972e05ef3c67d0b 100644 (file)
@@ -13,6 +13,8 @@
 
 trait Foo {
     type A;
+
+    fn dummy(&self) { }
 }
 
 fn bar(x: &Foo) {}
index d6b3a1908b82d6cb78b2619126ac7e56191199ef..cf0f48e025a0e037dd508ee1612c3a0555300f66 100644 (file)
@@ -11,7 +11,7 @@
 trait Trait<Input> {
     type Output;
 
-    fn method() -> bool { false }
+    fn method(&self, i: Input) -> bool { false }
 }
 
 fn main() {}
index 031a63ba474c181ae7b2a81438decc4a1c6a2627..5e6dd567d63288ff4c2621fc30f5efc25d91b897 100644 (file)
 
 #![feature(unboxed_closures)]
 
+use std::marker::PhantomData;
+
 #[derive(Debug)]
-struct LifetimeStruct<'a>;
+struct LifetimeStruct<'a>(PhantomData<&'a ()>);
 
 fn main() {
     takes_hrtb_closure(|lts| println!("{:?}", lts));
 }
 
 fn takes_hrtb_closure<F: for<'a>FnMut(LifetimeStruct<'a>)>(mut f: F) {
-    f(LifetimeStruct);
+    f(LifetimeStruct(PhantomData));
 }
index ff657376ecc1f848e51ee8b79f9ad3deacce6de0..8b5269ab92f03f89848ce94021d39671c56d70e6 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Trait {}
+trait Trait { fn dummy(&self) { } }
 
 #[derive(Debug)]
 struct Foo<T: Trait> {
index 1196162568a916c75ce6f812be1ec751a28d03c3..e603167b26be0a0c41b741d9d482e521fc4a128e 100644 (file)
@@ -9,11 +9,11 @@
 // except according to those terms.
 
 trait T {
-    unsafe extern "Rust" fn foo();
+    unsafe extern "Rust" fn foo(&self);
 }
 
 impl T for () {
-    unsafe extern "Rust" fn foo() {}
+    unsafe extern "Rust" fn foo(&self) {}
 }
 
 fn main() {}
index 91bc645b2d486a4a2bce680b492d399af05e29ab..38a7af3a69597b72b3b48412ccfc2a0e490d5358 100644 (file)
@@ -8,12 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Base {}
+trait Base {
+    fn dummy(&self) { }
+}
 trait AssocA {
     type X: Base;
+    fn dummy(&self) { }
 }
 trait AssocB {
     type Y: Base;
+    fn dummy(&self) { }
 }
 impl<T: AssocA> AssocB for T {
     type Y = <T as AssocA>::X;
index 43116f63641ded4b5e868cce3731a7fc33e0a4a3..7bb0d055b844d9279925252e47810a88588aa10e 100644 (file)
@@ -10,6 +10,7 @@
 
 trait PoolManager {
     type C;
+    fn dummy(&self) { }
 }
 
 struct InnerPool<M> {
index 01a073a6889aedf28a7fee91eaa3e1f09d4ef3a2..4339339d74c88761f865def4492e3abf71e0cc01 100644 (file)
@@ -10,6 +10,7 @@
 
 trait PoolManager {
     type C;
+    fn dummy(&self) { }
 }
 
 struct InnerPool<M: PoolManager> {
index 836e78b5b51439e279a97499b9cf01899096b959..572a0d825282e7c5425690b47ef056f02954ae8b 100644 (file)
@@ -16,7 +16,9 @@
 // whichever arm is run, and subsequently dropped at the end of the
 // statement surrounding the `match`.
 
-trait Boo { }
+trait Boo {
+    fn dummy(&self) { }
+}
 
 impl Boo for [i8; 1] { }
 impl Boo for [i8; 2] { }
index 79034a4a4a6d65590e8980a10fd2c16eda2a03a6..2f9e8feed248234be96d211da10bc540442f03f7 100644 (file)
@@ -16,7 +16,7 @@ struct B { b: u32 }
 struct C;
 struct D;
 
-trait T<A> {}
+trait T<A> { fn dummy(&self, a: A) { } }
 impl<A> T<A> for () {}
 
 impl B {
index 911ee715da2811d3088c29496d1088f62efb6013..97c06ac98265fd6a8bec89b6cf5b93eaead6c849 100644 (file)
@@ -8,7 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait T0 { type O; }
+trait T0 {
+    type O;
+    fn dummy(&self) { }
+}
 
 struct S<A>(A);
 impl<A> T0 for S<A> { type O = A; }
index a17c7b6ade48e4111b3cacd59b40d52e5590595b..d97017635718cfbcda8e502094d2b161c79ad09d 100644 (file)
@@ -8,7 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait T0 { type O; }
+trait T0 {
+    type O;
+    fn dummy(&self) { }
+}
 
 struct S<A>(A);
 impl<A> T0 for S<A> { type O = A; }
index 2fc1d9fd6433c4c15dcdb7be41b8a1b5f33d7ee0..71bb3d39fe1d6c01dd61832864ebea9030ad0bb7 100644 (file)
@@ -12,6 +12,7 @@
 
 trait Iterator {
     type Item;
+    fn dummy(&self) { }
 }
 
 impl<'a, T> Iterator for &'a mut (Iterator<Item=T> + 'a) {
index 5bbc90b260639e0405b2ff91dd73a9ed510e1a40..55b61dd1945566f88f5740d7de4503aaad6c3439 100644 (file)
@@ -8,11 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait A<X> {}
+trait A<X> {
+    fn dummy(&self, arg: X);
+}
 
 trait B {
     type X;
     type Y: A<Self::X>;
+
+    fn dummy(&self);
 }
 
 fn main () { }
index e0b98ab19652a40e302c4c5ef0d470aecffea249..5529d51b408c0782dde9c985ee71c364f211a5f3 100644 (file)
@@ -8,7 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait clam<A> { }
+trait clam<A> {
+    fn get(self) -> A;
+}
+
 struct foo<A> {
     x: A,
 }
index dc873ed08d701c6603359804c971309627bc62e1..b6b3114e2a487c3a07963eb8a6a1e39bfb2b1219 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait clam<A> { }
+trait clam<A> { fn get(self) -> A; }
 trait foo<A> {
    fn bar<B,C:clam<A>>(&self, c: C) -> B;
 }
index 8c597552d75aadb81a502a9e1050c5dab682d7e9..3f273b56efd6cc4ab90cfec83fa4f28d3979e2d1 100644 (file)
@@ -10,7 +10,7 @@
 
 // Testing that the B's are resolved
 
-trait clam<A> { }
+trait clam<A> { fn get(self) -> A; }
 
 struct foo(int);
 
index 2608c89d15567d1a6d83739150c5a250ad2209dd..c005699ce30b4f19911944ed5d64f60730a917f5 100644 (file)
@@ -12,7 +12,7 @@
 // than the traits require.
 
 trait A {
-  fn b<C:Sync,D>(x: C) -> C;
+  fn b<C:Sync,D>(&self, x: C) -> C;
 }
 
 struct E {
@@ -20,7 +20,7 @@ struct E {
 }
 
 impl A for E {
-  fn b<F,G>(_x: F) -> F { panic!() }
+  fn b<F,G>(&self, _x: F) -> F { panic!() }
   //~^ ERROR in method `b`, type parameter 0 has 1 bound, but
 }
 
index 7ca439a1a19dfa5861d5a90334c41df77e42f824..a7b53db6b0553f173988fa4b63e33ada1eac2fca 100644 (file)
@@ -11,7 +11,9 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-trait hax { }
+trait hax {
+    fn dummy(&self) { }
+}
 impl<A> hax for A { }
 
 fn perform_hax<T: 'static>(x: Box<T>) -> Box<hax+'static> {
index 962359537bf2917e492053b9d9dcdf480f8be14a..1594b94879cee099cdb31a22a7eb6bc9f1c2921d 100644 (file)
@@ -11,7 +11,9 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-trait hax { }
+trait hax {
+    fn dummy(&self) { }
+}
 impl<A> hax for A { }
 
 fn perform_hax<T: 'static>(x: Box<T>) -> Box<hax+'static> {
index 2ed662e9f2d6039ad0cbab6383550f43a2c7af20..d660f300ada99f4ac26cb4a86734966443c22d19 100644 (file)
@@ -9,14 +9,14 @@
 // except according to those terms.
 
 pub fn main() {
-    let _id: &Mat2<f64> = &Matrix::identity();
+    let _id: &Mat2<f64> = &Matrix::identity(1.0);
 }
 
-pub trait Index<Index,Result> { }
+pub trait Index<Index,Result> { fn get(&self, Index) -> Result { panic!() } }
 pub trait Dimensional<T>: Index<uint, T> { }
 
-pub struct Mat2<T> { x: () }
-pub struct Vec2<T> { x: () }
+pub struct Mat2<T> { x: T }
+pub struct Vec2<T> { x: T }
 
 impl<T> Dimensional<Vec2<T>> for Mat2<T> { }
 impl<T> Index<uint, Vec2<T>> for Mat2<T> { }
@@ -25,9 +25,9 @@ impl<T> Dimensional<T> for Vec2<T> { }
 impl<T> Index<uint, T> for Vec2<T> { }
 
 pub trait Matrix<T,V>: Dimensional<V> {
-    fn identity() -> Self;
+    fn identity(t:T) -> Self;
 }
 
 impl<T> Matrix<T, Vec2<T>> for Mat2<T> {
-    fn identity() -> Mat2<T> { Mat2{ x: () } }
+    fn identity(t:T) -> Mat2<T> { Mat2{ x: t } }
 }
index bb79cd4d0466744e1066cdae0c72dac22f407ea7..a6f3771bf62b450aeb9c6ab0fbdca55dd98865d3 100644 (file)
@@ -12,6 +12,7 @@
 #![feature(box_syntax)]
 
 pub trait EventLoop {
+    fn dummy(&self) { }
 }
 
 pub struct UvEventLoop {
index fd39bcc6b61216fe4fc69d6acc3de8e73b92d263..59bca87bed0b61a8432cf09be88ff86ebaf2ea17 100644 (file)
@@ -48,7 +48,9 @@ pub fn main() {
 
 
 // minimal
-pub trait MyTrait<T> { }
+pub trait MyTrait<T> {
+    fn dummy(&self, t: T) -> T { panic!() }
+}
 
 pub struct MyContainer<'a, T> {
     foos: Vec<&'a (MyTrait<T>+'a)> ,
index d96862b588f9d58b3610500f0b85af67ad5de60a..1746a6281dc2694a33144dc917a69f8b32327af9 100644 (file)
@@ -17,6 +17,7 @@
 
 trait Graph<Node, Edge> {
     fn f(&self, Edge);
+    fn g(&self, Node);
 
 }
 
@@ -24,6 +25,9 @@ impl<E> Graph<int, E> for HashMap<int, int> {
     fn f(&self, _e: E) {
         panic!();
     }
+    fn g(&self, _e: int) {
+        panic!();
+    }
 }
 
 pub fn main() {
index 1d8fe8bfce82c6a643952d6f182ab7f85190825c..6e608d34bd5781d9a4777f27fb6b37d51d007ca9 100644 (file)
@@ -15,7 +15,9 @@ pub enum Thing {
     A(Box<Foo+'static>)
 }
 
-pub trait Foo {}
+pub trait Foo {
+    fn dummy(&self) { }
+}
 
 pub struct Struct;
 
index 225213db6a4251f47c10281c5557e7d165341d07..77cfc7f0cf607dc2aa15b84089e2c1d9c11b170a 100644 (file)
@@ -10,6 +10,7 @@
 
 trait Foo {
     fn new() -> bool { false }
+    fn dummy(&self) { }
 }
 
 trait Bar {
index b6dfbb1ca42ad2a431f324761c18a5eb22e4d127..736860947f23cb0c149718be36ba0a940a6bfd2b 100644 (file)
 
 pub fn main() {}
 
-trait A {}
+trait A {
+    fn dummy(&self) { }
+}
+
 impl<T: 'static> A for T {}
 
 fn owned2<T: 'static>(a: Box<T>) { a as Box<A>; }
index 86948ebcb91e0e4dbf2de046876376d3508a3f41..3eb593708bee82e3651a74875f4ec1e418bb1e70 100644 (file)
@@ -14,7 +14,9 @@
 // with different mutability in macro in two methods
 
 #![allow(unused_variable)] // unused foobar_immut + foobar_mut
-trait FooBar {}
+trait FooBar {
+    fn dummy(&self) { }
+}
 struct Bar(i32);
 struct Foo { bar: Bar }
 
index 377b9ce262c73ab194cc140535df1fac77218e97..7bc8dbe616ff31315a38f842227f17955ba6fdac 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait A {}
+trait A {
+    fn dummy(&self) { }
+}
 struct B;
 impl A for B {}
 
index 44f07def531bced6272ef9157c3f544e4f6cdb0d..83c9e9bf4505334dd990dc3e6f6c4a81bd00cd05 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait A {}
+trait A {
+    fn dummy(&self) { }
+}
 struct B;
 impl A for B {}
 
index 8fc86eb49e769c061018198516df95ac47da65bd..aa1e65efaa41e49b87a8651caa213af1b2091278 100644 (file)
@@ -13,7 +13,9 @@ pub enum Enum<T> {
         A(T),
     }
 
-    pub trait X {}
+    pub trait X {
+        fn dummy(&self) { }
+    }
     impl X for int {}
 
     pub struct Z<'a>(Enum<&'a (X+'a)>);
@@ -21,7 +23,9 @@ impl X for int {}
 }
 
 mod b {
-    trait X {}
+    trait X {
+        fn dummy(&self) { }
+    }
     impl X for int {}
     struct Y<'a>{
         x:Option<&'a (X+'a)>,
index 2194453aac29aded856ee6917f20de869c1d6aeb..f180ffcd4e823763d6f601abb448b3d3ab640ba0 100644 (file)
@@ -15,7 +15,7 @@
 }
 
 trait A {
-    fn foo() {
+    fn foo(&self) {
         unsafe {
             rust_get_test_int();
         }
index 25ce0d774ebc1caaf5a40987412ce7dc8cead135..cec9753a2fecaed27bcb197162ed4f4fef01cde2 100644 (file)
 
 #![allow(dead_code)]
 
-struct Cursor<'a>;
+use std::marker;
+
+struct Cursor<'a> {
+    m: marker::PhantomData<&'a ()>
+}
 
 trait CursorNavigator {
     fn init_cursor<'a, 'b:'a>(&'a self, cursor: &mut Cursor<'b>) -> bool;
@@ -28,7 +32,7 @@ fn init_cursor<'a, 'b: 'a>(&'a self, _cursor: &mut Cursor<'b>) -> bool {
 }
 
 fn main() {
-    let mut c = Cursor;
+    let mut c = Cursor { m: marker::PhantomData };
     let n = SimpleNavigator;
     n.init_cursor(&mut c);
 }
index 338bd89ab5cb1e55e833fe478a790b04d849b382..15eb2ae2e4b49dbfa97f5258e67d03a9c7b1d448 100644 (file)
 
 // Note: this must be generic for the problem to show up
 trait Foo<A> {
-    fn foo(&self);
+    fn foo(&self, a: A);
 }
 
 impl Foo<u8> for [u8] {
-    fn foo(&self) {}
+    fn foo(&self, a: u8) {}
 }
 
 impl<'a, A, T> Foo<A> for &'a T where T: Foo<A> {
-    fn foo(&self) {
-        Foo::foo(*self)
+    fn foo(&self, a: A) {
+        Foo::foo(*self, a)
     }
 }
 
index eb17aa78bd9a8b75a7872b540fdab1bbc206b0cf..1164ef1a3c98e2406e83e7c0992cd2b0440c383a 100644 (file)
@@ -8,8 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::marker::MarkerTrait;
 
-trait Serializer {
+trait Serializer : MarkerTrait {
 }
 
 trait Serializable {
index be2b309b8217ffa78f8931ceff6925ea25c03b4b..d50f2efe0e7b4cab54f64e42ffb2c990619cfa43 100644 (file)
@@ -11,7 +11,8 @@
 use std::ops::Deref;
 
 struct DerefWithHelper<H, T> {
-    helper: H
+    helper: H,
+    value: T
 }
 
 trait Helper<T> {
@@ -39,6 +40,7 @@ fn foo(&self) -> int {self.x}
 }
 
 pub fn main() {
-    let x: DerefWithHelper<Option<Foo>, Foo> = DerefWithHelper { helper: Some(Foo {x: 5}) };
+    let x: DerefWithHelper<Option<Foo>, Foo> =
+        DerefWithHelper { helper: Some(Foo {x: 5}), value: Foo { x: 2 } };
     assert!(x.foo() == 5);
 }
index 2838909c1be625b16f102c1963932bd5f2257845..2ef9e08134cf7259fcf5dde6a4f99a59ac889bdb 100644 (file)
 
 #![feature(unboxed_closures)]
 
+use std::marker::PhantomData;
 use std::ops::Fn;
 use std::ops::Add;
 
-struct G<A>;
+struct G<A>(PhantomData<A>);
 
 impl<'a, A: Add<i32, Output=i32>> Fn<(A,)> for G<A> {
     type Output = i32;
@@ -27,5 +28,5 @@ extern "rust-call" fn call(&self, (arg,): (A,)) -> i32 {
 
 fn main() {
     // ICE trigger
-    G(1_i32);
+    (G(PhantomData))(1_i32);
 }
index 840e58848a742f59b31af183bcb70508365a05de..061c9168955a49c73db68dc7ba3700ed72b20a3d 100644 (file)
 #![allow(dead_code)]
 
 
-trait A<T> {}
-trait B<T, U> {}
-trait C<'a, U> {}
+trait A<T> { fn get(self) -> T; }
+trait B<T, U> { fn get(self) -> (T,U); }
+trait C<'a, U> { fn get(self) -> &'a U; }
 
 mod foo {
-    pub trait D<'a, T> {}
+    pub trait D<'a, T> { fn get(self) -> &'a T; }
 }
 
 fn foo1<T>(_: &(A<T> + Send)) {}
index f3380352f5fa946c96a52c215461adffebb508eb..e9b8e694d60605c3e445102a97571429b1eaada5 100644 (file)
@@ -19,6 +19,7 @@
 // public type, private value
 pub mod foo1 {
     pub trait Bar {
+        fn dummy(&self) { }
     }
     pub struct Baz;
 
@@ -50,6 +51,7 @@ fn test_glob1() {
 // private type, public value
 pub mod foo2 {
     trait Bar {
+        fn dummy(&self) { }
     }
     pub struct Baz;
 
@@ -81,6 +83,7 @@ fn test_glob2() {
 // public type, public value
 pub mod foo3 {
     pub trait Bar {
+        fn dummy(&self) { }
     }
     pub struct Baz;
 
index 6b629a9035db2538504b947f0534e9b17070e317..80ae371e5091e76638e104697a0ff63799b7a450 100644 (file)
 // Test that the compiler considers the 'static bound declared in the
 // trait. Issue #20890.
 
-trait Foo { type Value: 'static; }
+trait Foo {
+    type Value: 'static;
+    fn dummy(&self) { }
+}
 
 fn require_static<T: 'static>() {}
 
index 0a95a89d57c325a150b759fad8bb1bf3d4519030..a06e0f6da785a1c7a4dc5079bb89b605627e2b84 100644 (file)
@@ -12,7 +12,9 @@
 
 #![feature(issue_5723_bootstrap)]
 
-trait Foo { }
+trait Foo {
+    fn dummy(&self) { }
+}
 
 fn foo<'a, 'b, 'c:'a+'b, 'd>() {
 }
index c5baecf7272fae1311fb9abc3918998897c709ed..996583dc6de93eb49b1b9cfe67d7865f58636b28 100644 (file)
@@ -12,8 +12,9 @@
 
 #![feature(issue_5723_bootstrap)]
 
-
-trait Foo { }
+trait Foo {
+    fn dummy(&self) { }
+}
 
 fn foo<'a>(x: Box<Foo + 'a>) {
 }
index 978383c244780be12dd1e317258f68f37d2c2e5e..bdc0d41c94e823cdaa9777b1589aa5fb278c3f86 100644 (file)
@@ -14,6 +14,8 @@
 // lifetime parameters must be early bound in the type of the
 // associated item.
 
+use std::marker;
+
 pub enum Value<'v> {
     A(&'v str),
     B,
@@ -23,7 +25,9 @@ pub trait Decoder<'v> {
     fn read(&mut self) -> Value<'v>;
 }
 
-pub trait Decodable<'v, D: Decoder<'v>> {
+pub trait Decodable<'v, D: Decoder<'v>>
+    : marker::PhantomFn<(), &'v int>
+{
     fn decode(d: &mut D) -> Self;
 }
 
index 6fcfaf58a023b01cd5390f9db4cc11b52eed7297..3f434a4838d42bb10f720f278e4be48660b5ea11 100644 (file)
@@ -53,11 +53,11 @@ fn field_invoke2<'l, 'm, 'n>(x: &'n Struct2<'l,'m>) -> int {
     x.f.short()
 }
 
-trait MakerTrait<'o> {
+trait MakerTrait {
     fn mk() -> Self;
 }
 
-fn make_val<'p, T:MakerTrait<'p>>() -> T {
+fn make_val<T:MakerTrait>() -> T {
     MakerTrait::mk()
 }
 
@@ -80,7 +80,7 @@ fn short<'b>(&'b self) -> int {
     }
 }
 
-impl<'t> MakerTrait<'t> for Box<Trait<'t>+'static> {
+impl<'t> MakerTrait for Box<Trait<'t>+'static> {
     fn mk() -> Box<Trait<'t>+'static> { box() (4,5) as Box<Trait> }
 }
 
diff --git a/src/test/run-pass/regions-infer-bivariance.rs b/src/test/run-pass/regions-infer-bivariance.rs
deleted file mode 100644 (file)
index a3288e2..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that a type whose lifetime parameters is never used is
-// inferred to be bivariant.
-
-use std::marker;
-
-struct Bivariant<'a>;
-
-fn use1<'short,'long>(c: Bivariant<'short>,
-                      _where:Option<&'short &'long ()>) {
-    let _: Bivariant<'long> = c;
-}
-
-fn use2<'short,'long>(c: Bivariant<'long>,
-                      _where:Option<&'short &'long ()>) {
-    let _: Bivariant<'short> = c;
-}
-
-pub fn main() {}
index d3464f01203ac5f3adb5cb24587be0eb7ff622aa..5964ac65d5f6e977dc24b1bc0c7226ab93ed3146 100644 (file)
@@ -10,7 +10,9 @@
 
 #![feature(unsafe_destructor)]
 
-pub struct Foo<T>;
+use std::marker;
+
+pub struct Foo<T>(marker::PhantomData<T>);
 
 impl<T> Iterator for Foo<T> {
     type Item = T;
index a35ab1bfc0ce6b80445161dbb2d26d66ed0e3ff2..80c478afa644f2b2b1be49301bb3fd75fef35f18 100644 (file)
@@ -12,7 +12,9 @@
 // should not upset the variance inference for actual occurrences of
 // that lifetime in type expressions.
 
-pub trait HasLife<'a> { }
+pub trait HasLife<'a> {
+    fn dummy(&'a self) { } // just to induce a variance on 'a
+}
 
 trait UseLife01 {
     fn refs<'a, H: HasLife<'a>>(&'a self) -> H;
@@ -23,7 +25,11 @@ trait UseLife02 {
 }
 
 
-pub trait HasType<T> { }
+pub trait HasType<T>
+{
+    fn dummy(&self, t: T) -> T { panic!() }
+}
+
 
 trait UseLife03<T> {
     fn refs<'a, H: HasType<&'a T>>(&'a self) -> H;
index 40a4dc52a70b303585832efd3aae666a5414d76b..af2b2de8ab8ba19473b9108dc5601be028ea88e9 100644 (file)
@@ -29,6 +29,7 @@ pub struct Baz<X> {
 
 trait Bar<X> {
     fn bar(x: Self, y: &Self, z: Box<Self>) -> Self;
+    fn dummy(&self, x: X) { }
 }
 
 impl Bar<int> for Box<Baz<int>> {
index 7ed8cb434caf5517baa963c9612f8386e8ae5f62..2217dddbd21f0884a2efa04a48e7a97fb0a8ade6 100644 (file)
@@ -8,11 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
-
-enum opt<T> { none, }
+enum opt<T> { none, some(T) }
 
 pub fn main() {
     let x = opt::none::<int>;
-    match x { opt::none::<int> => { println!("hello world"); } }
+    match x {
+        opt::none::<int> => { println!("hello world"); }
+        opt::some(_) => { }
+    }
 }
index 3344844d49ff786523bf094b4af715906895e40d..340ad2a531a738188d19b7596dd5e99f859c81da 100644 (file)
 
 #![feature(optin_builtin_traits)]
 
-use std::marker::Send;
+use std::marker::{MarkerTrait, Send};
 
 struct TestType;
 
 impl TestType {}
 
-trait TestTrait {}
+trait TestTrait : MarkerTrait {}
 
 impl !Send for TestType {}
 
-struct TestType2<T>;
+struct TestType2<T>(T);
 
 impl<T> TestType2<T> {}
 
index b5ae259bc630ea523f995225d11f45a2bdf1bbf5..76c62a83e758c4cdeea93c688da99ac12992f01f 100644 (file)
@@ -12,7 +12,7 @@
 
 fn f<T,>(_: T,) {}
 
-struct Foo<T,>;
+struct Foo<T,>(T);
 
 struct Bar;
 
@@ -34,7 +34,7 @@ pub fn main() {
     let [_, _, .., _,] = [1, 1, 1, 1,];
     let [_, _, _.., _,] = [1, 1, 1, 1,];
 
-    let x: Foo<int,> = Foo::<int,>;
+    let x: Foo<int,> = Foo::<int,>(1);
 
     Bar::f(0,);
     Bar.g(0,);
index d03496403ad2a629a349cbb94f14f59f4fc801f4..ed25bf8b02e88fd6852338287eab01bc53640638 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-trait Foo {
+trait Foo : ::std::marker::MarkerTrait {
 }
 
 fn b(_x: Box<Foo+Send>) {
index e3234f037547b66235bae0318cd3c9cca449ced4..976120908b27ab376ebbee497f13573a3b07bca0 100644 (file)
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait U {}
-trait T<X: U> {}
+trait U : ::std::marker::MarkerTrait {}
+trait T<X: U> { fn get(self) -> X; }
 
-trait S2<Y: U> {
+trait S2<Y: U> : ::std::marker::MarkerTrait {
     fn m(x: Box<T<Y>+'static>) {}
 }
 
index 49f8999cd45e4229cd76436bfe99cb2c2beea8dd..7135dad7d190c9d96950581753986c946157c04b 100644 (file)
 
 trait I { fn i(&self) -> Self; }
 
-trait A<T:I> {
+trait A<T:I> : ::std::marker::MarkerTrait {
     fn id(x:T) -> T { x.i() }
 }
 
-trait J<T> { fn j(&self) -> Self; }
+trait J<T> { fn j(&self) -> T; }
 
-trait B<T:J<T>> {
+trait B<T:J<T>> : ::std::marker::MarkerTrait {
     fn id(x:T) -> T { x.j() }
 }
 
-trait C {
+trait C : ::std::marker::MarkerTrait {
     fn id<T:J<T>>(x:T) -> T { x.j() }
 }
 
index fdc42e58f8cac32da1fb6a936a1991d65f8c62c8..c9165050b9326ae1696496620cba76dcf44f77b2 100644 (file)
@@ -11,6 +11,7 @@
 
 trait A<T> {
     fn g(&self, x: uint) -> uint { x }
+    fn h(&self, x: T) { }
 }
 
 impl<T> A<T> for int { }
index 16ef315c206d5689193d7bd607aa32bc06ad14ff..bd2bf430a686cd9f74b349e0f78a83f78fb0a5cb 100644 (file)
@@ -16,7 +16,8 @@
 
 static mut COUNT: uint = 1;
 
-trait T {}
+trait T : ::std::marker::MarkerTrait {
+}
 
 impl<'a> T+'a {
     fn foo(&self) {
index 1e6e7227a067cc5fc915a973dd9748f69cd33723..f89eea46090d07884eb8d8795a54fb2a49d2c087 100644 (file)
@@ -14,8 +14,7 @@
 use std::cmp::{PartialEq, PartialOrd};
 use std::num::NumCast;
 
-pub trait TypeExt {}
-
+pub trait TypeExt : ::std::marker::MarkerTrait { }
 
 impl TypeExt for u8 {}
 impl TypeExt for u16 {}
index 3b454aad03e480a7c00ca8ee78a8d2ceba911833..8f3b325a513fe2f739a0d28f9c7ffd433d6de06e 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub trait MyEq { }
+pub trait MyEq : ::std::marker::MarkerTrait { }
 
-pub trait MyNum {
+pub trait MyNum : ::std::marker::MarkerTrait {
     fn from_int(int) -> Self;
 }
 
index 76352c799a0f2728805de9e25302f04d9c0b0e3a..6f89490716f081d123628285840d0404d4c17222 100644 (file)
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
+use std::marker;
+
 pub trait Trait2<A> {
-    fn doit(&self);
+    fn doit(&self) -> A;
 }
 
 pub struct Impl<A1, A2, A3> {
+    m1: marker::PhantomData<(A1,A2,A3)>,
     /*
      * With A2 we get the ICE:
      * task <unnamed> failed at 'index out of bounds: the len is 1 but the index is 1',
@@ -28,13 +31,13 @@ pub struct Impl<A1, A2, A3> {
 
 impl<A1, A2, A3> Impl<A1, A2, A3> {
     pub fn step(&self) {
-        self.t.doit()
+        self.t.doit();
     }
 }
 
 // test for #8601
 
-enum Type<T> { Constant }
+enum Type<T> { Constant(T) }
 
 trait Trait<K,V> {
     fn method(&self,Type<(K,V)>) -> int;
@@ -46,5 +49,5 @@ fn method(&self, _x: Type<(u8,V)>) -> int { 0 }
 
 pub fn main() {
     let a = box() () as Box<Trait<u8, u8>>;
-    assert_eq!(a.method(Type::Constant), 0);
+    assert_eq!(a.method(Type::Constant((1u8, 2u8))), 0);
 }
index a8cea24db0c0c15ef051de3e62be26e6a8c5c601..10439d5c86aa35721e6bb5e8ea4b8fd3a1717d4f 100644 (file)
@@ -10,7 +10,7 @@
 // except according to those terms.
 
 mod base {
-    pub trait HasNew<T> {
+    pub trait HasNew {
         fn new() -> Self;
     }
 
@@ -18,7 +18,7 @@ pub struct Foo {
         dummy: (),
     }
 
-    impl ::base::HasNew<Foo> for Foo {
+    impl ::base::HasNew for Foo {
         fn new() -> Foo {
             println!("Foo");
             Foo { dummy: () }
@@ -29,7 +29,7 @@ pub struct Bar {
         dummy: (),
     }
 
-    impl ::base::HasNew<Bar> for Bar {
+    impl ::base::HasNew for Bar {
         fn new() -> Bar {
             println!("Bar");
             Bar { dummy: () }
@@ -38,6 +38,6 @@ fn new() -> Bar {
 }
 
 pub fn main() {
-    let _f: base::Foo = base::HasNew::<base::Foo>::new();
-    let _b: base::Bar = base::HasNew::<base::Bar>::new();
+    let _f: base::Foo = base::HasNew::new();
+    let _b: base::Bar = base::HasNew::new();
 }
index 1f9b821178c46f43eac85ce007b66afc76a87761..2d1ba7f39b27bbd8115525bf99c077c64d635279 100644 (file)
@@ -10,7 +10,7 @@
 
 #![feature(core,unboxed_closures)]
 
-use std::marker::CovariantType;
+use std::marker::PhantomData;
 
 // Test that we are able to infer a suitable kind for a "recursive"
 // closure.  As far as I can tell, coding up a recursive closure
 
 struct YCombinator<F,A,R> {
     func: F,
-    marker: CovariantType<(A,R)>,
+    marker: PhantomData<(A,R)>,
 }
 
 impl<F,A,R> YCombinator<F,A,R> {
     fn new(f: F) -> YCombinator<F,A,R> {
-        YCombinator { func: f, marker: CovariantType }
+        YCombinator { func: f, marker: PhantomData }
     }
 }
 
index cec523a06712e025f2e4d1988ffa24ad13b44a03..1d4eb0a75232d9b8f61f69cfa11dcfb8f8d119fc 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-pub trait EventLoop { }
+pub trait EventLoop : ::std::marker::MarkerTrait { }
 
 pub struct UvEventLoop {
     uvio: int
index e6dd8d46952eb4b1627ceef0ac3d70bde9fd5d39..ae175d27b0a4ea09b08f9ae0bdbd75e7de00032a 100644 (file)
 
 // Test syntax checks for `?Sized` syntax.
 
-trait T1 {}
-pub trait T2 {}
-trait T3<X: T1> : T2 {}
-trait T4<X: ?Sized> {}
-trait T5<X: ?Sized, Y> {}
-trait T6<Y, X: ?Sized> {}
-trait T7<X: ?Sized, Y: ?Sized> {}
-trait T8<X: ?Sized+T2> {}
-trait T9<X: T2 + ?Sized> {}
-struct S1<X: ?Sized>;
-enum E<X: ?Sized> {}
+use std::marker::{PhantomData, PhantomFn};
+
+trait T1 : PhantomFn<Self> { }
+pub trait T2 : PhantomFn<Self> { }
+trait T3<X: T1> : T2 + PhantomFn<X> { }
+trait T4<X: ?Sized> : PhantomFn<(Self,X)> {}
+trait T5<X: ?Sized, Y> : PhantomFn<(Self,X,Y)> {}
+trait T6<Y, X: ?Sized> : PhantomFn<(Self,X,Y)> {}
+trait T7<X: ?Sized, Y: ?Sized> : PhantomFn<(Self,X,Y)> {}
+trait T8<X: ?Sized+T2> : PhantomFn<(Self,X)> {}
+trait T9<X: T2 + ?Sized> : PhantomFn<(Self,X)> {}
+struct S1<X: ?Sized>(PhantomData<X>);
+enum E<X: ?Sized> { E1(PhantomData<X>) }
 impl <X: ?Sized> T1 for S1<X> {}
 fn f<X: ?Sized>() {}
 type TT<T: ?Sized> = T;
index 285100dd7197cbdce2620c5b14837580ad5147cc..10b2f2fb7092423c2a2e77c772baf71b68abed31 100644 (file)
@@ -15,6 +15,8 @@
 
 // Test sized-ness checking in substitution.
 
+use std::marker;
+
 // Unbounded.
 fn f1<X: ?Sized>(x: &X) {
     f1::<X>(x);
@@ -25,7 +27,7 @@ fn f2<X>(x: &X) {
 }
 
 // Bounded.
-trait T {}
+trait T { fn dummy(&self) { } }
 fn f3<X: T+?Sized>(x: &X) {
     f3::<X>(x);
 }
@@ -66,20 +68,24 @@ fn f7<X: ?Sized+T3>(x: &X) {
 }
 
 trait T4<X> {
-    fn m1(x: &T4<X>);
-    fn m2(x: &T5<X>);
+    fn dummy(&self) { }
+    fn m1(x: &T4<X>, y: X);
+    fn m2(x: &T5<X>, y: X);
 }
 trait T5<X: ?Sized> {
+    fn dummy(&self) { }
     // not an error (for now)
     fn m1(x: &T4<X>);
     fn m2(x: &T5<X>);
 }
 
 trait T6<X: T> {
+    fn dummy(&self) { }
     fn m1(x: &T4<X>);
     fn m2(x: &T5<X>);
 }
 trait T7<X: ?Sized+T> {
+    fn dummy(&self) { }
     // not an error (for now)
     fn m1(x: &T4<X>);
     fn m2(x: &T5<X>);
index 9518671b4799dbb472a339da794d7561575eebfd..46e93b25697bbaa00be5edb94145c3cd24d62e0f 100644 (file)
@@ -10,7 +10,7 @@
 
 #![feature(visible_private_types)]
 
-trait Foo {}
+trait Foo { fn dummy(&self) { } }
 
 pub trait Bar : Foo {}
 
index a1a61127f68e05d9a6831e0812d28b018eb03545..3374f47ed5f80b8908b395b106a5cdc803fc467c 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Bound {}
+trait Bound {
+    fn dummy(&self) { }
+}
 
 trait Trait {
     fn a<T>(&self, T) where T: Bound;
index cade99b83a2fe429bf6b9e31919b408f179f37a5..4a149d4d3df44ed8050e5205dc1fcb90f682bdf8 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait TheTrait { }
+trait TheTrait { fn dummy(&self) { } }
 
 impl TheTrait for &'static int { }
 
index b391df8500bb7e65ce50ea9ae4fc2d176f7b4a65..ecc210ea579dbccb8d61f5c0d550f87e3f1c2ba9 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Foo<T> {}
+trait Foo<T> { fn dummy(&self, arg: T) { } }
 
 trait Bar<A> {
     fn method<B>(&self) where A: Foo<B>;
@@ -19,7 +19,7 @@ trait Bar<A> {
 
 impl Foo<S> for X {}
 
-impl Bar<X> for int {
+impl Bar<X> for i32 {
     fn method<U>(&self) where X: Foo<U> {
     }
 }
index 5d426793c2e36f9ad94c0821c9c2fad126068eee..1fd223b0dd3f6bd8c8d8ffaa83bd6a59ee8d3370 100644 (file)
 // Test that we can quantify lifetimes outside a constraint (i.e., including
 // the self type) in a where clause.
 
+use std::marker::PhantomFn;
+
 static mut COUNT: u32 = 1;
 
-trait Bar<'a> {
+trait Bar<'a>
+    : PhantomFn<&'a ()>
+{
     fn bar(&self);
 }
 
-trait Baz<'a> {
+trait Baz<'a>
+    : PhantomFn<&'a ()>
+{
     fn baz(&self);
 }