]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoFix inherent-associated-const search result links
mitaa [Fri, 12 Feb 2016 08:34:00 +0000 (09:34 +0100)]
Fix inherent-associated-const search result links

Normal constants have their own page while associated constants are
embedded within their parent-items page.

8 years agoAuto merge of #31368 - JohanLorenzo:dont-strip-if-test-build, r=alexcrichton
bors [Fri, 12 Feb 2016 05:53:18 +0000 (05:53 +0000)]
Auto merge of #31368 - JohanLorenzo:dont-strip-if-test-build, r=alexcrichton

Tools which rely on DWARF for generating code coverage report, don't generate accurate numbers on test builds. For instance, [this sample main](https://github.com/JohanLorenzo/rust-testing-example/blob/757bdbf3887f43db9771c20cb72dfc32aa8f4321/src/main.rs) returns [100% coverage](https://coveralls.io/builds/4940156/source?filename=main.rs) when [kcov](https://github.com/SimonKagstrom/kcov/) runs.

With @pnkfelix 's great help, we could narrow down the issue: The linker strips unused function during phase 6. Here's a patch which stops stripping when someone calls `rustc --test $ARGS`. @pnkfelix wasn't sure if we should add a new flag, or just use --test. What do you think @alexcrichton ?

Also, I'm not too sure: where is the best place to add a test for this addition?

Thanks for the help!

8 years agobootstrap: Add a --clean flag
Alex Crichton [Fri, 12 Feb 2016 04:44:03 +0000 (20:44 -0800)]
bootstrap: Add a --clean flag

Also add a `clean` target for the makefiles to blow away everything related to
the build. Note that this specifically does not tamper with:

* the LLVM build directory
* the directory of the bootstrap system
* the cached downloads of cargo/rustc

8 years agoAuto merge of #30830 - arcnmx:static-extern, r=alexcrichton
bors [Fri, 12 Feb 2016 02:16:13 +0000 (02:16 +0000)]
Auto merge of #30830 - arcnmx:static-extern, r=alexcrichton

See #29676

r? @alexcrichton

8 years agoRemove unnecessary bounds on Error and Display implementations for TryLockError and...
Jonathan Reem [Fri, 12 Feb 2016 01:24:57 +0000 (17:24 -0800)]
Remove unnecessary bounds on Error and Display implementations for TryLockError and PoisonError.

8 years agodoc: skipping (obvious) details here is worth making this more nice to read
Tshepang Lekhonkhobe [Thu, 11 Feb 2016 21:35:30 +0000 (23:35 +0200)]
doc: skipping (obvious) details here is worth making this more nice to read

8 years agoAuto merge of #31123 - alexcrichton:who-doesnt-want-two-build-systems, r=brson
bors [Fri, 12 Feb 2016 00:19:13 +0000 (00:19 +0000)]
Auto merge of #31123 - alexcrichton:who-doesnt-want-two-build-systems, r=brson

This series of commits adds the initial implementation of a new build system for
the compiler and standard library based on Cargo. The high-level architecture
now looks like:

1. The `./configure` script is run with `--enable-rustbuild` and other standard
   configuration options.
2. A `Makefile` is generate which proxies commands to the new build system.
3. The new build system has a Python script entry point which manages
   downloading both a Rust and Cargo nightly. This initial script also manages
   building the build system itself (which is written in Rust).
4. The build system, written in rust and called `bootstrap`, architects how to
   call `cargo` and manages building all native libraries and such.

One might reasonably ask "why rewrite the build system?", which is a good
question! The Rust project has used Makefiles for as long as I can remember at
least, and while ugly and difficult to use are undeniably robust as they contain
years worth of tweaking and tuning for working on as many platforms in as many
situation as possible. The rationale behind this PR, however is:

* The makefiles are impenetrable to all but a few people on this
  planet. This means that contributions to the build system are almost
  nonexistent, and furthermore if a build system change is needed it's
  incredibly difficult to figure out how to do so. This hindrance prevents us
  from doing some "perhaps fancier" things we may wish to do in make.

* Our build system, while portable, is unfortunately not infinitely portable
  everywhere.  For example the recently-introduced MSVC target is quite unlikely
  to have `make` installed by default (e.g. it requires building inside of an
  MSYS2 shell currently). Conversely, the portability of make comes at a cost of
  crazy and weird hacks to work around all sorts of versions of software
  everywhere, especially when it comes to the configure script and makefiles.
  By rewriting this logic in one of the most robust platforms there is, Rust,
  we get to assuage all of these worries for free!

* There's a standard tool to build Rust crates, Cargo, but the standard library
  and compiler don't use it. This means that they cannot benefit easily from the
  crates.io ecosystem, nor can the ecosystem benefit from a standard way to
  build this repository itself. Moving to Cargo should help assuage both of
  these needs. This has the added benefit of making the compiler more
  approachable for newbies as working on the compiler will just happen to be
  working on a large Cargo project, all the same standard tools and tricks will
  apply.

