Skip to content

Commit a712da9

Browse files
committed
---
yaml --- r: 235964 b: refs/heads/stable c: 033b886 h: refs/heads/master v: v3
1 parent 05222ba commit a712da9

File tree

33 files changed

+661
-6790
lines changed

33 files changed

+661
-6790
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: cca0ea718d363acb85e075aee41223f4da009e82
32+
refs/heads/stable: 033b886f8c4f4b8de0b1f670f45a780e5679620b
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/.gitattributes

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@
66
*.rs rust
77
src/etc/pkg/rust-logo.ico binary
88
src/etc/pkg/rust-logo.png binary
9-
src/rt/msvc/* -whitespace
10-
src/rt/valgrind/* -whitespace
119
*.woff binary

branches/stable/src/doc/trpl/crates-and-modules.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ Hello in English: Hello!
355355
Goodbye in English: Goodbye.
356356
```
357357
358+
`pub` also applies to `struct`s and their member fields. In keeping with Rust’s
359+
tendency toward safety, simply making a `struct` public won't automatically
360+
make its members public: you must mark the fields individually with `pub`.
361+
358362
Now that our functions are public, we can use them. Great! However, typing out
359363
`phrases::english::greetings::hello()` is very long and repetitive. Rust has
360364
another keyword for importing names into the current scope, so that you can

branches/stable/src/libcollections/vec_deque.rs

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl<T> VecDeque<T> {
231231
/// buf.push_back(3);
232232
/// buf.push_back(4);
233233
/// buf.push_back(5);
234-
/// assert_eq!(buf.get(1).unwrap(), &4);
234+
/// assert_eq!(buf.get(1), Some(&4));
235235
/// ```
236236
#[stable(feature = "rust1", since = "1.0.0")]
237237
pub fn get(&self, index: usize) -> Option<&T> {
@@ -852,12 +852,14 @@ impl<T> VecDeque<T> {
852852
///
853853
/// let mut buf = VecDeque::new();
854854
/// assert_eq!(buf.swap_back_remove(0), None);
855-
/// buf.push_back(5);
856-
/// buf.push_back(99);
857-
/// buf.push_back(15);
858-
/// buf.push_back(20);
859-
/// buf.push_back(10);
860-
/// assert_eq!(buf.swap_back_remove(1), Some(99));
855+
/// buf.push_back(1);
856+
/// buf.push_back(2);
857+
/// buf.push_back(3);
858+
///
859+
/// assert_eq!(buf.swap_back_remove(0), Some(1));
860+
/// assert_eq!(buf.len(), 2);
861+
/// assert_eq!(buf[0], 3);
862+
/// assert_eq!(buf[1], 2);
861863
/// ```
862864
#[unstable(feature = "deque_extras",
863865
reason = "the naming of this function may be altered")]
@@ -886,12 +888,14 @@ impl<T> VecDeque<T> {
886888
///
887889
/// let mut buf = VecDeque::new();
888890
/// assert_eq!(buf.swap_front_remove(0), None);
889-
/// buf.push_back(15);
890-
/// buf.push_back(5);
891-
/// buf.push_back(10);
892-
/// buf.push_back(99);
893-
/// buf.push_back(20);
894-
/// assert_eq!(buf.swap_front_remove(3), Some(99));
891+
/// buf.push_back(1);
892+
/// buf.push_back(2);
893+
/// buf.push_back(3);
894+
///
895+
/// assert_eq!(buf.swap_front_remove(2), Some(3));
896+
/// assert_eq!(buf.len(), 2);
897+
/// assert_eq!(buf[0], 2);
898+
/// assert_eq!(buf[1], 1);
895899
/// ```
896900
#[unstable(feature = "deque_extras",
897901
reason = "the naming of this function may be altered")]
@@ -1123,12 +1127,12 @@ impl<T> VecDeque<T> {
11231127
/// use std::collections::VecDeque;
11241128
///
11251129
/// let mut buf = VecDeque::new();
1126-
/// buf.push_back(5);
1127-
/// buf.push_back(10);
1128-
/// buf.push_back(12);
1129-
/// buf.push_back(15);
1130-
/// buf.remove(2);
1131-
/// assert_eq!(Some(&15), buf.get(2));
1130+
/// buf.push_back(1);
1131+
/// buf.push_back(2);
1132+
/// buf.push_back(3);
1133+
///
1134+
/// assert_eq!(buf.remove(1), Some(2));
1135+
/// assert_eq!(buf.get(1), Some(&3));
11321136
/// ```
11331137
#[stable(feature = "rust1", since = "1.0.0")]
11341138
pub fn remove(&mut self, index: usize) -> Option<T> {

branches/stable/src/libcore/slice.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,12 @@ impl<T> SliceExt for [T] {
300300

301301
#[inline]
302302
fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]) {
303+
let len = self.len();
304+
let ptr = self.as_mut_ptr();
305+
assert!(mid <= len);
303306
unsafe {
304-
let self2: &mut [T] = mem::transmute_copy(&self);
305-
306-
(ops::IndexMut::index_mut(self, ops::RangeTo { end: mid } ),
307-
ops::IndexMut::index_mut(self2, ops::RangeFrom { start: mid } ))
307+
(from_raw_parts_mut(ptr, mid),
308+
from_raw_parts_mut(ptr.offset(mid as isize), len - mid))
308309
}
309310
}
310311

branches/stable/src/liblibc/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ pub mod types {
10091009
use types::os::arch::posix88::{uid_t};
10101010

10111011
pub type nlink_t = u16;
1012-
pub type blksize_t = i32;
1012+
pub type blksize_t = u32;
10131013
pub type blkcnt_t = i64;
10141014
pub type fflags_t = u32;
10151015
#[repr(C)]
@@ -1035,7 +1035,7 @@ pub mod types {
10351035
pub st_lspare: int32_t,
10361036
pub st_birthtime: time_t,
10371037
pub st_birthtime_nsec: c_long,
1038-
pub __unused: [uint8_t; 2],
1038+
pub __unused: [u8; 8],
10391039
}
10401040

10411041
#[repr(C)]
@@ -1103,7 +1103,7 @@ pub mod types {
11031103
use types::os::arch::posix88::{uid_t};
11041104

11051105
pub type nlink_t = u16;
1106-
pub type blksize_t = i64;
1106+
pub type blksize_t = u32;
11071107
pub type blkcnt_t = i64;
11081108
pub type fflags_t = u32;
11091109
#[repr(C)]
@@ -1129,7 +1129,6 @@ pub mod types {
11291129
pub st_lspare: int32_t,
11301130
pub st_birthtime: time_t,
11311131
pub st_birthtime_nsec: c_long,
1132-
pub __unused: [uint8_t; 2],
11331132
}
11341133

11351134
#[repr(C)]

branches/stable/src/librustc/lint/context.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use lint::builtin;
3434
use util::nodemap::FnvHashMap;
3535

3636
use std::cell::RefCell;
37+
use std::cmp;
3738
use std::mem;
3839
use syntax::ast_util::IdVisitingOperation;
3940
use syntax::attr::AttrMetaMethods;
@@ -66,6 +67,9 @@ pub struct LintStore {
6667
/// Map of registered lint groups to what lints they expand to. The bool
6768
/// is true if the lint group was added by a plugin.
6869
lint_groups: FnvHashMap<&'static str, (Vec<LintId>, bool)>,
70+
71+
/// Maximum level a lint can be
72+
lint_cap: Option<Level>,
6973
}
7074

7175
/// The targed of the `by_name` map, which accounts for renaming/deprecation.
@@ -94,7 +98,10 @@ impl LintStore {
9498
}
9599
}
96100

97-
fn set_level(&mut self, lint: LintId, lvlsrc: LevelSource) {
101+
fn set_level(&mut self, lint: LintId, mut lvlsrc: LevelSource) {
102+
if let Some(cap) = self.lint_cap {
103+
lvlsrc.0 = cmp::min(lvlsrc.0, cap);
104+
}
98105
if lvlsrc.0 == Allow {
99106
self.levels.remove(&lint);
100107
} else {
@@ -109,6 +116,7 @@ impl LintStore {
109116
by_name: FnvHashMap(),
110117
levels: FnvHashMap(),
111118
lint_groups: FnvHashMap(),
119+
lint_cap: None,
112120
}
113121
}
114122

@@ -227,6 +235,13 @@ impl LintStore {
227235
}
228236
}
229237
}
238+
239+
self.lint_cap = sess.opts.lint_cap;
240+
if let Some(cap) = self.lint_cap {
241+
for level in self.levels.iter_mut().map(|p| &mut (p.1).0) {
242+
*level = cmp::min(*level, cap);
243+
}
244+
}
230245
}
231246
}
232247

branches/stable/src/librustc/session/config.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ pub struct Options {
8484
pub debug_assertions: bool,
8585
pub debuginfo: DebugInfoLevel,
8686
pub lint_opts: Vec<(String, lint::Level)>,
87+
pub lint_cap: Option<lint::Level>,
8788
pub describe_lints: bool,
8889
pub output_types: Vec<OutputType>,
8990
// This was mutable for rustpkg, which updates search paths based on the
@@ -203,6 +204,7 @@ pub fn basic_options() -> Options {
203204
optimize: No,
204205
debuginfo: NoDebugInfo,
205206
lint_opts: Vec::new(),
207+
lint_cap: None,
206208
describe_lints: false,
207209
output_types: Vec::new(),
208210
search_paths: SearchPaths::new(),
@@ -794,6 +796,9 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
794796
opt::multi("A", "allow", "Set lint allowed", "OPT"),
795797
opt::multi("D", "deny", "Set lint denied", "OPT"),
796798
opt::multi("F", "forbid", "Set lint forbidden", "OPT"),
799+
opt::multi("", "cap-lints", "Set the most restrictive lint level. \
800+
More restrictive lints are capped at this \
801+
level", "LEVEL"),
797802
opt::multi("C", "codegen", "Set a codegen option", "OPT[=VALUE]"),
798803
opt::flag("V", "version", "Print version info and exit"),
799804
opt::flag("v", "verbose", "Use verbose output"),
@@ -862,6 +867,12 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
862867
}
863868
}
864869

870+
let lint_cap = matches.opt_str("cap-lints").map(|cap| {
871+
lint::Level::from_str(&cap).unwrap_or_else(|| {
872+
early_error(&format!("unknown lint level: `{}`", cap))
873+
})
874+
});
875+
865876
let debugging_opts = build_debugging_options(matches);
866877

867878
let parse_only = debugging_opts.parse_only;
@@ -1025,6 +1036,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
10251036
optimize: opt_level,
10261037
debuginfo: debuginfo,
10271038
lint_opts: lint_opts,
1039+
lint_cap: lint_cap,
10281040
describe_lints: describe_lints,
10291041
output_types: output_types,
10301042
search_paths: search_paths,

branches/stable/src/librustc_resolve/lib.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,23 +2654,22 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
26542654
let pat_id = pattern.id;
26552655
walk_pat(pattern, |pattern| {
26562656
match pattern.node {
2657-
PatIdent(binding_mode, ref path1, _) => {
2658-
2659-
// The meaning of pat_ident with no type parameters
2657+
PatIdent(binding_mode, ref path1, ref at_rhs) => {
2658+
// The meaning of PatIdent with no type parameters
26602659
// depends on whether an enum variant or unit-like struct
26612660
// with that name is in scope. The probing lookup has to
26622661
// be careful not to emit spurious errors. Only matching
26632662
// patterns (match) can match nullary variants or
2664-
// unit-like structs. For binding patterns (let), matching
2665-
// such a value is simply disallowed (since it's rarely
2666-
// what you want).
2663+
// unit-like structs. For binding patterns (let
2664+
// and the LHS of @-patterns), matching such a value is
2665+
// simply disallowed (since it's rarely what you want).
2666+
let const_ok = mode == RefutableMode && at_rhs.is_none();
26672667

26682668
let ident = path1.node;
26692669
let renamed = mtwt::resolve(ident);
26702670

26712671
match self.resolve_bare_identifier_pattern(ident.name, pattern.span) {
2672-
FoundStructOrEnumVariant(def, lp)
2673-
if mode == RefutableMode => {
2672+
FoundStructOrEnumVariant(def, lp) if const_ok => {
26742673
debug!("(resolving pattern) resolving `{}` to \
26752674
struct or enum variant",
26762675
renamed);
@@ -2693,7 +2692,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
26932692
renamed)
26942693
);
26952694
}
2696-
FoundConst(def, lp) if mode == RefutableMode => {
2695+
FoundConst(def, lp) if const_ok => {
26972696
debug!("(resolving pattern) resolving `{}` to \
26982697
constant",
26992698
renamed);

0 commit comments

Comments
 (0)