Commit Graph

63543 Commits

Author SHA1 Message Date
Niko Matsakis
aa6c2b1cb7 propagate obligations during overlap check 2017-04-19 07:20:36 -04:00
bors
452bf0852e Auto merge of #41354 - alexcrichton:tool-no-debug, r=aturon
Disable debuginfo when compiling tools

Currently the Cargo binary has jumped from 14M to 34M on the beta channel, which
appears to be due to the fact that we're compiling tools with debug information
inside them. This additionally means that the `rls` binary is 62M right now!

This wasn't an intentional change, so be sure to disable debuginfo when
compiling tools as it's just intended for the standard library and compile for
now.
2017-04-19 11:07:08 +00:00
bors
467aaab50e Auto merge of #41325 - eddyb:isolate-snapshots-for-good, r=arielb1
Ban registering obligations during InferCtxt snapshots.

Back in #33852, a flag was added to `InferCtxt` to prevent rolling back a snapshot if obligations were added to some `FulfillmentContext` during the snapshot, to prevent leaking fresh inference variables (created during that snapshot, so their indices would get reused) in obligations, which could ICE or worse.

But that isn't enough in the long run, as type-checking ends up relying on success implying that eager side-effects are fine, and while stray obligations *do* get caught nowadays, those errors prevent, e.g. the speculative coercions from #37658, which *have to* be rolled back *even* if they succeed.

We can't just allow those obligations to stay around though, because we end up, again, in ICEs or worse.
Instead, this PR modifies `lookup_method_in_trait_adjusted` to return `InferOk` containing the obligations that `Autoderef::finalize_as_infer_ok` can propagate to deref coercions.

As there shouldn't be *anything* left that registers obligations during snapshots, it's completely banned.

r? @nikomatsakis @arielb1
2017-04-19 08:40:27 +00:00
bors
5f22d46e4b Auto merge of #41170 - Nashenas88:master, r=alexcrichton
Use the existing path when removing the prefix fails

This allows the use of out-of-tree paths to be specified. I found this while trying to build with a modified version of `rls-data`, which is currently pointing to a version on crates.io.

cc @alexcrichton

Also, it wasn't clear if I needed to add a test for this (or how). I didn't see any tests that took paths into consideration.
2017-04-19 05:54:23 +00:00
Alex Burka
d6b8d9f75d remove disclaimer from bootstrap/README.md 2017-04-19 01:45:34 -04:00
Scott McMurray
295bcdb715 Override ToOwned::clone_into for Path and OsStr
The only non-overridden one remaining is the CStr impl, which cannot
be optimized as doing so would break CString's second invariant.
2017-04-18 21:02:18 -07:00
bors
84be2df0e9 Auto merge of #41236 - cengizIO:master, r=nikomatsakis
Move E0101 and E0102 logic into new E0282 mechanism #40013

Hello there!

