Commit Graph

63805 Commits

Author SHA1 Message Date
Nick Sweeting
9765fbc813 fix build errors 2017-04-07 16:42:56 -04:00
Clar Charr
68909b0ec0 Add as_c_str. 2017-04-07 15:19:02 -04:00
Aidan Hobson Sayers
bd4f3815eb Disable errexit for sanity checking git repo 2017-04-07 20:15:02 +01:00
est31
bfc08c13cc pub(restricted) didn't make it into 1.17
Gets shipped in 1.18 instead.
2017-04-07 21:07:33 +02:00
Stjepan Glavina
f7ffe5bd24 Replace compare_exchange with swap 2017-04-07 18:04:15 +02:00
Jorge Aparicio
e280515499 hack: add a linker_flavor feature gate
to make tidy accept `-Z linker-flavor` documentation
2017-04-07 10:52:57 -05:00
Jorge Aparicio
2a177b7715 add some documentation to the unstable book 2017-04-07 10:52:42 -05:00
Jorge Aparicio
95bb45431a remove workaround for rust-lang/rust#39880
committed by mistake
2017-04-07 10:52:42 -05:00
Jorge Aparicio
9d11b089ad -Z linker-flavor
This patch adds a `-Z linker-flavor` flag to rustc which can be used to invoke
the linker using a different interface.

For example, by default rustc assumes that all the Linux targets will be linked
using GCC. This makes it impossible to use LLD as a linker using just `-C
linker=ld.lld` because that will invoke LLD with invalid command line
arguments. (e.g. rustc will pass -Wl,--gc-sections to LLD but LLD doesn't
understand that; --gc-sections would be the right argument)

With this patch one can pass `-Z linker-flavor=ld` to rustc to invoke the linker
using a LD-like interface. This way, `rustc -C linker=ld.lld -Z
linker-flavor=ld` will invoke LLD with the right arguments.

`-Z linker-flavor` accepts 4 different arguments: `em` (emcc), `ld`,
`gcc`, `msvc` (link.exe). `em`, `gnu` and `msvc` cover all the existing linker
interfaces. `ld` is a new flavor for interfacing GNU's ld and LLD.

This patch also changes target specifications. `linker-flavor` is now a
mandatory field that specifies the *default* linker flavor that the target will
use. This change also makes the linker interface *explicit*; before, it used to
be derived from other fields like linker-is-gnu, is-like-msvc,
is-like-emscripten, etc.

Another change to target specifications is that the fields `pre-link-args`,
`post-link-args` and `late-link-args` now expect a map from flavor to linker
arguments.

``` diff
-    "pre-link-args": ["-Wl,--as-needed", "-Wl,-z,-noexecstack"],
+    "pre-link-args": {
+        "gcc": ["-Wl,--as-needed", "-Wl,-z,-noexecstack"],
+        "ld": ["--as-needed", "-z,-noexecstack"],
+    },
```

[breaking-change]  for users of custom targets specifications
2017-04-07 10:52:42 -05:00
Stjepan Glavina
5c5a5182c9 Optimize AtomicBool::fetch_nand 2017-04-07 17:36:50 +02:00
bors
53f4bc311b Auto merge of #41138 - frewsxcv:rollup, r=frewsxcv
Rollup of 9 pull requests

- Successful merges: #40797, #41047, #41056, #41061, #41075, #41080, #41120, #41130, #41131
- Failed merges:
2017-04-07 15:25:47 +00:00
Jorge Aparicio
15fa301b7a change the format of the linked issue number 2017-04-07 09:46:55 -05:00
Corey Farwell
cd2310b93c Rollup merge of #41131 - euclio:collapse-animation, r=GuillaumeGomez
rustdoc: collapse docblock before showing label

The animation for collapsing descriptions is currently pretty jarring, as the label starts fading in as the description is collapsing. This causes the description to jump down a line (and sometimes change indentation) while animating.

This PR modifies this behavior to collapse the block entirely before starting to fade in the collapse button label.

