This commit is contained in:
Manish Goregaokar 2014-09-21 00:47:13 +05:30
parent 2a4f9fd8a3
commit 5b866e9e46
8 changed files with 17 additions and 58 deletions

4
Cargo.lock generated
View file

@ -363,6 +363,10 @@ name = "phf_mac"
version = "0.0.0"
source = "git+https://github.com/sfackler/rust-phf#06254fdde7708630a6397c41c6c17ef81a4b66a0"
[[package]]
name = "plugins"
version = "0.0.1"
[[package]]
name = "png"
version = "0.1.0"

View file

@ -12,7 +12,7 @@
* `components/net`: Networking, caching, image decoding.
* `components/msg`: Message structure definitions for inter-task communication.
* `components/*_traits`: Trait definitions to break crate dependencies.
* `components/macros`: Macros used by the rest of Servo.
* `components/plugins`: Various compiler plugins and macros used by the rest of Servo.
* `components/util`: Various utility functions used by other Servo components.
## Supporting libraries

View file

@ -20,8 +20,6 @@ use rustc::plugin::Registry;
mod lints;
mod macros;
#[cfg(test)]
mod tests;
#[plugin_registrar]

View file

@ -1,7 +1,3 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use syntax::{ast, codemap, visit};
use syntax::attr::AttrMetaMethods;
use rustc::lint::{Context, LintPass, LintArray};
@ -95,9 +91,9 @@ impl LintPass for UnrootedPass {
}
}
fn check_fn(&mut self, cx: &Context, kind: &visit::FnKind, decl: &ast::FnDecl,
fn check_fn(&mut self, cx: &Context, kind: visit::FnKind, decl: &ast::FnDecl,
block: &ast::Block, _span: codemap::Span, _id: ast::NodeId) {
match *kind {
match kind {
visit::FkItemFn(i, _, _, _) |
visit::FkMethod(i, _, _) if i.as_str() == "new" || i.as_str() == "new_inherited" => {
return;
@ -144,4 +140,4 @@ impl LintPass for UnrootedPass {
_ => {}
}
}
}
}

View file

@ -1,39 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::collections::hashmap::HashMap;
lazy_init! {
static ref NUMBER: uint = times_two(3);
static ref VEC: [Box<uint>, ..3] = [box 1, box 2, box 3];
static ref OWNED_STRING: String = "hello".to_string();
static ref HASHMAP: HashMap<uint, &'static str> = {
let mut m = HashMap::new();
m.insert(0u, "abc");
m.insert(1, "def");
m.insert(2, "ghi");
m
};
}
fn times_two(n: uint) -> uint {
n * 2
}
#[test]
fn test_basic() {
assert_eq!(*OWNED_STRING, "hello".to_string());
assert_eq!(*NUMBER, 6);
assert!(HASHMAP.find(&1).is_some());
assert!(HASHMAP.find(&3).is_none());
assert_eq!(VEC.as_slice(), &[box 1, box 2, box 3]);
}
#[test]
fn test_repeat() {
assert_eq!(*NUMBER, 6);
assert_eq!(*NUMBER, 6);
assert_eq!(*NUMBER, 6);
}

12
ports/cef/Cargo.lock generated
View file

@ -12,7 +12,7 @@ dependencies = [
"glut 0.0.1 (git+https://github.com/servo/rust-glut#01af0162ea0322ad1a40d6adb023a39813605949)",
"js 0.1.0 (git+https://github.com/servo/rust-mozjs#41fb0d80a5ed5614ca13a120cdb3281e599d4e04)",
"layers 0.1.0 (git+https://github.com/servo/rust-layers#ef89918471815dfced7aaf2f1594d5469f03eab7)",
"macros 0.0.1",
"plugins 0.0.1",
"msg 0.0.1",
"net 0.0.1",
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#6776e9c07feb149d34b087039ecf6b2c143e3afc)",
@ -194,7 +194,7 @@ dependencies = [
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
"harfbuzz 0.1.0 (git+https://github.com/servo/rust-harfbuzz#ad520942cc17232e1a40cdd8a99c2905623d35f6)",
"layers 0.1.0 (git+https://github.com/servo/rust-layers#ef89918471815dfced7aaf2f1594d5469f03eab7)",
"macros 0.0.1",
"plugins 0.0.1",
"msg 0.0.1",
"net 0.0.1",
"png 0.1.0 (git+https://github.com/servo/rust-png#74418ffbf20e94b0d3bed4a9d004062a13342c79)",
@ -295,7 +295,7 @@ dependencies = [
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
"gfx 0.0.1",
"layout_traits 0.0.1",
"macros 0.0.1",
"plugins 0.0.1",
"net 0.0.1",
"script 0.0.1",
"script_traits 0.0.1",
@ -321,7 +321,7 @@ version = "0.1.0"
source = "git+https://github.com/Kimundi/lazy-static.rs#e62a65372f1dd9019e37eb9381d819edff80e360"
[[package]]
name = "macros"
name = "plugins"
version = "0.0.1"
[[package]]
@ -405,7 +405,7 @@ dependencies = [
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo#4fdedeea8fc77149adf51bb24a37372af21c25b7)",
"hubbub 0.1.0 (git+https://github.com/servo/rust-hubbub#c7f868e688de6e9cbdc26aa09292ed072bc2648b)",
"js 0.1.0 (git+https://github.com/servo/rust-mozjs#41fb0d80a5ed5614ca13a120cdb3281e599d4e04)",
"macros 0.0.1",
"plugins 0.0.1",
"msg 0.0.1",
"net 0.0.1",
"script_traits 0.0.1",
@ -484,7 +484,7 @@ dependencies = [
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
"lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs#e62a65372f1dd9019e37eb9381d819edff80e360)",
"macros 0.0.1",
"plugins 0.0.1",
"url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
"util 0.0.1",
]

View file

@ -11,8 +11,8 @@ crate-type = ["dylib"]
[dependencies.servo]
path = "../.."
[dependencies.macros]
path = "../../components/macros"
[dependencies.plugins]
path = "../../components/plugins"
[dependencies.gfx]
path = "../../components/gfx"

View file

@ -12,7 +12,7 @@ extern crate log;
extern crate rustuv;
extern crate "macros" as servo_macros;
extern crate "plugins" as servo_plugins;
extern crate servo;
extern crate azure;