about summary refs log tree commit diff
path: root/src/test/compile-fail/trait-as-struct-constructor.rs
diff options
context:
space:
mode:
authorwickerwaka <martin.donlon@gmail.com>2014-08-29 21:11:34 -0700
committerwickerwaka <martin.donlon@gmail.com>2014-08-29 21:11:34 -0700
commitd3d14d6a41141c4780b9d0ddcdfa3748036de570 (patch)
tree34f364b9028d72a6e57bbf5da1b7a0fb8186a367 /src/test/compile-fail/trait-as-struct-constructor.rs
parentf5776f81fd69cfe73de2806b31ef04215501fb0c (diff)
downloadrust-d3d14d6a41141c4780b9d0ddcdfa3748036de570.tar.gz
rust-d3d14d6a41141c4780b9d0ddcdfa3748036de570.zip
Added cfail test
Changed error to 'use of trait `{}` as a struct constructor'
Diffstat (limited to 'src/test/compile-fail/trait-as-struct-constructor.rs')
-rw-r--r--src/test/compile-fail/trait-as-struct-constructor.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/compile-fail/trait-as-struct-constructor.rs b/src/test/compile-fail/trait-as-struct-constructor.rs
new file mode 100644
index 00000000000..a1fcab002e1
--- /dev/null
+++ b/src/test/compile-fail/trait-as-struct-constructor.rs
@@ -0,0 +1,17 @@
+// Copyright 2014 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.
+
+trait TraitNotAStruct { }
+
+fn main() {
+    TraitNotAStruct{ value: 0 };
+    //~^ ERROR: use of trait `TraitNotAStruct` as a struct constructor [E0159]
+}
+