Commit Graph

74166 Commits

Author SHA1 Message Date
kennytm
19aac099a5 Rollup merge of #47515 - jimmantooth:patch-1, r=QuietMisdreavus
Punctuation and clarity fixes.
2018-01-30 17:10:48 +08:00
bors
fe7e1a45f3 Auto merge of #45294 - petrochenkov:prioplus, r=nikomatsakis
syntax: Lower priority of `+` in `impl Trait`/`dyn Trait`

Now you have to write `Fn() -> (impl A + B)` instead of `Fn() -> impl A + B`, this is consistent with priority of `+` in trait objects (`Fn() -> A + B` means `(Fn() -> A) + B`).

To make this viable I changed the syntax to also permit `+` in return types in function declarations
```
fn f() -> dyn A + B { ... } // OK, don't have to write `-> (dyn A + B)`

// This is acceptable, because `dyn A + B` here is an isolated type and
// not part of a larger type with various operator priorities in play
// like `dyn A + B` in `Fn() -> dyn A + B` despite syntax similarities.
```
but you still have to use `-> (dyn A + B)` in function types and function-like trait object types (see this PR's tests for examples).

This can be a breaking change for code using `impl Trait` on nightly. The thing that is most likely to break is `&impl A + B`, it needs to be rewritten as `&(impl A + B)`.

cc https://github.com/rust-lang/rust/issues/34511 https://github.com/rust-lang/rust/issues/44662 https://github.com/rust-lang/rfcs/pull/438
2018-01-30 08:23:41 +00:00
Aaron Hill
b5f8cd5c20
Fix ref-to-ptr coercions not working with NLL in certain cases
Implicit coercions from references to pointers were lowered to slightly
different Mir than explicit casts (e.g. 'foo as *mut T'). This resulted
in certain uses of self-referential structs compiling correctly when an
explicit cast was used, but not when the implicit coercion was used.

To fix this, this commit adds an outer 'Use' expr when applying a
raw-ptr-borrow adjustment. This makes the lowered Mir for coercions
identical to that of explicit coercions, allowing the original code to
compile regardless of how the raw ptr cast occurs.

Fixes #47722
2018-01-29 23:25:54 -05:00
Christopher Durham
c06c707fbf Fix regression: account for trait methods in arg count mismatch error 2018-01-29 23:08:16 -05:00
Clar Charr
aab712cbc8 Move time::Duration to libcore 2018-01-29 18:16:43 -05:00
Clar Charr
2cab06855a Reworded to avoid fuzziness, mention ! in c_void docs. 2018-01-29 18:15:59 -05:00
Mark Mansi
576294237b fix typos 2018-01-29 17:08:11 -06:00
Clar Charr
853fa5873c Revisions suggested in comments 2018-01-29 17:44:12 -05:00
Clar Charr
1a043533f5 Document std::os::raw. 2018-01-29 17:44:12 -05:00
Mark Mansi
2184400be7 Update comment 2018-01-29 16:37:57 -06:00
bors
90eb44a589 Auto merge of #47837 - eddyb:going-places, r=nikomatsakis
Replace "lvalue" terminology with "place".

See #46425 for the previous PR (which only changed MIR-related code).

r? @nikomatsakis
2018-01-29 19:47:48 +00:00
Oliver Middleton
ae98f4cac5 rustdoc: Fix link title rendering with hoedown
The link title needs to be HTML escaped.
2018-01-29 19:26:31 +00:00
Niko Matsakis
adeb0aeb4a
move comment right onto the line in question 2018-01-29 13:28:23 -05:00
Marco A L Barbosa
898fdcc3ed Make run-pass/env-home-dir.rs test more robust
Remove the assumption that home_dir always returns Some

This allows the test to be executed with
[cross](https://github.com/japaric/cross).
2018-01-29 15:40:27 -02:00
Esteban Küber
08287c1e26 Toggle span highlighting on -Zteach 2018-01-29 08:59:15 -08:00
Pietro Albini
8389b66c18
Increase test coverage of use_nested_groups 2018-01-29 17:11:09 +01:00
varkor
e92bdb9828 Specify output filenames for compatibility with Windows 2018-01-29 14:38:50 +00:00
Mark Simulacrum
e09a8bd70c Add per-stage RUSTFLAGS: RUSTFLAGS_STAGE_{0,1,2} and RUSTFLAGS_STAGE_NOT_0
Fixes #47658.
2018-01-29 07:02:09 -07:00
varkor
9a2f02df66 Warn when -C extra-filename flag is used with -o 2018-01-29 12:50:36 +00:00
varkor
d97da7d536 Minor refactoring 2018-01-29 11:08:06 +00:00
varkor
ba76092c2e Fix tidy error 2018-01-29 11:08:06 +00:00
varkor
45e962ecc0 Use correct output file paths for error checking 2018-01-29 11:07:27 +00:00
varkor
3d55974be4 Fix quotation mark 2018-01-29 11:05:15 +00:00
varkor
dc274e68a7 Fix tidy error 2018-01-29 11:05:15 +00:00
varkor
df1c61d303 Warn when rustc output conflicts with existing directories
When the compiled executable would conflict with a directory, display a
rustc error instead of a verbose and potentially-confusing linker
error. This is a usability improvement, and doesn’t actually change
behaviour with regards to compilation success. This addresses the
concern in #35887.
2018-01-29 11:05:15 +00:00
bors
70f7d5842f Auto merge of #47766 - spastorino:inference-dirty-list, r=nikomatsakis
Make region inference use a dirty list

r? @nikomatsakis
2018-01-29 10:51:07 +00:00
Eduard-Mihai Burtescu
bba81c975d rustc_borrowck: replace "lvalue" terminology with "place" in docs. 2018-01-29 11:48:17 +02:00
Eduard-Mihai Burtescu
6f8d263e87 tests: replace "lvalue" terminology with "place". 2018-01-29 11:48:12 +02:00
John Kåre Alsaker
77bc26f4f3 Require yield types to be sized 2018-01-29 10:02:04 +01:00
John Kåre Alsaker
7a6f68c872 Make error reporting work on generator upvars. Fixes #47793, #47805 2018-01-29 10:02:03 +01:00
John Kåre Alsaker
dd3fa07a52 Make yield_in_scope_for_expr work with patterns. Fixes #47758 2018-01-29 10:02:03 +01:00
John Kåre Alsaker
ad058cfafe Make pattern visiting consistent 2018-01-29 10:02:03 +01:00
Manish Goregaokar
540f95d9fa Add internal-only rustc_serialize_exclude_null attribute for making the field only exist in the json if the flag is passed 2018-01-29 11:41:03 +05:30
Manish Goregaokar
a53bdc6212 Add -Zapproximate-suggestions 2018-01-29 11:41:02 +05:30
Manish Goregaokar
937bc2e04a Add approximate suggestions for rustfix
This adds `span_approximate_suggestion()` that lets you emit a
suggestion marked as "approximate" in the JSON output. UI
users see no difference. This is for when rustc and clippy wish to
 emit suggestions which will make sense to the reader (e.g. they may
have placeholders like `<type>`) but are not source-applicable, so that
rustfix/etc can ignore these.

fixes #39254
2018-01-29 11:40:50 +05:30
bors
679f30e1aa Auto merge of #47730 - alexcrichton:multitrans, r=Mark-Simulacrum
rustc: Split Emscripten to a separate codegen backend

This commit introduces a separately compiled backend for Emscripten, avoiding
compiling the `JSBackend` target in the main LLVM codegen backend. This builds
on the foundation provided by #47671 to create a new codegen backend dedicated
solely to Emscripten, removing the `JSBackend` of the main codegen backend in
the process.

A new field was added to each target for this commit which specifies the backend
to use for translation, the default being `llvm` which is the main backend that
we use. The Emscripten targets specify an `emscripten` backend instead of the
main `llvm` one.

There's a whole bunch of consequences of this change, but I'll try to enumerate
them here:

* A *second* LLVM submodule was added in this commit. The main LLVM submodule
  will soon start to drift from the Emscripten submodule, but currently they're
  both at the same revision.
* Logic was added to rustbuild to *not* build the Emscripten backend by default.
  This is gated behind a `--enable-emscripten` flag to the configure script. By
  default users should neither check out the emscripten submodule nor compile
  it.
* The `init_repo.sh` script was updated to fetch the Emscripten submodule from
  GitHub the same way we do the main LLVM submodule (a tarball fetch).
* The Emscripten backend, turned off by default, is still turned on for a number
  of targets on CI. We'll only be shipping an Emscripten backend with Tier 1
  platforms, though. All cross-compiled platforms will not be receiving an
  Emscripten backend yet.

This commit means that when you download the `rustc` package in Rustup for Tier
1 platforms you'll be receiving two trans backends, one for Emscripten and one
that's the general LLVM backend. If you never compile for Emscripten you'll
never use the Emscripten backend, so we may update this one day to only download
the Emscripten backend when you add the Emscripten target. For now though it's
just an extra 10MB gzip'd.

Closes #46819
2018-01-29 04:55:47 +00:00
penpalperson
81e49597bf Added inline to fmt for debug implementations of primitives. 2018-01-28 21:55:05 -07:00
Corey Farwell
7b4cbbd12d Document that Index ops can panic on HashMap & BTreeMap.
Fixes https://github.com/rust-lang/rust/issues/47011.
2018-01-28 21:51:33 -05:00
Alex Crichton
c6daea7c9a rustc: Split Emscripten to a separate codegen backend
This commit introduces a separately compiled backend for Emscripten, avoiding
compiling the `JSBackend` target in the main LLVM codegen backend. This builds
on the foundation provided by #47671 to create a new codegen backend dedicated
solely to Emscripten, removing the `JSBackend` of the main codegen backend in
the process.

A new field was added to each target for this commit which specifies the backend
to use for translation, the default being `llvm` which is the main backend that
we use. The Emscripten targets specify an `emscripten` backend instead of the
main `llvm` one.

There's a whole bunch of consequences of this change, but I'll try to enumerate
them here:

* A *second* LLVM submodule was added in this commit. The main LLVM submodule
  will soon start to drift from the Emscripten submodule, but currently they're
  both at the same revision.
* Logic was added to rustbuild to *not* build the Emscripten backend by default.
  This is gated behind a `--enable-emscripten` flag to the configure script. By
  default users should neither check out the emscripten submodule nor compile
  it.
* The `init_repo.sh` script was updated to fetch the Emscripten submodule from
  GitHub the same way we do the main LLVM submodule (a tarball fetch).
* The Emscripten backend, turned off by default, is still turned on for a number
  of targets on CI. We'll only be shipping an Emscripten backend with Tier 1
  platforms, though. All cross-compiled platforms will not be receiving an
  Emscripten backend yet.

This commit means that when you download the `rustc` package in Rustup for Tier
1 platforms you'll be receiving two trans backends, one for Emscripten and one
that's the general LLVM backend. If you never compile for Emscripten you'll
never use the Emscripten backend, so we may update this one day to only download
the Emscripten backend when you add the Emscripten target. For now though it's
just an extra 10MB gzip'd.

Closes #46819
2018-01-28 18:32:45 -08:00
Andy Russell
043d4615f2
use correct casing for rename suggestions
If the original name is uppercase, use camel case. Otherwise, use snake
case.
2018-01-28 20:48:54 -05:00
Esteban Küber
871856e831 Highlight code on diagnostics when underlined 2018-01-28 17:15:15 -08:00
Esteban Küber
67696be160 Point only at method signatures and point at trait
- On mismatch between impl and trait method, point at the trait
   signature.
 - Point only at the method signature instead of the whole body on
   trait/impl mismatch errors.
2018-01-28 17:06:30 -08:00
Eduard-Mihai Burtescu
46a9bdda78 rustc: replace "lvalue" terminology with "place" in the code. 2018-01-29 01:49:29 +02:00
bors
385ef1514c Auto merge of #47663 - malbarbo:mips-crt-static, r=alexcrichton
Do not assume dynamic linking for musl/mips[el] targets

All musl targets except mips[el] assume static linking by default. This can be [confusing](https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084).

When the musl/mips[el] targets was [added](https://github.com/rust-lang/rust/pull/31298), dynamic linking was chosen because of binary size concerns, and probably also because libunwind [didn't](https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084/8) supported mips.

Now that we have `crt-static` target-feature (the user can choose dynamic link for musl targets), and libunwind [6.0](https://github.com/llvm-mirror/libunwind/commits/release_60) add support to mips, we do not need to assume dynamic linking.
2018-01-28 23:30:15 +00:00
Eduard-Mihai Burtescu
06a0e4f7ae rustc: move expr_is_lval to rustc_typeck and rename to is_place_expr. 2018-01-29 01:24:25 +02:00
Eduard-Mihai Burtescu
3f4a489f8f rustc_typeck: rename LvalueOp to PlaceOp. 2018-01-29 01:20:18 +02:00
Eduard-Mihai Burtescu
2c4a75bf09 rustc_typeck: rename LvaluePreference::PreferMutLvalue to Needs::MutPlace. 2018-01-29 00:59:25 +02:00
Eduard-Mihai Burtescu
800166cf96 rustc: remove LvaluePreference argument from Ty::builtin_deref. 2018-01-29 00:42:51 +02:00
Esteban Küber
6c026997bf For named lifetimes point only at method signature
When refering to named lifetime conflict, point only at the method's
signature span instead of the entire method.

When the expected and found sup and sub traces are the same, avoid
redundant text.
2018-01-28 12:07:03 -08:00
Esteban Küber
b7437c56f8 Suggest removing value from break when invalid 2018-01-28 11:14:09 -08:00