Skip to content

Rollup of 5 pull requests #28689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Sep 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
81f0bf7
std: Switch string::ParseError to an empty enum
alexcrichton Sep 24, 2015
e82bb91
Fix dllimports of static data from rlibs
vadimcn Aug 21, 2015
91f7c60
Tell LLVM when a match is exhaustive
dotdash Sep 25, 2015
db18718
Simplify `Debug` for `{EnumSet, VecDeque}`
apasel422 Sep 25, 2015
d5f2d3b
std: Update MatchIndices to return a subslice
alexcrichton Sep 24, 2015
c21fcac
Converted test to rpass.
vadimcn Sep 26, 2015
38f1c47
Removed unused parameter.
vadimcn Sep 26, 2015
eef6030
Don't ICE if an archive isn't actually an archive
wthrowe Sep 25, 2015
0f491be
Typo fix in use declaration section of reference
therustmonk Sep 26, 2015
c099cfa
Add support for the rumprun unikernel
gandro Sep 21, 2015
08181d2
Remove warning of duplicated error code
GuillaumeGomez Sep 25, 2015
ded2370
clarify that `find` returns first match
Sep 26, 2015
fe6ad09
deduplicate trait errors before they are displayed
Sep 24, 2015
c9c7908
Auto merge of #28593 - gandro:rumprun, r=alexcrichton
bors Sep 26, 2015
c3a74fa
Elide lifetime in Deref doc example
fhartwig Sep 26, 2015
346088b
show each object-safety violation once
Sep 24, 2015
3885a81
Add an example of constructing a unit-like struct.
xaviershay Sep 26, 2015
865889a
Fix meta-documentation for generating all docs.
xaviershay Sep 26, 2015
589c824
Remove unnecessary `#![feature]` attributes
apasel422 Sep 26, 2015
54f7b1d
Auto merge of #28632 - alexcrichton:update-match-indices, r=Kimundi
bors Sep 26, 2015
f9b703e
remove the destructors table
arielb1 Sep 26, 2015
9a86713
don't crash when there are multiple conflicting implementations of Drop
arielb1 Sep 26, 2015
6f880ee
Auto merge of #28635 - alexcrichton:str-parse-error-void, r=aturon
bors Sep 26, 2015
7bf4c88
Auto merge of #28646 - vadimcn:imps, r=alexcrichton
bors Sep 26, 2015
9f129a9
Rollup merge of #28666 - GuillaumeGomez:warning, r=arielb1
steveklabnik Sep 27, 2015
692d9e9
Rollup merge of #28674 - DenisKolodin:patch-2, r=sanxiyn
steveklabnik Sep 27, 2015
2ec89c7
Rollup merge of #28677 - taboularasa:master, r=alexcrichton
steveklabnik Sep 27, 2015
6633988
Rollup merge of #28678 - fhartwig:deref-elide, r=steveklabnik
steveklabnik Sep 27, 2015
3e36eec
Rollup merge of #28679 - xaviershay:book-unit-example, r=steveklabnik
steveklabnik Sep 27, 2015
cc44d65
Rollup merge of #28680 - xaviershay:doc-readme, r=steveklabnik
steveklabnik Sep 27, 2015
90c04d0
Auto merge of #28685 - steveklabnik:rollup, r=steveklabnik
bors Sep 27, 2015
dde7283
Auto merge of #28651 - dotdash:exhaustive_match, r=eddyb
bors Sep 27, 2015
8c47cfe
Rollup merge of #28664 - apasel422:collections-debug, r=alexcrichton
Manishearth Sep 27, 2015
5f90904
Rollup merge of #28673 - wthrowe:bad-archive, r=alexcrichton
Manishearth Sep 27, 2015
7e6e64b
Rollup merge of #28681 - arielb1:destructor-fixes, r=eddyb
Manishearth Sep 27, 2015
30b43c1
Rollup merge of #28682 - apasel422:features, r=steveklabnik
Manishearth Sep 27, 2015
c34f3ea
Rollup merge of #28688 - Manishearth:fix-primitives-search, r=eddyb
Manishearth Sep 27, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,12 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
putvar CFG_MSVC_LIB_PATH_${bits}
;;

*-rumprun-netbsd)
step_msg "targeting rumprun-netbsd, disabling jemalloc"
CFG_DISABLE_JEMALLOC=1
putvar CFG_DISABLE_JEMALLOC
;;

