Commit Graph

64065 Commits

Author SHA1 Message Date
bors
50517d58a2 Auto merge of #41488 - estebank:closure-args, r=arielb1
Clean up callable type mismatch errors

```rust
error[E0593]: closure takes 1 argument but 2 arguments are required here
  --> ../../src/test/ui/mismatched_types/closure-arg-count.rs:13:15
   |
13 |     [1, 2, 3].sort_by(|(tuple, tuple2)| panic!());
   |               ^^^^^^^ -------------------------- takes 1 argument
   |               |
   |               expected closure that takes 2 arguments
```

instead of

```rust
error[E0281]: type mismatch: the type `[closure@../../src/test/ui/mismatched_types/closure-arg-count.rs:13:23: 13:49]` implements the trait `for<'r> std::ops::FnMut<(&'r {integer},)>`, but the trait `for<'r, 'r> std::ops::FnMut<(&'r {integer}, &'r {integer})>` is required (expected a tuple with 2 elements, found one with 1 elements)
  --> ../../src/test/ui/mismatched_types/closure-arg-count.rs:13:15
   |
13 |     [1, 2, 3].sort_by(|(tuple, tuple2)| panic!());
   |               ^^^^^^^
```

Fix #21857, re #24680.
2017-05-02 09:41:39 +00:00
est31
14bbd0a5a3 Address review 2017-05-02 06:35:36 +02:00
est31
d290849a23 Removal pass for anonymous parameters
Removes occurences of anonymous parameters from the
rustc codebase, as they are to be deprecated.

See issue #41686 and RFC 1685.
2017-05-02 05:55:20 +02:00
est31
6cc765dcad Add a lint to disallow anonymous parameters 2017-05-02 05:15:26 +02:00
bors
33535afda4 Auto merge of #40851 - oli-obk:multisugg, r=jonathandturner
Minimize single span suggestions into a label

changes

```
14 |     println!("☃{}", tup[0]);
   |                     ^^^^^^
   |
help: to access tuple elements, use tuple indexing syntax as shown
   |     println!("☃{}", tup.0);
```

into

```
14 |     println!("☃{}", tup[0]);
   |                     ^^^^^^ to access tuple elements, use `tup.0`
```

Also makes suggestions explicit in the backend in preparation of adding multiple suggestions to a single diagnostic. Currently that's already possible, but results in a full help message + modified code snippet per suggestion, and has no rate limit (might show 100+ suggestions).
2017-05-02 01:04:27 +00:00
Corey Farwell
7423966714 Fix incorrect hex value in doc comment example. 2017-05-01 20:38:59 -04:00
Steven Stewart-Gallus
f4fe3cd0e9 Added spin loop pause function 2017-05-01 17:11:44 -07:00
Niko Matsakis
c008f0540e patch the librustc_driver unit tests 2017-05-01 20:11:36 -04:00
Charlie Sheridan
3008f53c95 Increase macro recursion limit to 1024 Fixes #22552 2017-05-01 19:23:11 -04:00
bors
de4bdd20f8 Auto merge of #41629 - Mark-Simulacrum:re-enable-tests, r=nikomatsakis
Unignore tests which work fine now.

As far as I can tell, these tests will now work fine. #13745 tracks the remaining tests which are ignored for various reasons.
2017-05-01 22:36:44 +00:00
bors
777ee20796 Auto merge of #41611 - cramertj:metadata-queries-1, r=nikomatsakis
Queryify crate metadata

Part of https://github.com/rust-lang/rust/issues/41417.

r? @nikomatsakis
2017-05-01 19:53:19 +00:00
Niko Matsakis
b393d64360 kill regr test using ad-hoc lint
This was a pretty narrow test to start with, and it's kind of a pain to
update it. Not worth the trouble IMO.
2017-05-01 13:24:25 -04:00
Taylor Cramer
daa0094eb7 Queryify is_item_mir_available 2017-05-01 10:24:10 -07:00
Taylor Cramer
fb4380b12d Queryify const_is_rvalue_promotable_to_static 2017-05-01 10:24:10 -07:00
Taylor Cramer
05b2081e23 Queryify item_body_nested_bodies 2017-05-01 10:24:04 -07:00
bors
4cb396c680 Auto merge of #41560 - alevy:rwpi-ropi, r=eddyb
Add RWPI/ROPI relocation model support

