Commit Graph

65239 Commits

Author SHA1 Message Date
bors
88c3242ef2 Auto merge of #42431 - nagisa:core-float-2, r=alexcrichton
Fix NaN handling in is_sign_negative/positive

This would be my proposed fix for the #42425 provided we decide it is indeed a problem.

Note this would technically be a breaking change to a stable API. We might want to consider deprecating these methods and adding new ones.
2017-06-28 03:41:22 +00:00
bors
4079e6128f Auto merge of #42417 - eddyb:separate-fn-sig, r=nikomatsakis
Don't drag function signatures along function item types.

This PR separates the signature of a function from the "function item type" (`TyFnDef`), leaving only the `DefId` and parameter `Substs`, making them even more like (captureless) closure types.

The motivation for this change is reducing typesystem complexity, and its consequences:
* operating on the signature instead of just the parameters was less efficient
  * specifically, signatures can easily add several levels of depth on top of the parameter types
  * and the signatured were always substituted and normalized, so typically even more complex
* it was *the only* type that was *both* nominal (identity) and structural (signature)
  * harder to model in Chalk than either a purely nominal or structural type
  * subtyping worked on the signature but parameters were always invariant
  * call type-checking was transforming signatures but keeping the nominal half intact
  * the signature could therefore get out of sync during type inference in several ways

That last point comes with a `[breaking-change]`, because functions with `'static` in their return types will now *not* be as usable as if they were using lifetime parameters instead:
```rust
// Will cause lifetime mismatch in main after this PR.
fn bar() -> &'static str { "bar" }
// Will continue to work fine, as every use can choose its own lifetime.
fn bar<'a>() -> &'a str { "bar" }

fn main() {
    let s = String::from("foo");
    Some(&s[..]).unwrap_or_else(bar);
}
```

r? @nikomatsakis
2017-06-28 01:12:12 +00:00
Eduard-Mihai Burtescu
69076f3a78 tests: work around fallout from normalizing signatures separately. 2017-06-27 16:39:58 +03:00
Eduard-Mihai Burtescu
a9d4069975 rustc_typeck: support functions in variance computation. 2017-06-27 16:39:58 +03:00
Eduard-Mihai Burtescu
33ecf72e8e rustc: move the PolyFnSig out of TyFnDef. 2017-06-27 16:39:52 +03:00
Eduard-Mihai Burtescu
8e53a03d15 rustc: rename closure_type to fn_sig. 2017-06-27 16:32:48 +03:00
bors
f590a44ce6 Auto merge of #42922 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests

- Successful merges: #42519, #42871, #42874, #42905, #42917
- Failed merges:
2017-06-27 05:12:07 +00:00
Corey Farwell
d7a5508069 Rollup merge of #42917 - kennytm:gdb-fatal-proc-rec, r=Mark-Simulacrum
compiletest: show details why GDB failed to execute.

