Commit Graph

46872 Commits

Author SHA1 Message Date
bors
3a71c423c7 Auto merge of #28691 - utkarshkukreti:add-path_max-to-liblibc, r=alexcrichton
PATH_MAX is defined for OSX and various BSDs but not Linux right now.

[Source for the value.](9ffecb1028/include/uapi/linux/limits.h (L12))
2015-09-28 18:40:35 +00:00
Andrew Paseltiner
47c176e9d2 Add test for #24389
Closes #24389.
2015-09-28 13:39:29 -04:00
Willy Aguirre
7f9c4aaa09 fixes #17017 (update padding:11px line 142 of rustbook.css) 2015-09-28 12:11:18 -05:00
bors
9e11845d77 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.
2015-09-28 15:58:44 +00:00
Willy Aguirre
e1acf87fe0 remove a sentence #28701 2015-09-28 10:46:50 -05:00
Gavin Baker
f5b6a32230 Test case for Issue 11047
Tests invoking a static method using a type alias
2015-09-28 22:33:29 +10:00
Utkarsh Kukreti
dd91f3e431 Add PATH_MAX to liblibc's Linux bindings. 2015-09-27 21:06:54 +05:30
bors
638b2608a7 Auto merge of #28689 - Manishearth:rollup, r=Manishearth
- Successful merges: #28664, #28673, #28681, #28682, #28688
- Failed merges:
2015-09-27 11:01:11 +00:00
Manish Goregaokar
c34f3eaebc Rollup merge of #28688 - Manishearth:fix-primitives-search, r=eddyb
None
2015-09-27 15:05:18 +05:30
Manish Goregaokar
30b43c1b12 Rollup merge of #28682 - apasel422:features, r=steveklabnik 2015-09-27 15:05:18 +05:30
Manish Goregaokar
7e6e64b12d Rollup merge of #28681 - arielb1:destructor-fixes, r=eddyb
Fixes #28568 

r? @eddyb
2015-09-27 15:05:17 +05:30
Manish Goregaokar
5f90904e5a Rollup merge of #28673 - wthrowe:bad-archive, r=alexcrichton 2015-09-27 15:05:17 +05:30
Manish Goregaokar
8c47cfef5d Rollup merge of #28664 - apasel422:collections-debug, r=alexcrichton 2015-09-27 15:05:17 +05:30
Manish Goregaokar
9256947051 rustdoc: Remove crate name from primitives, make them turn up first in search 2015-09-27 14:48:36 +05:30
bors
219eca11b0 Auto merge of #28663 - bluss:vec-as-mut, r=alexcrichton
Implement AsMut for Vec

Fixes #28549
2015-09-27 08:26:49 +00:00
bors
dde7283b80 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:
```
2015-09-27 05:29:39 +00:00
bors
90c04d0362 Auto merge of #28685 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #28666, #28674, #28677, #28678, #28679, #28680
- Failed merges: #28621
2015-09-27 01:25:00 +00:00
Steve Klabnik
cc44d65c19 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
2015-09-26 18:00:39 -06:00
Steve Klabnik
3e36eecae4 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
2015-09-26 18:00:39 -06:00
Steve Klabnik
66339884df 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.
2015-09-26 18:00:38 -06:00
Steve Klabnik
2ec89c7279 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!"
2015-09-26 18:00:38 -06:00
Steve Klabnik
692d9e97b1 Rollup merge of #28674 - DenisKolodin:patch-2, r=sanxiyn 2015-09-26 18:00:38 -06:00
Steve Klabnik
9f129a9698 Rollup merge of #28666 - GuillaumeGomez:warning, r=arielb1
r? @Manishearth
2015-09-26 18:00:38 -06:00
bors
7bf4c885fc 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
2015-09-26 23:38:54 +00:00
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
Ariel Ben-Yehuda
9a86713166 don't crash when there are multiple conflicting implementations of Drop
Fixes #28568
2015-09-26 23:14:26 +03:00
Ariel Ben-Yehuda
f9b703e7ab remove the destructors table 2015-09-26 23:11:52 +03: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
Andrew Paseltiner
589c82449a Remove unnecessary #![feature] attributes 2015-09-26 15:59:31 -04:00
Xavier Shay
865889a2cc 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.
2015-09-26 12:05:47 -07:00
Xavier Shay
3885a81e5f 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.
2015-09-26 11:59:02 -07:00
Ariel Ben-Yehuda
346088b555 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
2015-09-26 21:49:54 +03:00
Florian Hartwig
c3a74fa4c6 Elide lifetime in Deref doc example 2015-09-26 20:40:22 +02: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
Ariel Ben-Yehuda
fe6ad097c6 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?)
2015-09-26 21:13:31 +03:00
David Elliott
ded2370a74 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!"
2015-09-26 10:36:37 -07: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
Guillaume Gomez
08181d2a3b Remove warning of duplicated error code 2015-09-26 17:11:01 +02: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
DenisKolodin
0f491bee69 Typo fix in use declaration section of reference 2015-09-26 12:16:55 +03: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
William Throwe
eef6030c92 Don't ICE if an archive isn't actually an archive 2015-09-26 01:54:12 -04:00
bors
7ebfd853c2 Auto merge of #28615 - sfackler:formatter-methods, r=alexcrichton
cc #27726 

r? @alexcrichton
2015-09-26 02:02:03 +00:00
Vadim Chugunov
38f1c47d18 Removed unused parameter. 2015-09-25 18:53:14 -07:00
Vadim Chugunov
c21fcac293 Converted test to rpass. 2015-09-25 18:48:54 -07: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
Alex Crichton
747f0be082 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.
2015-09-25 16:26:23 -07:00