Commit graph

94788 commits

Author SHA1 Message Date
Mazdak Farrokhzad
d5cc080b73 typeck/expr.rs: extract out check_expr_addr_of. 2019-06-15 01:50:33 +02:00
Mazdak Farrokhzad
840f3f64dc typeck/expr.rs: extract out check_expr_unary. 2019-06-15 01:45:39 +02:00
Mazdak Farrokhzad
7227a386a5 typeck/expr.rs: extract out check_expr_box. 2019-06-15 01:36:09 +02:00
Mazdak Farrokhzad
6cf4b3ac10 typeck: check_expr_kind -> expr.rs 2019-06-15 01:28:38 +02:00
bors
9606f6fa64 Auto merge of #61817 - eddyb:begone-gcx-attempt-2, r=oli-obk
Unify all uses of 'gcx and 'tcx.

This is made possible by @Zoxc landing #57214 (see https://github.com/rust-lang/rust/pull/57214#issuecomment-465036053 for the decision).

A bit of context for the approach: just like #61722, this is *not* how I originally intended to go about this, but @Zoxc and my own experimentation independently resulted in the same conclusion:
The interim alias `type TyCx<'tcx> = TyCtxt<'tcx, 'tcx>;` attempt required more work (adding `use`s), even only for handling the `TyCtxt<'tcx, 'tcx>` case and not the general `TyCtxt<'gcx, 'tcx>` one.

What this PR is based on is the realization that `'gcx` is a special-enough name that it can be replaced, without caring for context, with `'tcx`, and then repetitions of the name `'tcx` be compacted away.
After that, only a small number of error categories remained, each category easily dealt with with either more mass replacements (e.g. `TyCtxt<'tcx, '_>` -> `TyCtxt<'tcx>`) or by hand.

For the `rustfmt` commit, I used https://github.com/rust-lang/rustfmt/issues/1324#issuecomment-482109952, and manually filtered out some noise, like in #61735 and #61722, and like the latter, there was also a weird bug to work around.
It should be reviewed separately, and dropped if unwanted (in this PR it's pretty significant).

cc @rust-lang/compiler r? @nikomatsakis
2019-06-14 16:20:35 +00:00
Eduard-Mihai Burtescu
afc39bbf24 Run rustfmt --file-lines ... for changes from previous commits. 2019-06-14 18:58:32 +03:00
Eduard-Mihai Burtescu
f3f9d6dfd9 Unify all uses of 'gcx and 'tcx. 2019-06-14 18:58:23 +03:00
bors
fc550d4295 Auto merge of #61421 - vorner:string-in-rc-into-raw-docs, r=RalfJung
docs: Use String in Rc::into_raw examples

It is unclear if accessing an integer after `drop_in_place` has been
called on it is undefined behaviour or not, as demonstrated by the
discussion in
https://github.com/rust-lang/rust/pull/60766#pullrequestreview-243414222.

Avoid these uncertainties by using String which frees memory in its
`drop_in_place` to make sure this is undefined behaviour. The message in
the docs should be to watch out and not access the data after that, not
discussing when one maybe could get away with it O:-).
2019-06-14 12:37:28 +00:00
bors
e699ea096f Auto merge of #61679 - zackmdavis:maybe_dont_indicate_the_anonymous_lifetime, r=oli-obk
in which we decline to suggest the anonymous lifetime in declarations

