]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoRollup merge of #28666 - GuillaumeGomez:warning, r=arielb1
Steve Klabnik [Sun, 27 Sep 2015 00:00:38 +0000 (18:00 -0600)]
Rollup merge of #28666 - GuillaumeGomez:warning, r=arielb1

r? @Manishearth

8 years agoAuto merge of #28635 - alexcrichton:str-parse-error-void, r=aturon
bors [Sat, 26 Sep 2015 21:52:37 +0000 (21:52 +0000)]
Auto merge of #28635 - alexcrichton:str-parse-error-void, r=aturon

It can never be instantiated, so signify this by having it actually be an empty
`enum`.

cc #27734

8 years agoAuto merge of #28632 - alexcrichton:update-match-indices, r=Kimundi
bors [Sat, 26 Sep 2015 20:06:51 +0000 (20:06 +0000)]
Auto merge of #28632 - alexcrichton:update-match-indices, r=Kimundi

This commit updates the `MatchIndices` and `RMatchIndices` iterators to follow
the same pattern as the `chars` and `char_indices` iterators. The `matches`
iterator currently yield `&str` elements, so the `MatchIndices` iterator now
yields the index of the match as well as the `&str` that matched (instead of
start/end indexes).

cc #27743

8 years agoAuto merge of #28593 - gandro:rumprun, r=alexcrichton
bors [Sat, 26 Sep 2015 18:21:15 +0000 (18:21 +0000)]
Auto merge of #28593 - gandro:rumprun, r=alexcrichton

This adds a new target, `x86_64-rumprun-netbsd`, and related changes to `std`.

Rumprun is a unikernel platform that provides a POSIX-y interface. For the most part, rumprun uses NetBSD's libc and drivers, therefore `target_os` is `netbsd`. However, being a unikernel, rumprun does not support process management, signals or virtual memory, so related functions might fail at runtime. For this reason, stack guards are disabled in `std`.

To support conditional compilation, `target_env` is set to `rumprun`. Maybe `target_vendor` would be technically more fitting, but it doesn't seem to be worth the hassle.

Code for rumprun is always cross-compiled, it uses always static linking and needs a custom linker. The target makes use of the newly introduced `no_default_libs` flag, as the rumprun linker will otherwise not use the correct search path.

8 years agoAuto merge of #28649 - nhowell:improve-rustbook, r=steveklabnik
bors [Sat, 26 Sep 2015 16:34:56 +0000 (16:34 +0000)]
Auto merge of #28649 - nhowell:improve-rustbook, r=steveklabnik

Please see the commits for details.

Live demo: http://www.nickhowell.com/rust/book/

Commit 0bebbab should fix #22682

r? @steveklabnik

8 years agoRemove warning of duplicated error code
Guillaume Gomez [Fri, 25 Sep 2015 22:03:10 +0000 (00:03 +0200)]
Remove warning of duplicated error code

8 years agoAuto merge of #28642 - petrochenkov:name3, r=nrc
bors [Sat, 26 Sep 2015 14:48:56 +0000 (14:48 +0000)]
Auto merge of #28642 - petrochenkov:name3, r=nrc

This PR removes random remaining `Ident`s outside of libsyntax and performs general cleanup
In particular, interfaces of `Name` and `Ident` are tidied up, `Name`s and `Ident`s being small `Copy` aggregates are always passed to functions by value, and `Ident`s are never used as keys in maps, because `Ident` comparisons are tricky.

Although this PR closes https://github.com/rust-lang/rust/issues/6993 there's still work related to it:
- `Name` can be made `NonZero` to compress numerous `Option<Name>`s and `Option<Ident>`s but it requires const unsafe functions.
- Implementation of `PartialEq` on `Ident` should be eliminated and replaced with explicit hygienic, non-hygienic or member-wise comparisons.
- Finally, large parts of AST can potentially be converted to `Name`s in the same way as HIR to clearly separate identifiers used in hygienic and non-hygienic contexts.

r? @nrc

8 years agoAuto merge of #28629 - arielb1:supertrait-self, r=eddyb
bors [Sat, 26 Sep 2015 13:03:08 +0000 (13:03 +0000)]
Auto merge of #28629 - arielb1:supertrait-self, r=eddyb

Fixes #28576

r? @eddyb

8 years agoAdd support for the rumprun unikernel
Sebastian Wicki [Mon, 21 Sep 2015 17:16:24 +0000 (19:16 +0200)]
Add support for the rumprun unikernel

For most parts, rumprun currently looks like NetBSD, as they share the same
libc and drivers. However, being a unikernel, rumprun does not support
process management, signals or virtual memory, so related functions
might fail at runtime. Stack guards are disabled exactly for this reason.

Code for rumprun is always cross-compiled, it uses always static
linking and needs a custom linker.

8 years agoAuto merge of #28638 - wthrowe:gdb-version, r=alexcrichton
bors [Sat, 26 Sep 2015 11:16:40 +0000 (11:16 +0000)]
Auto merge of #28638 - wthrowe:gdb-version, r=alexcrichton

GDB 7.10 was recently released.

