about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-04-14 08:23:11 -0700
committerbors <bors@rust-lang.org>2016-04-14 08:23:11 -0700
commit073a09fd63c9b4ec3bb4709986a2517ca4c3cdf1 (patch)
tree23087cf0681e16d3512f3c9d731e0440547e91c0 /src/test
parentfbf8a8ce5e1d69d687b74dcc6c2068204164ed2f (diff)
parent2fd2210b880498829bf1556aee47f3753887ecfa (diff)
downloadrust-073a09fd63c9b4ec3bb4709986a2517ca4c3cdf1.tar.gz
rust-073a09fd63c9b4ec3bb4709986a2517ca4c3cdf1.zip
Auto merge of #32908 - oli-obk:hygienic_derive_encodable, r=alexcrichton
prevent other `encode` methods from breaking `derive(RustcEncodable)`

fixes https://github.com/rust-lang-nursery/rustc-serialize/issues/151
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass-fulldeps/rustc_encodable_hygiene.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/run-pass-fulldeps/rustc_encodable_hygiene.rs b/src/test/run-pass-fulldeps/rustc_encodable_hygiene.rs
new file mode 100644
index 00000000000..655b08225ab
--- /dev/null
+++ b/src/test/run-pass-fulldeps/rustc_encodable_hygiene.rs
@@ -0,0 +1,32 @@
+// Copyright 2016 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.
+
+#![feature(rustc_private)]
+
+#[allow(dead_code)]
+
+extern crate serialize as rustc_serialize;
+
+#[derive(RustcDecodable, RustcEncodable,Debug)]
+struct A {
+    a: String,
+}
+
+trait Trait {
+    fn encode(&self);
+}
+
+impl<T> Trait for T {
+    fn encode(&self) {
+        unimplemented!()
+    }
+}
+
+fn main() {}