While this PR works well for descriptions of structs, traits, etc., it still does not look ideal for attributes. I'd appreciate any suggestions for improving that animation. Perhaps we want to optimize for the single-attribute case, and try not to collapse the attribute list entirely before fading in the label?
2017-04-07 09:20:11 -04:00
Corey Farwell
72308b1c23 Rollup merge of #41130 - petrhosek:fuchsia-ci-upstream, r=alexcrichton
travis: Use upstream LLVM repositories for Fuchsia

The Fuchsia copies of LLVM repositories contain additional patches
for work-in-progress features and there is some amount of churn that
may break Rust. Use upstream LLVM repositories instead for building
the toolchain used by the Fuchsia builder.
2017-04-07 09:20:10 -04:00
Corey Farwell
25518db1dc Rollup merge of #41120 - clarcharr:c_str_transmute, r=alexcrichton
Remove some CStr transmutes.

Because dedicated methods exist for these, we don't have to add other transmutes.
2017-04-07 09:20:09 -04:00
Corey Farwell
2a92fe2aaa Rollup merge of #41080 - cuviper:generic-powerpc, r=alexcrichton
dist-powerpc-linux: use a pure 32-bit CPU profile

With `-mcpu=power4`, code might use instructions like `fcfid`, excluding
older CPUs like the PowerPC G4, which apparently some users would like
to use.  The generic `-mcpu=powerpc` should stick to pure 32-bit PowerPC
instructions.

Fixes rust-lang/cargo#3852.
2017-04-07 09:20:08 -04:00
Corey Farwell
a2c032631b Rollup merge of #41075 - aidanhs:aphs-enable-appveyor-cache, r=alexcrichton
Re-enable appveyor cache

After breaking the queue last time, I'm cautiously back with a PR to re-enable caching on appveyor.

If you look at https://ci.appveyor.com/project/rust-lang/rust/build/1.0.2623/job/46o90by4ari6gege (one of the multiple runs that started failed, there are actually two errors - one for restoring the cache, one right at the bottom for creating a directory. I only noticed the restore error at the time as I was a bit rushed to revert and didn't stop to wonder why it continued - turns out appveyor [does not abort on cache restore failure](https://github.com/appveyor/ci/issues/723).

Turns out the cause of the build failures was the cache directory existing and me being thinking that because mkdir on windows is [recursive by default](http://stackoverflow.com/a/905239/2352259), it ignores the error if the directory already exists. Apparently this is not true, so now it checks if the directory exists before attempting to create.

In addition, I've added some more paranoia to double check everything is sane.
2017-04-07 09:20:07 -04:00
Corey Farwell
996f06fe35 Rollup merge of #41061 - arielb1:parent-lock, r=eddyb
cstore: return an immutable borrow from `visible_parent_map`

This prevents an ICE when `visible_parent_map` is called multiple times, for example when an item referenced in an impl signature is imported from an  `extern crate` statement occurs within an impl.

Fixes #41053.

r? @eddyb
2017-04-07 09:20:06 -04:00
Corey Farwell
88e97f0541 Rollup merge of #41056 - michaelwoerister:central-defpath-hashes, r=nikomatsakis
Handle DefPath hashing centrally as part of DefPathTable (+ save work during SVH calculation)

In almost all cases where we construct a `DefPath`, we just hash it and throw it away again immediately.
With this PR, the compiler will immediately compute and store the hash for each `DefPath` as it is allocated. This way we
+ can get rid of any subsequent `DefPath` hash caching (e.g. the `DefPathHashes`),
+ don't need to allocate a transient `Vec` for holding the `DefPath` (although I'm always surprised how little these small, dynamic allocations seem to hurt performance), and
+ we don't hash `DefPath` prefixes over and over again.

That last part is because we construct the hash for `prefix::foo` by hashing `(hash(prefix), foo)` instead of hashing every component of prefix.

The last commit of this PR is pretty neat, I think:
```
The SVH (Strict Version Hash) of a crate is currently computed
by hashing the ICHes (Incremental Computation Hashes) of the
crate's HIR. This is fine, expect that for incr. comp. we compute
two ICH values for each HIR item, one for the complete item and
one that just includes the item's interface. The two hashes are
are needed for dependency tracking but if we are compiling
non-incrementally and just need the ICH values for the SVH,
one of them is enough, giving us the opportunity to save some
work in this case.
```

