]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoFill in some missing parts in the default HIR visitor
Vadim Petrochenkov [Mon, 28 Sep 2015 21:23:54 +0000 (00:23 +0300)]
Fill in some missing parts in the default HIR visitor

8 years agoFill in some missing parts in the default AST visitor
Vadim Petrochenkov [Mon, 28 Sep 2015 11:26:26 +0000 (14:26 +0300)]
Fill in some missing parts in the default AST visitor
+ Add helper macro for walking lists (including Options)

8 years agoAuto merge of #28668 - alexcrichton:crossing-with-jemalloc, r=nrc
bors [Mon, 28 Sep 2015 15:58:44 +0000 (15:58 +0000)]
Auto merge of #28668 - alexcrichton:crossing-with-jemalloc, r=nrc

This commit updates the compiler to not attempt to use jemalloc for platforms
where jemalloc is never enabled. Currently the compiler attempts to link in
jemalloc based on whether `--disable-jemalloc` was specified at build time for
the compiler itself, but this is only the right decision for the host target,
not for other targets.

This still leaves a hole open where a set of target libraries are downloaded
which were built with `--disable-jemalloc` and the compiler is unaware of that,
but this is a pretty rare case so it can always be fixed later.

8 years agoAuto merge of #28689 - Manishearth:rollup, r=Manishearth
bors [Sun, 27 Sep 2015 11:01:11 +0000 (11:01 +0000)]
Auto merge of #28689 - Manishearth:rollup, r=Manishearth

- Successful merges: #28664, #28673, #28681, #28682, #28688
- Failed merges:

8 years agoRollup merge of #28688 - Manishearth:fix-primitives-search, r=eddyb
Manish Goregaokar [Sun, 27 Sep 2015 09:35:18 +0000 (15:05 +0530)]
Rollup merge of #28688 - Manishearth:fix-primitives-search, r=eddyb

None

8 years agoRollup merge of #28682 - apasel422:features, r=steveklabnik
Manish Goregaokar [Sun, 27 Sep 2015 09:35:18 +0000 (15:05 +0530)]
Rollup merge of #28682 - apasel422:features, r=steveklabnik

8 years agoRollup merge of #28681 - arielb1:destructor-fixes, r=eddyb
Manish Goregaokar [Sun, 27 Sep 2015 09:35:17 +0000 (15:05 +0530)]
Rollup merge of #28681 - arielb1:destructor-fixes, r=eddyb

Fixes #28568

r? @eddyb

8 years agoRollup merge of #28673 - wthrowe:bad-archive, r=alexcrichton
Manish Goregaokar [Sun, 27 Sep 2015 09:35:17 +0000 (15:05 +0530)]
Rollup merge of #28673 - wthrowe:bad-archive, r=alexcrichton

8 years agoRollup merge of #28664 - apasel422:collections-debug, r=alexcrichton
Manish Goregaokar [Sun, 27 Sep 2015 09:35:17 +0000 (15:05 +0530)]
Rollup merge of #28664 - apasel422:collections-debug, r=alexcrichton

8 years agorustdoc: Remove crate name from primitives, make them turn up first in search
Manish Goregaokar [Sun, 27 Sep 2015 09:18:36 +0000 (14:48 +0530)]
rustdoc: Remove crate name from primitives, make them turn up first in search

8 years agoAuto merge of #28663 - bluss:vec-as-mut, r=alexcrichton
bors [Sun, 27 Sep 2015 08:26:49 +0000 (08:26 +0000)]
Auto merge of #28663 - bluss:vec-as-mut, r=alexcrichton

Implement AsMut for Vec

Fixes #28549

8 years agoAuto merge of #28651 - dotdash:exhaustive_match, r=eddyb
bors [Sun, 27 Sep 2015 05:29:39 +0000 (05:29 +0000)]
Auto merge of #28651 - dotdash:exhaustive_match, r=eddyb

By putting an "unreachable" instruction into the default arm of a switch
instruction we can let LLVM know that the match is exhaustive, allowing
for better optimizations.

For example, this match:
```rust
pub enum Enum {
    One,
    Two,
    Three,
}

impl Enum {
    pub fn get_disc(self) -> u8 {
        match self {
            Enum::One => 0,
            Enum::Two => 1,
            Enum::Three => 2,
        }
    }
}
```

Currently compiles to this on x86_64:
```asm
  .cfi_startproc
  movzbl  %dil, %ecx
  cmpl  $1, %ecx
  setne %al
  testb %cl, %cl
  je  .LBB0_2
  incb  %al
  movb  %al, %dil
.LBB0_2:
  movb  %dil, %al
  retq
.Lfunc_end0:
```

