1
Fork 0

Test fixes and rebase conflicts

This commit is contained in:
Alex Crichton 2014-11-26 10:21:45 -08:00
parent 62137b6d79
commit 60541cdc1e
14 changed files with 56 additions and 50 deletions

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::slice::{Found, NotFound}; use std::slice::BinarySearchResult::{Found, NotFound};
#[test] #[test]
fn binary_search_not_found() { fn binary_search_not_found() {

View file

@ -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 { fn non_member(elem: MovePathIndex, set: &[MovePathIndex]) -> bool {
match set.binary_search_elem(&elem) { match set.binary_search_elem(&elem) {
slice::Found(_) => false, slice::BinarySearchResult::Found(_) => false,
slice::NotFound(_) => true, slice::BinarySearchResult::NotFound(_) => true,
} }
} }
} }

View file

@ -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 /// - `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 /// usually corresponding to the lexical nesting, though in the case of
/// closures the parent scope is the innermost conditional expression or repeating /// closures the parent scope is the innermost conditional expression or repeating

View file

@ -741,7 +741,7 @@ fn ast_ty_to_trait_ref<'tcx,AC,RS>(this: &AC,
_ => { _ => {
span_note!(this.tcx().sess, ty.span, span_note!(this.tcx().sess, ty.span,
"perhaps you forget parentheses? (per RFC 248)"); "perhaps you forgot parentheses? (per RFC 248)");
} }
} }
Err(ErrorReported) Err(ErrorReported)

View file

@ -35,7 +35,8 @@ use std::io::File;
use std::io; use std::io;
use std::rc::Rc; use std::rc::Rc;
use externalfiles::ExternalHtml; 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 // reexported from `clean` so it can be easily updated with the mod itself
pub use clean::SCHEMA_VERSION; pub use clean::SCHEMA_VERSION;
@ -425,11 +426,11 @@ fn json_input(input: &str) -> Result<Output, String> {
}; };
match json::from_reader(&mut input) { match json::from_reader(&mut input) {
Err(s) => Err(s.to_string()), Err(s) => Err(s.to_string()),
Ok(json::Object(obj)) => { Ok(Json::Object(obj)) => {
let mut obj = obj; let mut obj = obj;
// Make sure the schema is what we expect // Make sure the schema is what we expect
match obj.remove(&"schema".to_string()) { match obj.remove(&"schema".to_string()) {
Some(json::String(version)) => { Some(Json::String(version)) => {
if version.as_slice() != SCHEMA_VERSION { if version.as_slice() != SCHEMA_VERSION {
return Err(format!( return Err(format!(
"sorry, but I only understand version {}", "sorry, but I only understand version {}",
@ -468,7 +469,7 @@ fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> ,
// "plugins": { output of plugins ... } // "plugins": { output of plugins ... }
// } // }
let mut json = std::collections::TreeMap::new(); 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() let plugins_json = res.into_iter()
.filter_map(|opt| { .filter_map(|opt| {
match 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("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)); let mut file = try!(File::create(&dst));
json::Object(json).to_writer(&mut file) Json::Object(json).to_writer(&mut file)
} }

View file

@ -113,8 +113,7 @@ for custom mappings.
```rust ```rust
extern crate serialize; extern crate serialize;
use serialize::json::ToJson; use serialize::json::{mod, ToJson, Json};
use serialize::json;
// A custom data structure // A custom data structure
struct ComplexNum { struct ComplexNum {
@ -125,7 +124,7 @@ struct ComplexNum {
// JSON value representation // JSON value representation
impl ToJson for ComplexNum { impl ToJson for ComplexNum {
fn to_json(&self) -> json::Json { 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 ```rust
extern crate serialize; extern crate serialize;
use std::collections::TreeMap; use std::collections::TreeMap;
use serialize::json::ToJson; use serialize::json::{mod, ToJson, Json};
use serialize::json;
// Only generate `Decodable` trait implementation // Only generate `Decodable` trait implementation
#[deriving(Decodable)] #[deriving(Decodable)]
@ -173,7 +171,7 @@ impl ToJson for TestStruct {
d.insert("data_int".to_string(), self.data_int.to_json()); 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_str".to_string(), self.data_str.to_json());
d.insert("data_vector".to_string(), self.data_vector.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_str: "toto".to_string(),
data_vector: vec![2,3,4,5], 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(); let json_str: String = json_obj.to_string();
// Deserialize like before // Deserialize like before

View file

@ -205,11 +205,12 @@ macro_rules! debug_assert_eq(
/// ///
/// ```rust /// ```rust
/// fn foo(x: Option<int>) { /// fn foo(x: Option<int>) {
/// match x { /// match x {
/// Some(n) if n >= 0 => println!("Some(Non-negative)"), /// Some(n) if n >= 0 => println!("Some(Non-negative)"),
/// Some(n) if n < 0 => println!("Some(Negative)"), /// Some(n) if n < 0 => println!("Some(Negative)"),
/// Some(_) => unreachable!(), // compile error if commented out /// Some(_) => unreachable!(), // compile error if commented out
/// None => println!("None") /// None => println!("None")
/// }
/// } /// }
/// ``` /// ```
/// ///

View file

@ -17,12 +17,12 @@ use parse::token::*;
use parse::token; use parse::token;
use ptr::P; use ptr::P;
//! Quasiquoting works via token trees. /// Quasiquoting works via token trees.
//! ///
//! This is registered as a set of expression syntax extension called quote! /// This is registered as a set of expression syntax extension called quote!
//! that lifts its argument token-tree to an AST representing the /// that lifts its argument token-tree to an AST representing the
//! construction of the same token tree, with token::SubstNt interpreted /// construction of the same token tree, with token::SubstNt interpreted
//! as antiquotes (splices). /// as antiquotes (splices).
pub mod rt { pub mod rt {
use ast; use ast;

View file

@ -1106,9 +1106,9 @@ fn calc_result(desc: &TestDesc, task_succeeded: bool) -> TestResult {
impl ToJson for Metric { impl ToJson for Metric {
fn to_json(&self) -> json::Json { fn to_json(&self) -> json::Json {
let mut map = TreeMap::new(); let mut map = TreeMap::new();
map.insert("value".to_string(), json::F64(self.value)); map.insert("value".to_string(), json::Json::F64(self.value));
map.insert("noise".to_string(), json::F64(self.noise)); map.insert("noise".to_string(), json::Json::F64(self.noise));
json::Object(map) json::Json::Object(map)
} }
} }

View file

@ -25,11 +25,11 @@ fn bsearch_table<T>(c: char, r: &'static [(char, &'static [T])]) -> Option<&'sta
else if val < c { Less } else if val < c { Less }
else { Greater } else { Greater }
}) { }) {
slice::Found(idx) => { slice::BinarySearchResult::Found(idx) => {
let (_, result) = r[idx]; let (_, result) = r[idx];
Some(result) 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 if val < b { Less }
else { Greater } else { Greater }
}) { }) {
slice::Found(idx) => { slice::BinarySearchResult::Found(idx) => {
let (_, result) = candidates[idx]; let (_, result) = candidates[idx];
Some(result) Some(result)
} }
slice::NotFound(_) => None slice::BinarySearchResult::NotFound(_) => None
} }
} }
} }

View file

@ -6249,11 +6249,11 @@ pub mod normalization {
else if hi < c { Less } else if hi < c { Less }
else { Greater } else { Greater }
}) { }) {
slice::Found(idx) => { slice::BinarySearchResult::Found(idx) => {
let (_, _, result) = r[idx]; let (_, _, result) = r[idx];
result result
} }
slice::NotFound(_) => 0 slice::BinarySearchResult::NotFound(_) => 0
} }
} }
@ -6392,8 +6392,8 @@ pub mod conversions {
else if key < c { Less } else if key < c { Less }
else { Greater } else { Greater }
}) { }) {
slice::Found(i) => Some(i), slice::BinarySearchResult::Found(i) => Some(i),
slice::NotFound(_) => None, slice::BinarySearchResult::NotFound(_) => None,
} }
} }
@ -6945,11 +6945,11 @@ pub mod charwidth {
else if hi < c { Less } else if hi < c { Less }
else { Greater } else { Greater }
}) { }) {
slice::Found(idx) => { slice::BinarySearchResult::Found(idx) => {
let (_, _, r_ncjk, r_cjk) = r[idx]; let (_, _, r_ncjk, r_cjk) = r[idx];
if is_cjk { r_cjk } else { r_ncjk } 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 if hi < c { Less }
else { Greater } else { Greater }
}) { }) {
slice::Found(idx) => { slice::BinarySearchResult::Found(idx) => {
let (_, _, cat) = r[idx]; let (_, _, cat) = r[idx];
cat cat
} }
slice::NotFound(_) => GC_Any slice::BinarySearchResult::NotFound(_) => GC_Any
} }
} }

View file

@ -30,6 +30,7 @@ struct Foo<'a> {
d: fn() -> Bar+'a, d: fn() -> Bar+'a,
//~^ ERROR E0171 //~^ ERROR E0171
//~^^ NOTE perhaps you forgot parentheses //~^^ NOTE perhaps you forgot parentheses
//~^^^ WARN deprecated syntax
} }
fn main() { } fn main() { }