This PR adds support for using LLVM 4's ROPI and RWPI relocation models for ARM.

ROPI (Read-Only Position Independence) and RWPI (Read-Write Position Independence) are two new relocation models in LLVM for the ARM backend ([LLVM changset](https://reviews.llvm.org/rL278015)). The motivation is that these are the specific strategies we use in userspace [Tock](https://www.tockos.org) apps, so supporting this is an important step (perhaps the final step, but can't confirm yet) in enabling userspace Rust processes.

## Explanation

ROPI makes all code and immutable accesses PC relative, but not assumed to be overriden at runtime (so for example, jumps are always relative).

RWPI uses a base register (`r9`) that stores the addresses of the GOT in memory so the runtime (e.g. a kernel) only adjusts r9 tell running code where the GOT is.

## Complications adding support in Rust

While this landed in LLVM master back in August, the header files in `llvm-c` have not been updated yet to reflect it. Rust replicates that header file's version of the `LLVMRelocMode` enum as the Rust enum `llvm::RelocMode` and uses an implicit cast in the ffi to translate from Rust's notion of the relocation model to the LLVM library's notion.

My workaround for this currently is to replace the `LLVMRelocMode` argument to `LLVMTargetMachineRef` with an int and using the hardcoded int representation of the `RelocMode` enum. This is A Bad Idea(tm), but I think very nearly the right thing.

Would a better alternative be to patch rust-llvm to support these enum variants (also a fairly trivial change)?
2017-05-01 17:23:09 +00:00
Niko Matsakis
3438cda788 use closure_base_def_id rather than walking up HIR 2017-05-01 11:18:15 -04:00
Niko Matsakis
c0434e2bab pacify the mercilous tidy 2017-05-01 11:09:36 -04:00
Niko Matsakis
d4d74dafe8 remove unused is_fn 2017-05-01 11:05:40 -04:00
Cameron Hart
1dd082fb3e Add simple [repr(align)] codegen test.
Checks alloca and memcpy are aligned correctly.
2017-05-01 23:13:22 +10:00
bors
526d39948a Auto merge of #41632 - Mark-Simulacrum:test-16994, r=arielb1
Add test for issue #16994.

Fixes #16994.

Please check that this is the correct way to write this test.

r? @arielb1 (author of test case)
2017-05-01 12:13:27 +00:00
bors
8f74f951cf Auto merge of #41666 - nagisa:try-poking-bigendian-again, r=arielb1
Try fixing bigendian metadata serialisation

I compiled this on PPC to check and it seems to work, but not sure whether I didn't mess up
anything in a major way.

Maybe a good shot at #41443

The easiest way to *really* test this is to land the patch (a high priority would be good, since I quite literally am just twiddling my thumbs on this now), wait for nightly, and, if the nightly works, backport this to beta.
2017-05-01 09:48:09 +00:00
topecongiro
91a9866bb3 Add an example for 'fence' 2017-05-01 17:25:07 +09:00
Simonas Kazlauskas
54de2749b0 Try fixing bigendian metadata serialisation
I compiled this on PPC to check and it seems to work, but not sure whether I didn't mess up
anything in a major way.

Maybe a good shot at #41443
2017-05-01 04:51:17 +03:00
Niko Matsakis
6c2f64bdd8 modify ExprUseVisitor and friends to take region-maps, not def-id 2017-04-30 17:03:32 -04:00
Taylor Cramer
73cd9bde37 introduce per-fn RegionMaps
Instead of requesting the region maps for the entire crate, request for
a given item etc. Several bits of code were modified to take
`&RegionMaps` as input (e.g., the `resolve_regions_and_report_errors()`
function). I am not totally happy with this setup -- I *think* I'd
rather have the region maps be part of typeck tables -- but at least the
`RegionMaps` works in a "parallel" way to `FreeRegionMap`, so it's not
too bad. Given that I expect a lot of this code to go away with NLL, I
didn't want to invest *too* much energy tweaking it.
2017-04-30 17:03:30 -04:00
Niko Matsakis
c7dc39dbf0 intern CodeExtents
Make a `CodeExtent<'tcx>` be something allocated in an arena
instead of an index into the `RegionMaps`.
2017-04-30 17:02:59 -04:00
Niko Matsakis
55d6066c05 remove ROOT_CODE_EXTENT and DUMMY_CODE_EXTENT
Instead, thread around `Option<CodeExtent>` where applicable.
2017-04-30 17:02:58 -04:00
Taylor Cramer
119c38ea91 Remove RefCells from RegionMaps 2017-04-30 17:02:58 -04:00
Taylor Cramer
eff39b73d1 On-demandify region mapping 2017-04-30 17:02:56 -04:00
Titus Barik
04e4d426a1 Rename os variable in bootstrap.py to avoid shadowing os module. 2017-04-30 16:10:31 -04:00
Ulrik Sverdrup
41aeb9d4ec std_unicode: Use #[inline] on the split_whitespace predicates 2017-04-30 21:24:47 +02:00
Ulrik Sverdrup
f41ecef6d5 std_unicode: impl Clone for .split_whitespace()
Use custom closure structs for the predicates so that the iterator's
clone can simply be derived. This should also reduce virtual call
overhead by not using function pointers.
2017-04-30 21:20:20 +02:00
Marco A L Barbosa
98964832f3 Add -march=armv7-a parameter to armv7 android linker 2017-04-30 15:07:43 -03:00
Marco A L Barbosa
5cf044643d Change arm-linux-androideabi to correspond to the armeabi official ABI
Fixes #40941.
2017-04-30 14:52:29 -03:00
Mark Simulacrum
3b003233fd Add test for issue #16994. 2017-04-30 08:53:47 -06:00
bors
06fb4d2564 Auto merge of #41651 - arielb1:missing-adjustment-2, r=eddyb
refactor the handling of lvalue ops

I think I got the code into a "mostly sane" situation.

Fixes #41604.

beta-nominating because fixes regression in #41578. I think I can do a smaller fix, but the previous code is too fragile.

r? @eddyb
2017-04-30 13:38:12 +00:00
Ariel Ben-Yehuda
b7b3c232f7 refactor the handling of lvalue ops
Fixes #41604.
2017-04-30 15:49:04 +03:00
bors
c0f86f5927 Auto merge of #41602 - hsivonen:explainnonnull, r=steveklabnik
Explain why zero-length slices require a non-null pointer

In reference to [a thread on Discourse](https://users.rust-lang.org/t/why-does-std-slice-from-raw-parts-require-a-non-null-pointer-for-zero-length-slices/10534), explain why `from_raw_parts` requires a non-null pointer for zero-length slices.

r? @steveklabnik
2017-04-30 07:58:10 +00:00
bors
78f6318136 Auto merge of #41643 - frewsxcv:rollup, r=frewsxcv
Rollup of 6 pull requests

- Successful merges: #41449, #41509, #41608, #41613, #41636, #41637
- Failed merges:
2017-04-30 05:25:47 +00:00
Corey Farwell
43cb7c4212 Rollup merge of #41637 - eddyb:used-not-dead, r=petrochenkov
Don't ever warn about #[used] items being dead code.

Fixes #41628 by whitelisting `#[used]` items in `rustc::middle::dead`.
2017-04-29 23:44:31 -04:00
Corey Farwell
eab2af9af5 Rollup merge of #41636 - moosingin3space:fix/process-exit-in-forget-doc, r=sfackler
process:exit -> process::exit in mem::forget docs

The documentation in mem::forget says "...or call `process:exit`..."
instead of `process::exit`.

r? @steveklabnik
2017-04-29 23:44:30 -04:00
Corey Farwell
c9f5a47ed1 Rollup merge of #41613 - cuviper:fix-release-links, r=aturon
Fix links in RELEASES.md for 1.10.0 through 1.12.0

Many links in this series have the `[link text]` and `(url)` on separate
lines, which doesn't get correctly interpreted in markdown.  Or maybe it
once did, but it doesn't now.  This patch joins the lines together.

Here is the content rendered [before](2971d491b9/RELEASES.md (version-1120-2016-09-29)) and [after](e8c4b7af21/RELEASES.md (version-1120-2016-09-29)).
2017-04-29 23:44:29 -04:00
Corey Farwell
b14694071c Rollup merge of #41608 - cuviper:distcheck-rust-src, r=alexcrichton
Add a distcheck for rust-src completeness

This is for the last commit of #41546.  For some reason, @bors only saw the first two commits, and wouldn't approve the last even when explicitly directed so.

r? @alexcrichton
2017-04-29 23:44:28 -04:00
Corey Farwell
3c1070689b Rollup merge of #41509 - froydnj:float-stack-reduction, r=nagisa
reduce stack requirements for floating-point formatting

Doing this speeds up float formatting by ~10% or so, and also makes the formatting code more suitable for embedded environments where stack space is at a premium.
2017-04-29 23:44:27 -04:00
Corey Farwell
ab99c9beb5 Rollup merge of #41449 - Eh2406:master, r=aturon
FromIterator and Extend Cow for String

This is a quick draft to start working on [#41351](https://github.com/rust-lang/rust/issues/41351).
I don't think I got the stable attributes correct, but it is good enuf to start a conversation.
2017-04-29 23:44:27 -04:00
bors
ba5b911340 Auto merge of #41593 - achernyak:def_span, r=eddyb
query for def_span

Resolves `fn def_span(&self, sess: &Session, def: DefId) -> Span;` of  #41417.

I had to change the query name to `def_sess_span` since `ty::TyCtxt` already has a method `def_span` implemented.

This also will probably have merge conflicts with  #41534 but I will resolves those once it's merged and wanted to start a code review on this one now.

r? @eddyb
2017-04-30 02:48:11 +00:00
bors
afa1240e57 Auto merge of #41544 - alexcrichton:bump-bootstrap, r=brson
Update stage0 bootstrap compiler

We've got a freshly minted beta compiler, let's update to use that on nightly!
This has a few other changes associated with it as well

* A bump to the rustc version number (to 1.19.0)
* Movement of the `cargo` and `rls` submodules to their "proper" location in
  `src/tools/{cargo,rls}`. Now that Cargo workspaces support the `exclude`
  option this can work.
* Updates of the `cargo` and `rls` submodules to their master branches.
* Tweak to the `src/stage0.txt` format to be more amenable for Cargo version
  numbers. On the beta channel Cargo will bootstrap from a different version
  than rustc (e.g. the version numbers are different), so we need different
  configuration for this.
* Addition of `dev` as a readable key in the `src/stage0.txt` format. If present
  then stage0 compilers are downloaded from `dev-static.rust-lang.org` instead
  of `static.rust-lang.org`. This is added to accomodate our updated release
  process with Travis and AppVeyor.
2017-04-29 20:38:15 +00:00
Eduard-Mihai Burtescu
c054b2a761 Don't ever warn about #[used] items being dead code. 2017-04-29 23:18:15 +03:00
Alex Crichton
5daf557a77 Update stage0 bootstrap compiler
We've got a freshly minted beta compiler, let's update to use that on nightly!
This has a few other changes associated with it as well

* A bump to the rustc version number (to 1.19.0)
* Movement of the `cargo` and `rls` submodules to their "proper" location in
  `src/tools/{cargo,rls}`. Now that Cargo workspaces support the `exclude`
  option this can work.
* Updates of the `cargo` and `rls` submodules to their master branches.
* Tweak to the `src/stage0.txt` format to be more amenable for Cargo version
  numbers. On the beta channel Cargo will bootstrap from a different version
  than rustc (e.g. the version numbers are different), so we need different
  configuration for this.
* Addition of `dev` as a readable key in the `src/stage0.txt` format. If present
  then stage0 compilers are downloaded from `dev-static.rust-lang.org` instead
  of `static.rust-lang.org`. This is added to accomodate our updated release
  process with Travis and AppVeyor.
2017-04-29 12:11:14 -07:00