But with this change we get:
```asm
  .cfi_startproc
  movb  %dil, %al
  retq
.Lfunc_end0:
```

8 years agoAuto merge of #28685 - steveklabnik:rollup, r=steveklabnik
bors [Sun, 27 Sep 2015 01:25:00 +0000 (01:25 +0000)]
Auto merge of #28685 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #28666, #28674, #28677, #28678, #28679, #28680
- Failed merges: #28621

8 years agoRollup merge of #28680 - xaviershay:doc-readme, r=steveklabnik
Steve Klabnik [Sun, 27 Sep 2015 00:00:39 +0000 (18:00 -0600)]
Rollup merge of #28680 - xaviershay:doc-readme, r=steveklabnik

This wasn't complete (you need a `./configure`), and it is already
documented well in the main README.

r? @steveklabnik

8 years agoRollup merge of #28679 - xaviershay:book-unit-example, r=steveklabnik
Steve Klabnik [Sun, 27 Sep 2015 00:00:39 +0000 (18:00 -0600)]
Rollup merge of #28679 - xaviershay:book-unit-example, r=steveklabnik

This was non-obvious to me: with no example, I assumed `Electron {}` and
didn't know what else to try when it didn't work.  The correct form is
weird because it looks like you're assigning the struct name rather than
an instance of the struct.

r? @steveklabnik

8 years agoRollup merge of #28678 - fhartwig:deref-elide, r=steveklabnik
Steve Klabnik [Sun, 27 Sep 2015 00:00:38 +0000 (18:00 -0600)]
Rollup merge of #28678 - fhartwig:deref-elide, r=steveklabnik

The lifetime can be elided here, and I think eliding it makes the example slightly simpler.

8 years agoRollup merge of #28677 - taboularasa:master, r=alexcrichton
Steve Klabnik [Sun, 27 Sep 2015 00:00:38 +0000 (18:00 -0600)]
Rollup merge of #28677 - taboularasa:master, r=alexcrichton

the example for `find` was misleading in that it fails to mention the result is either `None` or `Some` containing only the first match. Further confusing the issue is the `println!` statement, "We got some numbers!"

8 years agoRollup merge of #28674 - DenisKolodin:patch-2, r=sanxiyn
Steve Klabnik [Sun, 27 Sep 2015 00:00:38 +0000 (18:00 -0600)]
Rollup merge of #28674 - DenisKolodin:patch-2, r=sanxiyn

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 #28646 - vadimcn:imps, r=alexcrichton
bors [Sat, 26 Sep 2015 23:38:54 +0000 (23:38 +0000)]
Auto merge of #28646 - vadimcn:imps, r=alexcrichton

As discussed in the referenced issues, this PR makes rustc emit `__imp_<symbol>` stubs for all public static data to ensure smooth linking in on `-windows-msvc` targets.
Resolves #26591, cc #27438

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 agodon't crash when there are multiple conflicting implementations of Drop
Ariel Ben-Yehuda [Sat, 26 Sep 2015 20:12:11 +0000 (23:12 +0300)]
don't crash when there are multiple conflicting implementations of Drop

Fixes #28568

8 years agoremove the destructors table
Ariel Ben-Yehuda [Sat, 26 Sep 2015 19:25:49 +0000 (22:25 +0300)]
remove the destructors table

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 agoRemove unnecessary `#![feature]` attributes
Andrew Paseltiner [Sat, 26 Sep 2015 18:40:22 +0000 (14:40 -0400)]
Remove unnecessary `#![feature]` attributes

8 years agoFix meta-documentation for generating all docs.
Xavier Shay [Sat, 26 Sep 2015 19:03:42 +0000 (12:03 -0700)]
Fix meta-documentation for generating all docs.

This wasn't complete (you need a `./configure`), and it is already
documented well in the main README.

Also adds a reference to the books that this also generates.

8 years agoAdd an example of constructing a unit-like struct.
Xavier Shay [Sat, 26 Sep 2015 18:59:00 +0000 (11:59 -0700)]
Add an example of constructing a unit-like struct.

This was non-obvious to me: with no example, I assumed `Electron {}` and
didn't know what else to try when it didn't work.  The correct form is
weird because it looks like you're assigning the struct name rather than
an instance of the struct.

8 years agoshow each object-safety violation once
Ariel Ben-Yehuda [Thu, 24 Sep 2015 23:40:57 +0000 (02:40 +0300)]
show each object-safety violation once

different supertraits can suffer from the same object-safety violation,
leading to duplication in the error message. Avoid it.

