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.
r? @frewsxcv
Add a lint to disallow anonymous parameters
Adds a (allow by default) lint to disallow anonymous parameters, like it was decided in RFC 1685 (rust-lang/rfcs#1685).
cc tracking issue #41686
On demandify region mapping
This is an adaptation of @cramertj's PR. I am sort of tempted to keep simplifying it, but also tempted to land it so and we can refactor more in follow-up PRs. As is, it does the following things:
- makes the region-maps an on-demand query, per function `tcx.region_maps(def_id)`
- interns code extents instead of of having them be integers
- remove the "root region extent" and (to some extent) item extents; instead we use `Option<CodeExtent<'tcx>>` in a few places (no space inefficiency since `CodeExtent<'tcx>` is now a pointer).
I'm not entirely happy with the way I have it setup though. Here are some of the changes I was considering (I'm not sure if they would work out well):
1. Removing `item_extents` entirely -- they are rarely used now, because most of the relevant places now accept an `Option<Region<'tcx>>` or an `Option<CodeExtent<'tcx>>`, but I think still used in a few places.
2. Merging `RegionMaps` into the typeck tables, instead of having it be its own query.
3. Change `CodeExtent<'tcx>` to store the parent pointer. This would mean that fewer places in the code actually *need* a `RegionMaps` anyhow, since most of them just want to be able to walk "up the tree". On the other hand, you wouldn't be able to intern a `CodeExtent<'tcx>` for some random node-id, you'd need to look it up in the table (since there'd be more information).
Most of this code is semi-temporary -- I expect it to largely go away as we move to NLL -- so I'm also not *that* concerned with making it perfect.
r? @eddyb
Under MinGW, x.py fails to run with UnboundLocalError.
Under MinGW, `x.py` will fail with the following errors:
```bash
$ ./x.py
Traceback (most recent call last):
File "./x.py", line 20, in <module>
bootstrap.main()
File "C:/src/rust/src/bootstrap/bootstrap.py", line 620, in main
bootstrap()
File "C:/src/rust/src/bootstrap/bootstrap.py", line 601, in bootstrap
rb.build = rb.build_triple()
File "C:/src/rust/src/bootstrap/bootstrap.py", line 459, in build_triple
if os.environ.get('MSYSTEM') == 'MINGW64':
UnboundLocalError: local variable 'os' referenced before assignment
```
The reason is due to the `build_triple` function in `src/bootstrap/bootstrap.py` (Line 416):
```python
if ostype == 'Linux':
os = subprocess.check_output(['uname', '-o']).strip().decode(default_encoding)
```
Here, the assignment to `os` is causing the `os` module to be shadowed.
Then, in (Line 459):
```python
if os.environ.get('MSYSTEM') == 'MINGW64':
cputype = 'x86_64'
```
`os` now refers to the uninitialized local variable, not the `os` module.
Easiest fix is to simply rename the `os` variable to something like `os_from_sp`.
Also, there is a small typo fix in `x.py` referencing the wrong file name.
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.
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).
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.
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)?
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.
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.
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
process:exit -> process::exit in mem::forget docs
The documentation in mem::forget says "...or call `process:exit`..."
instead of `process::exit`.
r? @steveklabnik
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)).
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
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.
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.
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
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.