Skip to content

Commit

Permalink
Test fixes and rebase conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Nov 27, 2014
1 parent 62137b6 commit 60541cd
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/libcoretest/slice.rs
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/borrowck/fragments.rs
Expand Up @@ -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,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/region.rs
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/typeck/astconv.rs
Expand Up @@ -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)
Expand Down
13 changes: 7 additions & 6 deletions src/librustdoc/lib.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {}",
Expand Down Expand Up @@ -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 {
Expand All @@ -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)
}
12 changes: 5 additions & 7 deletions src/libserialize/json.rs
Expand Up @@ -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 {
Expand All @@ -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))
}
}
Expand Down Expand Up @@ -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)]
Expand All @@ -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)
}
}
Expand All @@ -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
Expand Down
11 changes: 6 additions & 5 deletions src/libstd/macros.rs
Expand Up @@ -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")
/// }
/// }
/// ```
///
Expand Down
12 changes: 6 additions & 6 deletions src/libsyntax/ext/quote.rs
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/libtest/lib.rs
Expand Up @@ -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)
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/libunicode/normalize.rs
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/libunicode/tables.rs
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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,
}
}

Expand Down Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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
}
}

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

fn main() { }
7 changes: 6 additions & 1 deletion src/test/run-pass/hrtb-precedence-of-plus-where-clause.rs
Expand Up @@ -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);
}

Expand Down
8 changes: 4 additions & 4 deletions src/test/run-pass/issue-2804.rs
Expand Up @@ -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 {
Expand All @@ -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) => {
Expand All @@ -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());
Expand All @@ -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())
Expand Down

0 comments on commit 60541cd

Please sign in to comment.