diff options
| author | bors <bors@rust-lang.org> | 2015-01-05 14:51:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-01-05 14:51:03 +0000 |
| commit | 03268bbf35d3ff2350d987fe7b60375839abdf2e (patch) | |
| tree | 86ecae7591630a6ccf7a69a47570577a0caea8c6 /src/test | |
| parent | 8e83af6e879535c33fd83d247d16619e39e0b951 (diff) | |
| parent | 0cb7a4062a3c69bb0c54f0c9136889a1006e4f62 (diff) | |
| download | rust-03268bbf35d3ff2350d987fe7b60375839abdf2e.tar.gz rust-03268bbf35d3ff2350d987fe7b60375839abdf2e.zip | |
auto merge of #20514 : alexcrichton/rust/serialize-associated-type, r=aturon
This commit moves the libserialize crate (and will force the hand of the rustc-serialize crate) to not require the `old_orphan_check` feature gate as well as using associated types wherever possible. Concretely, the following changes were made: * The error type of `Encoder` and `Decoder` is now an associated type, meaning that these traits have no type parameters. * The `Encoder` and `Decoder` type parameters on the `Encodable` and `Decodable` traits have moved to the corresponding method of the trait. This movement alleviates the dependency on `old_orphan_check` but implies that implementations can no longer be specialized for the type of encoder/decoder being implemented. Due to the trait definitions changing, this is a: [breaking-change]
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/variance-trait-matching-2.rs | 30 | ||||
| -rw-r--r-- | src/test/run-pass/issue-11881.rs | 10 | ||||
| -rw-r--r-- | src/test/run-pass/issue-15924.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/issue-4016.rs | 2 |
4 files changed, 4 insertions, 40 deletions
diff --git a/src/test/compile-fail/variance-trait-matching-2.rs b/src/test/compile-fail/variance-trait-matching-2.rs deleted file mode 100644 index cae7a4cefad..00000000000 --- a/src/test/compile-fail/variance-trait-matching-2.rs +++ /dev/null @@ -1,30 +0,0 @@ -// 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. - -extern crate serialize; - -use std::fmt; -use serialize::{Encodable, Encoder}; - -pub fn buffer_encode<'a, - T:Encodable<serialize::json::Encoder<'a>,fmt::Error>>( - to_encode_object: &T) - -> String { - let mut m = String::new(); - { - let mut encoder = - serialize::json::Encoder::new(&mut m); - //~^ ERROR `m` does not live long enough - to_encode_object.encode(&mut encoder); - } - m -} - -fn main() {} diff --git a/src/test/run-pass/issue-11881.rs b/src/test/run-pass/issue-11881.rs index 24deb7c2e4b..d0d8a8589a4 100644 --- a/src/test/run-pass/issue-11881.rs +++ b/src/test/run-pass/issue-11881.rs @@ -40,16 +40,10 @@ enum WireProtocol { // ... } -fn encode_json< - T: for<'a> Encodable<json::Encoder<'a>, - fmt::Error>>(val: &T, - wr: &mut SeekableMemWriter) { +fn encode_json<T: Encodable>(val: &T, wr: &mut SeekableMemWriter) { write!(wr, "{}", json::as_json(val)); } -fn encode_rbml<'a, - T: Encodable<writer::Encoder<'a, SeekableMemWriter>, - io::IoError>>(val: &T, - wr: &'a mut SeekableMemWriter) { +fn encode_rbml<T: Encodable>(val: &T, wr: &mut SeekableMemWriter) { let mut encoder = writer::Encoder::new(wr); val.encode(&mut encoder); } diff --git a/src/test/run-pass/issue-15924.rs b/src/test/run-pass/issue-15924.rs index 1ab8deda383..db9f1cc9df7 100644 --- a/src/test/run-pass/issue-15924.rs +++ b/src/test/run-pass/issue-15924.rs @@ -21,7 +21,7 @@ struct Foo<T> { } #[unsafe_destructor] -impl<T: for<'a> Encodable<json::Encoder<'a>, fmt::Error>> Drop for Foo<T> { +impl<T: Encodable> Drop for Foo<T> { fn drop(&mut self) { json::encode(&self.v); } diff --git a/src/test/run-pass/issue-4016.rs b/src/test/run-pass/issue-4016.rs index e5cc8414f06..220332f6354 100644 --- a/src/test/run-pass/issue-4016.rs +++ b/src/test/run-pass/issue-4016.rs @@ -13,7 +13,7 @@ extern crate serialize; use serialize::{json, Decodable}; -trait JD : Decodable<json::Decoder, json::DecoderError> { } +trait JD : Decodable {} fn exec<T: JD>() { let doc = json::from_str("").unwrap(); |
