Commit Graph

57615 Commits

Author SHA1 Message Date
bors
fd065a8381 Auto merge of #36814 - petrochenkov:def, r=eddyb
Refactoring/bugfixing around definitions for struct/variant constructors

 d917c364ad separates definitions for struct/variant constructors living in value namespace from struct/variant type definitions.

adfb37827b fixes cross-crate resolution of reexports reexporting half-items, like struct constructors without struct type or types without constructor. Such reexports can appear due to glob shadowing.
Resolution now is not affected by the order in which items and reexports are decoded from metadata (cc https://github.com/rust-lang/rust/issues/31337#issuecomment-183996263). `try_define` is not used during building reduced graph anymore.
500 lines of this PR are tests for this exotic situation, the remaining line diff count is actually negative! :)

c695d0c875 (and partially aabf132de0) moves most of pattern resolution checks from typeck to resolve (except those checking for associated items), uses the same wording for pattern resolution error messages from both typeck and resolve and makes the messages more precise.

11e3524e5a fixes seemingly incorrectly set `NON_ZERO_SIZED` attributes for struct/variant ctors in const eval.

4586fea253 eliminates `ty::VariantKind` in favor of `def::CtorKind`. The logic is that variant kinds are irrelevant for types, they make sense only when we deal with constructor functions/constants. Despite that `VariantDefData` still keeps a copy of `CtorKind`, but it's used only for various kinds of pretty-printing (and for storing in metadata).

aabf132de0 is mostly a cleanup of various impossible or improperly used definitions, and other small definition cleanups.

cc @jseyfried
r? @eddyb
2016-10-04 16:30:30 -07:00
Nikhil Shagrithaya
335d393114 Minor modifications in concurrency section of the Rust book 2016-10-04 22:09:29 +00:00
Eric Roshan-Eisner
7bbfac60e3 update sip.rs for new intrinsics and defaults 2016-10-04 14:48:03 -07:00
Vadim Petrochenkov
bc0eabd7a7 Remove some unused methods from metadata
Address comments + Fix rebase
2016-10-04 23:53:51 +03:00
Alexander von Gluck IV
4922abfbd2 Haiku: Fix IPv6 target_os check 2016-10-04 15:41:26 -05:00
bors
1a41928045 Auto merge of #36933 - alexcrichton:less-neon-again, r=eddyb
rustc: Try again to disable NEON on armv7 linux

This is a follow-up to #35814 which apparently didn't disable it hard enough. It
looks like LLVM's default armv7 target enables NEON so we'd otherwise have to
pass `-neon`, but we're already enabling armv7 with `+v7` supposedly, so let's
try just telling LLVM that the armv7 target is arm and then enable features
selectively.

Closes #36913
2016-10-04 13:23:09 -07:00
Michael Woerister
2d34ad04ef trans: Make sure that each FnOnce shim is only translated once. 2016-10-04 16:15:37 -04:00
Vadim Petrochenkov
bd291ce21a Turn some impossible definitions into ICEs 2016-10-04 22:25:25 +03:00
Vadim Petrochenkov
75d6522b9a Eliminate ty::VariantKind in favor of def::CtorKind 2016-10-04 22:22:36 +03:00
Vadim Petrochenkov
64bdf1b74b Set NON_ZERO_SIZED flag correctly for struct/union ctors
And for methods/functions as well, they are zero-sized now
2016-10-04 22:20:38 +03:00
Vadim Petrochenkov
c95b280d72 Move pattern resolution checks from typeck to resolve
Make error messages more precise
2016-10-04 22:20:38 +03:00
Vadim Petrochenkov
e8ea38e42a Further cleanup in resolve
`try_define` is not used in build_reduced_graph anymore
Collection of field names for error reporting is optimized
Some comments added
2016-10-04 22:20:37 +03:00
Vadim Petrochenkov
d19c16acfb Fix cross-crate resolution of half-items created by export shadowing 2016-10-04 22:20:37 +03:00
Vadim Petrochenkov
da7b1c984c Separate Def::StructCtor/Def::VariantCtor from Def::Struct/Def::Variant 2016-10-04 22:20:37 +03:00
Ariel Ben-Yehuda
bfdf437f37 update tests 2016-10-04 20:43:43 +03:00
Oliver Middleton
cd7a04cadc rustdoc: Fix missing *mut T impl
`impl<T> *mut T` is currently missing from
https://doc.rust-lang.org/nightly/std/primitive.pointer.html and this adds
it back.
2016-10-04 18:39:28 +01:00
angelsl
58190ccb63 reference: mention move keyword for lambdas 2016-10-05 00:59:13 +08:00
Keegan McAllister
29d3e570a5 Apply some Arc doc changes to Rc 2016-10-04 09:50:31 -07:00
Alex Crichton
4625642211 rustc: Try again to disable NEON on armv7 linux
This is a follow-up to #35814 which apparently didn't disable it hard enough. It
looks like LLVM's default armv7 target enables NEON so we'd otherwise have to
pass `-neon`, but we're already enabling armv7 with `+v7` supposedly, so let's
try just telling LLVM that the armv7 target is arm and then enable features
selectively.

