Commit Graph

62770 Commits

Author SHA1 Message Date
Jorge Aparicio
c759eea7a6 fix location of the emitted object file 2017-04-05 13:59:58 -05:00
Jorge Aparicio
bc1bd8a609 add tracking issue and feature-gate and run-make tests 2017-04-05 13:59:53 -05:00
Jorge Aparicio
4c7e277340 add an #[used] attribute
similar to GCC's __attribute((used))__. This attribute prevents LLVM from
optimizing away a non-exported symbol, within a compilation unit (object file),
when there are no references to it.

This is better explained with an example:

```
#[used]
static LIVE: i32 = 0;

static REFERENCED: i32 = 0;

static DEAD: i32 = 0;

fn internal() {}

pub fn exported() -> &'static i32 {
    &REFERENCED
}
```

Without optimizations, LLVM pretty much preserves all the static variables and
functions within the compilation unit.

```
$ rustc --crate-type=lib --emit=obj symbols.rs && nm -C symbols.o
0000000000000000 t drop::h1be0f8f27a2ba94a
0000000000000000 r symbols::REFERENCED::hb3bdfd46050bc84c
0000000000000000 r symbols::DEAD::hc2ea8f9bd06f380b
0000000000000000 r symbols::LIVE::h0970cf9889edb56e
0000000000000000 T symbols::exported::h6f096c2b1fc292b2
0000000000000000 t symbols::internal::h0ac1aadbc1e3a494
```

With optimizations, LLVM will drop dead code. Here `internal` is dropped because
it's not a exported function/symbol (i.e. not `pub`lic). `DEAD` is dropped for
the same reason. `REFERENCED` is preserved, even though it's not exported,
because it's referenced by the `exported` function. Finally, `LIVE` survives
because of the `#[used]` attribute even though it's not exported or referenced.

```
$ rustc --crate-type=lib -C opt-level=3 --emit=obj symbols.rs && nm -C symbols.o
0000000000000000 r symbols::REFERENCED::hb3bdfd46050bc84c
0000000000000000 r symbols::LIVE::h0970cf9889edb56e
0000000000000000 T symbols::exported::h6f096c2b1fc292b2
```

Note that the linker knows nothing about `#[used]` and will drop `LIVE`
because no other object references to it.

```
$ echo 'fn main() {}' >> symbols.rs
$ rustc symbols.rs && nm -C symbols | grep LIVE
```

At this time, `#[used]` only works on `static` variables.
2017-04-05 13:40:11 -05:00
bors
2564711e80 Auto merge of #41059 - TimNN:rollup, r=TimNN
Rollup of 1 pull requests

- Successful merges: #40998
- Failed merges: #41045
2017-04-04 17:23:32 +00:00
Tim Neumann
b012adc354 update image name for DEPLOY_ALT 2017-04-04 18:14:14 +02:00
Tim Neumann
dd7fc23a21 fix rollup 2017-04-04 15:46:48 +02:00
Tim Neumann
efdf05d91e Merge remote-tracking branch 'hub/centos5-vault' into rollup 2017-04-04 15:43:07 +02:00
Tim Neumann
12e921d0bc Rollup merge of #40998 - alexcrichton:split-dist, r=TimNN
travis: Split all dist builders in two