*)
;;
esac
Expand Down
24 changes: 24 additions & 0 deletions mk/cfg/x86_64-rumprun-netbsd.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# x86_64-rumprun-netbsd configuration
CROSS_PREFIX_x86_64-rumprun-netbsd=x86_64-rumprun-netbsd-
CC_x86_64-rumprun-netbsd=gcc
CXX_x86_64-rumprun-netbsd=g++
CPP_x86_64-rumprun-netbsd=gcc -E
AR_x86_64-rumprun-netbsd=ar
CFG_INSTALL_ONLY_RLIB_x86_64-rumprun-netbsd = 1
CFG_LIB_NAME_x86_64-rumprun-netbsd=lib$(1).so
CFG_STATIC_LIB_NAME_x86_64-rumprun-netbsd=lib$(1).a
CFG_LIB_GLOB_x86_64-rumprun-netbsd=lib$(1)-*.so
CFG_JEMALLOC_CFLAGS_x86_64-rumprun-netbsd := -m64
CFG_GCCISH_CFLAGS_x86_64-rumprun-netbsd := -Wall -Werror -g -fPIC -m64
CFG_GCCISH_CXXFLAGS_x86_64-rumprun-netbsd :=
CFG_GCCISH_LINK_FLAGS_x86_64-rumprun-netbsd :=
CFG_GCCISH_DEF_FLAG_x86_64-rumprun-netbsd :=
CFG_LLC_FLAGS_x86_64-rumprun-netbsd :=
CFG_INSTALL_NAME_x86_64-rumprun-netbsd =
CFG_EXE_SUFFIX_x86_64-rumprun-netbsd =
CFG_WINDOWSY_x86_64-rumprun-netbsd :=
CFG_UNIXY_x86_64-rumprun-netbsd := 1
CFG_LDPATH_x86_64-rumprun-netbsd :=
CFG_RUN_x86_64-rumprun-netbsd=$(2)
CFG_RUN_TARG_x86_64-rumprun-netbsd=$(call CFG_RUN_x86_64-rumprun-netbsd,,$(2))
CFG_GNU_TRIPLE_x86_64-rumprun-netbsd := x86_64-rumprun-netbsd
7 changes: 4 additions & 3 deletions src/doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

## Building

To generate all the docs, just run `make docs` from the root of the repository.
This will convert the distributed Markdown docs to HTML and generate HTML doc
for the 'std' and 'extra' libraries.
To generate all the docs, follow the "Building Documentation" instructions in
the README in the root of the repository. This will convert the distributed
Markdown docs to HTML and generate HTML doc for the books, 'std' and 'extra'
libraries.

To generate HTML documentation from one source file/crate, do something like:

Expand Down
2 changes: 1 addition & 1 deletion src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ mod foo {
}

use foo::example::iter; // good: foo is at crate root
// use example::iter; // bad: core is not at the crate root
// use example::iter; // bad: example is not at the crate root
use self::baz::foobaz; // good: self refers to module 'foo'
use foo::bar::foobar; // good: foo is at crate root

Expand Down
9 changes: 5 additions & 4 deletions src/doc/trpl/iterators.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,16 @@ let greater_than_forty_two = (0..100)
.find(|x| *x > 42);

match greater_than_forty_two {
Some(_) => println!("We got some numbers!"),
None => println!("No numbers found :("),
Some(_) => println!("Found a match!"),
None => println!("No match found :("),
}
```

`find` takes a closure, and works on a reference to each element of an
iterator. This closure returns `true` if the element is the element we're
looking for, and `false` otherwise. Because we might not find a matching
element, `find` returns an `Option` rather than the element itself.
looking for, and `false` otherwise. `find` returns the first element satisfying
the specified predicate. Because we might not find a matching element, `find`
returns an `Option` rather than the element itself.

Another important consumer is `fold`. Here's what it looks like:

Expand Down
2 changes: 2 additions & 0 deletions src/doc/trpl/structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ You can define a `struct` with no members at all:

```rust
struct Electron;

let x = Electron;
```

Such a `struct` is called ‘unit-like’ because it resembles the empty
Expand Down
11 changes: 1 addition & 10 deletions src/libcollections/enum_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,7 @@ impl<E> Clone for EnumSet<E> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<E:CLike + fmt::Debug> fmt::Debug for EnumSet<E> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
try!(write!(fmt, "{{"));
let mut first = true;
for e in self {
if !first {
try!(write!(fmt, ", "));
}
try!(write!(fmt, "{:?}", e));
first = false;
}
write!(fmt, "}}")
fmt.debug_set().entries(self).finish()
}
}

Expand Down
74 changes: 30 additions & 44 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,6 @@ impl str {
///
/// # Examples
/// ```
/// #![feature(str_split_at)]
///
/// let s = "Löwe 老虎 Léopard";
/// let first_space = s.find(' ').unwrap_or(s.len());
/// let (a, b) = s.split_at(first_space);
Expand Down Expand Up @@ -1157,25 +1155,21 @@ impl str {
core_str::StrExt::rmatches(self, pat)
}

