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
// except according to those terms.
use std::slice::{Found, NotFound};
use std::slice::BinarySearchResult::{Found, NotFound};
#[test]
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 {
match set.binary_search_elem(&elem) {
slice::Found(_) => false,
slice::NotFound(_) => true,
slice::BinarySearchResult::Found(_) => false,
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
/// usually corresponding to the lexical nesting, though in the case of
/// 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,
"perhaps you forget parentheses? (per RFC 248)");
"perhaps you forgot parentheses? (per RFC 248)");
}
}
Err(ErrorReported)

View File

@ -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)
}

View File

@ -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

View File

@ -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")
/// }
/// }
/// ```
///

View File

@ -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;

View File

@ -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)
}
}

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 { 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
}
}
}

View File

@ -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
}
}

View File

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

View File

@ -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);
}

View File

@ -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())