8 years agoAuto merge of #28631 - ranma42:robust-panic, r=alexcrichton
bors [Sat, 26 Sep 2015 07:19:22 +0000 (07:19 +0000)]
Auto merge of #28631 - ranma42:robust-panic, r=alexcrichton

This is mainly to avoid infinite recursion and make debugging more convenient in the anomalous case in which `on_panic` panics.
I encountered such issues while changing libstd to debug/fix part of #28129.

While writing this I was wondering about which functions belong to `panicking` and which to `unwind`.
I placed them in this way mostly because of convenience, but I would strongly appreciate guidance.

8 years agoAuto merge of #28615 - sfackler:formatter-methods, r=alexcrichton
bors [Sat, 26 Sep 2015 02:02:03 +0000 (02:02 +0000)]
Auto merge of #28615 - sfackler:formatter-methods, r=alexcrichton

cc #27726

r? @alexcrichton

8 years agoAuto merge of #28612 - gandro:targetvendor, r=alexcrichton
bors [Sat, 26 Sep 2015 00:14:39 +0000 (00:14 +0000)]
Auto merge of #28612 - gandro:targetvendor, r=alexcrichton

This adds a new target property, `target_vendor`. It is to be be used as a matcher for conditional compilation. The vendor is part of the [autoconf target triple](http://llvm.org/docs/doxygen/html/classllvm_1_1Triple.html#details): `<arch><sub>-<vendor>-<os>-<env>`. `arch`, `target_os` and `target_env` are already supported by Rust.

This change was suggested in PR #28593. It enables conditional compilation based on the vendor. This is needed for the rumprun target, which needs to match against both, target_os and target_vendor.

The default value for `target_vendor` is "unknown", "apple" and "pc" are other common values.

Matching against the `target_vendor` is introduced behind the feature gate `#![feature(cfg_target_vendor)]`.

This is the first time I messed around with rustc internals. I just added the my code where I found the existing `target_*` variables, hopefully I haven't missed anything. Please review with care. :)

r? @alexcrichton

8 years agoAuto merge of #28665 - steveklabnik:rollup, r=steveklabnik
bors [Fri, 25 Sep 2015 21:52:52 +0000 (21:52 +0000)]
Auto merge of #28665 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #28319, #28588, #28637, #28652, #28654, #28655
- Failed merges: #28621

8 years agoRollup merge of #28655 - alfiedotwtf:patch-2, r=sanxiyn
Steve Klabnik [Fri, 25 Sep 2015 19:33:33 +0000 (13:33 -0600)]
Rollup merge of #28655 - alfiedotwtf:patch-2, r=sanxiyn

8 years agoRollup merge of #28654 - ogham:patch-2, r=sanxiyn
Steve Klabnik [Fri, 25 Sep 2015 19:33:32 +0000 (13:33 -0600)]
Rollup merge of #28654 - ogham:patch-2, r=sanxiyn

This was discovered by maggyero on #rust.

In the [documentation for the macros in libstd](https://doc.rust-lang.org/stable/std/#macros), the first lines for `print!` and `println!` were exactly the same, with no mention of how one of them also emits a newline:

<img width="622" alt="screen shot 2015-09-25 at 12 11 52" src="https://cloud.githubusercontent.com/assets/503760/10099409/465d509a-6381-11e5-9eb9-766f21a08c50.png">

This commit makes the first lines of those two macros different.

8 years agoRollup merge of #28652 - SimonSapin:patch-11, r=sanxiyn
Steve Klabnik [Fri, 25 Sep 2015 19:33:32 +0000 (13:33 -0600)]
Rollup merge of #28652 - SimonSapin:patch-11, r=sanxiyn

Caught by Brian Smith: https://github.com/rust-lang/rust/issues/27774#issuecomment-143154735

8 years agoRollup merge of #28637 - SimonSapin:patch-6, r=alexcrichton
Steve Klabnik [Fri, 25 Sep 2015 19:33:32 +0000 (13:33 -0600)]
Rollup merge of #28637 - SimonSapin:patch-6, r=alexcrichton

8 years agoRollup merge of #28588 - critiqjo:trpl-closure, r=steveklabnik
Steve Klabnik [Fri, 25 Sep 2015 19:33:31 +0000 (13:33 -0600)]
Rollup merge of #28588 - critiqjo:trpl-closure, r=steveklabnik

r? @steveklabnik

8 years agoRollup merge of #28319 - Manishearth:mem_docs, r=steveklabnik
Steve Klabnik [Fri, 25 Sep 2015 19:33:31 +0000 (13:33 -0600)]
Rollup merge of #28319 - Manishearth:mem_docs, r=steveklabnik

https://users.rust-lang.org/t/confused-by-std-mem-drop/2783/3

r? @Gankro

8 years agoAdd note about Copy for drop()
Manish Goregaokar [Mon, 21 Sep 2015 02:40:30 +0000 (08:10 +0530)]
Add note about Copy for drop()

8 years agoAuto merge of #28610 - nrc:fmt6, r=brson
bors [Fri, 25 Sep 2015 19:06:02 +0000 (19:06 +0000)]
Auto merge of #28610 - nrc:fmt6, r=brson

8 years agostd: Update MatchIndices to return a subslice
Alex Crichton [Thu, 24 Sep 2015 15:38:48 +0000 (08:38 -0700)]
std: Update MatchIndices to return a subslice

This commit updates the `MatchIndices` and `RMatchIndices` iterators to follow
the same pattern as the `chars` and `char_indices` iterators. The `matches`
iterator currently yield `&str` elements, so the `MatchIndices` iterator now
yields the index of the match as well as the `&str` that matched (instead of
start/end indexes).

cc #27743

8 years agoKeep examples consistent
Alfie John [Fri, 25 Sep 2015 12:02:21 +0000 (12:02 +0000)]
Keep examples consistent

8 years agoChange the first line of the println macro doc
Ben S [Fri, 25 Sep 2015 11:29:47 +0000 (12:29 +0100)]
Change the first line of the println macro doc

This makes the first lines of the print! and println! macros
different. Previously, they would show up exactly the same in the
documentation for the macros in libstd [1], with nothing about how
one of them also prints a newline.

[1]: https://doc.rust-lang.org/stable/std/#macros

8 years agoDocs: &A and &mut A are references, not pointers
Simon Sapin [Fri, 25 Sep 2015 11:01:31 +0000 (13:01 +0200)]
Docs: &A and &mut A are references, not pointers

Caught by Brian Smith: https://github.com/rust-lang/rust/issues/27774#issuecomment-143154735

8 years agorustbook: Decrease the max-width for the mobile view
Nick Howell [Fri, 25 Sep 2015 04:36:30 +0000 (00:36 -0400)]
rustbook: Decrease the max-width for the mobile view

This should fix #22682.

"max-width: 1023px" seems like a good compromise here. This way,
1024x768 monitors will still see the sidebar (plus, iPad in landscape
mode).

8 years agoCleanup rustbook.css and fix some padding issues
Nick Howell [Fri, 25 Sep 2015 04:23:14 +0000 (00:23 -0400)]
Cleanup rustbook.css and fix some padding issues

8 years agorustbook: Inline javascript.rs into build.rs
Nick Howell [Fri, 25 Sep 2015 02:43:18 +0000 (22:43 -0400)]
rustbook: Inline javascript.rs into build.rs

There's no need for javascript.rs now that its contents were moved into
.js files.

Also, adjust a couple variable names and some indentation in build.rs.

8 years agoAdd 'use strict' to playpen.js
Nick Howell [Fri, 25 Sep 2015 02:35:04 +0000 (22:35 -0400)]
Add 'use strict' to playpen.js

8 years agoReplace occurrences of "rust-book" with "rustbook"
Nick Howell [Fri, 25 Sep 2015 02:34:01 +0000 (22:34 -0400)]
Replace occurrences of "rust-book" with "rustbook"

8 years agoAuto merge of #28505 - apasel422:issue-28448, r=alexcrichton
bors [Fri, 25 Sep 2015 02:05:25 +0000 (02:05 +0000)]
Auto merge of #28505 - apasel422:issue-28448, r=alexcrichton

Closes #28448.

r? @brson

8 years agoCleanup rustbook.js and add 'use strict'
Nick Howell [Fri, 25 Sep 2015 01:59:43 +0000 (21:59 -0400)]
Cleanup rustbook.js and add 'use strict'

Mostly indentation fixes, but a little refactoring, too.

8 years agoAbort earlier upon multi-panics
Andrea Canciani [Thu, 24 Sep 2015 15:21:29 +0000 (17:21 +0200)]
Abort earlier upon multi-panics

The double-panic `abort` is run after the logging code, to provide
feedback in case of a double-panic. This means that if the panic
logging fails with a panic, the `abort` might never be reached.

This should not normally occur, but if the `on_panic` function detects
more than 2 panics, aborting *before* logging makes panic handling
somewhat more robust, as it avoids an infinite recursion, which would
eventually crash the process, but also make the problem harder to
debug.

This handles the FIXME about what to do if the thread printing panics.

8 years agoExplicitly count the number of panics
Andrea Canciani [Thu, 24 Sep 2015 21:49:38 +0000 (23:49 +0200)]
Explicitly count the number of panics

Move the panic handling logic from the `unwind` module to `panicking`
and use a panic counter to distinguish between normal state, panics
and double panics.

8 years agoSeparate panic logging code
Andrea Canciani [Wed, 23 Sep 2015 17:47:15 +0000 (19:47 +0200)]
Separate panic logging code

Move the panic logging code to a function separate from `on_panic` and
simplify the code to decide whether the backtrace should be logged.

8 years agoAuto merge of #28608 - eddyb:no-place-for-an-old-box, r=pnkfelix
bors [Thu, 24 Sep 2015 20:42:56 +0000 (20:42 +0000)]
Auto merge of #28608 - eddyb:no-place-for-an-old-box, r=pnkfelix

While this is technically a [breaking-change], there is no excuse for touching `HEAP`.
r? @pnkfelix

8 years agoCleanup interfaces of Name, SyntaxContext and Ident
Vadim Petrochenkov [Thu, 24 Sep 2015 20:05:02 +0000 (23:05 +0300)]
Cleanup interfaces of Name, SyntaxContext and Ident
Make sure Name, SyntaxContext and Ident are passed by value
Make sure Idents don't serve as keys (or parts of keys) in maps, Ident comparison is not well defined

8 years agoAuto merge of #28538 - alevy:make_fixedsizearray_unsafe, r=alexcrichton
bors [Thu, 24 Sep 2015 18:55:00 +0000 (18:55 +0000)]
Auto merge of #28538 - alevy:make_fixedsizearray_unsafe, r=alexcrichton

[breaking-change]

`FixedSizeArray` is meant to be implemented for arrays of fixed size only, but can be implemented for anything at the moment. Marking the trait unsafe would make it more reasonable to write unsafe code which operates on fixed size arrays of any size.

For example, using `uninitialized` to create a fixed size array and immediately filling it with a fixed value is externally safe:

```
pub fn init_with_nones<T, A: FixedSizeArray<Option<T>>>() -> A {
    let mut res = unsafe { mem::uninitialized() };
    for elm in res.as_mut_slice().iter_mut() {
        *elm = None;
    }
    res
}
```

But the same code is not safe if `FixedSizeArray` is implemented for other types:

```
struct Foo { foo: usize }
impl FixedSizeArray<Option<usize>> for Foo {
    fn as_slice(&self) -> &[usize] { &[] }
    fn as_mut_slice(&self) -> &mut [usize] { &mut [] }
}
```

now `init_with_nones() : Foo` returns a `Foo` with an undefined value for the field `foo`.

8 years agotrpl: Refactor returning closures section
critiqjo [Tue, 22 Sep 2015 12:55:01 +0000 (18:25 +0530)]
trpl: Refactor returning closures section

8 years agoFix `target_vendor` for Android
Sebastian Wicki [Thu, 24 Sep 2015 17:44:27 +0000 (19:44 +0200)]
Fix `target_vendor` for Android

8 years agoAuto merge of #28634 - steveklabnik:rollup, r=steveklabnik
bors [Thu, 24 Sep 2015 17:07:04 +0000 (17:07 +0000)]
Auto merge of #28634 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #28616, #28617, #28618, #28619, #28620, #28622
- Failed merges: #28621

8 years agoAllow multi-digit GDB minor version numbers
William Throwe [Thu, 24 Sep 2015 04:34:20 +0000 (00:34 -0400)]
Allow multi-digit GDB minor version numbers

GDB 7.10 was recently released.

8 years agoUtf8Error::valid_up_to: make documented semantics more precise/useful
Simon Sapin [Thu, 24 Sep 2015 16:54:12 +0000 (18:54 +0200)]
Utf8Error::valid_up_to: make documented semantics more precise/useful

8 years agostd: Switch string::ParseError to an empty enum
Alex Crichton [Thu, 24 Sep 2015 16:40:50 +0000 (09:40 -0700)]
std: Switch string::ParseError to an empty enum

It can never be instantiated, so signify this by having it actually be an empty
`enum`.

cc #27734

8 years agoRollup merge of #28622 - tshepang:known-as-structs, r=steveklabnik
Steve Klabnik [Thu, 24 Sep 2015 16:26:37 +0000 (10:26 -0600)]
Rollup merge of #28622 - tshepang:known-as-structs, r=steveklabnik

8 years agoRollup merge of #28620 - tshepang:not-filled, r=steveklabnik
Steve Klabnik [Thu, 24 Sep 2015 16:26:37 +0000 (10:26 -0600)]
Rollup merge of #28620 - tshepang:not-filled, r=steveklabnik

8 years agoRollup merge of #28619 - tshepang:fix-link, r=steveklabnik
Steve Klabnik [Thu, 24 Sep 2015 16:26:37 +0000 (10:26 -0600)]
Rollup merge of #28619 - tshepang:fix-link, r=steveklabnik

8 years agoRollup merge of #28618 - tshepang:repetition, r=steveklabnik
Steve Klabnik [Thu, 24 Sep 2015 16:26:36 +0000 (10:26 -0600)]
Rollup merge of #28618 - tshepang:repetition, r=steveklabnik

8 years agoRollup merge of #28617 - tshepang:optional, r=steveklabnik
Steve Klabnik [Thu, 24 Sep 2015 16:26:36 +0000 (10:26 -0600)]
Rollup merge of #28617 - tshepang:optional, r=steveklabnik

8 years agoRollup merge of #28616 - tshepang:idiom, r=steveklabnik
Steve Klabnik [Thu, 24 Sep 2015 16:26:36 +0000 (10:26 -0600)]
Rollup merge of #28616 - tshepang:idiom, r=steveklabnik

8 years agoearly-prohibit objects with Self-containing supertraits
Ariel Ben-Yehuda [Thu, 24 Sep 2015 15:27:29 +0000 (18:27 +0300)]
early-prohibit objects with Self-containing supertraits

Fixes #28576

8 years agoRemove the deprecated box(PLACE) syntax.
Eduard Burtescu [Thu, 24 Sep 2015 15:00:08 +0000 (18:00 +0300)]
Remove the deprecated box(PLACE) syntax.

8 years agoAuto merge of #28602 - apasel422:clone_from, r=bluss
bors [Thu, 24 Sep 2015 14:19:20 +0000 (14:19 +0000)]
Auto merge of #28602 - apasel422:clone_from, r=bluss

r? @bluss

8 years agoOptimize `Vec::clone_from`
Andrew Paseltiner [Wed, 23 Sep 2015 14:33:36 +0000 (10:33 -0400)]
Optimize `Vec::clone_from`

Before:

test dst_bigger::src_100_dst_1000::clone      ... bench:  34 ns/iter (+/- 1)
test dst_bigger::src_100_dst_1000::clone_from ... bench:  75 ns/iter (+/- 3)

test dst_bigger::src_10_dst_100::clone        ... bench:  25 ns/iter (+/- 0)
test dst_bigger::src_10_dst_100::clone_from   ... bench:   9 ns/iter (+/- 1)

test eq::src_1000_dst_1000::clone             ... bench: 105 ns/iter (+/- 2)
test eq::src_1000_dst_1000::clone_from        ... bench: 593 ns/iter (+/- 21)

test eq::src_100_dst_100::clone               ... bench:  34 ns/iter (+/- 1)
test eq::src_100_dst_100::clone_from          ... bench:  75 ns/iter (+/- 1)

test src_bigger::src_1000_dst_100::clone      ... bench: 103 ns/iter (+/- 5)
test src_bigger::src_1000_dst_100::clone_from ... bench: 148 ns/iter (+/- 5)

test src_bigger::src_100_dst_10::clone        ... bench:  34 ns/iter (+/- 1)
test src_bigger::src_100_dst_10::clone_from   ... bench:  20 ns/iter (+/- 0)

After:

test dst_bigger::src_100_dst_1000::clone      ... bench:  34 ns/iter (+/- 2)
test dst_bigger::src_100_dst_1000::clone_from ... bench:  15 ns/iter (+/- 1)

test dst_bigger::src_10_dst_100::clone        ... bench:  26 ns/iter (+/- 1)
test dst_bigger::src_10_dst_100::clone_from   ... bench:   7 ns/iter (+/- 0)

test eq::src_1000_dst_1000::clone             ... bench: 103 ns/iter (+/- 1)
test eq::src_1000_dst_1000::clone_from        ... bench:  85 ns/iter (+/- 4)

test eq::src_100_dst_100::clone               ... bench:  34 ns/iter (+/- 2)
test eq::src_100_dst_100::clone_from          ... bench:  15 ns/iter (+/- 1)

test src_bigger::src_1000_dst_100::clone      ... bench: 103 ns/iter (+/- 4)
test src_bigger::src_1000_dst_100::clone_from ... bench:  90 ns/iter (+/- 2)

test src_bigger::src_100_dst_10::clone        ... bench:  34 ns/iter (+/- 2)
test src_bigger::src_100_dst_10::clone_from   ... bench:  20 ns/iter (+/- 0)

Closes #28601.

8 years agoreference: rename "structure" to the more familiar "struct"
Tshepang Lekhonkhobe [Thu, 24 Sep 2015 06:42:39 +0000 (08:42 +0200)]
reference: rename "structure" to the more familiar "struct"

8 years agoAdd accessors for Formatter flags
Steven Fackler [Thu, 24 Sep 2015 06:35:12 +0000 (23:35 -0700)]
Add accessors for Formatter flags

cc #27726

8 years agoreference: follow idiom in code snippet
Tshepang Lekhonkhobe [Thu, 24 Sep 2015 06:25:29 +0000 (08:25 +0200)]
reference: follow idiom in code snippet

8 years agoreference: 3 of the 4 things mentioned here are optional
Tshepang Lekhonkhobe [Thu, 24 Sep 2015 06:18:00 +0000 (08:18 +0200)]
reference: 3 of the 4 things mentioned here are optional

8 years agodoc: "familiarity" does not need to be repeated here
Tshepang Lekhonkhobe [Thu, 24 Sep 2015 06:04:55 +0000 (08:04 +0200)]
doc: "familiarity" does not need to be repeated here

8 years agoreference: fix anchor link
Tshepang Lekhonkhobe [Thu, 24 Sep 2015 05:55:59 +0000 (07:55 +0200)]
reference: fix anchor link

8 years agoreference: not sure this is the right place to discuss design
Tshepang Lekhonkhobe [Thu, 24 Sep 2015 05:50:44 +0000 (07:50 +0200)]
reference: not sure this is the right place to discuss design

8 years agoAuto merge of #28607 - remram44:doc-fix-str-pattern, r=alexcrichton
bors [Thu, 24 Sep 2015 02:39:02 +0000 (02:39 +0000)]
Auto merge of #28607 - remram44:doc-fix-str-pattern, r=alexcrichton

Reported by Moonlightning on #rust
> 17:13 EDT < Moonlightning> I think I found a bug in the str::matches() documentation. Was it copied from str::split()? :p
> 17:13 EDT < Moonlightning> Because it says “The pattern can be a simple `&str`, `char`, or a closure that determines the split.”

I changed "determines the split" to "determines if a character matches".

It's not super clear, "determines the split" is not super clear to begin with, maybe this can be made better? On the other hand following the link to Pattern provides enough details.

8 years agoAuto merge of #28598 - semarie:openbsd-unbreak, r=alexcrichton
bors [Thu, 24 Sep 2015 00:02:07 +0000 (00:02 +0000)]
Auto merge of #28598 - semarie:openbsd-unbreak, r=alexcrichton

separate use code between openbsd/netbsd

netbsd use c_int and c_uint, but openbsd not, resulting a unused_import
error.

r? @alexcrichton

problem introduced by #28543

8 years agorustc: Add target_vendor for target triples
Sebastian Wicki [Wed, 23 Sep 2015 23:20:43 +0000 (01:20 +0200)]
rustc: Add target_vendor for target triples

This adds a new target property, `target_vendor` which can be used as a
matcher for conditional compilation. The vendor is part of the autoconf
target triple: <arch><sub>-<vendor>-<os>-<env>

The default value for `target_vendor` is "unknown".

Matching against the `target_vendor` with `#[cfg]` is currently feature
gated as `cfg_target_vendor`.

8 years agoBetter function calls
Nick Cameron [Wed, 23 Sep 2015 23:32:01 +0000 (11:32 +1200)]
Better function calls

8 years agomanual fixups
Nick Cameron [Wed, 23 Sep 2015 22:03:05 +0000 (10:03 +1200)]
manual fixups

8 years agorustfmt liballoc
Nick Cameron [Wed, 23 Sep 2015 22:00:54 +0000 (10:00 +1200)]
rustfmt liballoc

8 years agoAuto merge of #28596 - sanxiyn:dedup-unused, r=alexcrichton
bors [Wed, 23 Sep 2015 21:41:09 +0000 (21:41 +0000)]
Auto merge of #28596 - sanxiyn:dedup-unused, r=alexcrichton

Fix #22599.

8 years agoAuto merge of #28569 - semarie:stdcpp-tests, r=alexcrichton
bors [Wed, 23 Sep 2015 18:55:01 +0000 (18:55 +0000)]
Auto merge of #28569 - semarie:stdcpp-tests, r=alexcrichton

extend the search path of libraries to /usr/local/lib in `run-make`
testsuite. It should permit to find libstdc++.so on usual directory.

r? @alexcrichton

8 years agoFix bad copypasta for patterns doc in std::str
Remi Rampin [Wed, 23 Sep 2015 18:35:53 +0000 (14:35 -0400)]
Fix bad copypasta for patterns doc in std::str

8 years agoRemove random Idents outside of libsyntax
Vadim Petrochenkov [Wed, 23 Sep 2015 17:04:49 +0000 (20:04 +0300)]
Remove random Idents outside of libsyntax

8 years agoAuto merge of #28603 - steveklabnik:small_config_fix, r=alexcrichton
bors [Wed, 23 Sep 2015 16:07:04 +0000 (16:07 +0000)]
Auto merge of #28603 - steveklabnik:small_config_fix, r=alexcrichton

We don't actually probe for javac in all circumstances, so if you have
javac installed, but don't have antlr4 installed, and you're on Mac OS
X, then you'll get a message that javac is missing, even though that's
wrong.

To fix this, let's just be a bit more generic in the message, so that
it's the same no matter what part of the lexer tests you're missing.

cc
https://www.reddit.com/r/rust/comments/3m199d/running_make_check_on_the_source_code_says_javac/

8 years agoMake lexer tooling message more generic
Steve Klabnik [Wed, 23 Sep 2015 15:43:49 +0000 (11:43 -0400)]
Make lexer tooling message more generic

We don't actually probe for javac in all circumstances, so if you have
javac installed, but don't have antlr4 installed, and you're on Mac OS
X, then you'll get a message that javac is missing, even though that's
wrong.

To fix this, let's just be a bit more generic in the message, so that
it's the same no matter what part of the lexer tests you're missing.

cc
https://www.reddit.com/r/rust/comments/3m199d/running_make_check_on_the_source_code_says_javac/

8 years agoExplain in comment why FixedSizeArray is unsafe
Amit Aryeh Levy [Wed, 23 Sep 2015 15:38:01 +0000 (11:38 -0400)]
Explain in comment why FixedSizeArray is unsafe

8 years agoOverride `clone_from` for `{BinaryHeap, String}`
Andrew Paseltiner [Wed, 23 Sep 2015 12:49:50 +0000 (08:49 -0400)]
Override `clone_from` for `{BinaryHeap, String}`

CC #28481

8 years agounbreak openbsd after netbsd integration
Sébastien Marie [Wed, 23 Sep 2015 04:39:42 +0000 (06:39 +0200)]
unbreak openbsd after netbsd integration

separate use code between openbsd/netbsd.

netbsd use c_int and c_uint, but openbsd not, resulting a unused_import
error.

8 years agoAuto merge of #28585 - ranma42:simpler-panic, r=alexcrichton
bors [Wed, 23 Sep 2015 03:56:27 +0000 (03:56 +0000)]
Auto merge of #28585 - ranma42:simpler-panic, r=alexcrichton

This is part of some cleanup I did while investigating #28129.
This also ensures that `on_panic` is run even if the user has registered too many callbacks.

8 years agoDo not traverse RHS of assignment twice for unused variables lint
Seo Sanghyeon [Wed, 23 Sep 2015 02:52:37 +0000 (11:52 +0900)]
Do not traverse RHS of assignment twice for unused variables lint

walk_expr includes call to visit_expr for subexpressions.

8 years agoAuto merge of #28580 - wesleywiser:split_out_type_lints, r=alexcrichton
bors [Wed, 23 Sep 2015 02:11:18 +0000 (02:11 +0000)]
Auto merge of #28580 - wesleywiser:split_out_type_lints, r=alexcrichton

Move out the `TypeLimits` and `ImproperCTypes` lints into a separate module.

Part of #22206

8 years agoAuto merge of #28535 - petrochenkov:name, r=nrc
bors [Wed, 23 Sep 2015 00:25:42 +0000 (00:25 +0000)]
Auto merge of #28535 - petrochenkov:name, r=nrc

Part of https://github.com/rust-lang/rust/issues/6993

This patch replaces `Ident`s with `Name`s in data structures of HIR and updates the dependent crates to compile and pass `make check`.
Some HIR structures still use `Ident`s, namely `PathSegment`, `PatIdent`, `ExprWhile`, `ExprLoop`, `ExprBreak` and `ExprAgain`,  they need them for resolve (but `PathSegment` is special, see https://github.com/rust-lang/rust/issues/6993#issuecomment-141256292).

r? @nrc

8 years agoAuto merge of #28504 - Eljay:fix-trait-privacy, r=nrc
bors [Tue, 22 Sep 2015 22:42:00 +0000 (22:42 +0000)]
Auto merge of #28504 - Eljay:fix-trait-privacy, r=nrc

Fixes #16264 / #18241.

As far as I can tell, it should be impossible for a trait to be inaccessible if it's in scope, so this check is unnecessary. Are there any cases where this check is actually needed?

8 years agoAuto merge of #28369 - ebfull:fix-higher-ranked, r=nikomatsakis
bors [Tue, 22 Sep 2015 20:57:43 +0000 (20:57 +0000)]
Auto merge of #28369 - ebfull:fix-higher-ranked, r=nikomatsakis

Fixes #28279.

Currently

`common_supertype(*mut for<'a> Fn(&'a usize), *mut for<'a> Fn(&'a usize) + 'static)`

equals `*mut Fn(&usize)` which seems to be caused by `higher_ranked_sub()` allowing region variables to escape the comparison. This prevents inference from working properly with stuff like `Rc<Fn(&T)>`.

r? @nikomatsakis

8 years agoAuto merge of #28543 - gandro:netbsd, r=alexcrichton
bors [Tue, 22 Sep 2015 19:13:39 +0000 (19:13 +0000)]
Auto merge of #28543 - gandro:netbsd, r=alexcrichton

These changes introduce the ability to cross-compile working binaries for NetBSD/amd64. Previous support added in PR #26682 shared all its code with the OpenBSD implementation, and was therefore never functional (e.g. linking against non-existing symbols and using wrong type definitions). Nonetheless, the previous patches were a great starting point and made my work significantly easier. :smiley:

Because there are no stage0 snapshots for NetBSD (yet), I used a cross-compiler for NetBSD 7.0 RC3 and only tested some toy programs (threading and channels, stack guards, a small TCP/IP echo server and some other platform dependent bits). If someone could point me to documentation on how to generate a stage0 snapshot from a cross-compiler I'm happy to run the full test suite.

A few other notes regarding Rust on NetBSD/amd64:
- To preserve binary compatibility, NetBSD introduces new symbols for system call wrappers on breaking ABI changes and keeps the old (legacy) symbols around, see [this documentation](https://www.netbsd.org/docs/internals/en/chap-processes.html#syscalls_master) for some details. I went ahead and modified the `libc` and `std` crate to use the current (renamed) symbols instead of the legacy ones where I found them, but I might have missed some. Notably using the `sigaction` symbol (deprecated in 1998) instead of `__sigaction14` even triggers SIGSYS (bad syscall) on my amd64 setup. I also changed the type definitions to use the most recent version.
- NetBSD's gdb doesn't really support position independent executables, so you might want to turn that off for debugging, see [NetBSD Problem Report #48250](https://gnats.netbsd.org/48250).
- For binaries invoked using a relative path, NetBSD supports `$ORIGIN` only for short `rpath`s (~64 chars or so, I'm told). If running an executable fails with `execname not specified in AUX vector: No such file or directory`, consider invoking the binary using its full absolute path.

8 years agoFix rebase
Vadim Petrochenkov [Tue, 22 Sep 2015 17:46:23 +0000 (20:46 +0300)]
Fix rebase

8 years agoRemove unwind::register
Andrea Canciani [Tue, 22 Sep 2015 16:51:04 +0000 (18:51 +0200)]
Remove unwind::register

The `register` function is unstable and it is not used anymore, hence
it can be removed (together with the now-unused `Callback` type and
`static` variables).

8 years agoRestore `fold_ident` and `visit_ident`
Vadim Petrochenkov [Tue, 22 Sep 2015 16:42:51 +0000 (19:42 +0300)]
Restore `fold_ident` and `visit_ident`

8 years agoUse Names in the remaining HIR structures with exception of...
Vadim Petrochenkov [Sun, 20 Sep 2015 13:47:24 +0000 (16:47 +0300)]
Use Names in the remaining HIR structures with exception of...
PathSegment, PatIdent, ExprWhile, ExprLoop, ExprBreak and ExprAgain - they need Idents for resolve

8 years agoUse Names in path fragments and MacroDef
Vadim Petrochenkov [Sun, 20 Sep 2015 11:51:40 +0000 (14:51 +0300)]
Use Names in path fragments and MacroDef

8 years agorun-make: search libstdc++ in /usr/local/lib too
Sébastien Marie [Mon, 21 Sep 2015 17:17:25 +0000 (19:17 +0200)]
run-make: search libstdc++ in /usr/local/lib too

extend the search path of libraries to /usr/local/lib in `run-make`
testsuite. It should permit to find libstdc++.so on usual directory.

8 years agoUse Names in hir::{Field, ExprMethodCall, ExprField}
Vadim Petrochenkov [Sun, 20 Sep 2015 11:00:18 +0000 (14:00 +0300)]
Use Names in hir::{Field, ExprMethodCall, ExprField}

8 years agoUse Names in HIR Items
Vadim Petrochenkov [Sun, 20 Sep 2015 01:50:30 +0000 (04:50 +0300)]
Use Names in HIR Items

8 years agoUse Names in HIR visitors and folders
Vadim Petrochenkov [Sun, 20 Sep 2015 00:34:12 +0000 (03:34 +0300)]
Use Names in HIR visitors and folders

8 years agoEncode/decode Names as strings
Vadim Petrochenkov [Sun, 20 Sep 2015 00:06:29 +0000 (03:06 +0300)]
Encode/decode Names as strings

8 years agoAuto merge of #28584 - ranma42:simpler-innertry, r=alexcrichton
bors [Tue, 22 Sep 2015 16:24:06 +0000 (16:24 +0000)]
Auto merge of #28584 - ranma42:simpler-innertry, r=alexcrichton

This simplifies a little inner_try and avoids multiple accesses to TLS.

8 years agoAuto merge of #28582 - jedireza:patch-1, r=huonw
bors [Tue, 22 Sep 2015 12:59:28 +0000 (12:59 +0000)]
Auto merge of #28582 - jedireza:patch-1, r=huonw

Fixed typo in example code.

8 years agoFix alignment of pthread types on NetBSD
Sebastian Wicki [Tue, 22 Sep 2015 09:48:00 +0000 (11:48 +0200)]
Fix alignment of pthread types on NetBSD

8 years agoAuto merge of #28578 - gandro:nodefaultlibs, r=alexcrichton
bors [Tue, 22 Sep 2015 09:19:47 +0000 (09:19 +0000)]
Auto merge of #28578 - gandro:nodefaultlibs, r=alexcrichton

This patch basically adds a target option for omitting the `-nodefaultlibs` flag when invoking the linker. I am not sure if this is the correct or only way to approach this problem, so any feedback is welcome.

Motivation: I'm currently working on a Rust target specification for the [rumprun](/rumpkernel/rumprun) unikernel. rumprun is based on rump kernels and uses NetBSDs libc and drivers to provide a POSIXy environment. It provides its own linker wrapper that generates binaries which can be "baked" into a unikernel after configuration. Using `-nodefaultlibs` on the rumprun linker will prevent it from selecting the search paths for the rumprun libraries. My current target implementation for rumprun is here: gandro/rust@295744b2ee2378f41a20d4b498b8f1991a75e93c

Currently, only a target that `is_like_windows` will omit the `-nodefaultlibs` flag, but since rumprun is not like Windows otherwise, I think a separate flag makes more sense. This might be a breaking change for target specifications that have the `is_like_windows` option set to true. Such targets need to set `no_default_libraries` to false in order to restore the old behavior.

8 years agoSimplify inner_try in std::rt::unwind::try
Andrea Canciani [Tue, 22 Sep 2015 06:58:47 +0000 (08:58 +0200)]
Simplify inner_try in std::rt::unwind::try

Resolve the TLS PANICKING variable just once and re-use it as needed.

8 years agoSimplify on_panic callback handling
Andrea Canciani [Tue, 22 Sep 2015 06:40:15 +0000 (08:40 +0200)]
Simplify on_panic callback handling

The registration of `panicking::on_panic` as a general-purpose
callback is overcomplicated and can fail.

Instead, invoking it explicitly removes the need for locking and paves
the way for further improvements.