## What's this?
Previously, me and @nikomatsakis worked on error messages of uninferred locals. (#38812)

This aims to build up on that by moving certain type checks from `writeback`.

With this, `E0101` and `E0102` errors are getting obsoleted and no longer thrown.

They're replaced with customized versions of `E0282`s instead.

## Sample Error Messages

#### `E0101` is getting converted into:
```rust
error[E0282]: type annotations needed
 --> test.rs:2:14
  |
2 |     let x = |_| {};
  |              ^ consider giving this closure parameter a type

error: aborting due to previous error
```

#### `E0102` is getting converted into:
```rust
error[E0282]: type annotations needed
 --> test.rs:2:9
  |
2 |     let x = [];
  |         ^
  |         |
  |         consider giving `x` a type
  |         cannot infer type for `[_; 0]`

error: aborting due to previous error
```

## Annoyances
- I think we need to change our way of type name resolving in relevant places, because that `[_; 0]` looks horrible IMHO.
- I'm not terribly happy with the note ordering of errors. So please do point to code that might help me accomplish this.

## Tests
Tests of `E0101` and `E0102` are getting converted from `compile-fail` to `ui` tests.

## Documentation
Please help me with documentation update. There are some confusing places that needed an update but I'm not sure if I did the right ones.

Please do comment on messages, layouts and other details.

## Appreciation
Huge thanks goes to @nikomatsakis for being a patient and humble mentor along this long journey. 🍻
2017-04-19 01:27:08 +00:00
Corey Farwell
bf202c880c Bump book and reference. 2017-04-18 21:26:10 -04:00
Corey Farwell
fea3576633 Add top level sections to the Unstable Book.
Prior to this commit, the contents of the Unstable Book were assumed to
be unstable features. This commit moves features into 'language features'
or 'library features' subsections. It also moves the 'linker_flavor'
compiler flag into a new 'Compiler Flags' subsection.

Even though it was helpful, I removed the tidy check that
cross-references the SUMMARY.md links with the Unstable Book directory
contents just because it would be difficult to maintain.

Relevant PR: https://github.com/rust-lang/rust/issues/41142.
2017-04-18 21:26:09 -04:00
Eduard-Mihai Burtescu
cba0c6ad6d rustc_trans: do not treat byval as using up registers. 2017-04-19 02:22:59 +03:00
Oliver Middleton
fd325a1b48 Fix a few stability attributes
These show up in rustdoc so need to be correct.
2017-04-18 23:33:38 +01:00
Cengiz Can
3092ac40b6 change note for patterns 2017-04-18 21:43:22 +03:00
Cengiz Can
8b45a21bd1 comment out removed error codes 2017-04-18 21:43:22 +03:00
Cengiz Can
6383de15b1 fixes #40013 2017-04-18 21:43:22 +03:00
bors
9f2abadca2 Auto merge of #41373 - frewsxcv:rollup, r=frewsxcv
Rollup of 6 pull requests

- Successful merges: #40290, #41353, #41356, #41360, #41361, #41364
- Failed merges:
2017-04-18 18:20:04 +00:00
Corey Farwell
20718c81de Rollup merge of #41364 - alexcrichton:less-backtrace-prune, r=petrochenkov
std: Back out backtrace pruning logic

It was discovered #40264 that this backtrace pruning logic is a little too
aggressive, so while we figure how out to handle #40264 this commit backs out
the changes to prune frames. Note that other cosmetic changes, such as better
path printing and such remain.
2017-04-18 14:05:46 -04:00
Corey Farwell
f448cdff9d Rollup merge of #41361 - arielb1:move-mir-init, r=pnkfelix
lower `move_val_init` during MIR construction

Because of its "magic" order-of-evaluation semantics, `move_val_init` must be lowered during MIR construction in order to work without needing a temporary.

r? @eddyb
2017-04-18 14:05:45 -04:00
Corey Farwell
ceaa55ea45 Rollup merge of #41360 - nikomatsakis:incr-comp-issue-40746-visitors, r=eddyb
convert calls to `visit_all_item_likes_in_krate`

We no longer need to track the tasks in these cases since these
particular tasks have no outputs (except, potentially, errors...)  and
they always execute.

cc #40746

r? @eddyb
2017-04-18 14:05:44 -04:00
Corey Farwell
ddf4781c1b Rollup merge of #41356 - richo:darwin-no-cputype-hack, r=alexcrichton
bootstrap: Don't workaround uname -m on Darwin

This no longer manifests on any versions of OSX that I could find.

How far back is Rust officially supported? I can try to get copies to test when this behaviour changed.

(Fun fact, at a minimum the comment already lies, since the flag is `-m` :))
2017-04-18 14:05:44 -04:00
Corey Farwell
2e4b0d57ac Rollup merge of #41353 - redox-os:master, r=alexcrichton
Improve Process::spawn with piped stdio on Redox

- Adds `dup2`, and uses it for stdio piping
- Removes `O_CLOEXEC` from piped stdio, as `dup` on Redox does not disable O_CLOEXEC
2017-04-18 14:05:43 -04:00
Corey Farwell
353bdb30e3 Rollup merge of #40290 - 3Hren:master, r=aturon
Add `as_bytes()` for `FromUtf8Error`.

This change allows to obtain an underlying invalid UTF-8 bytes without `FromUtf8Error` destruction. Such method may be useful for example in a library that attempts to save both valid and invalid UTF-8 strings in some struct and to be able to provide immutable access to it without destruction.