* There's a huge amount of portability information in the main distribution, for
  example around cross compiling, compiling on new OSes, etc. Pushing this logic
  into standard crates (like `gcc`) enables the community to immediately benefit
  from new build logic.

Despite these benefits, it's going to be a long road to actually replace our
current build system. This PR is just the beginning and doesn't implement the
full suite of functionality as the current one, but there are many more to
follow! The current implementation strategy hopes to look like:

1. Land a second build system in-tree that can be itereated on an and
   contributed to. This will not be used just yet in terms of gating new commits
   to the repo.
2. Over time, bring the second build system to feature parity with the old build
   system, start setting up CI for both build systems.
3. At some point in the future, switch the default to the new build system, but
   keep the old one around.
4. At some further point in the future, delete the entire old build system.

---

Alright, so with all that out of the way, here's some more info on this PR
itself. The inital build system here is contained in the `src/bootstrap`
directory and just adds the necessary minimum bits to bootstrap the compiler
itself. There is currently no support for building documentation, running tests,
or installing, but the implemented support is:

* Compiling LLVM with `cmake` instead of `./configure` + `make`. The LLVM
  project is removing their autotools build system, so we'd have to make this
  transition eventually anyway.

* Compiling compiler-rt with `cmake` as well (for the same rationale as above).

* Adding `Cargo.toml` to map out the dependency graph to all crates, and also
  adding `build.rs` files where appropriate. For example `alloc_jemalloc` has a
  script to build jemalloc, `flate` has a script to build `miniz.c`, `std` will
  build `libbacktrace`, etc.

* Orchestrating all the calls to `cargo` to build the standard distribution,
  following the normal bootstrapping process. This also tracks dependencies
  between steps to ensure cross-compilation targets happen as well.

* Configuration is intended to eventually be done through a `config.toml` file,
  so support is implemented for this. The most likely vector of configuration
  for now, however, is likely through `config.mk` (what `./configure` emits), so
  the build system currently parses this information.

There's still quite a few steps left to do, and I'll open up some follow-up
issues (as well as a tracking issue) for this migration, but hopefully this is a
great start to get going! This PR is currently tested on all the
Windows/Linux/OSX triples for x86\_64 and x86, but more portability is always
welcome!

---

Future functionality left to implement

* [ ] Re-verify that multi-host builds work
* [ ] Verify android build works
* [ ] Verify iOS build work (mostly compiler-rt)
* [ ] Verify sha256 and ideally gpg of downloaded nightly compiler and nightly rustc
* [ ] Implement testing -- this is a huge bullet point with lots of sub-bullets
* [ ] Build and generate documentation (plus the various tools we have in-tree)
* [ ] Move various src/etc scripts into Rust -- not sure how this interacts with `make` build system
* [ ] Implement `make install` - like testing this is also quite massive
* [x] Deduplicate version information with makefiles

8 years agoAuto merge of #31545 - dotdash:no_noalias, r=alexcrichton
bors [Thu, 11 Feb 2016 22:22:54 +0000 (22:22 +0000)]
Auto merge of #31545 - dotdash:no_noalias, r=alexcrichton

LLVM's memory dependence analysis doesn't properly account for calls
that could unwind and thus effectively act as a branching point. This
can lead to stores that are only visible when the call unwinds being
removed, possibly leading to calls to drop() functions with b0rked
memory contents.

As there is no fix for this in LLVM yet and we want to keep
compatibility to current LLVM versions anyways, we have to workaround
this bug by omitting the noalias attribute on &mut function arguments.
Benchmarks suggest that the performance loss by this change is very
small.

Thanks to @RalfJung for pushing me towards not removing too many
noalias annotations and @alexcrichton for helping out with the test for
this bug.

Fixes #29485

8 years agoAdd a no-landing-pads MIR pass
Simonas Kazlauskas [Thu, 11 Feb 2016 08:13:35 +0000 (10:13 +0200)]
Add a no-landing-pads MIR pass

The pass removes the unwind branch of each terminator, thus moving the responsibility of handling
the -Z no-landing-pads flag to a small self-contained pass… instead of polluting the translator.

8 years agodoc: assert_eq on 2 boolean values is redundant
Tshepang Lekhonkhobe [Thu, 11 Feb 2016 21:05:00 +0000 (23:05 +0200)]
doc: assert_eq on 2 boolean values is redundant

8 years agodoc: add missing words
Tshepang Lekhonkhobe [Thu, 11 Feb 2016 20:59:34 +0000 (22:59 +0200)]
doc: add missing words

8 years agoRemove some unnecessary indirection from AST structures
Vadim Petrochenkov [Thu, 11 Feb 2016 20:33:09 +0000 (23:33 +0300)]
Remove some unnecessary indirection from AST structures

8 years agorustc_back: Fix disabling jemalloc
Alex Crichton [Fri, 22 Jan 2016 02:37:46 +0000 (18:37 -0800)]
rustc_back: Fix disabling jemalloc