Closes #36913
2016-10-04 09:26:57 -07:00
Michael Woerister
457019967b Add symbol hash to trans::partitioning debug output. 2016-10-04 12:02:19 -04:00
Michael Woerister
29212ecdc9 Assign internal linkage to autogenerated FnOnce::call_once() instances. 2016-10-04 12:00:15 -04:00
Keegan McAllister
05b6d68619 Update Arc docs to match new Rc docs 2016-10-04 08:34:24 -07:00
bors
a5dac7a2af Auto merge of #36874 - japaric:thumbs, r=alexcrichton
add Thumbs to the compiler

this commit adds 4 new target definitions to the compiler for easier
cross compilation to ARM Cortex-M devices.

- `thumbv6m-none-eabi`
  - For the Cortex-M0, Cortex-M0+ and Cortex-M1
  - This architecture doesn't have hardware support (instructions) for
    atomics. Hence, the `Atomic*` structs are not available for this
    target.
- `thumbv7m-none-eabi`
  - For the Cortex-M3
- `thumbv7em-none-eabi`
  - For the FPU-less variants of the Cortex-M4 and Cortex-M7
  - On this target, all the floating point operations will be lowered
    software routines (intrinsics)
- `thumbv7em-none-eabihf`
  - For the variants of the Cortex-M4 and Cortex-M7 that do have a FPU.
  - On this target, all the floating point operations will be lowered
    to hardware instructions

No binary releases of standard crates, like `core`, are planned for
these targets because Cargo, in the future, will compile e.g. the `core`
crate on the fly as part of the `cargo build` process. In the meantime,
you'll have to compile the `core` crate yourself. [Xargo] is the easiest
way to do that as in handles the compilation of `core` automatically and
can be used just like Cargo: `xargo build --target thumbv6m-none-eabi`
is all that's needed.

[Xargo]: https://crates.io/crates/xargo

---

cc @brson @alexcrichton
2016-10-04 08:29:41 -07:00
Ariel Ben-Yehuda
44ac0160ce SimplifyCfg: don't incref target when collapsing a goto with 1 pred 2016-10-04 17:07:34 +03:00
Ariel Ben-Yehuda
ae51ccfa77 SimplifyCfg: simplify the start block 2016-10-04 16:23:01 +03:00
bors
4a9af010eb Auto merge of #36953 - Manishearth:rollup, r=Manishearth
Rollup of 12 pull requests

- Successful merges: #36798, #36878, #36902, #36903, #36908, #36916, #36917, #36921, #36928, #36938, #36941, #36951
- Failed merges:
2016-10-04 04:15:20 -07:00
Niko Matsakis
3e1bd199b0 force i1 booleans to i8 when comparing
Work around LLVM bug.

cc #36856
2016-10-04 05:56:02 -04:00
Manish Goregaokar
177aabdfe3 Rollup merge of #36951 - nnethercote:fix-ICE, r=eddyb
Fix an ICE in BuildReducedGraphVisitor::visit_trait_item.