Previously we would use one builder on Travis to produce two sets of host
compilers for two different targets. Unfortunately though we've recently
increased how much we're building for each target so this is starting to take
unnecessarily long (#40804). This commit splits the dist builders in two by
ensuring that we only dist one target on each builder, which should take a much
shorter amount of time. This should also unblock other work such as landing the
RLS (#40584).
2017-04-04 15:41:17 +02:00
Tim Neumann
6dc8869f38 use fixed ip for vault.centos.org until updates have propagated to all mirrors 2017-04-03 22:51:06 +02:00
Tim Neumann
802c11c33e switch to vault.centos.org 2017-04-03 22:14:45 +02:00
Alex Crichton
541512b0bf travis: Split all dist builders in two
Previously we would use one builder on Travis to produce two sets of host
compilers for two different targets. Unfortunately though we've recently
increased how much we're building for each target so this is starting to take
unnecessarily long (#40804). This commit splits the dist builders in two by
ensuring that we only dist one target on each builder, which should take a much
shorter amount of time. This should also unblock other work such as landing the
RLS (#40584).
2017-04-03 12:30:06 -07:00
bors
5309a3e31d Auto merge of #40915 - nrc:save-assoc, r=eddyb
save-analysis: track associated types

r? @eddyb
2017-04-03 03:26:09 +00:00
bors
72ecd79a6c Auto merge of #40919 - GuillaumeGomez:fix-new-rustdoc, r=frewsxcv,steveklabnik
Add support for image, rules and footnotes

Part of #40912.

r? @rust-lang/docs

PS: the footnotes are waiting for https://github.com/google/pulldown-cmark/pull/21 to be merged to be fully working.
2017-04-02 18:16:09 +00:00
Guillaume Gomez
ef01ae7fe0 Force footnote references to be sorted by id 2017-04-01 00:31:37 -06:00
bors
5e122f59ba Auto merge of #40967 - alexcrichton:old-osx, r=brson
travis: Compile OSX releases with Xcode 7

Unfortunately what we're using right now, Xcode 8.2, cannot compile LLVM for OSX
10.7. We've done this historically and Gecko would like to maintain this
compabitiliby. This commit moves our release builders for OSX to using Xcode 7
which can compile LLVM for 10.7.

The builders running tests continue to use Xcode 8.2, however, because the LLDB
version with Xcode 7, 350, is blacklisted in running our LLDB tests. To continue
running LLDB tests we'll stick with Xcode 8.2.
2017-04-01 05:56:08 +00:00
bors
2f1652870f Auto merge of #40972 - frewsxcv:rollup, r=frewsxcv
Rollup of 6 pull requests

- Successful merges: #40703, #40728, #40763, #40871, #40935, #40947
- Failed merges:
2017-03-31 23:23:49 +00:00
Corey Farwell
54b3f6aa21 Rollup merge of #40947 - stjepang:test-sort-random-cmp, r=alexcrichton
Test sort algorithms using a random cmp function

This ensures that sorting using a broken comparison function doesn't panic nor fail in some other way (especially not segfault).

r? @alexcrichton
2017-03-31 16:48:29 -04:00
Corey Farwell
c9a9d7acaf Rollup merge of #40935 - donniebishop:str_boilerplate_docs, r=steveklabnik
Modify str Structs descriptions

References #29375. Modified descriptions of multiple structs to be more in line with structs found under [`std::iter`](https://doc.rust-lang.org/std/iter/#structs), such as [`Chain`](https://doc.rust-lang.org/std/iter/struct.Chain.html) and [`Enumerate`](https://doc.rust-lang.org/std/iter/struct.Enumerate.html)
2017-03-31 16:48:28 -04:00
Corey Farwell
c5082fe801 Rollup merge of #40871 - projektir:atomic_links, r=steveklabnik
Adding links for Atomics docs #29377

r? @steveklabnik

This should be good for `std::sync::atomic`. The other pages still need more (examples, etc.).
2017-03-31 16:48:27 -04:00
Corey Farwell
6edab01499 Rollup merge of #40763 - pirate:patch-2, r=steveklabnik
Add helpful hint in io docs about how ? is not allowed in main()

This is my effort to help alleviate the confusion caused by the error message:
```rust
error[E0277]: the trait bound `(): std::ops::Carrier` is not satisfied
  --> hello_world.rs:72:5
   |
72 |     io::stdin().read_line(&mut d_input)?;
   |     ------------------------------------
   |     |
   |     the trait `std::ops::Carrier` is not implemented for `()`
   |     in this macro invocation
   |
   = note: required by `std::ops::Carrier::from_error`

error: aborting due to previous error
```
This has been discussed at length in https://github.com/rust-lang/rust/issues/35946, but I figured it would be helpful to mention in the docs.
Reading user input is one of the first things beginners will look up in the docs, so my thinking was they'd see this warning here and not have to deal with the [tricky error message](https://blog.rust-lang.org/2017/03/02/lang-ergonomics.html).

If you think this isn't the right place to put this in the docs, that's understandable, I'm open to suggestions for putting it elsewhere or removing it entirely.
2017-03-31 16:48:26 -04:00
Corey Farwell
c6e2512705 Rollup merge of #40728 - topecongiro:stabilize, r=arielb1
Make overlapping_inherent_impls lint a hard error

Closes #36889.
2017-03-31 16:48:25 -04:00
Corey Farwell
efc2ae8e59 Rollup merge of #40703 - GuillaumeGomez:pointer-docs, r=steveklabnik
Add missing urls in ptr docs

r? @rust-lang/docs
2017-03-31 16:48:24 -04:00
Alex Crichton
3076155674 travis: Compile OSX releases with Xcode 7
Unfortunately what we're using right now, Xcode 8.2, cannot compile LLVM for OSX
10.7. We've done this historically and Gecko would like to maintain this
compabitiliby. This commit moves our release builders for OSX to using Xcode 7
which can compile LLVM for 10.7.

The builders running tests continue to use Xcode 8.2, however, because the LLDB
version with Xcode 7, 350, is blacklisted in running our LLDB tests. To continue
running LLDB tests we'll stick with Xcode 8.2.
2017-03-31 11:19:36 -07:00
Guillaume Gomez
4de4a95505 Add end whitespace ignore flag for tidy 2017-03-31 12:16:03 -06:00
Guillaume Gomez
51d3cec387 Fix hard break issue 2017-03-31 12:16:03 -06:00
bors
40feadb966 Auto merge of #40950 - frewsxcv:rollup, r=frewsxcv
Rollup of 10 pull requests

- Successful merges: #40694, #40842, #40869, #40888, #40898, #40904, #40925, #40928, #40929, #40934
- Failed merges:
2017-03-31 16:04:18 +00:00
Corey Farwell
c34f533a85 Rollup merge of #40934 - SamWhited:improve_write_writeln_docs, r=steveklabnik
Improve the docs for the write and writeln macros

This change reduces duplication by linking the documentation for
`writeln!` to `write!`. It also restructures the `write!` documentation
to read in a more logical manner (I hope; feedback would be welcome).

Updates #29329, #29381
2017-03-31 11:43:39 -04:00
Corey Farwell
d36b24d8bf Rollup merge of #40929 - bluss:full-reverse, r=alexcrichton
Implement all PartialOrd methods for Reverse

When making a forwarding wrapper we must in general forward all methods,
so that we use the type's own `lt` for example instead of the default.

Example important case: f32's partial_cmp does several operations but
its lt is a primitive.

Follow up on #40720
2017-03-31 11:43:38 -04:00
Corey Farwell
c650ed8ee7 Rollup merge of #40928 - GAJaloyan:patch-2, r=eddyb
adding debug in consume_body function

When in debug_assertions=true mode, the function consume_body lacks some debug output, which makes it harder to follow the control flow. This commit adds this needed debug.
2017-03-31 11:43:37 -04:00
Corey Farwell
4af41b4789 Rollup merge of #40925 - DaseinPhaos:patch-5, r=steveklabnik
Add missing link in unstable-book

add link to specialization's tracking issue
2017-03-31 11:43:36 -04:00
Corey Farwell
fe34818606 Rollup merge of #40904 - rap2hpoutre:patch-1, r=steveklabnik
Add example to std::process::abort

This is a first step in order to complete this issue: https://github.com/rust-lang/rust/issues/29370
I submitted this PR with the help of @steveklabnik More info here: https://github.com/rust-lang/rust/issues/29370#issuecomment-290089330

It's my first PR on Rust, I'm learning how to contribute: Should I ping someone? I will post another PR with a more complicated example soon, I prefer send it separately (cause maybe I made some mistakes).
2017-03-31 11:43:35 -04:00
Corey Farwell
5f1bb8f2d0 Rollup merge of #40898 - MaloJaffre:remove-unused-feature, r=alexcrichton
Remove unused feature from error index generator

Remove feature `rustdoc`.
2017-03-31 11:43:34 -04:00
Corey Farwell
488a7b3945 Rollup merge of #40888 - wesleywiser:rustdoc_src_sidebar, r=GuillaumeGomez
Make the rustdoc sidebar white on `src` pages

Fixes #40724
2017-03-31 11:43:33 -04:00
Corey Farwell
7ccd0b994f Rollup merge of #40869 - ctjhoa:master, r=steveklabnik
Improve os::linux documentation (#29367)

Improve `os::linux` documentation according to #29367

r? @steveklabnik
2017-03-31 11:43:32 -04:00
Corey Farwell
eeb075af25 Rollup merge of #40842 - Mic92:RawFd, r=aturon
Implement AsRawFd/IntoRawFd for RawFd

This is useful to build os abstraction like the nix crate does.
It allows to define functions, which accepts generic arguments
of data structures convertible to RawFd, including RawFd itself.
For example:

```
fn write<FD: AsRawFd>(fd: FD, buf: &[u8]) -> Result<usize>
write(file, buf);
```
instead of:
```
fn write(fd: RawFd, buf: &[u8]) -> Result<usize>
write(file.as_raw_fd(), buf);
```

cc @kamalmarhubi
2017-03-31 11:43:31 -04:00
Corey Farwell
d2128fd166 Rollup merge of #40694 - frewsxcv:unstable-book-checker, r=steveklabnik
Sync all unstable features with Unstable Book; add tidy lint.

Add a tidy lint that checks for...

* Unstable Book sections with no corresponding SUMMARY.md links
* unstable features that don't have Unstable Book sections
* Unstable Book sections that don't have corresponding unstable features
2017-03-31 11:43:30 -04:00
Corey Farwell
eef2a9598b Sync all unstable features with Unstable Book; add tidy lint.
Add a tidy lint that checks for...

* Unstable Book sections with no corresponding SUMMARY.md links
* unstable features that don't have Unstable Book sections
* Unstable Book sections that don't have corresponding unstable features
2017-03-31 11:40:44 -04:00
Stjepan Glavina
0e2d3d41bb Test sort algorithms using a random cmp function 2017-03-31 17:00:24 +02:00
bors
a9329d3aa3 Auto merge of #40737 - nagisa:safe-slicing-strs, r=BurntSushi
Checked slicing for strings

cc https://github.com/rust-lang/rust/issues/39932
2017-03-31 11:13:20 +00:00
bors
474f7a91ee Auto merge of #40620 - laumann:slash-in-diagnostics-path, r=BurntSushi
Replace hardcoded forward slash with path::MAIN_SEPARATOR

Fixes #40149
2017-03-31 03:22:39 +00:00
Guillaume Gomez
36b15f0409 Fix multiple footnotes and improve testing 2017-03-30 17:29:54 -06:00
Donnie Bishop
3b396217b5 Remove parentheses in method references 2017-03-30 18:33:23 -04:00
Donnie Bishop
c4b11d19b8 Revert SplitWhitespace's description
Original headline of SplitWhitespace's description is more descriptive as to what it contains and iterates over.
2017-03-30 16:46:16 -04:00
Donnie Bishop
a4a7166fd5 Modify SplitWhitespace's description 2017-03-30 16:36:06 -04:00
Donnie Bishop
5d14ccbc96 Modify EncodeUtf16's description 2017-03-30 16:35:19 -04:00
Donnie Bishop
17b4884d3c Modify Chars' description 2017-03-30 15:51:49 -04:00
Donnie Bishop
41e0498586 Modify CharIndices' description 2017-03-30 15:46:41 -04:00
Sam Whited
b03edb4a02 Improve the docs for the write and writeln macros
This change reduces duplication by linking the documentation for
`writeln!` to `write!`. It also restructures the `write!` documentation
to read in a more logical manner.

Updates #29329, #29381
2017-03-30 14:40:10 -05:00
Donnie Bishop
0f5cf54246 Modify Bytes' description 2017-03-30 15:40:05 -04:00
Donnie Bishop
9d4b486b84 Modify Lines' description 2017-03-30 15:36:50 -04:00