Help finding reasons of spurious errors due to GDB failing to run (#42693).
2017-06-26 23:34:13 -04:00
Corey Farwell
83d4b43422 Rollup merge of #42905 - casey:casey-utf8-null-doc, r=steveklabnik
Reword OsStr docs to clarify that utf8 may contain nulls

The use of the word "but" in the OsStr docs implies (at least to me) that valid UTF-8 does not contain null bytes.

Using "which" instead makes it clear that valid UTF-8 may contain null bytes.
2017-06-26 23:34:12 -04:00
Corey Farwell
7808fddede Rollup merge of #42874 - zackmdavis:overzealous_by_outer_forbid, r=nikomatsakis
only set "overruled by outer forbid" once for lint groups, by group name

Previously, conflicting forbid/allow attributes for a lint group would
result in a separate "allow(L) overruled by outer forbid(L)" error for
every lint L in the group. This was needlessly and annoyingly verbose;
we prefer to just have one error pointing out the conflicting
attributes.

(Also, while we're touching context.rs, clean up some unused arguments.)

Resolves #42873.
2017-06-26 23:34:11 -04:00
Corey Farwell
b1afcb6ae9 Rollup merge of #42871 - llogiq:for_lowering_vs_clippy, r=arielb1
change binding name of for loop lowering to appease clippy

With the latest change to for loop lowering (#42634), a `_next` binding was introduced.
Unfortunately, this [disturbs](https://github.com/Manishearth/rust-clippy/issues/1846) clippy's `used_underscore_binding` lint. This commit just renames the binding to `__next` so clippy will be happy. It should have no other effect.
2017-06-26 23:34:10 -04:00
Corey Farwell
b2c313007d Rollup merge of #42519 - GuillaumeGomez:create-more-error-codes, r=QuietMisdreavus
Create more error codes

Fixes #31174.
Part of #42229.

cc @Susurrus
2017-06-26 23:34:09 -04:00
bors
77931c2a04 Auto merge of #42916 - Mark-Simulacrum:update-cargo, r=alexcrichton
Update Cargo

Haven't run extensive tests locally (not really sure what to test) but this primarily pulls in minor changes: https://github.com/rust-lang/cargo/pull/4215, https://github.com/rust-lang/cargo/pull/4209, and https://github.com/rust-lang/cargo/pull/4218. The last one fixes the flaky cargo test by ignoring it, which should unblock https://github.com/rust-lang/rust/pull/42745 -- that's beta nominated.

r? @alexcrichton
2017-06-26 22:42:08 +00:00
kennytm
3f1cb30b14
compiletest: show details if GDB failed to execute. 2017-06-27 02:44:42 +08:00
Mark Simulacrum
38b468832f Update Cargo 2017-06-26 10:30:36 -06:00
bors
859c3236e5 Auto merge of #42885 - ollie27:rustdoc_empty_glob_path, r=GuillaumeGomez
rustdoc: Don't ICE on `use *;`

Fixes #42875
2017-06-26 11:06:13 +00:00
Casey Rodarmor
0d985c9e87 Reword OsStr docs to clarify that utf8 may contain nulls 2017-06-25 14:23:43 -07:00
bors
fc9ccfdbe0 Auto merge of #42865 - ollie27:rustdoc_assoc_consts, r=GuillaumeGomez
rustdoc: Fix a few issues with associated consts

* Make sure private consts are stripped.
* Don't show a code block for the value if there is none.
* Make sure default values are shown in impls.
* Make sure docs from the trait are used if the impl has no docs.
2017-06-25 17:39:26 +00:00
Guillaume Gomez
bcf0d600f3 Add reference link 2017-06-25 09:25:37 +02:00
bors
bc9822af2e Auto merge of #42784 - tlively:wasm-bot, r=alexcrichton
Make wasm32 buildbot test LLVM backend

This adds the experimental targets option to configure so it can be used
by the builders and changes the wasm32 Dockerfile accordingly. Instead
of using LLVM from the emsdk, the builder's emscripten tools now uses
the Rust in-tree LLVM, since this is the one built with wasm support.
2017-06-24 22:34:08 +00:00
Guillaume Gomez
9137153e47 Use new macro instead 2017-06-24 21:28:11 +02:00
Guillaume Gomez
deb1eb6134 wording improvement 2017-06-24 21:28:08 +02:00
Guillaume Gomez
7b8c6a2d30 Add E0607 2017-06-24 21:27:49 +02:00
Guillaume Gomez
30effc14e4 Add E0606 2017-06-24 21:27:45 +02:00
Guillaume Gomez
0e4b8ffccd Add E0605 2017-06-24 21:25:31 +02:00
Guillaume Gomez
d5977df1c1 Add E0604 2017-06-24 21:25:31 +02:00
Thomas Lively
c130b83bae Restore old emscripten.sh for use by asmjs 2017-06-24 11:35:48 -07:00
Oliver Middleton
927625912a rustdoc: Don't ICE on use *; 2017-06-24 18:16:39 +01:00
bors
c9bb93576d Auto merge of #42864 - slo1:attempt, r=Mark-Simulacrum
Saves created temp directory if save-temps option is used.

Should fix #38068.
2017-06-24 14:43:01 +00:00
bors
3cf9f5d787 Auto merge of #42541 - gilescope:patch-1, r=alexcrichton
assert_eq failure message easier to read

By having the left and right strings aligned with one another it helps spot the difference between the two far quicker than if they are on the same line.

E.g.
Before:

```
thread 'tests::test_safe_filename' panicked at 'assertion failed: `(left == right)` left:  `"-aandb--S123.html"` right: `"-aandb-S123.html"`',
```

After:

```
thread 'tests::test_safe_filename' panicked at 'assertion failed: `(left == right)`
left:  `"-aandb--S123.html"`
right: `"-aandb-S123.html"`',
```

When the strings are both on the same line it take a lot longer to spot the difference. It is a small change but the small time savings add up with repetition. This would help Rust be an excellent language to write tests in out of the box.

Closes https://github.com/rust-lang/rust/issues/41615
2017-06-24 12:18:40 +00:00
bors
7e76505e01 Auto merge of #42854 - razielgn:relaxed-debug-constraints-on-maps-iterators, r=sfackler
Relaxed Debug constraints on {HashMap,BTreeMap}::{Keys,Values}.

I has hit by this yesterday too. 😄
And I've realised that Debug for BTreeMap::{Keys,Values} wasn't formatting just keys and values respectively, but the whole map. 🤔

Fixed #41924

r? @jonhoo
2017-06-24 09:32:20 +00:00
bors
b0081b36b4 Auto merge of #42724 - Mark-Simulacrum:tests, r=alexcrichton
Add tests for a few issues.

Fixes #41998
Fixes #38381
Fixes #37515
Fixes #37510
Fixes #37366
Fixes #37323
Fixes #37051
Fixes #36839
Fixes #35570
Fixes #34373
Fixes #34222

Certainly not all of the E-needstest issues right now, but I started to get bored.
2017-06-24 07:10:10 +00:00
Zack M. Davis
890a76f479 only set "overruled by outer forbid" once for lint groups, by group name
Previously, conflicting forbid/allow attributes for a lint group would
result in a separate "allow(L) overruled by outer forbid(L)" error for
every lint L in the group. This was needlessly and annoyingly verbose;
we prefer to just have one error pointing out the conflicting
attributes.

Resolves #42873.
2017-06-23 22:36:40 -07:00
bors
1ccc330d4b Auto merge of #42687 - alexcrichton:windows-tls, r=sfackler
rustc: Enable #[thread_local] for Windows

I think LLVM has had support for quite some time now for this, we just never got
around to testing it out and binding it. We've had some trouble landing this in
the past I believe, but it's time to try again!

This commit flags the `#[thread_local]` attribute as being available for Windows
targets and adds an implementation of `register_dtor` in the `thread::local`
module to ensure we can destroy these keys. The same functionality is
implemented in clang via a function called `__tlregdtor` (presumably provided in
some Windows runtime somewhere), but this function unfortunately does not take a
data pointer (just a thunk) which means we can't easily call it. For now
destructors are just run in the same way the Linux fallback is implemented,
which is just keeping track via a single OS-based TLS key.
2017-06-24 04:42:18 +00:00
Zack M. Davis
426331b9e4 remove unused parameters from LintStore.find_lint
Long ago, in the before-time, the find_lint method was created with the
unused_variables ("unused_variable" in the singular, as it was called at
the time) attribute in anticipation of using the session and span in the
handling of renamed lints (31b7d64fd), and indeed, the session and span
came to be used in this method, while the unused_variables attribute
remained (1ad1e2e29). In modern times, the session and span are again no
longer used (ca81d3dd); it seems we can safely prune them from the
method signature, for justice, and mercy.
2017-06-23 19:34:28 -07:00
Thomas Lively
4ad6a95860 Add Target (de)serialization for environment vars
Also turn WebAssembly backend back on in its builder.
2017-06-23 17:49:36 -07:00
Alex Crichton
06540cb205 rustc: Enable #[thread_local] for Windows
I think LLVM has had support for quite some time now for this, we just never got
around to testing it out and binding it. We've had some trouble landing this in
the past I believe, but it's time to try again!

This commit flags the `#[thread_local]` attribute as being available for Windows
targets and adds an implementation of `register_dtor` in the `thread::local`
module to ensure we can destroy these keys. The same functionality is
implemented in clang via a function called `__tlregdtor` (presumably provided in
some Windows runtime somewhere), but this function unfortunately does not take a
data pointer (just a thunk) which means we can't easily call it. For now
destructors are just run in the same way the Linux fallback is implemented,
which is just keeping track via a single OS-based TLS key.
2017-06-23 16:11:39 -07:00
Oliver Middleton
4488f9bc0f rustdoc: Fix a few issues with associated consts
* Make sure private consts are stripped.
* Don't show a code block for the value if there is none.
* Make sure default values are shown in impls.
* Make sure docs from the trait are used if the impl has no docs.
2017-06-23 18:39:27 +01:00
slo
a5c29cbf38 Saves created temp directory if save-temps option is used. 2017-06-23 13:20:23 -04:00
Andre Bogus
ebe71fdd53 change binding name of for loop lowering to appease clippy
With the latest change to for loop lowering, a `_next` binding was introduced.
Unfortunately, this disturbs clippy's `used_underscore_binding` lint. This
commit just renames the binding to `__next` so clippy will be happy. It should
have no other effect.
2017-06-23 18:23:23 +02:00
Mark Simulacrum
2346169f99 Add tests for a few issues. 2017-06-23 07:51:01 -06:00
bors
229d0d3266 Auto merge of #42856 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 8 pull requests

- Successful merges: #42777, #42783, #42787, #42821, #42822, #42825, #42829, #42833
- Failed merges:
2017-06-23 13:46:43 +00:00
Mark Simulacrum
9037ef2c78 Rollup merge of #42833 - durka:non-constant-used-with-constant, r=Mark-Simulacrum
change span label for E0435

r? @Mark-Simulacrum
2017-06-23 06:02:15 -06:00
Mark Simulacrum
747643ff3a Rollup merge of #42829 - ids1024:cxx, r=alexcrichton
Set CXX_<target> in bootstrap

I came across this trying to cross-compile rustc for Redox. It was also mentioned in a comment on https://github.com/rust-lang/rust/pull/42206, but doesn't seem to have been corrected.
2017-06-23 06:02:14 -06:00
Mark Simulacrum
97b7783333 Rollup merge of #42825 - letheed:patch-1, r=alexcrichton
Fix ref as mutable ref in std::rc::Rc doc
2017-06-23 06:02:12 -06:00
Mark Simulacrum
bb2db942ee Rollup merge of #42822 - ChrisMacNaughton:guard-traits, r=alexcrichton
Ensure Guard types impl Display & Debug

Fixes #24372
2017-06-23 06:02:11 -06:00
Mark Simulacrum
f3aebb0a83 Rollup merge of #42821 - michaelwoerister:incr-debug-output-on-stderr, r=alexcrichton
Print -Zincremental-info to stderr instead of stdout.

Fixes #42583.

The [cargo-incremental](https://github.com/nikomatsakis/cargo-incremental) tool probably does not need to be updated. It already merges stdout and stderr before parsing the compiler's output.

r? @alexcrichton
2017-06-23 06:02:10 -06:00
Mark Simulacrum
ddc2333fab Rollup merge of #42787 - zackmdavis:explain_E0562, r=GuillaumeGomez
add extended information for E0562; impl Trait can only be a return type

r? @GuillaumeGomez
2017-06-23 06:02:09 -06:00
Mark Simulacrum
d22eb081ef Rollup merge of #42783 - ids1024:redox-env, r=sfackler
Redox: Use create() instead of open() when setting env variable

See https://github.com/redox-os/kernel/pull/25.
2017-06-23 06:02:08 -06:00
Mark Simulacrum
377ff895a5 Rollup merge of #42777 - kennytm:kill-ignore-doctest, r=estebank
Remove most "```ignore" doc tests.

Unconditional ` ```ignore ` doc tests lead to outdated examples (e.g. https://github.com/rust-lang/rust/issues/42729#issuecomment-309346572). This PR tries to change all existing ` ```ignore ` tests into one of the following:

* Add import and declarations to ensure the code is run-pass
* If the code is not Rust, change to ` ```text `/` ```sh `/` ```json `/` ```dot `
* If the code is expected compile-fail, change to ` ```compile_fail `
* If the code is expected run-fail, change to ` ```should_panic `
* If the code can type-check but cannot link/run, change to ` ```no_run `
* Otherwise, add an explanation after the ` ```ignore `

The `--explain` handling is changed to cope with hidden lines from the error index.

Tidy is changed to reject any unexplained ` ```ignore ` and ` ```rust,ignore `.
2017-06-23 06:02:08 -06:00