Personally without this change I ended with `Result<String, (Vec<u8>, Utf8Error)`, which almost copies the functionality of `FromUtf8Error`, but allows immutable view access.
2017-04-18 14:05:42 -04:00
Nicolas Bigaouette
82ed7830ad Use an (over-writable) environment variable for the gdb command
Instead of hard-coding the command to run, using the environment
variable `GDB_CMD` (that defaults to `gdb`) allows using a different
debugger than the default `gdb` executable.

This gives the possibility to use `cgdb` as the debugger, which provides
a nicer user interface. Note that one has to use `GDB_CMD="cgdb --"` to
use cgdb (note the trailing `--`) to let cgdb pass the proper arguments
to `gdb`.
2017-04-18 14:00:08 -04:00
Marco A L Barbosa
a42c0257c7 Add bootstrap support for android 2017-04-18 13:50:29 -03:00
Josh Stone
0a69bf4cdd Bump stage0 to fix ARM LLVM
There was a serious ARM codegen bug in LLVM that was fixed by #40779,
also backported to beta.  This updates stage0 to 1.17.0-beta.3 to pick
up that change, so ARM can bootstrap natively again.

Fixes #41291
cc @arielb1
2017-04-18 08:57:56 -07:00
steveklabnik
43d92bb585 update mdbook 2017-04-18 11:41:07 -04:00
Alex Crichton
e46a8bde3c std: Back out backtrace pruning logic
It was discovered #40264 that this backtrace pruning logic is a little too
aggressive, so while we figure how out to handle #40264 this commit backs out
the changes to prune frames. Note that other cosmetic changes, such as better
path printing and such remain.
2017-04-18 06:49:39 -07:00
lukaramu
d6f7577279 Fix typos in std::path's docs
* Closed an unclosed paren
* seperator -> separator
* deperator -> separator
2017-04-18 15:03:41 +02:00
Niko Matsakis
c8427831ea update dep-graph-struct-signature test case
the `CollectItem` task no longer exists
2017-04-18 08:22:52 -04:00
Niko Matsakis
8388772f42 kill a bunch of one off tasks 2017-04-18 08:20:12 -04:00
Ariel Ben-Yehuda
ed3810bf5e lower move_val_init during MIR construction
Because of its "magic" order-of-evaluation semantics, `move_val_init`
must be lowered during MIR construction in order to work.
2017-04-18 15:09:11 +03:00
Ariel Ben-Yehuda
3e473b1aaa use Lvalue helper functions in rustc_mir::shim 2017-04-18 15:05:04 +03:00
bors
c398efc53f Auto merge of #39271 - est31:add_float_bits, r=BurntSushi
Add functions to safely transmute float to int

The safe subset of Rust tries to be as powerful as possible. While it is very powerful already, its currently impossible to safely transmute integers to floats. While crates exist that provide a safe interface, most prominently the `iee754` crate (which also inspired naming of the added functions), they themselves only use the unsafe `mem::transmute` function to accomplish this task.

Also, including an entire crate for just two lines of unsafe code seems quite wasteful.

That's why this PR adds functions to safely transmute integers to floats and vice versa, currently gated by the newly added `float_bits_conv` feature.