This ICE occurs in the futures-rs-test-all benchmark in rustc-benchmarks (fixes #36950).
2016-10-04 15:24:04 +05:30
Manish Goregaokar
0e3cd4ed15 Rollup merge of #36941 - martinhath:issue-21837, r=alexcrichton
Add regression test for Issue #21837

This PR adds a regression test for Issue #21837, as explained in the comments of the issue.
2016-10-04 15:24:04 +05:30
Manish Goregaokar
1f9036872d Rollup merge of #36938 - tmiasko:cursor-seek-overflow, r=alexcrichton
Check for overflow in Cursor<Vec<u8>>::write.

Ensure that cursor position fits into usize, before proceeding with
write. Fixes issue #36884.
2016-10-04 15:24:04 +05:30
Manish Goregaokar
05e412a1e5 Rollup merge of #36928 - GuillaumeGomez:error_urls, r=steveklabnik
Add missing urls for error module

r? @steveklabnik
2016-10-04 15:24:04 +05:30
Manish Goregaokar
5c55db9450 Rollup merge of #36921 - nnethercote:two-lexer-tweaks, r=nrc
Two lexer tweaks

19 days later, I haven't received a review of my commits in #36470. In an attempt to make some progress, I'm going to split up the changes. Here are the ones that don't relate to renaming things.
2016-10-04 15:24:03 +05:30
Manish Goregaokar
ad7635894f Rollup merge of #36917 - nnethercote:speed-up-plug_leaks, r=eddyb
Speed up `plug_leaks`

Profiling shows that `plug_leaks` and the functions it calls are hot on some benchmarks. It's very common that `skol_map` is empty in this function, and we can specialize `plug_leaks` in that case for some big speed-ups.

The PR has two commits. I'm fairly confident that the first one is correct -- I traced through the code to confirm that the `fold_regions` and `pop_skolemized` calls are no-ops when `skol_map` is empty, and I also temporarily added an assertion to check that `result` ends up having the same value as `value` in that case. This commit is responsible for most of the improvement.

I'm less confident about the second commit. The call to `resolve_type_vars_is_possible` can change `value` when `skol_map` is empty... but testing suggests that it doesn't matter if the call is
omitted.

So, please check both patches carefully, especially the second one!

Here are the speed-ups for the first commit alone.

stage1 compiler (built with old rustc, using glibc malloc), doing debug builds:
```
futures-rs-test  4.710s vs  4.538s --> 1.038x faster (variance: 1.009x, 1.005x)
issue-32062-equ  0.415s vs  0.368s --> 1.129x faster (variance: 1.009x, 1.010x)
issue-32278-big  1.884s vs  1.808s --> 1.042x faster (variance: 1.020x, 1.017x)
jld-day15-parse  1.907s vs  1.668s --> 1.143x faster (variance: 1.011x, 1.007x)
piston-image-0. 13.024s vs 12.421s --> 1.049x faster (variance: 1.004x, 1.012x)
rust-encoding-0  3.335s vs  3.276s --> 1.018x faster (variance: 1.021x, 1.028x)
```
stage2 compiler (built with new rustc, using jemalloc), doing debug builds:
```
futures-rs-test  4.167s vs  4.065s --> 1.025x faster (variance: 1.006x, 1.018x)
issue-32062-equ  0.383s vs  0.343s --> 1.118x faster (variance: 1.012x, 1.016x)
issue-32278-big  1.680s vs  1.621s --> 1.036x faster (variance: 1.007x, 1.007x)
jld-day15-parse  1.671s vs  1.478s --> 1.131x faster (variance: 1.016x, 1.004x)
piston-image-0. 11.336s vs 10.852s --> 1.045x faster (variance: 1.003x, 1.006x)
rust-encoding-0  3.036s vs  2.971s --> 1.022x faster (variance: 1.030x, 1.032x)
```
I've omitted the benchmarks for which the change was negligible.

And here are the speed-ups for the first and second commit in combination.

stage1 compiler (built with old rustc, using glibc malloc), doing debug
builds:
```
futures-rs-test  4.684s vs  4.498s --> 1.041x faster (variance: 1.012x, 1.012x)
issue-32062-equ  0.413s vs  0.355s --> 1.162x faster (variance: 1.019x, 1.006x)
issue-32278-big  1.869s vs  1.763s --> 1.060x faster (variance: 1.013x, 1.018x)
jld-day15-parse  1.900s vs  1.602s --> 1.186x faster (variance: 1.010x, 1.003x)
piston-image-0. 12.907s vs 12.352s --> 1.045x faster (variance: 1.005x, 1.006x)
rust-encoding-0  3.254s vs  3.248s --> 1.002x faster (variance: 1.063x, 1.045x)
```
stage2 compiler (built with new rustc, using jemalloc), doing debug builds:
```
futures-rs-test  4.183s vs  4.046s --> 1.034x faster (variance: 1.007x, 1.004x)
issue-32062-equ  0.380s vs  0.340s --> 1.117x faster (variance: 1.020x, 1.003x)
issue-32278-big  1.671s vs  1.616s --> 1.034x faster (variance: 1.031x, 1.012x)
jld-day15-parse  1.661s vs  1.417s --> 1.172x faster (variance: 1.013x, 1.005x)
piston-image-0. 11.347s vs 10.841s --> 1.047x faster (variance: 1.007x, 1.010x)
rust-encoding-0  3.050s vs  3.000s --> 1.017x faster (variance: 1.016x, 1.012x)
```
@eddyb: `git blame` suggests that you should review this. Thanks!
2016-10-04 15:24:03 +05:30
Manish Goregaokar
454124974f Rollup merge of #36916 - frewsxcv:patch-1, r=alexcrichton
Update unstable attr to reference tracking issue.
2016-10-04 15:24:03 +05:30
Manish Goregaokar
268521f58a Rollup merge of #36908 - GuillaumeGomez:default_doc, r=apasel422
fix typos

r? @steveklabnik
2016-10-04 15:24:03 +05:30
Manish Goregaokar
825e6b3287 Rollup merge of #36903 - frewsxcv:typekind, r=jseyfried
Minor librustdoc cleanup and refactoring.
2016-10-04 15:24:02 +05:30
Manish Goregaokar
d25aeb0ef1 Rollup merge of #36902 - ollie27:stab_impls, r=alexcrichton
std: Correct stability attributes for some implementations

These are displayed by rustdoc so should be correct.
2016-10-04 15:24:02 +05:30
Manish Goregaokar
e39a78a28c Rollup merge of #36878 - BlueSpaceCanary:book-dedup-cargo-run-intro, r=GuillaumeGomez
Avoid introducing `run` twice in the Rust book

As it stands, getting-started.md and guessing-game.md both introduce `run` as a new command. I switched it so that the 2nd refers back to the first introduction, rather than re-introducing the command.

(First ever FOSS PR, sorry if I screwed up anything obvious :) )