/// An iterator over the start and end indices of the disjoint matches
/// of a pattern within `self`.
/// An iterator over the disjoint matches of a pattern within `self` as well
/// as the index that the match starts at.
///
/// For matches of `pat` within `self` that overlap, only the indices
/// corresponding to the first
/// match are returned.
/// corresponding to the first match are returned.
///
/// The pattern can be a simple `&str`, `char`, or a closure that
/// determines if a character matches.
/// Additional libraries might provide more complex patterns like
/// regular expressions.
/// The pattern can be a simple `&str`, `char`, or a closure that determines
/// if a character matches. Additional libraries might provide more complex
/// patterns like regular expressions.
///
/// # Iterator behavior
///
/// The returned iterator will be double ended if the pattern allows a
/// reverse search
/// and forward/reverse search yields the same elements. This is true for,
/// eg, `char` but not
/// for `&str`.
/// reverse search and forward/reverse search yields the same elements. This
/// is true for, eg, `char` but not for `&str`.
///
/// If the pattern allows a reverse search but its results might differ
/// from a forward search, `rmatch_indices()` can be used.
Expand All @@ -1185,42 +1179,36 @@ impl str {
/// ```
/// #![feature(str_match_indices)]
///
/// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".match_indices("abc").collect();
/// assert_eq!(v, [(0, 3), (6, 9), (12, 15)]);
/// let v: Vec<_> = "abcXXXabcYYYabc".match_indices("abc").collect();
/// assert_eq!(v, [(0, "abc"), (6, "abc"), (12, "abc")]);
///
/// let v: Vec<(usize, usize)> = "1abcabc2".match_indices("abc").collect();
/// assert_eq!(v, [(1, 4), (4, 7)]);
/// let v: Vec<_> = "1abcabc2".match_indices("abc").collect();
/// assert_eq!(v, [(1, "abc"), (4, "abc")]);
///
/// let v: Vec<(usize, usize)> = "ababa".match_indices("aba").collect();
/// assert_eq!(v, [(0, 3)]); // only the first `aba`
/// let v: Vec<_> = "ababa".match_indices("aba").collect();
/// assert_eq!(v, [(0, "aba")]); // only the first `aba`
/// ```
#[unstable(feature = "str_match_indices",
reason = "might have its iterator type changed",
issue = "27743")]
// NB: Right now MatchIndices yields `(usize, usize)`, but it would
// be more consistent with `matches` and `char_indices` to return `(usize, &str)`
pub fn match_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> MatchIndices<'a, P> {
core_str::StrExt::match_indices(self, pat)
}