The functions added are no niche case. Not just `ieee754` [currently implements](https://github.com/huonw/ieee754/blob/master/src/lib.rs#L441) float to int transmutation via unsafe code but also the [very popular `byteorder` crate](https://github.com/BurntSushi/byteorder/blob/1.0.0/src/lib.rs#L258). This functionality of byteorder is in turn used by higher level crates. I only give two examples out of many: [chor](a7363ea9aa/src/ser.rs (L227)) and [bincode](f06a4cfcb5/src/serde/reader.rs (L218)).

One alternative would be to manually use functions like pow or multiplication by 1 to get a similar result, but they only work in the int -> float direction, and are not bit exact, and much slower (also, most likely the optimizer will never optimize it to a transmute because the conversion is not bit exact while the transmute is).

Tracking issue: #40470
2017-04-18 11:23:44 +00:00
Niko Matsakis
810e0151af convert calls to visit_all_item_likes_in_krate
We no longer need to track the tasks in these cases since these
particular tasks have no outputs (except, potentially, errors...)  and
they always execute.
2017-04-18 07:08:40 -04:00
bors
e621e1c73f Auto merge of #41357 - frewsxcv:rollup, r=frewsxcv
Rollup of 3 pull requests

- Successful merges: #41262, #41310, #41344
- Failed merges:
2017-04-18 04:15:13 +00:00
Corey Farwell
8f65bb450f Rollup merge of #41344 - Diggsey:remove-natvis-nbsp, r=alexcrichton
Remove non-breaking spaces from natvis files

Visual studio will see natvis files with non-breaking spaces as invalid XML, and will ignore them.
2017-04-17 23:21:19 -04:00
Corey Farwell
24e8158213 Rollup merge of #41310 - eddyb:demand-const-eval, r=nikomatsakis
[on-demand] Turn monomorphic_const_eval into a proper query, not just a cache.

The error definitions and reporting logic, alongside with `eval_length` were moved to `librustc`.
Both local and cross-crate constant evaluation is on-demand now, but the latter is only used for `enum` discriminants, to replace the manual insertion into the cache which was done when decoding variants.

r? @nikomatsakis
2017-04-17 23:21:18 -04:00
Corey Farwell
b8c446eab8 Rollup merge of #41262 - jonhoo:compiler-barrier-rename, r=alexcrichton
Rename compiler_barrier to compiler_fence

This addresses concerns raised following the merge of #41092. Specifically:

> The naming of these seems surprising: the multithreaded functions (and both the single and multithreaded intrinsics themselves) are fences, but this is a barrier. It's not incorrect, but the latter is both inconsistent with the existing functions and slightly confusing with another type in std (e.g., `Barrier`).

`compiler_fence` carries the same semantic implication that this is a compiler-only operation, while being more in line with the fence/barrier concepts already in use in `std`.
2017-04-17 23:21:17 -04:00
Richo Healey
1dbc72b28e bootstrap: Don't workaround uname -m on Darwin
This no longer manifests on any versions of OSX that I could find.
2017-04-17 19:30:18 -07:00
bors
6b2aaaf668 Auto merge of #41340 - eddyb:demand-assoc-defids, r=nikomatsakis
rustc: move associated_item_def_ids to an on-demand query.

r? @nikomatsakis
2017-04-18 01:18:14 +00:00
Alex Crichton
e3ad1b58f5 Disable debuginfo when compiling tools
Currently the Cargo binary has jumped from 14M to 34M on the beta channel, which
appears to be due to the fact that we're compiling tools with debug information
inside them. This additionally means that the `rls` binary is 62M right now!

This wasn't an intentional change, so be sure to disable debuginfo when
compiling tools as it's just intended for the standard library and compile for
now.
2017-04-17 18:16:53 -07:00
est31
0c148153f4 Add float_bits_conv to unstable book 2017-04-18 02:55:47 +02:00
est31
873a3b0363 Allow us to remove masking in the future 2017-04-18 02:43:16 +02:00
est31
3993eb4a27 Preserve sNaN payload when converting them to quiet NaNs 2017-04-18 02:43:16 +02:00
est31
fc028b8180 Convert sNaN to quiet NaN instead of returning errors 2017-04-18 02:43:16 +02:00
est31
bdab5cdc63 assert_ne and tracking issue 2017-04-18 02:43:16 +02:00
est31
56760abf3b Add examples heading 2017-04-18 02:43:16 +02:00
est31
82eead0d0b Return Err(()) when trying to convert sNaN representation to float 2017-04-18 02:43:16 +02:00
est31
32a43da68a Add functions to safely transmute float to int 2017-04-18 02:43:16 +02:00
Dylan Maccora
2877a01feb Address review comments 2017-04-18 08:29:05 +10:00
bors
235fe8313f Auto merge of #41282 - arielb1:missing-impl-item, r=petrochenkov
libsyntax/parse: fix missing kind error reporting

Fixes #41161.
Fixes #41239.
2017-04-17 22:22:56 +00:00