r? @nikomatsakis

This PR depends on https://github.com/rust-lang/rust/pull/40878 to be merged first (you can ignore the first commit for reviewing, that's just https://github.com/rust-lang/rust/pull/40878).
2017-04-07 09:20:05 -04:00
Corey Farwell
ef9eee7402 Rollup merge of #41047 - cuviper:src_is_git, r=alexcrichton
Only use cargo-vendor if building from git sources

The only time we need to vendor sources is when building from git.  If one is
building from a rustc source tarball, everything should already be in place.
This also matters for distros which do offline builds, as they can't install
cargo-vendor this way.

This adds a common `Build::src_is_git` flag, and then uses it in the dist-src
target to decide whether to install or use `cargo-vendor` at all.

Fixes #41042.
2017-04-07 09:20:04 -04:00
Corey Farwell
d860b1c003 Rollup merge of #40797 - GAJaloyan:patch-1, r=arielb1
Correcting mistakes in the README.md

Correcting the two mistakes in the README.md (issue #40793)
2017-04-07 09:20:03 -04:00
Jon Gjengset
e6597e12bc
Mention interrupts and green threads 2017-04-07 09:13:06 -04:00
Jon Gjengset
8fc3ab20b0
rustdoc needs space after # to ignore 2017-04-07 09:11:07 -04:00
bors
c438c1fb39 Auto merge of #40971 - malbarbo:android-emulator-64, r=alexcrichton
Use 64 bits emulator to run android tests

Also install headless jre instead of the full jre.
2017-04-07 12:51:18 +00:00
Michael Woerister
bb6387295a SVH: Don't hash the HIR twice when once is enough.
The SVH (Strict Version Hash) of a crate is currently computed
by hashing the ICHes (Incremental Computation Hashes) of the
crate's HIR. This is fine, expect that for incr. comp. we compute
two ICH values for each HIR item, one for the complete item and
one that just includes the item's interface. The two hashes are
are needed for dependency tracking but if we are compiling
non-incrementally and just need the ICH values for the SVH,
one of them is enough, giving us the opportunity to save some
work in this case.
2017-04-07 14:37:48 +02:00
Michael Woerister
edc1ac3016 ICH: Centrally compute and cache DefPath hashes as part of DefPathTable. 2017-04-07 14:36:51 +02:00
bors
4c59c92bc4 Auto merge of #40873 - cramertj:on-demandify-queries, r=nikomatsakis
On demandify reachability

cc https://github.com/rust-lang/rust/issues/40746

I tried following this guidance from #40746:
> The following tasks currently execute before a tcx is built, but they could be easily converted into queries that are requested after tcx is built. The main reason they are the way they are was to avoid a gratuitious refcell (but using the refcell map seems fine)...

but the result of moving `region_maps` out of `TyCtxt` and into a query caused a lot of churn, and seems like it could potentially result in a rather large performance hit, since it means a dep-graph lookup on every use of `region_maps` (rather than just a field access). Possibly `TyCtxt` could store a `RefCell<Option<RegionMap>>` internally and use that to prevent repeat lookups, but that feels like it's duplicating the work of the dep-graph. @nikomatsakis What did you have in mind for this?
2017-04-07 08:36:11 +00:00
Petr Hosek
b135c1291d travis: Use upstream LLVM repositories for Fuchsia
The Fuchsia copies of LLVM repositories contain additional patches
for work-in-progress features and there is some amount of churn that
may break Rust. Use upstream LLVM repositories instead for building
the toolchain used by the Fuchsia builder.
2017-04-06 23:29:23 -07:00
Jorge Aparicio
f45c6d8fc7 document some existing unstable features
"msp430-interrupt", "ptx-kernel" and #![compiler_builtins_lib]
2017-04-07 01:05:03 -05:00
bors
b9c5197d48 Auto merge of #39987 - japaric:used, r=arielb1
#[used] attribute

(For an explanation of what this feature does, read the commit message)

I'd like to propose landing this as an experimental feature (experimental as in:
no clear stabilization path -- like `asm!`, `#[linkage]`) as it's low
maintenance (I think) and relevant to the "Usage in resource-constrained
environments" exploration area.