When building with Cargo we need to detect `feature = "jemalloc"` to enable
jemalloc, so propagate this same change to the build system to pass the right
`--cfg` argument.

8 years agoconfigure: Add an option to use the cargo build system
Alex Crichton [Fri, 22 Jan 2016 01:05:04 +0000 (17:05 -0800)]
configure: Add an option to use the cargo build system

This commit adds a `--enable-rustbuild` option to the configure script which
will copy a different `Makefile.in` into place to intercept all `make`
invocations.

Currently this makefile only has one target, but it's expected to be filled out
quite a bit over time!

8 years agorustc_llvm: Tweak how initialization is performed
Alex Crichton [Thu, 21 Jan 2016 23:39:22 +0000 (15:39 -0800)]
rustc_llvm: Tweak how initialization is performed

Refactor a bit to have less repetition and #[cfg] and try to bury it all inside
of a macro.

8 years agorustbook: Make `main` a public function
Alex Crichton [Thu, 21 Jan 2016 23:37:15 +0000 (15:37 -0800)]
rustbook: Make `main` a public function

This will allow it to be used as a crate in a Cargo-based build

8 years agobootstrap: Add directives to not double-link libs
Alex Crichton [Thu, 21 Jan 2016 23:36:25 +0000 (15:36 -0800)]
bootstrap: Add directives to not double-link libs

Have all Cargo-built crates pass `--cfg cargobuild` and then add appropriate
`#[cfg]` definitions to all crates to avoid linking anything if this is passed.
This should help allow libstd to compile with both the makefiles and with Cargo.

8 years agobootstrap: Add build scripts for crates
Alex Crichton [Thu, 21 Jan 2016 23:21:13 +0000 (15:21 -0800)]
bootstrap: Add build scripts for crates

This commits adds build scripts to the necessary Rust crates for all the native
dependencies. This is currently a duplication of the support found in mk/rt.mk
and is my best effort at representing the logic twice, but there may be some
unfortunate-and-inevitable divergence.

As a summary:

* alloc_jemalloc - build script to compile jemallocal
* flate - build script to compile miniz.c
* rustc_llvm - build script to run llvm-config and learn about how to link it.
  Note that this crucially (and will not ever) compile LLVM as that would take
  far too long.
* rustdoc - build script to compile hoedown
* std - script to determine lots of libraries/linkages as well as compile
  libbacktrace

8 years agobootstrap: Add a bunch of Cargo.toml files
Alex Crichton [Thu, 21 Jan 2016 23:19:23 +0000 (15:19 -0800)]
bootstrap: Add a bunch of Cargo.toml files

These describe the structure of all our crate dependencies.

8 years agoAuto merge of #31083 - SimonSapin:set_port, r=alexcrichton
bors [Thu, 11 Feb 2016 18:44:52 +0000 (18:44 +0000)]
Auto merge of #31083 - SimonSapin:set_port, r=alexcrichton

As demonstrated in the `resolve_socket_addr` change, this is less awkward than re-creating a new address from the other parts.

If this is to be accepted, pleas open a tracking issue (I can’t set the appropriate tags) and I’ll update the PR with the tracking issue number.

8 years agoconfigure: Remove default NDK path value
Alex Crichton [Fri, 15 Jan 2016 00:19:41 +0000 (16:19 -0800)]
configure: Remove default NDK path value

This likely isn't always valid, and subverts auto-detection.

8 years agobootstrap: Read configuration from config.mk
Alex Crichton [Fri, 20 Nov 2015 00:55:21 +0000 (16:55 -0800)]
bootstrap: Read configuration from config.mk

During the transition period where we're still using ./configure and makefiles,
read some extra configuration from `config.mk` if it's present. This means that
the bootstrap build should be configured the same as the original ./configure
invocation.

Eventually this will all be removed in favor of only storing information in
`config.toml` (e.g. the configure script will generate config.toml), but for now
this should suffice.

8 years agoAdd a Cargo-based build system
Alex Crichton [Thu, 19 Nov 2015 23:20:12 +0000 (15:20 -0800)]
Add a Cargo-based build system

This commit is the start of a series of commits which start to replace the
makefiles with a Cargo-based build system. The aim is not to remove the
makefiles entirely just yet but rather just replace the portions that invoke the
compiler to do the bootstrap. This commit specifically adds enough support to
perform the bootstrap (and all the cross compilation within) along with
generating documentation.

More commits will follow up in this series to actually wire up the makefiles to
call this build system, so stay tuned!

8 years agoFix usage of GetUserProfileDirectoryW in env::home_dir
Peter Atashian [Thu, 11 Feb 2016 18:12:56 +0000 (13:12 -0500)]
Fix usage of GetUserProfileDirectoryW in env::home_dir

Signed-off-by: Peter Atashian <retep998@gmail.com>
8 years agoPass through diagnostic handler instead
arcnmx [Fri, 15 Jan 2016 19:43:14 +0000 (14:43 -0500)]
Pass through diagnostic handler instead