Fixes #20692

8 years agoElide lifetime in Deref doc example
Florian Hartwig [Sat, 26 Sep 2015 18:40:22 +0000 (20:40 +0200)]
Elide lifetime in Deref doc example

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 agodeduplicate trait errors before they are displayed
Ariel Ben-Yehuda [Thu, 24 Sep 2015 16:58:00 +0000 (19:58 +0300)]
deduplicate trait errors before they are displayed

Because of type inference, duplicate obligations exist and cause duplicate
errors. To avoid this, only display the first error for each (predicate,span).

The inclusion of the span is somewhat bikesheddy, but *is* the more
conservative option (it does not remove some instability, as duplicate
obligations are ignored by `duplicate_set` under some inference conditions).

Fixes #28098
cc #21528 (is it a dupe?)

8 years agoclarify that `find` returns first match
David Elliott [Sat, 26 Sep 2015 17:36:37 +0000 (10:36 -0700)]
clarify that `find` returns first match

the example for `find` was misleading in that it fails to mention the result is either `None` or `Some` containing only the first match. Further confusing the issue is the `println!` statement, "We got some numbers!"

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 agoTypo fix in use declaration section of reference
DenisKolodin [Sat, 26 Sep 2015 09:16:55 +0000 (12:16 +0300)]
Typo fix in use declaration section of reference

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 agoDon't ICE if an archive isn't actually an archive
William Throwe [Fri, 25 Sep 2015 04:46:33 +0000 (00:46 -0400)]
Don't ICE if an archive isn't actually an archive

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 agoRemoved unused parameter.
Vadim Chugunov [Sat, 26 Sep 2015 01:53:14 +0000 (18:53 -0700)]
Removed unused parameter.

8 years agoConverted test to rpass.
Vadim Chugunov [Sat, 26 Sep 2015 01:48:54 +0000 (18:48 -0700)]
Converted test to rpass.

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 agorustc: Don't use jemalloc when crossing to MSVC
Alex Crichton [Fri, 25 Sep 2015 23:26:23 +0000 (16:26 -0700)]
rustc: Don't use jemalloc when crossing to MSVC

This commit updates the compiler to not attempt to use jemalloc for platforms
where jemalloc is never enabled. Currently the compiler attempts to link in
jemalloc based on whether `--disable-jemalloc` was specified at build time for
the compiler itself, but this is only the right decision for the host target,
not for other targets.

This still leaves a hole open where a set of target libraries are downloaded
which were built with `--disable-jemalloc` and the compiler is unaware of that,
but this is a pretty rare case so it can always be fixed later.

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 agoAdd AsMut<Vec<T>> for Vec<T>
Ulrik Sverdrup [Fri, 25 Sep 2015 17:54:15 +0000 (19:54 +0200)]
Add AsMut<Vec<T>> for Vec<T>

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 agoSimplify `Debug` for `{EnumSet, VecDeque}`
Andrew Paseltiner [Fri, 25 Sep 2015 16:03:03 +0000 (12:03 -0400)]
Simplify `Debug` for `{EnumSet, VecDeque}`

8 years agoImplement AsMut for Vec
Ulrik Sverdrup [Fri, 25 Sep 2015 15:43:58 +0000 (17:43 +0200)]
Implement AsMut for Vec

Fixes #28549

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 agoTell LLVM when a match is exhaustive
Björn Steinbrink [Fri, 25 Sep 2015 09:02:51 +0000 (11:02 +0200)]
Tell LLVM when a match is exhaustive

By putting an "unreachable" instruction into the default arm of a switch
instruction we can let LLVM know that the match is exhaustive, allowing
for better optimizations.

For example, this match:
```rust
pub enum Enum {
    One,
    Two,
    Three,
}

impl Enum {
    pub fn get_disc(self) -> u8 {
        match self {
            Enum::One => 0,
            Enum::Two => 1,
            Enum::Three => 2,
        }
    }
}
```

Currently compiles to this on x86_64:
```asm
  .cfi_startproc
  movzbl  %dil, %ecx
  cmpl  $1, %ecx
  setne %al
  testb %cl, %cl
  je  .LBB0_2
  incb  %al
  movb  %al, %dil
.LBB0_2:
  movb  %dil, %al
  retq
.Lfunc_end0:
```

But with this change we get:
```asm
  .cfi_startproc
  movb  %dil, %al
  retq
.Lfunc_end0:
```

8 years agoFix dllimports of static data from rlibs
Vadim Chugunov [Fri, 21 Aug 2015 07:41:07 +0000 (00:41 -0700)]
Fix dllimports of static data from rlibs

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