Commit Graph

1782 Commits

Author SHA1 Message Date
bors
339a409bfd Auto merge of #31430 - nagisa:mir-dyndrop, r=nikomatsakis
Zeroing on-drop seems to work fine. Still thinking about the best way to approach zeroing on-move.

(based on top of the other drop PR; only the last 2 commits are relevant)
2016-03-01 23:30:49 +00:00
Simonas Kazlauskas
d1a12392b2 Nits and cleanups 2016-02-26 14:15:38 +02:00
Niko Matsakis
b7f53b8aa6 fix drop of fat ptrs 2016-02-25 16:56:11 -05:00
bors
798ce4ab59 Auto merge of #30856 - mneumann:thread_local_extern, r=alexcrichton
This will correctly add the thread_local attribute to the external static variable ```errno```:

```rust
extern {
     #[thread_local]
     static errno: c_int;
}
```

Before this commit, the thread_local attribute is ignored. Fixes #30795.

Thanks @alexcrichton for pointing out the solution.
2016-02-25 20:37:38 +00:00
Manish Goregaokar
a48f95879d Rollup merge of #31362 - jseyfried:fix_extern_crate_visibility, r=nikomatsakis
This PR changes the visibility of extern crate declarations to match that of items (fixes #26775).
To avoid breakage, the PR makes it a `public_in_private` lint to reexport a private extern crate, and it adds the lint `inaccessible_extern_crate` for uses of an inaccessible extern crate.

The lints can be avoided by making the appropriate `extern crate` declaration public.
2016-02-25 11:41:01 +05:30
Simonas Kazlauskas
ba26efb60c Implement filling drop in MIR
Hopefully the author caught all the cases. For the mir_dynamic_drops_3 test case the ratio of
memsets to other instructions is 12%. On the other hand we actually do not double drop for at least
the test cases provided anymore in MIR.
2016-02-24 21:05:21 +02:00
Jeffrey Seyfried
f8d6dcf46e Warn when reexporting a private extern crate 2016-02-24 01:34:20 +00:00
dileepb
fbfe70e6ab #31820 - Utilize if..let instead of single match branch 2016-02-23 21:21:51 +05:30
bors
d3929b2c8a Auto merge of #30969 - Amanieu:extended_atomic_cmpxchg, r=alexcrichton
This is an implementation of rust-lang/rfcs#1443.
2016-02-22 19:10:13 +00:00
Ariel Ben-Yehuda
3c6f41026b store the normalized types of field accesses
Fixes #31504
2016-02-20 01:54:58 +02:00
Ariel Ben-Yehuda
76608c8e0a make *mut T -> *const T a coercion
rather than being implicit quasi-subtyping. Nothing good can come out
of quasi-subtyping.
2016-02-20 01:54:58 +02:00
Ariel Ben-Yehuda
6f633ef128 tuple arguments to overloaded calls
also fix translation of "rust-call" functions, although that could use
more optimizations
2016-02-20 01:54:58 +02:00
bors
de366b5218 Auto merge of #31600 - nagisa:mir-msvc-seh-2, r=nikomatsakis
r? @alexcrichton for the translator changes and @nikomatsakis for the no-landing-pads pass.
2016-02-18 20:46:28 +00:00
Amanieu d'Antras
64ddcb33f4 Add intrinsics for compare_exchange and compare_exchange_weak 2016-02-18 19:07:05 +00:00
Simonas Kazlauskas
1752615591 MSVC SEH in MIR is implemented here 2016-02-17 21:46:05 +02:00
bors
0d1cd9bd6a Auto merge of #31685 - petrochenkov:patrefact2, r=eddyb
And split `PatKind::Enum` into `PatKind::TupleStruct` and `PatKind::Path`.
This is the HIR part of https://github.com/rust-lang/rust/pull/31581.
This is also kind of a preparation for https://github.com/rust-lang/rfcs/pull/1492.

r? @eddyb
2016-02-17 06:01:49 +00:00
bors
18f8143530 Auto merge of #30714 - wesleywiser:fix_29914, r=arielb1
The issue was that the const evaluator was returning an error because
the feature flag const_indexing wasn't turned on. The error was then
reported as a bug.

Fixes #29914
2016-02-16 17:13:46 +00:00
Vadim Petrochenkov
06755d90ce Split PatKind::Enum into PatKind::TupleStruct and PatKind::Path 2016-02-16 00:40:38 +03:00
bors
9a7913786c Auto merge of #31653 - tomaka:emscripten-abi, r=eddyb
Needs a correct review because I'm not too confident with how this works.
All tests related to the C ABI are now passing.

References:
- dbe68fecd0/lib/CodeGen/TargetInfo.cpp (L479-L489)
- dbe68fecd0/lib/CodeGen/TargetInfo.cpp (L466-L477)

The `classifyArgumentType` function has two different paths depending on `RAA == CGCXXABI::RAA_DirectInMemory`, but I don't really know what's the corresponding option in Rust.

cc @brson @eddyb
2016-02-15 11:07:02 +00:00
Alex Crichton
cc719d2d7d trans: Don't link whole rlibs to executables
Back in 9bc8e6d14 the linking of rlibs changed to using the `link_whole_rlib`
function. This change, however was only intended to affect dylibs, not
executables. For executables we don't actually want to link entire rlibs because
we want the linker to strip out as much as possible.

This commit adds a conditional to this logic to only link entire rlibs if we're
creating a dylib, and otherwise an executable just links an rlib as usual. A
test is included which will fail to link if this behavior is reverted.
2016-02-14 11:45:59 -08:00
Pierre Krieger
5b224ec94d Fix the asmjs ABI 2016-02-14 17:25:49 +01:00
Vadim Petrochenkov
9b40e1e5b3 Rename hir::Pat_ and its variants 2016-02-14 15:25:12 +03:00
bors
9d98390765 Auto merge of #31581 - petrochenkov:patrefact, r=Manishearth
cc https://github.com/rust-lang/rust/pull/31487#issuecomment-182945101
plugin-[breaking-change]

The first commit renames `ast::Pat_` to `ast::PatKind` and uses its variants in enum qualified form. I've also taken the opportunity and renamed `PatKind::Region` into `PatKind::Ref`.

The second commit splits `PatKind::Enum` into `PatKind::TupleStruct` and `PatKind::UnitStruct`.
So, pattern kinds now correspond to their struct/variant kinds - `Struct`, `TupleStruct` and `UnitStruct`.
@nikomatsakis @nrc @arielb1 Are you okay with this naming scheme?
An alternative possible naming scheme is `PatKind::StructVariant`, `PatKind::TupleVariant`, `PatKind::UnitVariant` (it's probably closer to the common use, but I like it less).

I intend to apply these changes to HIR later, they should not necessarily go in the same nightly with https://github.com/rust-lang/rust/pull/31487
r? @Manishearth
2016-02-14 06:18:10 +00:00
Wesley Wiser
271777ce22 Fix ICE on using result of index on a constant to index into a constant
The issue was that the const evaluator was returning an error because
the feature flag const_indexing wasn't turned on. The error was then
reported as a bug.

Fixes #29914
2016-02-13 15:13:10 -05:00
bors
4b7245047b Auto merge of #31588 - soltanmm:layer, r=nikomatsakis
<sup>**context:** moving back to a layered approach to type checking.</sup>

It looks like they'd not ended up tightly coupled in the time one was owned by the other. Every instance outside of `FnCtxt.inh` was from an `InferCtxt` created and dropped in the same function body.

This conflicts slightly with #30652, but there too it looks like the `FulfillmentContext` is from an `InferCtxt` that is created and dropped within the same function body (across one call to a module-private function).

That said, I heard that the PR that originally moved `FulfillmentContext` into `InferCtxt` was big, which leaves me concerned that I'm missing something.

r? @nikomatsakis
2016-02-13 15:25:23 +00:00
Vadim Petrochenkov
9f414a44a7 Split ast::PatKind::Enum into tuple struct and path patterns 2016-02-13 15:51:27 +03:00
Vadim Petrochenkov
14adc9bb63 Rename ast::Pat_ and its variants 2016-02-13 13:49:24 +03:00
bors
1ab22d77f9 Auto merge of #31564 - durka:lang-item-icemelt, r=nikomatsakis
This changes three ICEs to fatal errors.

I've grepped for `lang_item.*expect` and `\.expect.*lang` and didn't come up with any more. But, there could be more ICEs lurking.

I wasn't sure about a test because there already _is_ a cfail test for missing lang items, but it only checks one.

Relevant to (already closed) #31477 #31480 #31558.
cc @lilred
2016-02-13 10:23:49 +00:00
bors
3548b8c273 Auto merge of #31524 - jonas-schievink:autoderef, r=steveklabnik 2016-02-13 00:16:03 +00:00
Jonas Schievink
93e58cc28f Autoderef in librustc_trans 2016-02-12 19:28:42 +01:00
bors
ce4b75f256 Auto merge of #30726 - GuillaumeGomez:compile-fail, r=brson
r? @brson
cc @alexcrichton

I still need to add error code explanation test with this, but I can't figure out a way to generate the `.md` files in order to test example source codes.

Will fix #27328.
2016-02-12 18:25:08 +00:00
bors
c7640aa2aa Auto merge of #31583 - petrochenkov:indi_ast, r=Manishearth
cc #31487
plugin-[breaking-change]

The AST part of https://github.com/rust-lang/rust/pull/30087

r? @Manishearth
2016-02-12 14:56:20 +00:00
bors
77f9231818 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](757bdbf388/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!
2016-02-12 05:53:18 +00:00
bors
4b2c7030fd Auto merge of #30830 - arcnmx:static-extern, r=alexcrichton
See #29676

r? @alexcrichton
2016-02-12 02:16:13 +00:00
bors
78a5d5b54e 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
2016-02-12 00:19:13 +00:00
bors
98ec51a4dd 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
2016-02-11 22:22:54 +00:00
Simonas Kazlauskas
5ad4673a40 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.
2016-02-11 23:13:55 +02:00
Vadim Petrochenkov
77cc5764b9 Remove some unnecessary indirection from AST structures 2016-02-11 23:33:09 +03:00
Alex Crichton
2581b14147 bootstrap: Add a bunch of Cargo.toml files
These describe the structure of all our crate dependencies.
2016-02-11 11:12:32 -08:00
arcnmx
0ff055ad66 Pass through diagnostic handler instead 2016-02-11 12:45:52 -05:00
arcnmx
a141c52816 Use find_export_name_attr instead of string literal 2016-02-11 12:45:52 -05:00
arcnmx
e6f0f7d52d Only retain external static symbols across LTO 2016-02-11 12:45:52 -05:00
bors
7732c0aa9e 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.
2016-02-11 12:52:42 +00:00
Oliver 'ker' Schneider
2b816b0d6a [breaking-change] don't glob export ast::PathListItem_ variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
dfe35da6b8 [breaking-change] don't glob export ast::TraitItemKind variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
73fa9b2da2 [breaking-change] don't glob export ast::Mutablity variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
14e09ad468 [breaking-change] don't glob export ast::MetaItem_ 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
019614f03d [breaking-change] don't glob export ast::Item_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
498a2e416e [breaking-change] don't pub export ast::IntLitType variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
69072c4f5d [breaking-change] don't pub export ast::Lit_ variants 2016-02-11 12:34:48 +01:00