Commit Graph

46721 Commits

Author SHA1 Message Date
bors
6f880eee79 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
2015-09-26 21:52:37 +00:00
bors
54f7b1d455 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
2015-09-26 20:06:51 +00:00
bors
c9c79084b0 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.
2015-09-26 18:21:15 +00:00
bors
e266651a3d 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
2015-09-26 16:34:56 +00:00
bors
2e88c36ebc 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
2015-09-26 14:48:56 +00:00
bors
9169e6c53c Auto merge of #28629 - arielb1:supertrait-self, r=eddyb
Fixes #28576

r? @eddyb
2015-09-26 13:03:08 +00:00
Sebastian Wicki
c099cfab06 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.
2015-09-26 14:10:14 +02:00
bors
b94c4f5996 Auto merge of #28638 - wthrowe:gdb-version, r=alexcrichton
GDB 7.10 was recently released.
2015-09-26 11:16:40 +00:00
bors
6645ca1a85 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.
2015-09-26 07:19:22 +00:00
bors
7ebfd853c2 Auto merge of #28615 - sfackler:formatter-methods, r=alexcrichton
cc #27726 

r? @alexcrichton
2015-09-26 02:02:03 +00:00
bors
78ce46ffdd 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
2015-09-26 00:14:39 +00:00
bors
69f27c856b Auto merge of #28665 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #28319, #28588, #28637, #28652, #28654, #28655
- Failed merges: #28621
2015-09-25 21:52:52 +00:00
Steve Klabnik
f4dc6c785c Rollup merge of #28655 - alfiedotwtf:patch-2, r=sanxiyn 2015-09-25 13:33:33 -06:00
Steve Klabnik
8b85b57ccb 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.
2015-09-25 13:33:32 -06:00
Steve Klabnik
eae4821d1d Rollup merge of #28652 - SimonSapin:patch-11, r=sanxiyn
Caught by Brian Smith: https://github.com/rust-lang/rust/issues/27774#issuecomment-143154735
2015-09-25 13:33:32 -06:00
Steve Klabnik
d2e2ec1661 Rollup merge of #28637 - SimonSapin:patch-6, r=alexcrichton 2015-09-25 13:33:32 -06:00
Steve Klabnik
aed73e0122 Rollup merge of #28588 - critiqjo:trpl-closure, r=steveklabnik
r? @steveklabnik
2015-09-25 13:33:31 -06:00
Steve Klabnik
de2792faa0 Rollup merge of #28319 - Manishearth:mem_docs, r=steveklabnik
https://users.rust-lang.org/t/confused-by-std-mem-drop/2783/3

r? @Gankro
2015-09-25 13:33:31 -06:00
Manish Goregaokar
012f36947a Add note about Copy for drop() 2015-09-26 01:00:05 +05:30
bors
e7a73881e9 Auto merge of #28610 - nrc:fmt6, r=brson 2015-09-25 19:06:02 +00:00
Alex Crichton
d5f2d3b177 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
2015-09-25 09:29:23 -07:00
Alfie John
29048c3a80 Keep examples consistent 2015-09-25 12:02:21 +00:00
Ben S
c6e1b12a58 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
2015-09-25 12:29:47 +01:00
Simon Sapin
761d16327a Docs: &A and &mut A are references, not pointers
Caught by Brian Smith: https://github.com/rust-lang/rust/issues/27774#issuecomment-143154735
2015-09-25 13:01:31 +02:00
Nick Howell
0bebbab41a 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).
2015-09-25 00:36:30 -04:00
Nick Howell
b68e9162fe Cleanup rustbook.css and fix some padding issues 2015-09-25 00:23:14 -04:00
Nick Howell
9f770a7536 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.
2015-09-24 22:43:18 -04:00
Nick Howell
115ec662b5 Add 'use strict' to playpen.js 2015-09-24 22:35:04 -04:00
Nick Howell
c8f5f6f70f Replace occurrences of "rust-book" with "rustbook" 2015-09-24 22:34:01 -04:00
bors
6c2e3fbe90 Auto merge of #28505 - apasel422:issue-28448, r=alexcrichton
Closes #28448.

r? @brson
2015-09-25 02:05:25 +00:00
Nick Howell
5ac899c8c2 Cleanup rustbook.js and add 'use strict'
Mostly indentation fixes, but a little refactoring, too.
2015-09-24 21:59:43 -04:00
Andrea Canciani
54c0231b14 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.
2015-09-24 23:52:13 +02:00
Andrea Canciani
c7b84909b0 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.
2015-09-24 23:49:38 +02:00
Andrea Canciani
44d1b149d2 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.
2015-09-24 23:45:59 +02:00
bors
5ca60d9431 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
2015-09-24 20:42:56 +00:00
Vadim Petrochenkov
f284cbc7af 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
2015-09-24 23:05:02 +03:00
bors
6a2187414a 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`.
2015-09-24 18:55:00 +00:00
critiqjo
09d4deef5b trpl: Refactor returning closures section 2015-09-25 00:17:54 +05:30
Sebastian Wicki
abfedb7d16 Fix target_vendor for Android 2015-09-24 19:44:53 +02:00
bors
e9801294a1 Auto merge of #28634 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #28616, #28617, #28618, #28619, #28620, #28622
- Failed merges: #28621
2015-09-24 17:07:04 +00:00
William Throwe
1e0c23d781 Allow multi-digit GDB minor version numbers
GDB 7.10 was recently released.
2015-09-24 13:04:22 -04:00
Simon Sapin
081278eb7a Utf8Error::valid_up_to: make documented semantics more precise/useful 2015-09-24 18:54:12 +02:00
Alex Crichton
81f0bf7667 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
2015-09-24 09:40:50 -07:00
Steve Klabnik
c3ca182082 Rollup merge of #28622 - tshepang:known-as-structs, r=steveklabnik 2015-09-24 10:26:37 -06:00
Steve Klabnik
e314ac601a Rollup merge of #28620 - tshepang:not-filled, r=steveklabnik 2015-09-24 10:26:37 -06:00
Steve Klabnik
c104ba3755 Rollup merge of #28619 - tshepang:fix-link, r=steveklabnik 2015-09-24 10:26:37 -06:00
Steve Klabnik
668ffb1dd8 Rollup merge of #28618 - tshepang:repetition, r=steveklabnik 2015-09-24 10:26:36 -06:00
Steve Klabnik
c16b0f7060 Rollup merge of #28617 - tshepang:optional, r=steveklabnik 2015-09-24 10:26:36 -06:00
Steve Klabnik
6f0a095d05 Rollup merge of #28616 - tshepang:idiom, r=steveklabnik 2015-09-24 10:26:36 -06:00
Ariel Ben-Yehuda
77e8f33c3d early-prohibit objects with Self-containing supertraits
Fixes #28576
2015-09-24 18:27:29 +03:00