diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-11-26 10:21:45 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-11-26 16:50:13 -0800 |
| commit | 60541cdc1ec334b278740fd6d59b9d08929e6d0d (patch) | |
| tree | 807a52a2c2ce80e7b77753367029cd9f5eca8658 | |
| parent | 62137b6d7976635c0c8271f14c5f09fe519d8ba9 (diff) | |
| download | rust-60541cdc1ec334b278740fd6d59b9d08929e6d0d.tar.gz rust-60541cdc1ec334b278740fd6d59b9d08929e6d0d.zip | |
Test fixes and rebase conflicts
| -rw-r--r-- | src/libcoretest/slice.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/borrowck/fragments.rs | 4 | ||||
| -rw-r--r-- | src/librustc/middle/region.rs | 4 | ||||
| -rw-r--r-- | src/librustc/middle/typeck/astconv.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 13 | ||||
| -rw-r--r-- | src/libserialize/json.rs | 12 | ||||
| -rw-r--r-- | src/libstd/macros.rs | 11 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 12 | ||||
| -rw-r--r-- | src/libtest/lib.rs | 6 | ||||
| -rw-r--r-- | src/libunicode/normalize.rs | 8 | ||||
| -rw-r--r-- | src/libunicode/tables.rs | 16 | ||||
| -rw-r--r-- | src/test/compile-fail/hrtb-precedence-of-plus-error-message.rs | 1 | ||||
| -rw-r--r-- | src/test/run-pass/hrtb-precedence-of-plus-where-clause.rs | 7 | ||||
| -rw-r--r-- | src/test/run-pass/issue-2804.rs | 8 |
14 files changed, 56 insertions, 50 deletions
diff --git a/src/libcoretest/slice.rs b/src/libcoretest/slice.rs index 29253c50ed0..987da903211 100644 --- a/src/libcoretest/slice.rs +++ b/src/libcoretest/slice.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::slice::{Found, NotFound}; +use std::slice::BinarySearchResult::{Found, NotFound}; #[test] fn binary_search_not_found() { diff --git a/src/librustc/middle/borrowck/fragments.rs b/src/librustc/middle/borrowck/fragments.rs index 7e766e9138e..9891320f756 100644 --- a/src/librustc/middle/borrowck/fragments.rs +++ b/src/librustc/middle/borrowck/fragments.rs @@ -277,8 +277,8 @@ pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) { fn non_member(elem: MovePathIndex, set: &[MovePathIndex]) -> bool { match set.binary_search_elem(&elem) { - slice::Found(_) => false, - slice::NotFound(_) => true, + slice::BinarySearchResult::Found(_) => false, + slice::BinarySearchResult::NotFound(_) => true, } } } diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 3684f64ebe5..41b06923e82 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -72,8 +72,8 @@ impl CodeExtent { } } -The region maps encode information about region relationships. - +/// The region maps encode information about region relationships. +/// /// - `scope_map` maps from a scope id to the enclosing scope id; this is /// usually corresponding to the lexical nesting, though in the case of /// closures the parent scope is the innermost conditional expression or repeating diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 8f1e2d115d3..0a5ae10dd01 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -741,7 +741,7 @@ fn ast_ty_to_trait_ref<'tcx,AC,RS>(this: &AC, _ => { span_note!(this.tcx().sess, ty.span, - "perhaps you forget parentheses? (per RFC 248)"); + "perhaps you forgot parentheses? (per RFC 248)"); } } Err(ErrorReported) diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 36e74d43e64..5b99151c532 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -35,7 +35,8 @@ use std::io::File; use std::io; use std::rc::Rc; use externalfiles::ExternalHtml; -use serialize::{json, Decodable, Encodable}; +use serialize::{Decodable, Encodable}; +use serialize::json::{mod, Json}; // reexported from `clean` so it can be easily updated with the mod itself pub use clean::SCHEMA_VERSION; @@ -425,11 +426,11 @@ fn json_input(input: &str) -> Result<Output, String> { }; match json::from_reader(&mut input) { Err(s) => Err(s.to_string()), - Ok(json::Object(obj)) => { + Ok(Json::Object(obj)) => { let mut obj = obj; // Make sure the schema is what we expect match obj.remove(&"schema".to_string()) { - Some(json::String(version)) => { + Some(Json::String(version)) => { if version.as_slice() != SCHEMA_VERSION { return Err(format!( "sorry, but I only understand version {}", @@ -468,7 +469,7 @@ fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> , // "plugins": { output of plugins ... } // } let mut json = std::collections::TreeMap::new(); - json.insert("schema".to_string(), json::String(SCHEMA_VERSION.to_string())); + json.insert("schema".to_string(), Json::String(SCHEMA_VERSION.to_string())); let plugins_json = res.into_iter() .filter_map(|opt| { match opt { @@ -495,8 +496,8 @@ fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> , }; json.insert("crate".to_string(), crate_json); - json.insert("plugins".to_string(), json::Object(plugins_json)); + json.insert("plugins".to_string(), Json::Object(plugins_json)); let mut file = try!(File::create(&dst)); - json::Object(json).to_writer(&mut file) + Json::Object(json).to_writer(&mut file) } diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 15c554be5d9..8b252da6715 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -113,8 +113,7 @@ for custom mappings. ```rust extern crate serialize; -use serialize::json::ToJson; -use serialize::json; +use serialize::json::{mod, ToJson, Json}; // A custom data structure struct ComplexNum { @@ -125,7 +124,7 @@ struct ComplexNum { // JSON value representation impl ToJson for ComplexNum { fn to_json(&self) -> json::Json { - json::String(format!("{}+{}i", self.a, self.b)) + Json::String(format!("{}+{}i", self.a, self.b)) } } @@ -154,8 +153,7 @@ fn main() { ```rust extern crate serialize; use std::collections::TreeMap; -use serialize::json::ToJson; -use serialize::json; +use serialize::json::{mod, ToJson, Json}; // Only generate `Decodable` trait implementation #[deriving(Decodable)] @@ -173,7 +171,7 @@ impl ToJson for TestStruct { d.insert("data_int".to_string(), self.data_int.to_json()); d.insert("data_str".to_string(), self.data_str.to_json()); d.insert("data_vector".to_string(), self.data_vector.to_json()); - json::Object(d) + Json::Object(d) } } @@ -184,7 +182,7 @@ fn main() { data_str: "toto".to_string(), data_vector: vec![2,3,4,5], }; - let json_obj: json::Json = input_data.to_json(); + let json_obj: Json = input_data.to_json(); let json_str: String = json_obj.to_string(); // Deserialize like before diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index dbb45f2e556..12ca80bfaab 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -205,11 +205,12 @@ macro_rules! debug_assert_eq( /// /// ```rust /// fn foo(x: Option<int>) { -/// match x { -/// Some(n) if n >= 0 => println!("Some(Non-negative)"), -/// Some(n) if n < 0 => println!("Some(Negative)"), -/// Some(_) => unreachable!(), // compile error if commented out -/// None => println!("None") +/// match x { +/// Some(n) if n >= 0 => println!("Some(Non-negative)"), +/// Some(n) if n < 0 => println!("Some(Negative)"), +/// Some(_) => unreachable!(), // compile error if commented out +/// None => println!("None") +/// } /// } /// ``` /// diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index e703ac21f26..3fca110a881 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -17,12 +17,12 @@ use parse::token::*; use parse::token; use ptr::P; -//! Quasiquoting works via token trees. -//! -//! This is registered as a set of expression syntax extension called quote! -//! that lifts its argument token-tree to an AST representing the -//! construction of the same token tree, with token::SubstNt interpreted -//! as antiquotes (splices). +/// Quasiquoting works via token trees. +/// +/// This is registered as a set of expression syntax extension called quote! +/// that lifts its argument token-tree to an AST representing the +/// construction of the same token tree, with token::SubstNt interpreted +/// as antiquotes (splices). pub mod rt { use ast; diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index bed66b99d83..6556ba3864c 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -1106,9 +1106,9 @@ fn calc_result(desc: &TestDesc, task_succeeded: bool) -> TestResult { impl ToJson for Metric { fn to_json(&self) -> json::Json { let mut map = TreeMap::new(); - map.insert("value".to_string(), json::F64(self.value)); - map.insert("noise".to_string(), json::F64(self.noise)); - json::Object(map) + map.insert("value".to_string(), json::Json::F64(self.value)); + map.insert("noise".to_string(), json::Json::F64(self.noise)); + json::Json::Object(map) } } diff --git a/src/libunicode/normalize.rs b/src/libunicode/normalize.rs index ad36215c11b..92b5a69a99f 100644 --- a/src/libunicode/normalize.rs +++ b/src/libunicode/normalize.rs @@ -25,11 +25,11 @@ fn bsearch_table<T>(c: char, r: &'static [(char, &'static [T])]) -> Option<&'sta else if val < c { Less } else { Greater } }) { - slice::Found(idx) => { + slice::BinarySearchResult::Found(idx) => { let (_, result) = r[idx]; Some(result) } - slice::NotFound(_) => None + slice::BinarySearchResult::NotFound(_) => None } } @@ -88,11 +88,11 @@ pub fn compose(a: char, b: char) -> Option<char> { else if val < b { Less } else { Greater } }) { - slice::Found(idx) => { + slice::BinarySearchResult::Found(idx) => { let (_, result) = candidates[idx]; Some(result) } - slice::NotFound(_) => None + slice::BinarySearchResult::NotFound(_) => None } } } diff --git a/src/libunicode/tables.rs b/src/libunicode/tables.rs index dfba686143f..7cece6701dc 100644 --- a/src/libunicode/tables.rs +++ b/src/libunicode/tables.rs @@ -6249,11 +6249,11 @@ pub mod normalization { else if hi < c { Less } else { Greater } }) { - slice::Found(idx) => { + slice::BinarySearchResult::Found(idx) => { let (_, _, result) = r[idx]; result } - slice::NotFound(_) => 0 + slice::BinarySearchResult::NotFound(_) => 0 } } @@ -6392,8 +6392,8 @@ pub mod conversions { else if key < c { Less } else { Greater } }) { - slice::Found(i) => Some(i), - slice::NotFound(_) => None, + slice::BinarySearchResult::Found(i) => Some(i), + slice::BinarySearchResult::NotFound(_) => None, } } @@ -6945,11 +6945,11 @@ pub mod charwidth { else if hi < c { Less } else { Greater } }) { - slice::Found(idx) => { + slice::BinarySearchResult::Found(idx) => { let (_, _, r_ncjk, r_cjk) = r[idx]; if is_cjk { r_cjk } else { r_ncjk } } - slice::NotFound(_) => 1 + slice::BinarySearchResult::NotFound(_) => 1 } } @@ -7160,11 +7160,11 @@ pub mod grapheme { else if hi < c { Less } else { Greater } }) { - slice::Found(idx) => { + slice::BinarySearchResult::Found(idx) => { let (_, _, cat) = r[idx]; cat } - slice::NotFound(_) => GC_Any + slice::BinarySearchResult::NotFound(_) => GC_Any } } diff --git a/src/test/compile-fail/hrtb-precedence-of-plus-error-message.rs b/src/test/compile-fail/hrtb-precedence-of-plus-error-message.rs index a0d81b831f6..ff3512ad8e7 100644 --- a/src/test/compile-fail/hrtb-precedence-of-plus-error-message.rs +++ b/src/test/compile-fail/hrtb-precedence-of-plus-error-message.rs @@ -30,6 +30,7 @@ struct Foo<'a> { d: fn() -> Bar+'a, //~^ ERROR E0171 //~^^ NOTE perhaps you forgot parentheses + //~^^^ WARN deprecated syntax } fn main() { } diff --git a/src/test/run-pass/hrtb-precedence-of-plus-where-clause.rs b/src/test/run-pass/hrtb-precedence-of-plus-where-clause.rs index 86ce49f56cb..88e6de6d3e6 100644 --- a/src/test/run-pass/hrtb-precedence-of-plus-where-clause.rs +++ b/src/test/run-pass/hrtb-precedence-of-plus-where-clause.rs @@ -13,10 +13,15 @@ // Test that `F : Fn(int) -> int + Send` is interpreted as two // distinct bounds on `F`. -fn foo<F>(f: F) +fn foo1<F>(f: F) where F : FnOnce(int) -> int + Send { bar(f); +} + +fn foo2<F>(f: F) + where F : FnOnce(int) -> int + Send +{ baz(f); } diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index ba73b7cee2e..ec19b95ab1a 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -13,7 +13,7 @@ extern crate collections; extern crate serialize; use std::collections::HashMap; -use serialize::json; +use serialize::json::{mod, Json}; use std::option; enum object { @@ -24,7 +24,7 @@ enum object { fn lookup(table: json::Object, key: String, default: String) -> String { match table.find(&key.to_string()) { - option::Some(&json::String(ref s)) => { + option::Some(&Json::String(ref s)) => { s.to_string() } option::Some(value) => { @@ -40,7 +40,7 @@ fn lookup(table: json::Object, key: String, default: String) -> String fn add_interface(_store: int, managed_ip: String, data: json::Json) -> (String, object) { match &data { - &json::Object(ref interface) => { + &Json::Object(ref interface) => { let name = lookup(interface.clone(), "ifDescr".to_string(), "".to_string()); @@ -59,7 +59,7 @@ fn add_interfaces(store: int, managed_ip: String, device: HashMap<String, json:: -> Vec<(String, object)> { match device["interfaces".to_string()] { - json::Array(ref interfaces) => + Json::Array(ref interfaces) => { interfaces.iter().map(|interface| { add_interface(store, managed_ip.clone(), (*interface).clone()) |
