Skip to content

Commit 775aed2

Browse files
committed
---
yaml --- r: 159567 b: refs/heads/auto c: 8771394 h: refs/heads/master i: 159565: 8b5dc5d 159563: 5662724 159559: 98b9112 159551: 8f2ef77 v: v3
1 parent dc4d4a3 commit 775aed2

File tree

6 files changed

+24
-35
lines changed

6 files changed

+24
-35
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 15ba87f0314fda5e81603f37ae5f40e2022bcfc1
13+
refs/heads/auto: 877139495d4c572493f2440cff038283a3ba4e5e
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/middle/stability.rs

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ use syntax::{attr, visit};
1717
use syntax::ast;
1818
use syntax::ast::{Attribute, Block, Crate, DefId, FnDecl, NodeId, Variant};
1919
use syntax::ast::{Item, RequiredMethod, ProvidedMethod, TraitItem};
20-
use syntax::ast::{TypeMethod, Method, Generics, StructField, TypeTraitItem};
20+
use syntax::ast::{TypeMethod, Method, Generics, StructDef, StructField};
21+
use syntax::ast::{Ident, TypeTraitItem};
2122
use syntax::ast_util::is_local;
2223
use syntax::attr::Stability;
2324
use syntax::visit::{FnKind, FkMethod, Visitor};
@@ -47,15 +48,9 @@ impl Annotator {
4748
match attr::find_stability(attrs.as_slice()) {
4849
Some(stab) => {
4950
self.index.local.insert(id, stab.clone());
50-
51-
// Don't inherit #[stable]
52-
if stab.level != attr::Stable {
53-
let parent = replace(&mut self.parent, Some(stab));
54-
f(self);
55-
self.parent = parent;
56-
} else {
57-
f(self);
58-
}
51+
let parent = replace(&mut self.parent, Some(stab));
52+
f(self);
53+
self.parent = parent;
5954
}
6055
None => {
6156
self.parent.clone().map(|stab| self.index.local.insert(id, stab));
@@ -68,15 +63,6 @@ impl Annotator {
6863
impl<'v> Visitor<'v> for Annotator {
6964
fn visit_item(&mut self, i: &Item) {
7065
self.annotate(i.id, &i.attrs, |v| visit::walk_item(v, i));
71-
72-
match i.node {
73-
ast::ItemStruct(ref sd, _) => {
74-
sd.ctor_id.map(|id| {
75-
self.annotate(id, &i.attrs, |_| {})
76-
});
77-
}
78-
_ => {}
79-
}
8066
}
8167

8268
fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl,
@@ -109,6 +95,13 @@ impl<'v> Visitor<'v> for Annotator {
10995
self.annotate(var.node.id, &var.node.attrs, |v| visit::walk_variant(v, var, g))
11096
}
11197

98+
fn visit_struct_def(&mut self, s: &StructDef, _: Ident, _: &Generics, _: NodeId) {
99+
match s.ctor_id {
100+
Some(id) => self.annotate(id, &vec![], |v| visit::walk_struct_def(v, s)),
101+
None => visit::walk_struct_def(self, s)
102+
}
103+
}
104+
112105
fn visit_struct_field(&mut self, s: &StructField) {
113106
self.annotate(s.node.id, &s.node.attrs, |v| visit::walk_struct_field(v, s));
114107
}

branches/auto/src/librustc/util/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn time<T, U>(do_it: bool, what: &str, u: U, f: |U| -> T) -> T {
3535
let rv = rv.unwrap();
3636

3737
println!("{}time: {}.{:03} \t{}", " ".repeat(old),
38-
dur.num_seconds(), dur.num_milliseconds(), what);
38+
dur.num_seconds(), dur.num_milliseconds() % 1000, what);
3939
depth.replace(Some(old));
4040

4141
rv

branches/auto/src/libstd/time/duration.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl Duration {
140140
pub fn span(f: ||) -> Duration {
141141
let before = super::precise_time_ns();
142142
f();
143-
Duration::nanoseconds((before - super::precise_time_ns()) as i64)
143+
Duration::nanoseconds((super::precise_time_ns() - before) as i64)
144144
}
145145

146146
/// Returns the total number of whole weeks in the duration.
@@ -565,4 +565,11 @@ mod tests {
565565
assert_eq!(format!("{:30}", Duration::days(1) + Duration::milliseconds(2345)),
566566
"P1DT2.345S".to_string());
567567
}
568+
569+
#[test]
570+
fn span() {
571+
use io::timer::sleep;
572+
let dur = Duration::span(|| sleep(Duration::milliseconds(5)));
573+
assert!(dur > Duration::milliseconds(1));
574+
}
568575
}

branches/auto/src/test/auxiliary/inherited_stability.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,10 @@ pub fn stable() {}
1818

1919
#[stable]
2020
pub mod stable_mod {
21-
pub fn experimental() {}
22-
23-
#[stable]
24-
pub fn stable() {}
25-
}
26-
27-
#[unstable]
28-
pub mod unstable_mod {
2921
#[experimental]
3022
pub fn experimental() {}
3123

32-
pub fn unstable() {}
24+
pub fn stable() {}
3325
}
3426

3527
pub mod experimental_mod {
@@ -41,9 +33,9 @@ pub mod experimental_mod {
4133

4234
#[stable]
4335
pub trait Stable {
36+
#[experimental]
4437
fn experimental(&self);
4538

46-
#[stable]
4739
fn stable(&self);
4840
}
4941

branches/auto/src/test/compile-fail/lint-stability.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ mod inheritance {
165165
stable_mod::experimental(); //~ ERROR use of experimental item
166166
stable_mod::stable();
167167

168-
unstable_mod::experimental(); //~ ERROR use of experimental item
169-
unstable_mod::unstable(); //~ ERROR use of unstable item
170-
171168
experimental_mod::experimental(); //~ ERROR use of experimental item
172169
experimental_mod::stable();
173170

0 commit comments

Comments
 (0)