r? @steveklabnik
2016-10-04 15:24:02 +05:30
Manish Goregaokar
5a4ecb4a0c Rollup merge of #36798 - gavinb:fix/36164, r=GuillaumeGomez
Improve error message and snippet for "did you mean `x`"

- Fixes #36164
- Part of #35233

Based on the standalone example https://is.gd/8STXMd posted by @nikomatsakis and using the third formatting option mentioned in #36164 and agreed by @jonathandturner.

Note however this does not address the question of [how to handle an empty or unknown suggestion](https://github.com/rust-lang/rust/issues/36164#issuecomment-244460024). @nikomatsakis any suggestions on how best to address that part?
2016-10-04 15:24:01 +05:30
Nicholas Nethercote
78579034ec Fix an ICE in BuildReducedGraphVisitor::visit_trait_item.
This ICE occurs in the futures-rs-test-all benchmark in
rustc-benchmarks.
2016-10-04 16:41:53 +11:00
Jorge Aparicio
6136069609 change max_atomic_width type from u64 to Option<u64>
to better express the idea that omitting this field defaults this value
to target_pointer_width
2016-10-03 23:45:40 -05:00
Jorge Aparicio
251f04e90d fix: "abort" -> PanicStrategy 2016-10-03 22:54:59 -05:00
Jorge Aparicio
470eff75df add a reference about the stated FP facts 2016-10-03 22:34:33 -05:00
Jorge Aparicio
cbc56f16b4 add +d16 and +fp-only-sp to thumbv7em-none-eabihf and documentation 2016-10-03 22:28:40 -05:00
bors
5ea241b9fb Auto merge of #36876 - nikomatsakis:issue-36381, r=pnkfelix
loosen assertion against proj in collector

The collector was asserting a total absence of projections, but some projections are expected, even in trans: in particular, projections containing higher-ranked regions, which we don't currently normalize.

r? @pnkfelix

Fixes #36381
2016-10-03 19:36:27 -07:00
Brian Anderson
2e7f796e58 Fix mod declarations on untested platforms 2016-10-03 22:29:03 +00:00
Ariel Ben-Yehuda
c2a0859b3e stop having identity casts be lexprs
that made no sense (see test), and was incompatible with borrowck.

Fixes #36936.
2016-10-04 01:13:36 +03:00
bors
9c31d76e97 Auto merge of #36821 - pweaver:master, r=michaelwoerister
#36821

I am just starting to learn rust. Feedback would be appreciated.
2016-10-03 15:04:41 -07:00
Martin Thoresen
d8ddef0de3
Add test for Issue #21837 2016-10-03 23:40:40 +02:00
Tomasz Miąsko
4935343f6e Check for overflow in Cursor<Vec<u8>>::write.
Ensure that cursor position fits into usize, before proceeding with
write. Fixes issue #36884.
2016-10-03 22:16:13 +02:00