/// An iterator over the start and end indices of the disjoint matches of
/// a pattern within
/// `self`, yielded in reverse order.
/// An iterator over the disjoint matches of a pattern within `self`,
/// yielded in reverse order along with the index of the match.
///
/// For matches of `pat` within `self` that overlap, only the indices
/// corresponding to the last
/// match are returned.
/// corresponding to the last match are returned.
///
/// The pattern can be a simple `&str`, `char`, or a closure that
/// determines if a character matches.
/// Additional libraries might provide more complex patterns like
/// regular expressions.
/// The pattern can be a simple `&str`, `char`, or a closure that determines
/// if a character matches. Additional libraries might provide more complex
/// patterns like regular expressions.
///
/// # Iterator behavior
///
/// The returned iterator requires that the pattern supports a
/// reverse search,
/// and it will be double ended if a forward/reverse search yields
/// The returned iterator requires that the pattern supports a reverse
/// search, and it will be double ended if a forward/reverse search yields
/// the same elements.
///
/// For iterating from the front, `match_indices()` can be used.
Expand All @@ -1230,20 +1218,18 @@ impl str {
/// ```
/// #![feature(str_match_indices)]
///
/// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".rmatch_indices("abc").collect();
/// assert_eq!(v, [(12, 15), (6, 9), (0, 3)]);
/// let v: Vec<_> = "abcXXXabcYYYabc".rmatch_indices("abc").collect();
/// assert_eq!(v, [(12, "abc"), (6, "abc"), (0, "abc")]);
///
/// let v: Vec<(usize, usize)> = "1abcabc2".rmatch_indices("abc").collect();
/// assert_eq!(v, [(4, 7), (1, 4)]);
/// let v: Vec<_> = "1abcabc2".rmatch_indices("abc").collect();
/// assert_eq!(v, [(4, "abc"), (1, "abc")]);
///
/// let v: Vec<(usize, usize)> = "ababa".rmatch_indices("aba").collect();
/// assert_eq!(v, [(2, 5)]); // only the last `aba`
/// let v: Vec<_> = "ababa".rmatch_indices("aba").collect();
/// assert_eq!(v, [(2, "aba")]); // only the last `aba`
/// ```
#[unstable(feature = "str_match_indices",
reason = "might have its iterator type changed",
issue = "27743")]
// NB: Right now RMatchIndices yields `(usize, usize)`, but it would
// be more consistent with `rmatches` and `char_indices` to return `(usize, &str)`
pub fn rmatch_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatchIndices<'a, P>
where P::Searcher: ReverseSearcher<'a>
{
Expand Down Expand Up @@ -1416,10 +1402,10 @@ impl str {
pub fn replace(&self, from: &str, to: &str) -> String {
let mut result = String::new();
let mut last_end = 0;
for (start, end) in self.match_indices(from) {
for (start, part) in self.match_indices(from) {
result.push_str(unsafe { self.slice_unchecked(last_end, start) });
result.push_str(to);
last_end = end;
last_end = start + part.len();
}
result.push_str(unsafe { self.slice_unchecked(last_end, self.len()) });
result
Expand Down
24 changes: 22 additions & 2 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,8 +1041,8 @@ impl ops::DerefMut for String {
#[unstable(feature = "str_parse_error", reason = "may want to be replaced with \
Void if it ever exists",
issue = "27734")]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct ParseError(());
#[derive(Copy)]
pub enum ParseError {}

#[stable(feature = "rust1", since = "1.0.0")]
impl FromStr for String {
Expand All @@ -1053,6 +1053,26 @@ impl FromStr for String {
}
}

impl Clone for ParseError {
fn clone(&self) -> ParseError {
match *self {}
}
}

impl fmt::Debug for ParseError {
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
match *self {}
}
}

impl PartialEq for ParseError {
fn eq(&self, _: &ParseError) -> bool {
match *self {}
}
}

impl Eq for ParseError {}

/// A generic trait for converting a value to a string
#[stable(feature = "rust1", since = "1.0.0")]
pub trait ToString {
Expand Down
2 changes: 0 additions & 2 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,6 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// #![feature(split_off)]
///
/// let mut vec = vec![1,2,3];
/// let vec2 = vec.split_off(1);
/// assert_eq!(vec, [1]);
Expand Down
13 changes: 1 addition & 12 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1319,8 +1319,6 @@ impl<T> VecDeque<T> {
/// # Examples
///
/// ```
/// #![feature(split_off)]
///
/// use std::collections::VecDeque;
///
/// let mut buf: VecDeque<_> = vec![1,2,3].into_iter().collect();
Expand Down Expand Up @@ -1406,8 +1404,6 @@ impl<T> VecDeque<T> {
/// # Examples
///
/// ```
/// #![feature(vec_deque_retain)]
///
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
Expand Down Expand Up @@ -1787,14 +1783,7 @@ impl<'a, T: 'a + Copy> Extend<&'a T> for VecDeque<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: fmt::Debug> fmt::Debug for VecDeque<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "["));

for (i, e) in self.iter().enumerate() {
if i != 0 { try!(write!(f, ", ")); }
try!(write!(f, "{:?}", *e));
}

write!(f, "]")
f.debug_list().entries(self).finish()
}
}

Expand Down
5 changes: 0 additions & 5 deletions src/libcollectionstest/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

#![feature(ascii)]
#![feature(append)]
#![feature(binary_heap_extras)]
#![feature(box_syntax)]
#![feature(btree_range)]
Expand All @@ -29,18 +28,14 @@
#![feature(set_recovery)]
#![feature(slice_bytes)]
#![feature(slice_splits)]
#![feature(split_off)]
#![feature(step_by)]
#![feature(str_char)]
#![feature(str_escape)]
#![feature(str_match_indices)]
#![feature(str_split_at)]
#![feature(str_utf16)]
#![feature(box_str)]
#![feature(test)]
#![feature(unboxed_closures)]
#![feature(unicode)]
#![feature(vec_deque_retain)]
#![feature(vec_push_all)]

#[macro_use] extern crate log;
Expand Down
4 changes: 2 additions & 2 deletions src/libcollectionstest/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ fn test_pattern_deref_forward() {
fn test_empty_match_indices() {
let data = "aä中!";
let vec: Vec<_> = data.match_indices("").collect();
assert_eq!(vec, [(0, 0), (1, 1), (3, 3), (6, 6), (7, 7)]);
assert_eq!(vec, [(0, ""), (1, ""), (3, ""), (6, ""), (7, "")]);
}

#[test]
Expand Down Expand Up @@ -1477,7 +1477,7 @@ generate_iterator_test! {

generate_iterator_test! {
double_ended_match_indices {
("a1b2c3", char::is_numeric) -> [(1, 2), (3, 4), (5, 6)];
("a1b2c3", char::is_numeric) -> [(1, "1"), (3, "2"), (5, "3")];
}
with str::match_indices, str::rmatch_indices;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,7 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeTo<Idx> {
/// impl<T> Deref for DerefExample<T> {
/// type Target = T;
///
/// fn deref<'a>(&'a self) -> &'a T {
/// fn deref(&self) -> &T {
/// &self.value
/// }
/// }
Expand Down
Loading