The main use case I see is running code before `main`. This could be used, for
instance, to cheaply initialize an allocator before `main` where the alternative
is to use `lazy_static` to initialize the allocator on its first use which it's
more expensive (atomics) and doesn't work on ARM Cortex-M0 microcontrollers (no
`AtomicUsize` on that platform)

Here's a `std` example of that:

``` rust

unsafe extern "C" fn before_main_1() {
    println!("Hello");
}

unsafe extern "C" fn before_main_2() {
    println!("World");
}

#[link_section = ".init_arary"]
#[used]
static INIT_ARRAY: [unsafe extern "C" fn(); 2] = [before_main_1, before_main_2];

fn main() {
    println!("Goodbye");
}
```

```
$ rustc -C lto -C opt-level=3 before_main.rs
$ ./before_main
Hello
World
Goodbye
```

In general, this pattern could be used to let *dependencies* run code before
`main` (which sounds like it could go very wrong in some cases). There are
probably other use cases; I hope that the people I have cc-ed can comment on
those.

Note that I'm personally unsure if the above pattern is something we want to
promote / allow and that's why I'm proposing this feature as experimental. If
this leads to more footguns than benefits then we can just axe the feature.

cc @nikomatsakis ^ I know you have some thoughts on having a process for
experimental features though I'm fine with writing an RFC before landing this.

- `dead_code` lint will have to be updated to special case `#[used]` symbols.

- Should we extend `#[used]` to work on non-generic functions?

cc rust-lang/rfcs#1002
cc rust-lang/rfcs#1459
cc @dpc @JinShil
2017-04-07 04:56:45 +00:00
Jorge Aparicio
98037ca43d don't pass -C to nm
the nm in our macOS bots don't support that flag and it's not really required
2017-04-06 23:53:32 -05:00
Jon Gjengset
5202ac5753
Correct book examples for hardware re-ordering 2017-04-06 23:29:16 -04:00
Ryan Scott
c9932b395a Changes based on PR feedback 2017-04-07 12:20:37 +09:00
Andy Russell
8a1d2a3a5a
rustdoc: collapse docblock before showing label 2017-04-06 21:56:47 -04:00
QuietMisdreavus
bfd01b7f40 rustdoc: move the space at the end of where clauses
...so that we don't indent the next line by one extra space
2017-04-06 18:36:14 -05:00
Jorge Aparicio
f4f79c3304 ignore the .init_array doctest
as it's specific to ELF and won't pass on macOS / Windows
2017-04-06 18:32:39 -05:00
bors
2277f4bdcc Auto merge of #41121 - frewsxcv:rollup, r=frewsxcv
Rollup of 8 pull requests

- Successful merges: #40878, #40976, #41089, #41090, #41108, #41111, #41112, #41114
- Failed merges:
2017-04-06 22:51:51 +00:00
lukaramu
0dce5862fc improved std:#️⃣:Hasher docs
Part of #29357.
* rephrased summary sentences to be less redundant
* expanded top-level docs, adding a usage example and links to relevant
  methods (`finish`, `write` etc) as well as `Hash`
* added examples to the `finish` and `write` methods
2017-04-07 00:39:27 +02:00
Clar Charr
9ffb54568c Remove some CStr transmutes. 2017-04-06 17:42:02 -04:00
lukaramu
37275b6fc3 improved std:#️⃣:Hash docs
Part of #29357.
* merged "Derivable" and "How can I implement `Hash`?" sections into one
  "Implementing `Hash`" section to aid coherency
* added an example for `#[derive(Hash)]`
* moved part about relation between `Hash` and `Eq` into a new "`Hash` and
  `Eq`" section; changed wording to be more consistent with `HashMap` and
  `HashSet`'s