The elided-lifetimes-in-path lint (part of our suite of Rust 2018 idiom lints which we are hoping to promote to Warn status) was firing with an illegal suggestion to write an anonymous lifetime in a
struct/item declaration (where we don't allow it). The linting code was already deciding whether to act on the basis of a `ParamMode` enum, indicating whether the present path-segment was part of an
expression, or anywhere else. The present case seemed to be part of the "anywhere else", and yet meriting different rules as far as the lint was concerned, so it seemed expedient to introduce a new enum member. We yank out `TyKind::Path` arm into its own method so that we can call it with our new `ParamMode` specifically when lowering struct fields—one would have hoped to think of something more elegant than this, but it definitely beats changing the signature of `lower_ty` to take a `ParamMode`!

Resolves #61124.

cc @memoryruins
r? @oli-obk
2019-06-14 09:39:17 +00:00
Zack M. Davis
7a3184a04c in which we decline to suggest the anonymous lifetime in declarations
The elided-lifetimes-in-path lint (part of our suite of Rust 2018
idiom lints which we are hoping to promote to Warn status) was firing
with an illegal suggestion to write an anonymous lifetime in a
struct/item declaration (where we don't allow it). The linting code
was already deciding whether to act on the basis of a `ParamMode`
enum, indicating whether the present path-segment was part of an
expression, or anywhere else. The present case seemed to be part of
the "anywhere else", and yet meriting different rules as far as the
lint was concerned, so it seemed expedient to introduce a new enum
member. We yank out a `TyKind::Path` arm into its own method so that
we can call it with our new `ParamMode` specifically when lowering
struct fields. (The alternative strategy of changing the signature of
`lower_ty` to take a `ParamMode` would be inelegant given that most of
the `TyKind` match arm bodies therein don't concern themselves with
`ParamMode`.)

Resolves #61124.
2019-06-14 00:01:59 -07:00
bors
42503d5790 Auto merge of #61803 - Centril:write_resolution, r=petrochenkov
typeck: small refactoring, add 'fn write_resolution'
2019-06-14 06:46:01 +00:00
bors
bcc568f27b Auto merge of #61792 - lzutao:issue-51301, r=Centril
Add ui test for issue 51301

Closes #51301
2019-06-14 03:57:28 +00:00
bors
cdd743755a Auto merge of #61639 - Mark-Simulacrum:bootstrap-cleanup, r=alexcrichton
Bootstrap cleanup

Each commit is (mostly) standalone and probably best reviewed as such. Nothing too major just some drive-by nits as I was looking through the code.

r? @alexcrichton
2019-06-13 22:23:42 +00:00
bors
0e4a56b4b0 Auto merge of #61772 - alexcrichton:pr-and-master-builds, r=pietroalbini
ci: Enable toolstate tracking on Azure

Currently just run it through its paces but don't actually push to
official locations. Instead let's just push to a separate fork (mine) as
well as open issues in a separate fork (mine). Make sure that people
aren't pinged for these issues as well!

This should hopefully ensure that everything is working on Azure and
give us a chance to work through any issues that come up.

Fixes https://github.com/rust-lang/rust/issues/61790
Fixes https://github.com/rust-lang/rust/issues/61371
2019-06-13 15:44:58 +00:00
Mark Rousskov
d728d27ef3 Remove unnecessary Std dependency 2019-06-13 08:57:55 -06:00
Mark Rousskov
11543585c2 Delete unused fields on Crate struct 2019-06-13 08:57:55 -06:00
Mark Rousskov
7234d8cb5e Inline prepare_tool_cmd
Removing the tool argument in the previous commit means it's no longer
restricted to just bootstrap tools despite being written as such.
Inlining it prevents accidental use.
2019-06-13 08:57:55 -06:00
Mark Rousskov
0e14818321 Delete unnecessary command 2019-06-13 08:57:55 -06:00
Mark Rousskov
92f5e58ccc Delete Rustbook step
There's no need to have it given it merely forwarded to RustbookSrc.
2019-06-13 08:57:55 -06:00
Mazdak Farrokhzad
a17e918284 typeck: small refactoring, add 'fn write_resolution' 2019-06-13 16:45:18 +02:00
Alex Crichton
521edee2e5 ci: Enable toolstate tracking on Azure
Currently just run it through its paces but don't actually push to
official locations. Instead let's just push to a separate fork (mine) as
well as open issues in a separate fork (mine). Make sure that people
aren't pinged for these issues as well!

This should hopefully ensure that everything is working on Azure and
give us a chance to work through any issues that come up.
2019-06-13 07:09:51 -07:00
bors
57a3300c25 Auto merge of #61799 - Centril:rollup-vpm5uxr, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #61598 (Handle index out of bound errors during const eval without panic)
 - #61720 (std: Remove internal definitions of `cfg_if!` macro)
 - #61757 (Deprecate ONCE_INIT in future 1.38 release)
 - #61766 (submodules: update clippy from c0dbd34b to bd33a97c)
 - #61791 (Small cleanup in `check_pat_path`)

Failed merges:

r? @ghost
2019-06-13 12:52:29 +00:00
Mazdak Farrokhzad
8917b8e32c
Rollup merge of #61791 - Centril:cleanup-check_pat_path, r=petrochenkov
Small cleanup in `check_pat_path`
2019-06-13 14:52:00 +02:00
Mazdak Farrokhzad
e70a1062ac
Rollup merge of #61766 - matthiaskrgr:submodule_upd, r=oli-obk
submodules: update clippy from c0dbd34b to bd33a97c

Changes:
````
Fix implicit_return docs
rustup https://github.com/rust-lang/rust/pull/61758/files
Remove wrong lifetime from LintContext
Workaround for rust-lang/rustfmt#3615
Fixing eta with respect to lazy evaluation.
````
r? @oli-obk
2019-06-13 14:51:59 +02:00
Mazdak Farrokhzad
e45c83ca23
Rollup merge of #61757 - sfackler:deprecate-once-init, r=alexcrichton
Deprecate ONCE_INIT in future 1.38 release

Once::new() has been a stable const fn for a while now.

Closes #61746
2019-06-13 14:51:57 +02:00
Mazdak Farrokhzad
ca06f8896b
Rollup merge of #61720 - alexcrichton:libstd-cfg-if-dep, r=sfackler
std: Remove internal definitions of `cfg_if!` macro

This is duplicated in a few locations throughout the sysroot to work
around issues with not exporting a macro in libstd but still wanting it
available to sysroot crates to define blocks. Nowadays though we can
simply depend on the `cfg-if` crate on crates.io, allowing us to use it
from there!
2019-06-13 14:51:56 +02:00
Mazdak Farrokhzad
a0d05150c9
Rollup merge of #61598 - estebank:const-idx, r=oli-obk
Handle index out of bound errors during const eval without panic

Fix #61595
2019-06-13 14:51:53 +02:00
Michal 'vorner' Vaner
79e5839992
docs: Use String in Rc::into_raw examples
It is unclear if accessing an integer after `drop_in_place` has been
called on it is undefined behaviour or not, as demonstrated by the
discussion in
https://github.com/rust-lang/rust/pull/60766#pullrequestreview-243414222.

Avoid these uncertainties by using String which frees memory in its
`drop_in_place` to make sure this is undefined behaviour. The message in
the docs should be to watch out and not access the data after that, not
discussing when one maybe could get away with it O:-).
2019-06-13 13:18:59 +02:00
bors
96636f3eb8 Auto merge of #61743 - RalfJung:miri, r=oli-obk
update miri

Fixes https://github.com/rust-lang/rust/issues/61662

r? @oli-obk
2019-06-13 08:28:15 +00:00
Ralf Jung
4e8626e4af update miri 2019-06-13 10:03:12 +02:00
Matthias Krüger
64d279bb84 submodules: update clippy from c0dbd34b to 7b2a7a22
Changes:
````
Fix wrong lifetime of TyCtxt
travis: Wait at most 30 minutes for base test
Typos and minor grammar corrections
Adds lint for integer division
redundant_closure_for_method_calls fixes: lint does not trigger when there is a difference in mutability lint does not trigger when the method belongs to a trait which is not implemebted directly (Deref)
Fix implicit_return docs
rustup https://github.com/rust-lang/rust/pull/61758/files
Remove wrong lifetime from LintContext
Workaround for rust-lang/rustfmt#3615
Fixing eta with respect to lazy evaluation.
````
2019-06-13 08:25:08 +02:00
Steven Fackler
72e99f57c5 Deprecate ONCE_INIT
Once::new() has been a stable const fn for a while now.

Closes #61746
2019-06-12 21:32:51 -07:00
bors
e011fe1c13 Auto merge of #61597 - lnicola:bump-rand, r=alexcrichton
Bump dirs, rand and redox_users

Part of #57724.
2019-06-13 04:19:28 +00:00
Lzu Tao
8a5e1eeee6 Add ui test for issue 51301 2019-06-13 03:31:01 +00:00
Mazdak Farrokhzad
a947b75196 Small cleanup in check_pat_path. 2019-06-13 04:58:12 +02:00
bors
d8f50ab0ea Auto merge of #61789 - Centril:rollup-hhyvopq, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #60376 (Stabilize Option::xor)
 - #61398 (Stabilize copy_within)
 - #61629 (Hygienize macros in the standard library)
 - #61675 (Include frame pointer for bare metal RISC-V targets)
 - #61750 (Fix x.py install)
 - #61761 (Add an alias for x86_64-sun-solaris target tuple)
 - #61762 (rustbuild: fix libtest_stamp)
 - #61763 (ci: fix ci stats upload condition)
 - #61776 (Fix typos in error_codes)

Failed merges:

r? @ghost
2019-06-13 01:32:17 +00:00
Mazdak Farrokhzad
af281d24ca
Rollup merge of #61776 - JohnTitor:fix-typo-in-error-codes, r=Centril
Fix typos in error_codes

`observedin` should be `observed in`.
2019-06-13 01:49:37 +02:00
Mazdak Farrokhzad
3272e6e750
Rollup merge of #61763 - pietroalbini:azure-fix-condition, r=alexcrichton
ci: fix ci stats upload condition

The condition I suggested in #61632 was not correct and it errors out while evaluating. This fixes the condition. [Example of a failure](https://dev.azure.com/rust-lang/rust/_build/results?buildId=543).

r? @alexcrichton
2019-06-13 01:49:35 +02:00
Mazdak Farrokhzad
555b2d9250
Rollup merge of #61762 - Keruspe:rustbuild-libtest-fix, r=Mark-Simulacrum
rustbuild: fix libtest_stamp

Looks like an obvious copy/paste typo
2019-06-13 01:49:33 +02:00
Mazdak Farrokhzad
b03ffbc69a
Rollup merge of #61761 - lzutao:target-tuple-solaris, r=varkor
Add an alias for x86_64-sun-solaris target tuple

Closes #40531

r? @varkor
2019-06-13 01:49:32 +02:00
Mazdak Farrokhzad
4cbae09efa
Rollup merge of #61750 - tmandry:fix-install, r=Mark-Simulacrum
Fix x.py install

Make sure we look for save analysis in the right place. Fixes #61703.

r? @Mark-Simulacrum
cc @petrhosek @cramertj
2019-06-13 01:49:31 +02:00
Mazdak Farrokhzad
0d8d08d067
Rollup merge of #61675 - fintelia:riscv-frame-pointer, r=nagisa
Include frame pointer for bare metal RISC-V targets

This changes the default setting to enable the use of the frame pointer register when targeting RISC-V. On that architecture there is a dedicated frame pointer register which LLVM would otherwise never use so there is no increase in register pressure. Further, since these are bare metal targets, getting backtraces without the frame pointer is considerably more difficult (you can't just ask the OS to load the ELF executable and parse DWARF symbols). It is true that this setting can also be changed with the `-C force-frame-pointers` flag but that won't impact the compilation of the standard library, meaning that backtraces from, say, a panic handler would be useless.
2019-06-13 01:49:29 +02:00
Mazdak Farrokhzad
96b58301a3
Rollup merge of #61629 - petrochenkov:stdmac, r=alexcrichton
Hygienize macros in the standard library

Same as https://github.com/rust-lang/rust/pull/55597, but for all macros in the standard library.
Nested macro calls will now call what they are intended to call rather than whatever is in the closest scope at call site.
Technically this is a breaking change, so crater run would probably be useful.

---

One exception that is not hygienized is calls to `panic!(...)`.
Macros defined in libcore do not want to call `core::panic`.
What they really want to call is either `std::panic` or `core::panic` depending on `no_std` settings.
EDIT: After some thought, recursive calls to `panic` from `panic` itself probably do want to use `$crate` (UPDATE: done).

Calling `std::panic` from macros defined in std and "whatever `panic` is in scope" from macros defined in libcore is probably even worse than always calling "whatever `panic` is in scope", so I kept the existing code.

The only way to do the std/core switch correctly that I'm aware of is to define a built-in panic macro that would dispatch to `std::panic` or `core::panic` using compiler magic.
Then standard library macros could delegate to this built-in macro.
The macro could be named `panic` too, that would fix https://github.com/rust-lang/rust/issues/61567.
(This PR doesn't do that.)

---
cc https://github.com/rust-lang/rust/issues/56389
cc https://github.com/rust-lang/rust/issues/61567
Fixes https://github.com/rust-lang/rust/issues/61699
r? @alexcrichton
2019-06-13 01:49:27 +02:00
Mazdak Farrokhzad
a1ff450a68
Rollup merge of #61398 - kennytm:stabilize-copy-within, r=SimonSapin
Stabilize copy_within

Closes #54236.
2019-06-13 01:49:26 +02:00
Mazdak Farrokhzad
b35aeae5b4
Rollup merge of #60376 - lzutao:stabilize-option_xor, r=SimonSapin
Stabilize Option::xor

FCP done in https://github.com/rust-lang/rust/issues/50512#issuecomment-469527554 .

Closes #50512 .
2019-06-13 01:49:24 +02:00
Esteban Küber
ef6240a3e3 Handle index out of bound errors during const eval without panic 2019-06-12 14:58:53 -07:00
bors
2887008e0c Auto merge of #61426 - Zoxc:just-tcx-mir-building, r=eddyb
Use a single lifetime for MIR construction

Builds on https://github.com/rust-lang/rust/pull/57214

r? @eddyb
2019-06-12 19:24:40 +00:00
Lzu Tao
7c8644dc23 Add an alias for x86_64-sun-solaris target tuple 2019-06-12 19:04:43 +00:00
Vadim Petrochenkov
eb09daa762 Hygienize macros in the standard library 2019-06-12 20:27:29 +03:00
John Kåre Alsaker
d3e1181b1c Use a single lifetime for MIR construction 2019-06-12 19:27:00 +02:00