8 years agoUse find_export_name_attr instead of string literal
arcnmx [Tue, 12 Jan 2016 20:55:59 +0000 (15:55 -0500)]
Use find_export_name_attr instead of string literal

8 years agoRemove link_section and linkage as extern indicators
arcnmx [Tue, 12 Jan 2016 18:07:04 +0000 (13:07 -0500)]
Remove link_section and linkage as extern indicators

8 years agoOnly retain external static symbols across LTO
arcnmx [Sat, 7 Nov 2015 17:22:04 +0000 (12:22 -0500)]
Only retain external static symbols across LTO

8 years agoadd item_post methods
llogiq [Thu, 11 Feb 2016 17:19:18 +0000 (18:19 +0100)]
add item_post methods

8 years agoAuto merge of #31532 - tomaka:fix-emscripten, r=brson
bors [Thu, 11 Feb 2016 16:49:20 +0000 (16:49 +0000)]
Auto merge of #31532 - tomaka:fix-emscripten, r=brson

Before this PR:

> test result: FAILED. 2039 passed; 327 failed; 2 ignored; 0 measured

After:

> test result: FAILED. 2232 passed; 134 failed; 2 ignored; 0 measured

r? @brson

8 years agoAuto merge of #31527 - danlrobertson:i15735, r=alexcrichton
bors [Thu, 11 Feb 2016 14:51:47 +0000 (14:51 +0000)]
Auto merge of #31527 - danlrobertson:i15735, r=alexcrichton

After some digging I couldn't find a test for #15735, so I added a simplified version to `run-pass` and tested it against 80a3f45 to ensure it fails.

8 years agoAdd SocketAddrV6::set_flowinfo and set_scope_id
Simon Sapin [Thu, 11 Feb 2016 14:36:10 +0000 (15:36 +0100)]
Add SocketAddrV6::set_flowinfo and set_scope_id

8 years agoAdd `SocketAddr{,V4,V6}::set_ip`.
Simon Sapin [Thu, 11 Feb 2016 13:56:08 +0000 (14:56 +0100)]
Add `SocketAddr{,V4,V6}::set_ip`.

8 years agoMinor change.
Sandeep Datta [Thu, 11 Feb 2016 14:25:45 +0000 (19:55 +0530)]
Minor change.

8 years agoMinor change.
Sandeep Datta [Thu, 11 Feb 2016 14:14:33 +0000 (19:44 +0530)]
Minor change.

8 years agoExplained the data race with an example.
Sandeep Datta [Thu, 11 Feb 2016 14:10:19 +0000 (19:40 +0530)]
Explained the data race with an example.

8 years agoAdd `SocketAddr{,V4,V6}::set_port`.
Simon Sapin [Thu, 21 Jan 2016 18:47:38 +0000 (19:47 +0100)]
Add `SocketAddr{,V4,V6}::set_port`.

As demonstrated in the `resolve_socket_addr` change, this is less awkward
than re-creating a new address from the other parts.

8 years agoAuto merge of #31487 - oli-obk:breaking_batch/ast/unop, r=Manishearth
bors [Thu, 11 Feb 2016 12:52:42 +0000 (12:52 +0000)]
Auto merge of #31487 - oli-obk:breaking_batch/ast/unop, r=Manishearth

r? @Manishearth

I just noticed they can't be rolled up (often modifying the same line(s) in imports). So once I reach the critical amount for them to be merged I'll create a PR that merges all of them.

8 years agoEnable /SAFESEH for i686-pc-windows-msvc
Oliver Middleton [Tue, 9 Feb 2016 17:20:32 +0000 (17:20 +0000)]
Enable /SAFESEH for i686-pc-windows-msvc

8 years agoEnable /LARGEADDRESSAWARE for i686-pc-windows-msvc
Oliver Middleton [Wed, 3 Feb 2016 13:28:18 +0000 (13:28 +0000)]
Enable /LARGEADDRESSAWARE for i686-pc-windows-msvc

It's already enabled for i686-pc-windows-gnu.

8 years agofixup: meta item kind
Oliver Schneider [Thu, 11 Feb 2016 11:35:47 +0000 (12:35 +0100)]
fixup: meta item kind

8 years ago[breaking-change] don't glob export ast::PathListItem_ variants
Oliver 'ker' Schneider [Tue, 9 Feb 2016 17:09:18 +0000 (18:09 +0100)]
[breaking-change] don't glob export ast::PathListItem_ variants

8 years ago[breaking-change] don't glob export ast::StrStyle variants
Oliver 'ker' Schneider [Tue, 9 Feb 2016 17:01:08 +0000 (18:01 +0100)]
[breaking-change] don't glob export ast::StrStyle variants

8 years ago[breaking-change] don't glob export ast::Visibility variants
Oliver 'ker' Schneider [Tue, 9 Feb 2016 16:57:49 +0000 (17:57 +0100)]
[breaking-change] don't glob export ast::Visibility variants

