]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoAuto merge of #62435 - scottmcm:constrained-array-impls, r=centril
bors [Sun, 7 Jul 2019 18:37:08 +0000 (18:37 +0000)]
Auto merge of #62435 - scottmcm:constrained-array-impls, r=centril

Use const generics for array impls [part 1]

Part 1 of #61415, following the plan in https://github.com/rust-lang/rust/issues/61415#issuecomment-497922482

Found a way that works ðŸ™ƒ

5 years agoUse const generics for array impls, restricted to 0..=32
Scott McMurray [Sat, 6 Jul 2019 06:59:59 +0000 (23:59 -0700)]
Use const generics for array impls, restricted to 0..=32

- uses a never-stable core::array::LengthAtMost32 to bound the impls
- includes a custom error message to avoid mentioning LengthAtMost32 too often
- doesn't use macros for the slice implementations to avoid #62433

5 years agoAuto merge of #62467 - Centril:rollup-083tn7t, r=Centril
bors [Sun, 7 Jul 2019 15:00:47 +0000 (15:00 +0000)]
Auto merge of #62467 - Centril:rollup-083tn7t, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #61883 (`non_ascii_idents` lint (part of RFC 2457))
 - #62042 (Support stability and deprecation checking for all macros)
 - #62213 (rustdoc: set cfg(doctest) when collecting doctests)
 - #62286 (Check if the archive has already been added to avoid duplicates)

Failed merges:

r? @ghost

5 years agoRollup merge of #62286 - petrhosek:rustc-no-duplicate-archives, r=cramertj
Mazdak Farrokhzad [Sun, 7 Jul 2019 15:00:20 +0000 (17:00 +0200)]
Rollup merge of #62286 - petrhosek:rustc-no-duplicate-archives, r=cramertj

Check if the archive has already been added to avoid duplicates

This avoids adding archives multiple times, which results in duplicate
objects in the resulting rlib, leading to symbol collision and link
failures. This could happen when crate contains multiple link attributes
that all reference the same archive.

5 years agoRollup merge of #62213 - QuietMisdreavus:cfg-doctest, r=GuillaumeGomez
Mazdak Farrokhzad [Sun, 7 Jul 2019 15:00:18 +0000 (17:00 +0200)]
Rollup merge of #62213 - QuietMisdreavus:cfg-doctest, r=GuillaumeGomez

rustdoc: set cfg(doctest) when collecting doctests

Note: This PR builds on top of https://github.com/rust-lang/rust/pull/61199; only the last commit is specific to this PR.

As discussed in https://github.com/rust-lang/rust/pull/61199, we want the ability to isolate items to only when rustdoc is collecting doctests, but we can't use `cfg(test)` because of libcore's `#![cfg(not(test))]`. This PR proposes a new cfg flag, `cfg(doctest)`, specific to this situation, rather than reusing an existing flag. I've isolated it behind a feature gate so that we can contain the effects to nightly only. (A stable workaround that can be used in lieu of `#[cfg(doctest)]` is `#[cfg(rustdoc)] #[doc(hidden)]`, at least once https://github.com/rust-lang/rust/pull/61351 lands.)

Tracking issue: https://github.com/rust-lang/rust/issues/62210

5 years agoRollup merge of #62042 - petrochenkov:macstab, r=matthewjasper
Mazdak Farrokhzad [Sun, 7 Jul 2019 15:00:17 +0000 (17:00 +0200)]
Rollup merge of #62042 - petrochenkov:macstab, r=matthewjasper

Support stability and deprecation checking for all macros

RELNOTES: Deprecation attributes on macros now have effect.

Fixes https://github.com/rust-lang/rust/issues/34079
Fixes https://github.com/rust-lang/rust/issues/49912
Unblocks https://github.com/rust-lang/rust/pull/62086
Unblocks https://github.com/rust-lang/rust/pull/61000

5 years agoRollup merge of #61883 - zackmdavis:non_ascii_idents_lint, r=Manishearth
Mazdak Farrokhzad [Sun, 7 Jul 2019 15:00:15 +0000 (17:00 +0200)]
Rollup merge of #61883 - zackmdavis:non_ascii_idents_lint, r=Manishearth

`non_ascii_idents` lint (part of RFC 2457)

