Skip to content

Commit 8efa2aa

Browse files
committed
---
yaml --- r: 276891 b: refs/heads/try c: 3e9b859 h: refs/heads/master i: 276889: 63dc1e9 276887: 676bab1
1 parent 28c3406 commit 8efa2aa

File tree

16 files changed

+75
-75
lines changed

16 files changed

+75
-75
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: 76a58954e08aa1dede29a87adb50d4ad9179ba5c
4+
refs/heads/try: 3e9b859af2b54130a898741706a736ade406774d
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/doc/book/concurrency.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ thread may outlive the scope of `x`, leading to a dangling pointer.
127127

128128
To fix this, we use a `move` closure as mentioned in the error message. `move`
129129
closures are explained in depth [here](closures.html#move-closures); basically
130-
they move variables from their environment into themselves.
130+
they move variables from their environment into themselves. This means that `x`
131+
is now owned by the closure, and cannot be used in `main()` after the call to
132+
`spawn()`.
131133

132134
```rust
133135
use std::thread;
@@ -162,7 +164,7 @@ The same [ownership system](ownership.html) that helps prevent using pointers
162164
incorrectly also helps rule out data races, one of the worst kinds of
163165
concurrency bugs.
164166

165-
As an example, here is a Rust program that could have a data race in many
167+
As an example, here is a Rust program that would have a data race in many
166168
languages. It will not compile:
167169

168170
```ignore
@@ -195,11 +197,6 @@ thread, and the thread takes ownership of the reference, we'd have three owners!
195197
`data` gets moved out of `main` in the first call to `spawn()`, so subsequent
196198
calls in the loop cannot use this variable.
197199

198-
Note that this specific example will not cause a data race since different array
199-
indices are being accessed. But this can't be determined at compile time, and in
200-
a similar situation where `i` is a constant or is random, you would have a data
201-
race.
202-
203200
So, we need some type that lets us have more than one owning reference to a
204201
value. Usually, we'd use `Rc<T>` for this, which is a reference counted type
205202
that provides shared ownership. It has some runtime bookkeeping that keeps track

branches/try/src/doc/book/crates-and-modules.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ build deps examples libphrases-a7448e02a0468eaa.rlib native
118118
`libphrases-hash.rlib` is the compiled crate. Before we see how to use this
119119
crate from another crate, let’s break it up into multiple files.
120120

121-
# Multiple File Crates
121+
# Multiple file crates
122122

123123
If each crate were just one file, these files would get very large. It’s often
124124
easier to split up crates into multiple files, and Rust supports this in two
@@ -190,19 +190,13 @@ mod farewells;
190190
```
191191

192192
Again, these declarations tell Rust to look for either
193-
`src/english/greetings.rs`, `src/english/farewells.rs`,
194-
`src/japanese/greetings.rs` and `src/japanese/farewells.rs` or
195-
`src/english/greetings/mod.rs`, `src/english/farewells/mod.rs`,
196-
`src/japanese/greetings/mod.rs` and
197-
`src/japanese/farewells/mod.rs`. Because these sub-modules don’t have
198-
their own sub-modules, we’ve chosen to make them
199-
`src/english/greetings.rs`, `src/english/farewells.rs`,
200-
`src/japanese/greetings.rs` and `src/japanese/farewells.rs`. Whew!
201-
202-
The contents of `src/english/greetings.rs`,
203-
`src/english/farewells.rs`, `src/japanese/greetings.rs` and
204-
`src/japanese/farewells.rs` are all empty at the moment. Let’s add
205-
some functions.
193+
`src/english/greetings.rs` and `src/japanese/greetings.rs` or
194+
`src/english/farewells/mod.rs` and `src/japanese/farewells/mod.rs`. Because
195+
these sub-modules don’t have their own sub-modules, we’ve chosen to make them
196+
`src/english/greetings.rs` and `src/japanese/farewells.rs`. Whew!
197+
198+
The contents of `src/english/greetings.rs` and `src/japanese/farewells.rs` are
199+
both empty at the moment. Let’s add some functions.
206200

207201
Put this in `src/english/greetings.rs`:
208202

branches/try/src/doc/book/lifetimes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ To fix this, we have to make sure that step four never happens after step
5656
three. The ownership system in Rust does this through a concept called
5757
lifetimes, which describe the scope that a reference is valid for.
5858

59-
When we have a function that takes an argument by reference, we can be
60-
implicit or explicit about the lifetime of the reference:
59+
When we have a function that takes a reference by argument, we can be implicit
60+
or explicit about the lifetime of the reference:
6161

6262
```rust
6363
// implicit

branches/try/src/libcollections/borrow.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,6 @@ pub trait ToOwned {
4949
type Owned: Borrow<Self>;
5050

5151
/// Creates owned data from borrowed data, usually by cloning.
52-
///
53-
/// # Examples
54-
///
55-
/// Basic usage:
56-
///
57-
/// ```
58-
/// let s = "a"; // &str
59-
/// let ss = s.to_owned(); // String
60-
///
61-
/// let v = &[1, 2]; // slice
62-
/// let vv = v.to_owned(); // Vec
63-
/// ```
6452
#[stable(feature = "rust1", since = "1.0.0")]
6553
fn to_owned(&self) -> Self::Owned;
6654
}

branches/try/src/libcore/ptr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl<T: ?Sized> *const T {
220220
/// ```
221221
/// let s: &str = "Follow the rabbit";
222222
/// let ptr: *const u8 = s.as_ptr();
223-
/// assert!(!ptr.is_null());
223+
/// assert!(ptr.is_null() == false);
224224
/// ```
225225
#[stable(feature = "rust1", since = "1.0.0")]
226226
#[inline]
@@ -306,7 +306,7 @@ impl<T: ?Sized> *mut T {
306306
/// ```
307307
/// let mut s = [1, 2, 3];
308308
/// let ptr: *mut u32 = s.as_mut_ptr();
309-
/// assert!(!ptr.is_null());
309+
/// assert!(ptr.is_null() == false);
310310
/// ```
311311
#[stable(feature = "rust1", since = "1.0.0")]
312312
#[inline]

branches/try/src/librustc/lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ declare_lint! {
144144

145145
declare_lint! {
146146
pub ILLEGAL_STRUCT_OR_ENUM_CONSTANT_PATTERN,
147-
Warn,
147+
Deny,
148148
"constants of struct or enum type can only be used in a pattern if \
149149
the struct or enum has `#[derive(PartialEq, Eq)]`"
150150
}

branches/try/src/librustc_resolve/check_unused.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,16 @@ impl<'a, 'b, 'tcx:'b> DerefMut for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
5151

5252
impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> {
5353
// We have information about whether `use` (import) directives are actually
54-
// used now. If an import is not used at all, we signal a lint error.
55-
fn check_import(&mut self, id: ast::NodeId, span: Span) {
54+
// used now. If an import is not used at all, we signal a lint error. If an
55+
// import is only used for a single namespace, we remove the other namespace
56+
// from the recorded privacy information. That means in privacy.rs, we will
57+
// only check imports and namespaces which are used. In particular, this
58+
// means that if an import could name either a public or private item, we
59+
// will check the correct thing, dependent on how the import is used.
60+
fn finalize_import(&mut self, id: ast::NodeId, span: Span) {
61+
debug!("finalizing import uses for {:?}",
62+
self.session.codemap().span_to_snippet(span));
63+
5664
if !self.used_imports.contains(&(id, TypeNS)) &&
5765
!self.used_imports.contains(&(id, ValueNS)) {
5866
self.session.add_lint(lint::builtin::UNUSED_IMPORTS,
@@ -87,16 +95,23 @@ impl<'a, 'b, 'v, 'tcx> Visitor<'v> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
8795
hir::ItemUse(ref p) => {
8896
match p.node {
8997
ViewPathSimple(_, _) => {
90-
self.check_import(item.id, p.span)
98+
self.finalize_import(item.id, p.span)
9199
}
92100

93101
ViewPathList(_, ref list) => {
94102
for i in list {
95-
self.check_import(i.node.id(), i.span);
103+
self.finalize_import(i.node.id(), i.span);
96104
}
97105
}
98106
ViewPathGlob(_) => {
99-
self.check_import(item.id, p.span)
107+
if !self.used_imports.contains(&(item.id, TypeNS)) &&
108+
!self.used_imports.contains(&(item.id, ValueNS)) {
109+
self.session
110+
.add_lint(lint::builtin::UNUSED_IMPORTS,
111+
item.id,
112+
p.span,
113+
"unused import".to_string());
114+
}
100115
}
101116
}
102117
}

branches/try/src/libstd/collections/hash/map.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,10 @@ fn robin_hood<'a, K: 'a, V: 'a>(bucket: FullBucketMut<'a, K, V>,
428428
mut val: V)
429429
-> &'a mut V {
430430
let starting_index = bucket.index();
431-
let size = bucket.table().size();
431+
let size = {
432+
let table = bucket.table(); // FIXME "lifetime too short".
433+
table.size()
434+
};
432435
// Save the *starting point*.
433436
let mut bucket = bucket.stash();
434437
// There can be at most `size - dib` buckets to displace, because
@@ -741,9 +744,10 @@ impl<K, V, S> HashMap<K, V, S>
741744
let h = bucket.hash();
742745
let (b, k, v) = bucket.take();
743746
self.insert_hashed_ordered(h, k, v);
744-
if b.table().size() == 0 {
745-
break;
746-
}
747+
{
748+
let t = b.table(); // FIXME "lifetime too short".
749+
if t.size() == 0 { break }
750+
};
747751
b.into_bucket()
748752
}
749753
Empty(b) => b.into_bucket()

branches/try/src/libstd/env.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
181181
}
182182

183183
/// Fetches the environment variable `key` from the current process, returning
184-
/// `None` if the variable isn't set.
184+
/// None if the variable isn't set.
185185
///
186186
/// # Examples
187187
///
@@ -617,7 +617,7 @@ pub mod consts {
617617
#[stable(feature = "env", since = "1.0.0")]
618618
pub const ARCH: &'static str = super::arch::ARCH;
619619

620-
/// The family of the operating system. Example value is `unix`.
620+
/// The family of the operating system. In this case, `unix`.
621621
///
622622
/// Some possible values:
623623
///
@@ -626,8 +626,8 @@ pub mod consts {
626626
#[stable(feature = "env", since = "1.0.0")]
627627
pub const FAMILY: &'static str = super::os::FAMILY;
628628

629-
/// A string describing the specific operating system in use.
630-
/// Example value is `linux`.
629+
/// A string describing the specific operating system in use: in this
630+
/// case, `linux`.
631631
///
632632
/// Some possible values:
633633
///
@@ -646,7 +646,7 @@ pub mod consts {
646646
pub const OS: &'static str = super::os::OS;
647647

648648
/// Specifies the filename prefix used for shared libraries on this
649-
/// platform. Example value is `lib`.
649+
/// platform: in this case, `lib`.
650650
///
651651
/// Some possible values:
652652
///
@@ -656,7 +656,7 @@ pub mod consts {
656656
pub const DLL_PREFIX: &'static str = super::os::DLL_PREFIX;
657657

658658
/// Specifies the filename suffix used for shared libraries on this
659-
/// platform. Example value is `.so`.
659+
/// platform: in this case, `.so`.
660660
///
661661
/// Some possible values:
662662
///
@@ -667,7 +667,7 @@ pub mod consts {
667667
pub const DLL_SUFFIX: &'static str = super::os::DLL_SUFFIX;
668668

669669
/// Specifies the file extension used for shared libraries on this
670-
/// platform that goes after the dot. Example value is `so`.
670+
/// platform that goes after the dot: in this case, `so`.
671671
///
672672
/// Some possible values:
673673
///
@@ -678,7 +678,7 @@ pub mod consts {
678678
pub const DLL_EXTENSION: &'static str = super::os::DLL_EXTENSION;
679679

680680
/// Specifies the filename suffix used for executable binaries on this
681-
/// platform. Example value is `.exe`.
681+
/// platform: in this case, the empty string.
682682
///
683683
/// Some possible values:
684684
///
@@ -690,7 +690,7 @@ pub mod consts {
690690
pub const EXE_SUFFIX: &'static str = super::os::EXE_SUFFIX;
691691

692692
/// Specifies the file extension, if any, used for executable binaries
693-
/// on this platform. Example value is `exe`.
693+
/// on this platform: in this case, the empty string.
694694
///
695695
/// Some possible values:
696696
///

branches/try/src/libstd/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1708,7 +1708,7 @@ mod tests {
17081708
let tmpdir = tmpdir();
17091709
let dir = &tmpdir.join("fileinfo_false_on_dir");
17101710
check!(fs::create_dir(dir));
1711-
assert!(!dir.is_file());
1711+
assert!(dir.is_file() == false);
17121712
check!(fs::remove_dir(dir));
17131713
}
17141714

branches/try/src/libstd/primitive_docs.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,11 @@ mod prim_str { }
425425
///
426426
/// # Trait implementations
427427
///
428-
/// If every type inside a tuple implements one of the following
429-
/// traits, then a tuple itself also implements it.
428+
/// If every type inside a tuple implements one of the following traits, then a
429+
/// tuple itself also implements it.
430430
///
431431
/// * [`Clone`]
432+
/// * [`Copy`]
432433
/// * [`PartialEq`]
433434
/// * [`Eq`]
434435
/// * [`PartialOrd`]
@@ -438,6 +439,7 @@ mod prim_str { }
438439
/// * [`Hash`]
439440
///
440441
/// [`Clone`]: clone/trait.Clone.html
442+
/// [`Copy`]: marker/trait.Copy.html
441443
/// [`PartialEq`]: cmp/trait.PartialEq.html
442444
/// [`Eq`]: cmp/trait.Eq.html
443445
/// [`PartialOrd`]: cmp/trait.PartialOrd.html

branches/try/src/libsyntax/parse/parser.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,12 +1188,12 @@ impl<'a> Parser<'a> {
11881188
-> PResult<'a, TyKind> {
11891189
/*
11901190
1191-
[unsafe] [extern "ABI"] fn (S) -> T
1192-
^~~~^ ^~~~^ ^~^ ^
1193-
| | | |
1194-
| | | Return type
1195-
| | Argument types
1196-
| |
1191+
[unsafe] [extern "ABI"] fn <'lt> (S) -> T
1192+
^~~~^ ^~~~^ ^~~~^ ^~^ ^
1193+
| | | | |
1194+
| | | | Return type
1195+
| | | Argument types
1196+
| | Lifetimes
11971197
| ABI
11981198
Function Style
11991199
*/

branches/try/src/libtest/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,7 @@ mod tests {
15091509

15101510
assert_eq!(filtered.len(), 1);
15111511
assert_eq!(filtered[0].desc.name.to_string(), "1");
1512-
assert!(!filtered[0].desc.ignore);
1512+
assert!(filtered[0].desc.ignore == false);
15131513
}
15141514

15151515
#[test]

branches/try/src/test/run-pass/specialization/specialization-cross-crate-defaults.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ impl Foo for LocalOverride {
2626
}
2727

2828
fn test_foo() {
29-
assert!(!0i8.foo());
30-
assert!(!0i32.foo());
31-
assert!(0i64.foo());
29+
assert!(0i8.foo() == false);
30+
assert!(0i32.foo() == false);
31+
assert!(0i64.foo() == true);
3232

33-
assert!(!LocalDefault.foo());
34-
assert!(LocalOverride.foo());
33+
assert!(LocalDefault.foo() == false);
34+
assert!(LocalOverride.foo() == true);
3535
}
3636

3737
fn test_bar() {

branches/try/src/test/run-pass/specialization/specialization-default-methods.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ impl Foo for i64 {
3535
}
3636

3737
fn test_foo() {
38-
assert!(!0i8.foo());
39-
assert!(!0i32.foo());
40-
assert!(0i64.foo());
38+
assert!(0i8.foo() == false);
39+
assert!(0i32.foo() == false);
40+
assert!(0i64.foo() == true);
4141
}
4242

4343
// Next, test mixture of explicit `default` and provided methods:

0 commit comments

Comments
 (0)