8 years ago[breaking-change] don't glob export ast::TraitItemKind variants
Oliver 'ker' Schneider [Tue, 9 Feb 2016 16:54:11 +0000 (17:54 +0100)]
[breaking-change] don't glob export ast::TraitItemKind variants

8 years ago[breaking-change] don't glob export ast::Mutablity variants
Oliver 'ker' Schneider [Tue, 9 Feb 2016 16:44:47 +0000 (17:44 +0100)]
[breaking-change] don't glob export ast::Mutablity variants

8 years ago[breaking-change] don't glob export ast::MetaItem_
Oliver 'ker' Schneider [Tue, 9 Feb 2016 11:05:20 +0000 (12:05 +0100)]
[breaking-change] don't glob export ast::MetaItem_

8 years ago[breaking-change] don't glob export ast::MacStmtStyle
Oliver 'ker' Schneider [Tue, 9 Feb 2016 10:56:59 +0000 (11:56 +0100)]
[breaking-change] don't glob export ast::MacStmtStyle

8 years ago[breaking-change] don't glob export ast::KleeneOp variants
Oliver 'ker' Schneider [Tue, 9 Feb 2016 10:45:01 +0000 (11:45 +0100)]
[breaking-change] don't glob export ast::KleeneOp variants

8 years ago[breaking-change] don't glob export ast::Item_ variants
Oliver 'ker' Schneider [Tue, 9 Feb 2016 10:36:51 +0000 (11:36 +0100)]
[breaking-change] don't glob export ast::Item_ variants

8 years ago[breaking-change] don't glob export ast::ForeignItem_ variants
Oliver 'ker' Schneider [Tue, 9 Feb 2016 10:31:19 +0000 (11:31 +0100)]
[breaking-change] don't glob export ast::ForeignItem_ variants

8 years ago[breaking-change] don't pub export ast::Stmt_ variants
Oliver Schneider [Mon, 8 Feb 2016 16:23:13 +0000 (17:23 +0100)]
[breaking-change] don't pub export ast::Stmt_ variants

8 years ago[breaking-change] don't pub export ast::IntLitType variants
Oliver Schneider [Mon, 8 Feb 2016 16:16:23 +0000 (17:16 +0100)]
[breaking-change] don't pub export ast::IntLitType variants

8 years ago[breaking-change] don't pub export ast::Lit_ variants
Oliver Schneider [Mon, 8 Feb 2016 16:06:20 +0000 (17:06 +0100)]
[breaking-change] don't pub export ast::Lit_ variants

8 years ago[breaking-change] don't pub export ast::Ty_ variants
Oliver Schneider [Mon, 8 Feb 2016 15:53:21 +0000 (16:53 +0100)]
[breaking-change] don't pub export ast::Ty_ variants

8 years ago[breaking-change] remove unused enum ast::PrimTy
Oliver Schneider [Mon, 8 Feb 2016 15:35:20 +0000 (16:35 +0100)]
[breaking-change] remove unused enum ast::PrimTy

8 years agoremove unit test that can't be tested anymore
Oliver Schneider [Wed, 23 Dec 2015 21:29:43 +0000 (22:29 +0100)]
remove unit test that can't be tested anymore

8 years ago[breaking-change] remove the sign from integer literals in the ast
Oliver Schneider [Thu, 11 Feb 2016 08:52:55 +0000 (09:52 +0100)]
[breaking-change] remove the sign from integer literals in the ast

8 years ago[breaking-change] don't glob export ast::{UintTy, IntTy} variants
Oliver Schneider [Mon, 8 Feb 2016 15:20:57 +0000 (16:20 +0100)]
[breaking-change] don't glob export ast::{UintTy, IntTy} variants

8 years ago[breaking-change] don't glob export ast::FloatTy variants
Oliver Schneider [Mon, 8 Feb 2016 15:09:01 +0000 (16:09 +0100)]
[breaking-change] don't glob export ast::FloatTy variants

8 years ago[breaking-change] don't glob export ast::Expr_ variants
Oliver Schneider [Mon, 8 Feb 2016 15:05:05 +0000 (16:05 +0100)]
[breaking-change] don't glob export ast::Expr_ variants

8 years ago[breaking-change] don't glob export ast::ExplicitSelf_ variants
Oliver Schneider [Mon, 8 Feb 2016 14:43:56 +0000 (15:43 +0100)]
[breaking-change] don't glob export ast::ExplicitSelf_ variants

8 years ago[breaking-change] don't glob export ast::Decl_ variants
Oliver Schneider [Mon, 8 Feb 2016 14:34:47 +0000 (15:34 +0100)]
[breaking-change] don't glob export ast::Decl_ variants

8 years ago[breaking-change] don't glob export ast::CaptureClause variants
Oliver Schneider [Mon, 8 Feb 2016 14:27:08 +0000 (15:27 +0100)]
[breaking-change] don't glob export ast::CaptureClause variants

8 years ago[breaking-change] don't glob import/export syntax::abi enum variants
Oliver Schneider [Fri, 5 Feb 2016 12:13:36 +0000 (13:13 +0100)]
[breaking-change] don't glob import/export syntax::abi enum variants