RFC 2457 [declares](https://github.com/rust-lang/rfcs/blob/121bbeff500c3274cea22c7e0ca176274d592646/text/2457-non-ascii-idents.md): "A `non_ascii_idents` lint is added to the compiler. This lint is allow by default."

(Part of #55467.)

r? @Manishearth

5 years agoAuto merge of #59800 - Zoxc:less-dylibs, r=alexcrichton
bors [Sun, 7 Jul 2019 11:32:58 +0000 (11:32 +0000)]
Auto merge of #59800 - Zoxc:less-dylibs, r=alexcrichton

rustc: Remove `dylib` crate type from most rustc crates

Revival of https://github.com/rust-lang/rust/pull/56987

cc @alexcrichton
r? @michaelwoerister

5 years agoAddress review comments + Fix rebase
Vadim Petrochenkov [Fri, 5 Jul 2019 22:58:52 +0000 (01:58 +0300)]
Address review comments + Fix rebase

5 years agosyntax: Pre-intern names of all built-in macros
Vadim Petrochenkov [Sun, 23 Jun 2019 11:59:42 +0000 (14:59 +0300)]
syntax: Pre-intern names of all built-in macros

They always end up interned anyway

5 years agosyntax: Migrate built-in macros to the regular stability checking
Vadim Petrochenkov [Sat, 22 Jun 2019 13:18:05 +0000 (16:18 +0300)]
syntax: Migrate built-in macros to the regular stability checking

5 years agoSupport deprecation checking for macros
Vadim Petrochenkov [Fri, 21 Jun 2019 23:44:45 +0000 (02:44 +0300)]
Support deprecation checking for macros

5 years agoresolve: Use standard stability diagnostics for macros
Vadim Petrochenkov [Fri, 21 Jun 2019 21:18:09 +0000 (00:18 +0300)]
resolve: Use standard stability diagnostics for macros

5 years agosyntax: Keep full `Stability` in `SyntaxExtension`
Vadim Petrochenkov [Fri, 21 Jun 2019 08:50:30 +0000 (11:50 +0300)]
syntax: Keep full `Stability` in `SyntaxExtension`

5 years agoresolve: Check stability for local macros as well
Vadim Petrochenkov [Thu, 20 Jun 2019 22:59:30 +0000 (01:59 +0300)]
resolve: Check stability for local macros as well

5 years agoCollect library features from non-exported macros
Vadim Petrochenkov [Thu, 20 Jun 2019 22:55:40 +0000 (01:55 +0300)]
Collect library features from non-exported macros

5 years agoresolve/expand: Move macro stability checking to an earlier point
Vadim Petrochenkov [Thu, 20 Jun 2019 19:00:47 +0000 (22:00 +0300)]
resolve/expand: Move macro stability checking to an earlier point

5 years agosyntax: Remove `NodeId` from `SyntaxExtension`
Vadim Petrochenkov [Thu, 20 Jun 2019 08:52:31 +0000 (11:52 +0300)]
syntax: Remove `NodeId` from `SyntaxExtension`

5 years agoAuto merge of #62434 - Manishearth:clippyup, r=Manishearth
bors [Sun, 7 Jul 2019 08:07:54 +0000 (08:07 +0000)]
Auto merge of #62434 - Manishearth:clippyup, r=Manishearth

Update clippy

r? @ghost

5 years agoAuto merge of #62458 - Centril:rollup-j6o2sqj, r=Centril
bors [Sun, 7 Jul 2019 04:42:58 +0000 (04:42 +0000)]
Auto merge of #62458 - Centril:rollup-j6o2sqj, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #61990 (First question mark in doctest)
 - #62379 (Add missing links in Option documentation)
 - #62438 (rustbuild: Cleanup global lint settings)
 - #62455 (name the trait in ambiguous-associated-items fully qualified suggestion)

Failed merges:

r? @ghost

5 years agoUpdate clippy
Manish Goregaokar [Sat, 6 Jul 2019 07:06:36 +0000 (00:06 -0700)]
Update clippy

5 years agoRollup merge of #62455 - zackmdavis:name_trait_for_ambiguous_assoc_item, r=petrochenkov
Mazdak Farrokhzad [Sun, 7 Jul 2019 03:11:56 +0000 (05:11 +0200)]
Rollup merge of #62455 - zackmdavis:name_trait_for_ambiguous_assoc_item, r=petrochenkov

name the trait in ambiguous-associated-items fully qualified suggestion

We have the trait at this point, so we can name it in the error message, rather than using "Trait" as a (potentially confusing) placeholder.

Thanks to Yuki "@JohnTitor" Okushi for pointing out where to look (in the same file) for a closely related issue for ambiguous associated types (as opposed to items; that was #59225, except that one won't be
quite as easy to resolve, because we actually don't have the trait `DefId` at that point).

r? @petrochenkov

5 years agoRollup merge of #62438 - petrochenkov:buildwarn, r=Mark-Simulacrum
Mazdak Farrokhzad [Sun, 7 Jul 2019 03:11:55 +0000 (05:11 +0200)]
Rollup merge of #62438 - petrochenkov:buildwarn, r=Mark-Simulacrum

rustbuild: Cleanup global lint settings

Lint settings do not depend on `if let Some(target) = target` in any way, so they are moved out of that clause.

Internal lints now respect `RUSTC_DENY_WARNINGS`.

Crate name treatment is cleaned up a bit.

cc https://github.com/rust-lang/rust/pull/61545 @flip1995
r? @Mark-Simulacrum

5 years agoRollup merge of #62379 - GuillaumeGomez:option-doc-links, r=QuietMisdreavus
Mazdak Farrokhzad [Sun, 7 Jul 2019 03:11:53 +0000 (05:11 +0200)]
Rollup merge of #62379 - GuillaumeGomez:option-doc-links, r=QuietMisdreavus

Add missing links in Option documentation

r? @rust-lang/docs

5 years agoRollup merge of #61990 - llogiq:questionmark-test, r=QuietMisdreavus
Mazdak Farrokhzad [Sun, 7 Jul 2019 03:11:51 +0000 (05:11 +0200)]
Rollup merge of #61990 - llogiq:questionmark-test, r=QuietMisdreavus

First question mark in doctest

We have had `?` for `Result`s in doctests for some time, but so far haven't used them in doctests. With this PR, I want to start the de-`unwrap`ping of doctests â€“ and the discussion on where to do so.

There is one downside, which is that the code can no longer be copied into a plain `main()` method, on the other hand, there should be a workable error if one does this.

5 years agoforce single-threaded text execution
QuietMisdreavus [Tue, 2 Jul 2019 18:30:54 +0000 (13:30 -0500)]
force single-threaded text execution

5 years agorustdoc: set cfg(doctest) when collecting doctests
QuietMisdreavus [Fri, 28 Jun 2019 15:31:27 +0000 (10:31 -0500)]
rustdoc: set cfg(doctest) when collecting doctests

5 years agoLink compiler plugins to rustc_driver
John KÃ¥re Alsaker [Sat, 6 Jul 2019 17:56:20 +0000 (19:56 +0200)]
Link compiler plugins to rustc_driver

5 years agoUpdate Cargo.lock
John KÃ¥re Alsaker [Fri, 5 Jul 2019 10:23:51 +0000 (12:23 +0200)]
Update Cargo.lock

5 years agoRemove some dummy dependencies
John KÃ¥re Alsaker [Tue, 9 Apr 2019 08:03:02 +0000 (10:03 +0200)]
Remove some dummy dependencies

5 years agorustc: Remove `dylib` crate type from most rustc crates
Alex Crichton [Wed, 19 Dec 2018 17:11:31 +0000 (18:11 +0100)]
rustc: Remove `dylib` crate type from most rustc crates

Now that procedural macros no longer link transitively to libsyntax,
this shouldn't be needed any more! This commit is an experiment in
removing all dynamic libraries from rustc except for librustc_driver
itself. Let's see how far we can get with that!

5 years agoAuto merge of #62281 - Disasm:riscv-pic, r=nagisa
bors [Sun, 7 Jul 2019 01:14:42 +0000 (01:14 +0000)]
Auto merge of #62281 - Disasm:riscv-pic, r=nagisa

Add support for pc-relative addressing on 64-bit RISC-V

These changes allow Rust to generate position-independent code on `riscv64` targets with code model `medium`.

Closes: https://github.com/rust-lang/rust/issues/59802
See also: https://github.com/rust-embedded/riscv-rt/issues/25, https://github.com/rust-embedded/wg/issues/218

5 years agoin which the `non_ascii_idents` lint appears (RFC 2457)
Zack M. Davis [Sun, 16 Jun 2019 03:22:07 +0000 (20:22 -0700)]
in which the `non_ascii_idents` lint appears (RFC 2457)

RFC 2457 declares: "A `non_ascii_idents` lint is added to the
compiler. This lint is allow by default."

5 years agoname the trait in ambiguous-associated-items fully qualified suggestion
Zack M. Davis [Sat, 6 Jul 2019 23:47:43 +0000 (16:47 -0700)]
name the trait in ambiguous-associated-items fully qualified suggestion

We have the trait at this point, so we can name it in the error
message, rather than using "Trait" as a (potentially confusing)
placeholder.

Thanks to Yuki "@JohnTitor" Okushi for pointing out where to look (in
the same file) for a closely related issue for ambiguous associated
types (as opposed to items; that was #59225, except that one won't be
quite as easy to resolve, because we actually don't have the trait
`DefId` at that point).

5 years agoAddress review comments
Vadim Petrochenkov [Sat, 6 Jul 2019 22:18:29 +0000 (01:18 +0300)]
Address review comments

5 years agoAuto merge of #62452 - Centril:rollup-5jww3h7, r=Centril
bors [Sat, 6 Jul 2019 21:47:45 +0000 (21:47 +0000)]
Auto merge of #62452 - Centril:rollup-5jww3h7, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #60081 (Refactor unicode.py script)
 - #61862 (Make the Weak::{into,as}_raw methods)
 - #62243 (Improve documentation for built-in macros)
 - #62422 (Remove some uses of mem::uninitialized)
 - #62436 (normalize use of backticks/lowercase in compiler messages for librustc_mir)

Failed merges:

r? @ghost

5 years agoRollup merge of #62436 - fakenine:normalize_use_of_backticks_compiler_messages_1...
Mazdak Farrokhzad [Sat, 6 Jul 2019 20:14:39 +0000 (22:14 +0200)]
Rollup merge of #62436 - fakenine:normalize_use_of_backticks_compiler_messages_1, r=Centril

normalize use of backticks/lowercase in compiler messages for librustc_mir

normalize use of backticks/lowercase in compiler messages for librustc_mir

https://github.com/rust-lang/rust/issues/60532

r? @alexreg

5 years agoRollup merge of #62422 - lzutao:remove-some-mem-uinit, r=alexcrichton
Mazdak Farrokhzad [Sat, 6 Jul 2019 20:14:38 +0000 (22:14 +0200)]
Rollup merge of #62422 - lzutao:remove-some-mem-uinit, r=alexcrichton

Remove some uses of mem::uninitialized

cc #62397
r? @RalfJung

5 years agoRollup merge of #62243 - petrochenkov:macrodoc, r=eddyb
Mazdak Farrokhzad [Sat, 6 Jul 2019 20:14:36 +0000 (22:14 +0200)]
Rollup merge of #62243 - petrochenkov:macrodoc, r=eddyb

Improve documentation for built-in macros

This is the `libcore` part of https://github.com/rust-lang/rust/pull/62086.
Right now the only effect is improved documentation.

The changes in the last few commits are required to make the `libcore` change compile successfully.

5 years agoRollup merge of #61862 - vorner:weak-into-raw-methods, r=sfackler
Mazdak Farrokhzad [Sat, 6 Jul 2019 20:14:35 +0000 (22:14 +0200)]
Rollup merge of #61862 - vorner:weak-into-raw-methods, r=sfackler

Make the Weak::{into,as}_raw methods

Because Weak doesn't Deref, so there's no reason for them to be only
associated methods.

As kindly pointed out here https://github.com/rust-lang/rust/pull/60766#issuecomment-501706422 by @chpio.

5 years agoRollup merge of #60081 - pawroman:cleanup_unicode_script, r=varkor
Mazdak Farrokhzad [Sat, 6 Jul 2019 20:14:33 +0000 (22:14 +0200)]
Rollup merge of #60081 - pawroman:cleanup_unicode_script, r=varkor

Refactor unicode.py script

Hi, I noticed that the `unicode.py` script used some deprecated escapes in regular expressions. E.g. `\d`, `\w`, `\.` will be illegal in the future without "raw strings". This is now fixed. I have also cleaned up the script quite a bit.

## Escape deprecation

OK (note the `r`):
`re.compile(r"\d")`

Deprecated (from Python 3.6 onwards, see [here][link1] and [here][link2]):
`re.compile("\d")`.

[link1]: https://docs.python.org/3.6/whatsnew/3.6.html#deprecated-python-behavior
[link2]: https://bugs.python.org/issue27364

This was evident running the script using Python 3.7 like so:

```
$ python3 -Wall unicode.py
unicode.py:227: DeprecationWarning: invalid escape sequence \w
  re1 = re.compile("^ *([0-9A-F]+) *; *(\w+)")
unicode.py:228: DeprecationWarning: invalid escape sequence \.
  re2 = re.compile("^ *([0-9A-F]+)\.\.([0-9A-F]+) *; *(\w+)")
unicode.py:453: DeprecationWarning: invalid escape sequence \d
  pattern = "for Version (\d+)\.(\d+)\.(\d+) of the Unicode"
```

The documentation states that
> A backslash-character pair that is not a valid escape sequence now generates a DeprecationWarning. Although this will eventually become a SyntaxError, that will not be for several Python releases.

## Testing

To test my changes, I had to add support for choosing the Unicode version to use. The script will default to latest release (which is 12.0.0 at the moment, repo has 11.0.0 checked in).

The script generates the exact same output for version 11.0.0 with Python 2.7 and 3.7 and no longer generates any deprecation warnings:

```
$ python3 -Wall unicode.py -v 11.0.0
Using Unicode version: 11.0.0
Regenerated tables.rs.
$ git diff tables.rs
$ python2 -Wall unicode.py -v 11.0.0
Using Unicode version: 11.0.0
Regenerated tables.rs.
$ git diff tables.rs
$ python2 --version
Python 2.7.16
$ python3 --version
Python 3.7.3
```

## Extra functionality

Furthermore, the script will check and download the latest Unicode version by default (without the `-v` argument). The `--help` is below:

```
$ ./unicode.py --help
usage: unicode.py [-h] [-v VERSION]

Regenerate Unicode tables (tables.rs).

optional arguments:
  -h, --help            show this help message and exit
  -v VERSION, --version VERSION
                        Unicode version to use (if not specified, defaults to
                        latest available final release).
```

## Cleanups

I have cleaned up the code quite a bit, with Python best practices and code style in mind. I'm happy to provide more details and rationale for all my changes if the reviewers so desire.

One externally visible change is that the Unicode data will now be downloaded into `src/libcore/unicode/downloaded` directory suffixed by Unicode version:

```
$ pwd
.../rust/src/libcore/unicode
$ exa -T downloaded/
downloaded
├── 11.0.0
│  â”œâ”€â”€ DerivedCoreProperties.txt
│  â”œâ”€â”€ DerivedNormalizationProps.txt
│  â”œâ”€â”€ PropList.txt
│  â”œâ”€â”€ ReadMe.txt
│  â”œâ”€â”€ Scripts.txt
│  â”œâ”€â”€ SpecialCasing.txt
│  â””── UnicodeData.txt
└── 12.0.0
   â”œâ”€â”€ DerivedCoreProperties.txt
   â”œâ”€â”€ DerivedNormalizationProps.txt
   â”œâ”€â”€ PropList.txt
   â”œâ”€â”€ ReadMe.txt
   â”œâ”€â”€ Scripts.txt
   â”œâ”€â”€ SpecialCasing.txt
   â””── UnicodeData.txt
```

5 years agonormalize use of backticks/lowercase in compiler messages for librustc_mir
Samy Kacimi [Sat, 6 Jul 2019 07:48:03 +0000 (09:48 +0200)]
normalize use of backticks/lowercase in compiler messages for librustc_mir

https://github.com/rust-lang/rust/issues/60532

r? @alexreg

5 years agoAuto merge of #59772 - andrehjr:add-rustc-guide-to-toolstate, r=mark-i-m
bors [Sat, 6 Jul 2019 18:19:01 +0000 (18:19 +0000)]
Auto merge of #59772 - andrehjr:add-rustc-guide-to-toolstate, r=mark-i-m

Add rustc guide to toolstate

Closes #59597

5 years agoresolve: Reserve cfg/cfg_attr/derive only in attribute sub-namespace
Vadim Petrochenkov [Sat, 29 Jun 2019 22:24:34 +0000 (01:24 +0300)]
resolve: Reserve cfg/cfg_attr/derive only in attribute sub-namespace

5 years agoDon't return an error from linkcheck when it's not supported'
André Luis Leal Cardoso Junior [Fri, 5 Jul 2019 17:36:24 +0000 (14:36 -0300)]
Don't return an error from linkcheck when it's not supported'

5 years agoIgnore unused variable for non-linux builds
André Luis Leal Cardoso Junior [Fri, 5 Jul 2019 14:57:33 +0000 (11:57 -0300)]
Ignore unused variable for non-linux builds

5 years agofix macos build
Mark Mansi [Fri, 5 Jul 2019 01:20:14 +0000 (20:20 -0500)]
fix macos build

5 years agocfg: linkcheck only on x86-64 linux
Mark Mansi [Tue, 25 Jun 2019 00:07:32 +0000 (19:07 -0500)]
cfg: linkcheck only on x86-64 linux

5 years agoadd missing libssl-dev dependency to docker images on travis
André Luis Leal Cardoso Junior [Sat, 18 May 2019 20:33:52 +0000 (17:33 -0300)]
add missing libssl-dev dependency to docker images on travis

5 years agoAdd 'Apache-2.0 OR MIT' license variation to tidy/tools check
André Luis Leal Cardoso Junior [Sat, 4 May 2019 19:20:24 +0000 (16:20 -0300)]
Add 'Apache-2.0 OR MIT' license variation to tidy/tools check

5 years agoMove installing of deps to the docker container, instead of installing on the host...
André Luis Leal Cardoso Junior [Mon, 8 Apr 2019 23:59:06 +0000 (20:59 -0300)]
Move installing of deps to the docker container, instead of installing on the host machine on travis

5 years agoAdd linkcheck command to rustbook tool
André Luis Leal Cardoso Junior [Sun, 7 Apr 2019 12:59:33 +0000 (09:59 -0300)]
Add linkcheck command to rustbook tool

5 years agoTrack rustc-guide on toolstate
André Luis Leal Cardoso Junior [Thu, 4 Apr 2019 16:06:05 +0000 (13:06 -0300)]
Track rustc-guide on toolstate

5 years agoadd ./x.py test src/doc/rustc-guide
André Luis Leal Cardoso Junior [Thu, 4 Apr 2019 16:05:22 +0000 (13:05 -0300)]
add ./x.py test src/doc/rustc-guide

5 years agoprivacy: Only opaque macros leak private things
Vadim Petrochenkov [Sat, 29 Jun 2019 22:12:04 +0000 (01:12 +0300)]
privacy: Only opaque macros leak private things

5 years agoFix tidy issues
Vadim Petrochenkov [Sat, 29 Jun 2019 22:09:59 +0000 (01:09 +0300)]
Fix tidy issues

5 years agoImprove documentation for built-in macros
Vadim Petrochenkov [Sat, 29 Jun 2019 14:51:20 +0000 (17:51 +0300)]
Improve documentation for built-in macros

5 years ago`#[rustc_transparent_macro]` -> `#[rustc_macro_transparency = ...]`
Vadim Petrochenkov [Sun, 23 Jun 2019 13:37:28 +0000 (16:37 +0300)]
`#[rustc_transparent_macro]` -> `#[rustc_macro_transparency = ...]`

5 years ago`#[rustc_doc_only_macro]` -> `#[rustc_builtin_macro]`
Vadim Petrochenkov [Sat, 29 Jun 2019 14:30:51 +0000 (17:30 +0300)]
`#[rustc_doc_only_macro]` -> `#[rustc_builtin_macro]`

5 years agorustbuild: Cleanup global lint settings
Vadim Petrochenkov [Sat, 6 Jul 2019 00:15:04 +0000 (03:15 +0300)]
rustbuild: Cleanup global lint settings

5 years agoAuto merge of #61988 - Centril:there-is-only-loop, r=matthewjasper
bors [Sat, 6 Jul 2019 06:15:44 +0000 (06:15 +0000)]
Auto merge of #61988 - Centril:there-is-only-loop, r=matthewjasper

[let_chains, 3/6] And then there was only Loop

Here we remove `hir::ExprKind::While`.
Instead, we desugar: `'label: while $cond $body` into:

```rust
'label: loop {
    match DropTemps($cond) {
        true => $body,
        _ => break,
    }
}
```

Per https://github.com/rust-lang/rust/issues/53667#issuecomment-471583239.
This is a follow up to https://github.com/rust-lang/rust/pull/59288 which did the same for `if` expressions.

r? @matthewjasper

5 years ago--bless --compare-mode=nll
Mazdak Farrokhzad [Fri, 5 Jul 2019 08:34:30 +0000 (10:34 +0200)]
--bless --compare-mode=nll

5 years agoBless mir-opt/while-storage.rs.
Mazdak Farrokhzad [Wed, 26 Jun 2019 15:44:26 +0000 (17:44 +0200)]
Bless mir-opt/while-storage.rs.

5 years agoCleanup liveness comment.
Mazdak Farrokhzad [Wed, 26 Jun 2019 12:51:01 +0000 (14:51 +0200)]
Cleanup liveness comment.

5 years agowhile_{let_}loops/change_{break,continue}: typeck_tables_of clean.
Mazdak Farrokhzad [Mon, 24 Jun 2019 02:27:20 +0000 (04:27 +0200)]
while_{let_}loops/change_{break,continue}: typeck_tables_of clean.

5 years agoLowering: Fuse ExprKind::While logic + Cleanup.
Mazdak Farrokhzad [Sun, 23 Jun 2019 16:58:36 +0000 (18:58 +0200)]
Lowering: Fuse ExprKind::While logic + Cleanup.

5 years agoMake WhileTrue into an EarlyLintPass lint.
Mazdak Farrokhzad [Fri, 21 Jun 2019 23:30:24 +0000 (01:30 +0200)]
Make WhileTrue into an EarlyLintPass lint.

5 years agoMake sure while-exprs require 'cond: bool' exactly.
Mazdak Farrokhzad [Thu, 20 Jun 2019 12:13:28 +0000 (14:13 +0200)]
Make sure while-exprs require 'cond: bool' exactly.

5 years agoAdjust incremental test while_loops.rs
Mazdak Farrokhzad [Thu, 20 Jun 2019 10:29:22 +0000 (12:29 +0200)]
Adjust incremental test while_loops.rs

5 years agowhile desugars to loop so 'a: while break 'a {} in ctfe doesn't work yet.
Mazdak Farrokhzad [Thu, 20 Jun 2019 08:35:27 +0000 (10:35 +0200)]
while desugars to loop so 'a: while break 'a {} in ctfe doesn't work yet.

5 years agoEnforce 'cond: bool' in while-expr + improve reachability diags.
Mazdak Farrokhzad [Thu, 20 Jun 2019 08:29:42 +0000 (10:29 +0200)]
Enforce 'cond: bool' in while-expr + improve reachability diags.

5 years agomin_const_fn: change error message due to changed desugaring.
Mazdak Farrokhzad [Thu, 20 Jun 2019 05:16:26 +0000 (07:16 +0200)]
min_const_fn: change error message due to changed desugaring.

5 years agoRemove ExprKind::While from HIR.
Mazdak Farrokhzad [Wed, 19 Jun 2019 15:21:28 +0000 (17:21 +0200)]
Remove ExprKind::While from HIR.

5 years agoRemove use of mem::uninitialized in code_gen crate
Lzu Tao [Fri, 5 Jul 2019 19:26:25 +0000 (19:26 +0000)]
Remove use of mem::uninitialized in code_gen crate

5 years agoRemove use of mem::uninitialized in libterm crate
Lzu Tao [Fri, 5 Jul 2019 18:59:56 +0000 (18:59 +0000)]
Remove use of mem::uninitialized in libterm crate

5 years agoAuto merge of #62428 - Centril:rollup-2udow5e, r=Centril
bors [Sat, 6 Jul 2019 02:58:36 +0000 (02:58 +0000)]
Auto merge of #62428 - Centril:rollup-2udow5e, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #62151 (Update linked OpenSSL version)
 - #62245 (Miri engine: support extra function (pointer) values)
 - #62257 (forward read_c_str method from Memory to Alloc)
 - #62264 (Fix perf regression from Miri Machine trait changes)
 - #62296 (request at least ptr-size alignment from posix_memalign)
 - #62329 (Remove support for 1-token lookahead from the lexer)
 - #62377 (Add test for ICE #62375)

Failed merges:

r? @ghost

5 years agoRollup merge of #62377 - wesleywiser:fix_62375, r=alexcrichton
Mazdak Farrokhzad [Sat, 6 Jul 2019 00:38:02 +0000 (02:38 +0200)]
Rollup merge of #62377 - wesleywiser:fix_62375, r=alexcrichton

Add test for ICE #62375

Fixes #62375

5 years agoRollup merge of #62329 - matklad:no-peeking, r=petrochenkov
Mazdak Farrokhzad [Sat, 6 Jul 2019 00:38:01 +0000 (02:38 +0200)]
Rollup merge of #62329 - matklad:no-peeking, r=petrochenkov

Remove support for 1-token lookahead from the lexer

`StringReader` maintained `peek_token` and `peek_span_src_raw` for look ahead.

`peek_token` was used only by rustdoc syntax coloring. After moving peeking logic into highlighter, I was able to remove `peek_token` from the lexer. I tried to use `iter::Peekable`, but that wasn't as pretty as I hoped, due to buffered fatal errors. So I went with hand-rolled peeking.

After that I've noticed that the only peeking behavior left was for raw tokens to test tt jointness. I've rewritten it in terms of trivia tokens, and not just spans.

After that it became possible to simplify the awkward constructor of the lexer, which could return `Err` if the first peeked token contained error.

5 years agoRollup merge of #62296 - RalfJung:memalign, r=alexcrichton
Mazdak Farrokhzad [Sat, 6 Jul 2019 00:37:59 +0000 (02:37 +0200)]
Rollup merge of #62296 - RalfJung:memalign, r=alexcrichton

request at least ptr-size alignment from posix_memalign

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

5 years agoRollup merge of #62264 - RalfJung:inline-forcing, r=zackmdavis
Mazdak Farrokhzad [Sat, 6 Jul 2019 00:37:58 +0000 (02:37 +0200)]
Rollup merge of #62264 - RalfJung:inline-forcing, r=zackmdavis

Fix perf regression from Miri Machine trait changes

Maybe this fixes the perf regression that https://github.com/rust-lang/rust/pull/62003 seemingly introduced?

Cc @nnethercote

5 years agoRollup merge of #62257 - RalfJung:miri-c-str, r=estebank
Mazdak Farrokhzad [Sat, 6 Jul 2019 00:37:56 +0000 (02:37 +0200)]
Rollup merge of #62257 - RalfJung:miri-c-str, r=estebank

forward read_c_str method from Memory to Alloc

This is more convenient to call when one starts with a `Scalar` (which is the common case).

`read_c_str` is only used in Miri.

5 years agoRollup merge of #62245 - RalfJung:miri-extra-fn, r=eddyb,zackmdavis
Mazdak Farrokhzad [Sat, 6 Jul 2019 00:37:54 +0000 (02:37 +0200)]
Rollup merge of #62245 - RalfJung:miri-extra-fn, r=eddyb,zackmdavis

Miri engine: support extra function (pointer) values

We want to add basic support for `dlsym` in Miri (needed to run the latest version of `getrandom`). For that to work, `dlsym` needs to return *something* that can be stored in a function pointer and later called.

So we add a new `ExtraFnVal` type to the `Machine` trait, and enable Miri's memory to associate allocation IDs with such values, so that `create_fn_alloc` and `get_fn` can work on *both* `Instance` (this is used for "normal" function pointers) and `ExtraFnVal`.

Cc @oli-obk

5 years agoRollup merge of #62151 - alexcrichton:update-openssl, r=Mark-Simulacrum
Mazdak Farrokhzad [Sat, 6 Jul 2019 00:37:53 +0000 (02:37 +0200)]
Rollup merge of #62151 - alexcrichton:update-openssl, r=Mark-Simulacrum

Update linked OpenSSL version

This bumps our linked OpenSSL version from 1.1.1a to 1.1.1c, picking up
some various bug fixes and minor security issue fixes.

5 years agoCorrect definition of CONSOLE_SCREEN_BUFFER_INFO
Lzu Tao [Fri, 5 Jul 2019 18:47:55 +0000 (18:47 +0000)]
Correct definition of CONSOLE_SCREEN_BUFFER_INFO

5 years agoAuto merge of #62419 - Centril:rollup-82umycq, r=Centril
bors [Fri, 5 Jul 2019 18:27:52 +0000 (18:27 +0000)]
Auto merge of #62419 - Centril:rollup-82umycq, r=Centril

Rollup of 13 pull requests

Successful merges:

 - #61545 (Implement another internal lints)
 - #62110 (Improve -Ztime-passes)
 - #62133 (Feature gate `rustc` attributes harder)
 - #62158 (Add MemoryExtra in InterpretCx constructor params)
 - #62168 (The (almost) culmination of HirIdification)
 - #62193 (Create async version of the dynamic-drop test)
 - #62369 (Remove `compile-pass` from compiletest)
 - #62380 (rustc_target: avoid negative register counts in the SysV x86_64 ABI.)
 - #62381 (Fix a typo in Write::write_vectored docs)
 - #62390 (Update README.md)
 - #62396 (remove Scalar::is_null_ptr)
 - #62406 (Lint on invalid values passed to x.py --warnings)
 - #62414 (Remove last use of mem::uninitialized in SGX)

Failed merges:

r? @ghost

5 years agoRollup merge of #62414 - jethrogb:jb/sgx-uninit, r=Mark-Simulacrum
Mazdak Farrokhzad [Fri, 5 Jul 2019 18:27:08 +0000 (20:27 +0200)]
Rollup merge of #62414 - jethrogb:jb/sgx-uninit, r=Mark-Simulacrum

Remove last use of mem::uninitialized in SGX

See #62397

5 years agoRollup merge of #62406 - Mark-Simulacrum:warnings-lint, r=RalfJung
Mazdak Farrokhzad [Fri, 5 Jul 2019 18:27:06 +0000 (20:27 +0200)]
Rollup merge of #62406 - Mark-Simulacrum:warnings-lint, r=RalfJung

Lint on invalid values passed to x.py --warnings

This also introduces support for `--warnings allow` and fixes --warnings
being overridden by the configuration file, config.toml.

Fixes #62402

r? @RalfJung

5 years agoRollup merge of #62396 - RalfJung:miri-no-null, r=alexcrichton
Mazdak Farrokhzad [Fri, 5 Jul 2019 18:27:05 +0000 (20:27 +0200)]
Rollup merge of #62396 - RalfJung:miri-no-null, r=alexcrichton

remove Scalar::is_null_ptr

Comparing pointers should be done more carefully than that. With https://github.com/rust-lang/miri/pull/825, Miri does not need it any more and it is otherwise unused.

5 years agoRollup merge of #62390 - markebrooks:encourage, r=Centril
Mazdak Farrokhzad [Fri, 5 Jul 2019 18:27:04 +0000 (20:27 +0200)]
Rollup merge of #62390 - markebrooks:encourage, r=Centril

Update README.md

Let's not discourage contributions.

5 years agoRollup merge of #62381 - pawroman:fix_typo_in_write_vectored, r=Centril
Mazdak Farrokhzad [Fri, 5 Jul 2019 18:27:02 +0000 (20:27 +0200)]
Rollup merge of #62381 - pawroman:fix_typo_in_write_vectored, r=Centril

Fix a typo in Write::write_vectored docs

Fixed what seems like a typo. "Copy to from" is extremely confusing.

5 years agoRollup merge of #62380 - eddyb:x64-sysv-regs, r=nagisa
Mazdak Farrokhzad [Fri, 5 Jul 2019 18:27:01 +0000 (20:27 +0200)]
Rollup merge of #62380 - eddyb:x64-sysv-regs, r=nagisa

rustc_target: avoid negative register counts in the SysV x86_64 ABI.

Because `needed_{int,sse}` and `{int,sse}_regs` were only used with integer literals, they were inferred to `i32` and `{int,sse}_regs` could therefore be negative.
There was a check which prevented that, but *only* for aggregate arguments, not scalars.

Fixes #62350.

r? @nagisa or @rkruppe

5 years agoRollup merge of #62369 - JohnTitor:remove-compile-pass, r=petrochenkov
Mazdak Farrokhzad [Fri, 5 Jul 2019 18:26:59 +0000 (20:26 +0200)]
Rollup merge of #62369 - JohnTitor:remove-compile-pass, r=petrochenkov

Remove `compile-pass` from compiletest

This is a part of #62277.
Removes `compile-pass` from compiletest (and modify some tests' annotations).

r? @Centril

5 years agoRollup merge of #62193 - matthewjasper:dynamic-drop-async, r=Centril
Mazdak Farrokhzad [Fri, 5 Jul 2019 18:26:58 +0000 (20:26 +0200)]
Rollup merge of #62193 - matthewjasper:dynamic-drop-async, r=Centril

Create async version of the dynamic-drop test

Some of the tests in dynamic-drop have been cut:
* The tests that are just simpler versions of other tests - these tests are already fairly slow due to all of the unwinding and async functions have more control flow paths than normal functions.
* The union test - it's for an unstable feature that has an RFC to remove it.
* The generator test - there aren't async generators yet.
* The tests that show values being leaked - these can be added once the issue is fixed.

r? @Centril
cc  #62121 @cramertj

5 years agoRollup merge of #62168 - ljedrz:the_culmination_of_hiridification, r=Zoxc
Mazdak Farrokhzad [Fri, 5 Jul 2019 18:26:56 +0000 (20:26 +0200)]
Rollup merge of #62168 - ljedrz:the_culmination_of_hiridification, r=Zoxc

The (almost) culmination of HirIdification

It's finally over.

This PR removes old `FIXME`s and renames some functions so that the `HirId` variant has the shorter name.
All that remains (and rightfully so) is stuff in `resolve`, `save_analysis` and (as far as I can tell) in a few places where we can't replace `NodeId` with `HirId`.

5 years agoRollup merge of #62158 - christianpoveda:ecx-memory-extra, r=RalfJung
Mazdak Farrokhzad [Fri, 5 Jul 2019 18:26:55 +0000 (20:26 +0200)]
Rollup merge of #62158 - christianpoveda:ecx-memory-extra, r=RalfJung

Add MemoryExtra in InterpretCx constructor params

This is to avoid modifying `MemoryExtra` inside `InterpretCx` after initialization. Related miri PR: https://github.com/rust-lang/miri/pull/792

r? @RalfJung

5 years agoRollup merge of #62133 - petrochenkov:norustc, r=eddyb
Mazdak Farrokhzad [Fri, 5 Jul 2019 18:26:54 +0000 (20:26 +0200)]
Rollup merge of #62133 - petrochenkov:norustc, r=eddyb

Feature gate `rustc` attributes harder

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

5 years agoRollup merge of #62110 - nnethercote:improve-Ztime-passes, r=Zoxc
Mazdak Farrokhzad [Fri, 5 Jul 2019 18:26:52 +0000 (20:26 +0200)]
Rollup merge of #62110 - nnethercote:improve-Ztime-passes, r=Zoxc

Improve -Ztime-passes

Two improvements that make `-Ztime-passes` more useful.

r? @Zoxc

5 years agoRollup merge of #61545 - flip1995:internal_lints, r=oli-obk
Mazdak Farrokhzad [Fri, 5 Jul 2019 18:26:51 +0000 (20:26 +0200)]
Rollup merge of #61545 - flip1995:internal_lints, r=oli-obk

Implement another internal lints

cc #49509

This adds ~~two~~ one internal lint~~s~~:
1. LINT_PASS_IMPL_WITHOUT_MACRO: Make sure, that the `{declare,impl}_lint_pass` macro is used to implement lint passes. cc #59669
2. ~~USAGE_OF_TYCTXT_AND_SPAN_ARGS: item 2 on the list in #49509~~

~~With 2. I wasn't sure, if this lint should be applied everywhere. That means a careful review of 0955835 would be great. Also 73fb9b4 allows this lint on some functions. Should I also apply this lint there?~~

TODO (not directly relevant for review):
- [ ] https://github.com/rust-lang/rust/pull/59316#discussion_r280186517 (not sure yet, if this works or how to query for `rustc_private`, since it's not in [`Features`](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/feature_gate/struct.Features.html) :thinking: cc @eddyb)
- [x] https://github.com/rust-lang/rust/pull/61735#discussion_r292389870
- [x] Check explicitly for the `{declare,impl}_lint_pass!` macros

r? @oli-obk

5 years agoFix test annotation
Yuki Okushi [Fri, 5 Jul 2019 17:06:39 +0000 (02:06 +0900)]
Fix test annotation

5 years agoUpdate rustc-guide
Yuki Okushi [Thu, 4 Jul 2019 11:56:13 +0000 (20:56 +0900)]
Update rustc-guide