View file

@ -13,10 +13,15 @@
// Test that `F : Fn(int) -> int + Send` is interpreted as two // Test that `F : Fn(int) -> int + Send` is interpreted as two
// distinct bounds on `F`. // distinct bounds on `F`.
fn foo<F>(f: F) fn foo1<F>(f: F)
where F : FnOnce(int) -> int + Send where F : FnOnce(int) -> int + Send
{ {
bar(f); bar(f);
}
fn foo2<F>(f: F)
where F : FnOnce(int) -> int + Send
{
baz(f); baz(f);
} }

View file

@ -13,7 +13,7 @@ extern crate collections;
extern crate serialize; extern crate serialize;
use std::collections::HashMap; use std::collections::HashMap;
use serialize::json; use serialize::json::{mod, Json};
use std::option; use std::option;
enum object { enum object {
@ -24,7 +24,7 @@ enum object {
fn lookup(table: json::Object, key: String, default: String) -> String fn lookup(table: json::Object, key: String, default: String) -> String
{ {
match table.find(&key.to_string()) { match table.find(&key.to_string()) {
option::Some(&json::String(ref s)) => { option::Some(&Json::String(ref s)) => {
s.to_string() s.to_string()
} }
option::Some(value) => { 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) fn add_interface(_store: int, managed_ip: String, data: json::Json) -> (String, object)
{ {
match &data { match &data {
&json::Object(ref interface) => { &Json::Object(ref interface) => {
let name = lookup(interface.clone(), let name = lookup(interface.clone(),
"ifDescr".to_string(), "ifDescr".to_string(),
"".to_string()); "".to_string());
@ -59,7 +59,7 @@ fn add_interfaces(store: int, managed_ip: String, device: HashMap<String, json::
-> Vec<(String, object)> { -> Vec<(String, object)> {
match device["interfaces".to_string()] match device["interfaces".to_string()]
{ {
json::Array(ref interfaces) => Json::Array(ref interfaces) =>
{ {
interfaces.iter().map(|interface| { interfaces.iter().map(|interface| {
add_interface(store, managed_ip.clone(), (*interface).clone()) add_interface(store, managed_ip.clone(), (*interface).clone())