8 years ago[breaking-change] don't glob export ast::BlockCheckMode variants
Oliver Schneider [Mon, 8 Feb 2016 11:44:45 +0000 (12:44 +0100)]
[breaking-change] don't glob export ast::BlockCheckMode variants

8 years ago[breaking-change] don't glob import ast::FunctionRetTy variants
Oliver Schneider [Mon, 8 Feb 2016 14:04:11 +0000 (15:04 +0100)]
[breaking-change] don't glob import ast::FunctionRetTy variants

8 years ago[breaking-change] don't glob export ast::BinOp_
Oliver Schneider [Mon, 8 Feb 2016 12:16:12 +0000 (13:16 +0100)]
[breaking-change] don't glob export ast::BinOp_

8 years ago[breaking-change] don't glob export ast::UnOp variants
Oliver Schneider [Mon, 8 Feb 2016 12:21:29 +0000 (13:21 +0100)]
[breaking-change] don't glob export ast::UnOp variants

8 years agoIgnore tests that use threads on emscripten
Pierre Krieger [Thu, 11 Feb 2016 11:34:41 +0000 (12:34 +0100)]
Ignore tests that use threads on emscripten

8 years agoAuto merge of #31525 - antonblanchard:powerpc64_merge4, r=alexcrichton
bors [Thu, 11 Feb 2016 10:56:45 +0000 (10:56 +0000)]
Auto merge of #31525 - antonblanchard:powerpc64_merge4, r=alexcrichton

We no longer have a separate powerpc64 and powerpc64le target_arch, and instead use target_endian to select between the two. These patches fix a couple of remaining issues.

8 years agoAdd -C link-dead-code option r=alexcrichton
Johan Lorenzo [Tue, 2 Feb 2016 17:56:59 +0000 (17:56 +0000)]
Add -C link-dead-code option r=alexcrichton

Turning gc-sections off improves code coverage based for tools which
use DWARF debugging information (like kcov). Otherwise dead code is
stripped and kcov returns a coverage percentage that doesn't reflect
reality.

8 years agoAuto merge of #31507 - dirk:dirk/fix-rustdoc-undeclared-type-ice, r=nrc
bors [Thu, 11 Feb 2016 09:01:12 +0000 (09:01 +0000)]
Auto merge of #31507 - dirk:dirk/fix-rustdoc-undeclared-type-ice, r=nrc

Fixes #31451.

8 years agoMove FulfillmentContext out of InferCtxt
Masood Malekghassemi [Thu, 11 Feb 2016 08:03:37 +0000 (00:03 -0800)]
Move FulfillmentContext out of InferCtxt

8 years agoFix regression from #31461 and fix the test that was supposed to catch it.
Jeffrey Seyfried [Thu, 11 Feb 2016 07:18:41 +0000 (07:18 +0000)]
Fix regression from #31461 and fix the test that was supposed to catch it.

8 years agoClarified move semantics in "the details" section.
Sandeep Datta [Thu, 11 Feb 2016 06:53:06 +0000 (12:23 +0530)]
Clarified move semantics in "the details" section.

8 years agoAuto merge of #31357 - rthomas:hashers, r=alexcrichton
bors [Thu, 11 Feb 2016 06:48:54 +0000 (06:48 +0000)]
Auto merge of #31357 - rthomas:hashers, r=alexcrichton

add a public hasher function for HashSet and HashMap

8 years agodon't ICE on missing exchange_* lang items
Alex Burka [Thu, 11 Feb 2016 06:38:08 +0000 (01:38 -0500)]
don't ICE on missing exchange_* lang items

8 years agodon't ICE on missing box_free lang item
Alex Burka [Thu, 11 Feb 2016 06:37:55 +0000 (01:37 -0500)]
don't ICE on missing box_free lang item

8 years agoUpdate some debug logging
Masood Malekghassemi [Thu, 11 Feb 2016 06:22:16 +0000 (22:22 -0800)]
Update some debug logging

8 years agoAdded a few words to indicate where the vector object is created.
Sandeep Datta [Thu, 11 Feb 2016 05:46:47 +0000 (11:16 +0530)]
Added a few words to indicate where the vector object is created.

8 years agoAdd a public hasher function for HashSet and HashMap
Ryan Thomas [Tue, 2 Feb 2016 03:29:48 +0000 (14:29 +1100)]
Add a public hasher function for HashSet and HashMap

8 years agoAdd _post methods for blocks and crates
llogiq [Thu, 11 Feb 2016 04:58:09 +0000 (05:58 +0100)]
Add _post methods for blocks and crates

8 years agoAuto merge of #31461 - jseyfried:remove_import_resolutions, r=nrc
bors [Thu, 11 Feb 2016 04:27:13 +0000 (04:27 +0000)]
Auto merge of #31461 - jseyfried:remove_import_resolutions, r=nrc