* explicitly mentioned `#[derive(PartialEq, Eq, Hash)]` in the new section
* changed method summaries for consistency, adding links and examples
2017-04-06 23:39:32 +02:00
lukaramu
e88a511fd5 improved std:#️⃣:BuildHasher docs
Part of #29357.
* split summary and explanation more clearly, while expanding the
  explanation to make the reason for `BuildHasher` existing more clear
* added an example illustrating that `Hasher`s created by one `BuildHasher`
  should be identical
* added links
* repeated the fact that hashers produced should be identical in
  `build_hasher`s method docs
2017-04-06 22:32:51 +02:00
bors
50c186419b Auto merge of #40863 - eddyb:coerce-only-once, r=arielb1
Avoid type-checking addition and indexing twice.

Fixes #40610 by moving the common `check_expr_coercable_to_type` call before the error reporting logic for binops and removing the one from `check_str_addition`.
Fixes #40861 by removing an unnecessary `check_expr_coercable_to_type` call.
2017-04-06 20:15:17 +00:00
lukaramu
c199d25386 rephrased std:#️⃣:BuildHasherDefault docs
Part of #29357.
* split summary and explanation more clearly
* added link to nomicon for "zero-sized"
* "does not need construction" -> say how it can be created, and that it
  doesn't need to be done with `HashMap` or `HashSet`
2017-04-06 21:59:08 +02:00
QuietMisdreavus
ae0e45c028 rustdoc: where clause adjustment to fix tests
- add spaces to output so stripping lines and breaking spaces renders
  the same
- add commas to where clauses in rustdoc tests to match the new output
2017-04-06 14:19:45 -05:00
Corey Farwell
8af853b310 Rollup merge of #41114 - nodakai:patch-2, r=petrochenkov
.gitmodules: use the official Git URL w/o redirect
2017-04-06 14:55:09 -04:00
Corey Farwell
f129c0c62b Rollup merge of #41112 - ollie27:rustdoc_pull, r=GuillaumeGomez
rustdoc: Use pulldown-cmark for Markdown HTML rendering

Instead of rendering all of the HTML in rustdoc this relies on
pulldown-cmark's `push_html` to do most of the work. A few iterator
adapters are used to make rustdoc specific modifications to the output.

This also fixes MarkdownHtml and link titles in plain_summary_line.

https://ollie27.github.io/rust_doc_test/ is the docs built with this change and #41111.

Part of #40912.

cc @GuillaumeGomez

r? @steveklabnik
2017-04-06 14:55:08 -04:00
Corey Farwell
202be73aef Rollup merge of #41111 - ollie27:docs_markdown_fix, r=GuillaumeGomez
Fix Markdown issues in the docs

* Since the switch to pulldown-cmark reference links need a blank line
before the URLs. (#40912)
* Reference link references are not case sensitive.
* Doc comments need to be indented uniformly otherwise rustdoc gets
confused.
2017-04-06 14:55:07 -04:00
Corey Farwell
30477a8dec Rollup merge of #41108 - arielb1:tuple-blame, r=estebank
don't try to blame tuple fields for immutability

Tuple fields don't have an `&T` in their declaration that can be changed
to `&mut T` - skip them..

Fixes #41104.

r? @nikomatsakis
2017-04-06 14:55:06 -04:00
Corey Farwell
a7502761ff Rollup merge of #41090 - rap2hpoutre:patch-2, r=steveklabnik
Add example to std::process::abort

This is a second step in order to complete this issue: https://github.com/rust-lang/rust/issues/29370
I submitted this PR with the help of @steveklabnik again. Thanks to him! More info here: https://github.com/rust-lang/rust/issues/29370#issuecomment-290653877
2017-04-06 14:55:05 -04:00
Corey Farwell
9516c80bb7 Rollup merge of #41089 - alexcrichton:update-musl, r=brson
travis: Update musl for i686/x86_64

This is a random stab towards #38618, no idea if it'll work. But hey more
up-to-date software is better, right?
2017-04-06 14:55:04 -04:00