This PR adds to `NameBinding` so it can more fully represent bindings from imports as well from items, refactors away `Target`, generalizes `ImportResolution` to a simpler type `NameResolution`, and uses a single `NameResolution`-valued map in place the existing maps `children` and `import_resolutions` (of `NameBinding`s and `ImportResolution`s, respectively), simplifying duplicate checking and name resolution.

It also unifies the `resolve_name_in_module` in `lib.rs` with its namesake in `resolve_imports.rs`, clarifying and improving the core logic (fixes #31403 and fixes #31404) while maintaining clear future-comparability with shadowable globs (i.e., never reporting that a resolution is a `Success` or is `Failing` unless this would also be knowable with shadowable globs).

Since it fixes #31403, this is technically a [breaking-change], but it is exceedingly unlikely to cause breakage in practice. The following is an example of code that would break:
```rust
mod foo {
    pub mod bar {} // This defines bar in the type namespace
    pub use alpha::bar; // This defines bar in the value namespace

    // This should define baz in both namespaces, but it only defines baz in the type namespace.
    pub use self::bar as baz;
    pub fn baz() {} // This should collide with baz, but now it does not.
}

pub fn f() {}
mod alpha {
    pub use self::f as bar; // Changing this to `pub fn bar() {}` causes the collision right now.
    pub use super::*;
}
```

r? @nrc

8 years agomod.rs: fix typo
Scott Whittaker [Thu, 11 Feb 2016 03:28:32 +0000 (22:28 -0500)]
mod.rs: fix typo

"destructors" was misspelled.

8 years agoAuto merge of #31479 - kamalmarhubi:fmt-pointer-unsized, r=alexcrichton
bors [Thu, 11 Feb 2016 01:54:15 +0000 (01:54 +0000)]
Auto merge of #31479 - kamalmarhubi:fmt-pointer-unsized, r=alexcrichton

This allows printing pointers to unsized types with the {:p} formatting
directive. The following impls are extended to unsized types:
 - impl<'a, T: ?Sized> Pointer for &'a T
 - impl<'a, T: ?Sized> Pointer for &'a mut T
 - impl<T: ?Sized> Pointer for *const T
 - impl<T: ?Sized> Pointer for *mut T
 - impl<T: ?Sized> fmt::Pointer for Box<T>
 - impl<T: ?Sized> fmt::Pointer for Rc<T>
 - impl<T: ?Sized> fmt::Pointer for Arc<T>

8 years agoDon't assume color=always when explicitally specified
Steven Allen [Thu, 11 Feb 2016 01:02:20 +0000 (20:02 -0500)]
Don't assume color=always when explicitally specified

Fixes #31546

8 years agoAuto merge of #31409 - alexcrichton:command-exec, r=aturon
bors [Wed, 10 Feb 2016 22:51:43 +0000 (22:51 +0000)]
Auto merge of #31409 - alexcrichton:command-exec, r=aturon

These commits are an implementation of https://github.com/rust-lang/rfcs/pull/1359 which is tracked via https://github.com/rust-lang/rust/issues/31398. The `before_exec` implementation fit easily with the current process spawning framework we have, but unfortunately the `exec` implementation required a bit of a larger refactoring. The stdio handles were all largely managed as implementation details of `std::process` and the `exec` function lived in `std::sys`, so the two didn't have access to one another.

I took this as a sign that a deeper refactoring was necessary, and I personally feel that the end result is cleaner for both Windows and Unix. The commits should be separated nicely for reviewing (or all at once if you're feeling ambitious), but the changes made here were:

* The process spawning on Unix was refactored in to a pre-exec and post-exec function. The post-exec function isn't allowed to do any allocations of any form, and management of transmitting errors back to the parent is managed by the pre-exec function (as it's the one that actually forks).
* Some management of the exit status was pushed into platform-specific modules. On Unix we must cache the return value of `wait` as the pid is consumed after we wait on it, but on Windows we can just keep querying the system because the handle stays valid.
* The `Stdio::None` variant was renamed to `Stdio::Null` to better reflect what it's doing.
* The global lock on `CreateProcess` is now correctly positioned to avoid unintended inheritance of pipe handles that other threads are sending to their child processes. After a more careful reading of the article referenced the race is not in `CreateProcess` itself, but rather the property that handles are unintentionally shared.
* All stdio management now happens in platform-specific modules. This provides a cleaner implementation/interpretation for `FromFraw{Fd,Handle}` for each platform as well as a cleaner transition from a configuration to what-to-do once we actually need to do the spawn.

With these refactorings in place, implementing `before_exec` and `exec` ended up both being pretty trivial! (each in their own commit)

8 years agoWorkaround LLVM optimizer bug by not marking &mut pointers as noalias
Björn Steinbrink [Fri, 29 Jan 2016 10:11:24 +0000 (11:11 +0100)]
Workaround LLVM optimizer bug by not marking &mut pointers as noalias

LLVM's memory dependence analysis doesn't properly account for calls
that could unwind and thus effectively act as a branching point. This
can lead to stores that are only visible when the call unwinds being
removed, possibly leading to calls to drop() functions with b0rked
memory contents.

As there is no fix for this in LLVM yet and we want to keep
compatibility to current LLVM versions anyways, we have to workaround
this bug by omitting the noalias attribute on &mut function arguments.
Benchmarks suggest that the performance loss by this change is very
small.

Thanks to @RalfJung for pushing me towards not removing too many
noalias annotations and @alexcrichton for helping out with the test for
this bug.

Fixes #29485

8 years agoAuto merge of #31455 - tmiasko:expected-tokens, r=alexcrichton
bors [Wed, 10 Feb 2016 20:55:53 +0000 (20:55 +0000)]
Auto merge of #31455 - tmiasko:expected-tokens, r=alexcrichton

Previously when breaking tokens into smaller pieces, the replace_token
function have been used. It replaced current token and updated span
information, but it did not clear the list of expected tokens, neither
did it update remaining info about last token. This could lead to
incorrect error message, like one described in the issue #24780:

    expected one of ... `>` ...  found `>`

8 years agodoc: concat_idents! macro: more on its limitations.
NODA, Kai [Wed, 10 Feb 2016 16:55:47 +0000 (00:55 +0800)]
doc: concat_idents! macro: more on its limitations.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
8 years agoMore emscripten test fixes
Pierre Krieger [Wed, 10 Feb 2016 19:21:56 +0000 (20:21 +0100)]
More emscripten test fixes

8 years agostd: Move constant back to where it needs to be
Alex Crichton [Tue, 9 Feb 2016 23:14:12 +0000 (15:14 -0800)]
std: Move constant back to where it needs to be

Lost track of this during the std::process refactorings

8 years agostd: Use macros from libc instead of locally
Alex Crichton [Tue, 9 Feb 2016 23:13:33 +0000 (15:13 -0800)]
std: Use macros from libc instead of locally

Helps cut down on #[cfg]!

8 years agostd: Implement CommandExt::exec
Alex Crichton [Thu, 4 Feb 2016 19:16:32 +0000 (11:16 -0800)]
std: Implement CommandExt::exec

This commit implements the `exec` function proposed in [RFC 1359][rfc] which is
a function on the `CommandExt` trait to execute all parts of a `Command::spawn`
without the `fork` on Unix. More details on the function itself can be found in
the comments in the commit.

[rfc]: https://github.com/rust-lang/rfcs/pull/1359

cc #31398

8 years agostd: Push process stdio setup in std::sys
Alex Crichton [Thu, 4 Feb 2016 19:10:37 +0000 (11:10 -0800)]
std: Push process stdio setup in std::sys

Most of this is platform-specific anyway, and we generally have to jump through
fewer hoops to do the equivalent operation on Windows. One benefit for Windows
today is that this new structure avoids an extra `DuplicateHandle` when creating
pipes. For Unix, however, the behavior should be the same.

Note that this is just a pure refactoring, no functionality was added or
removed.

8 years agostd: Lift out Windows' CreateProcess lock a bit
Alex Crichton [Thu, 4 Feb 2016 17:59:47 +0000 (09:59 -0800)]
std: Lift out Windows' CreateProcess lock a bit

The function `CreateProcess` is not itself unsafe to call from many threads, the
article in question is pointing out that handles can be inherited by unintended
child processes. This is basically the same race as the standard Unix
open-then-set-cloexec race.

Since the intention of the lock is to protect children from inheriting
unintended handles, the lock is now lifted out to before the creation of the
child I/O handles (which will all be inheritable). This will ensure that we only
have one process in Rust at least creating inheritable handles at a time,
preventing unintended inheritance to children.

8 years agostd: Rename Stdio::None to Stdio::Null
Alex Crichton [Thu, 4 Feb 2016 17:53:01 +0000 (09:53 -0800)]
std: Rename Stdio::None to Stdio::Null

This better reflects what it's actually doing as we don't actually have an
option for "leave this I/O slot as an empty hole".

8 years agostd: Push Child's exit status to sys::process
Alex Crichton [Thu, 4 Feb 2016 02:09:35 +0000 (18:09 -0800)]
std: Push Child's exit status to sys::process

On Unix we have to be careful to not call `waitpid` twice, but we don't have to
be careful on Windows due to the way process handles work there. As a result the
cached `Option<ExitStatus>` is only necessary on Unix, and it's also just an
implementation detail of the Unix module.

At the same time. also update some code in `kill` on Unix to avoid a wonky
waitpid with WNOHANG. This was added in 0e190b9a to solve #13124, but the
`signal(0)` method is not supported any more so there's no need to for this
workaround. I believe that this is no longer necessary as it's not really doing
anything.

8 years agostd: Implement CommandExt::before_exec
Alex Crichton [Thu, 4 Feb 2016 00:55:59 +0000 (16:55 -0800)]
std: Implement CommandExt::before_exec

This is a Unix-specific function which adds the ability to register a closure to
run pre-exec to configure the child process as required (note that these
closures are run post-fork).

cc #31398