]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #60951 - saleemjaffer:mir_better_error_enum, r=oli-obk
Mark Rousskov [Tue, 23 Jul 2019 16:51:02 +0000 (12:51 -0400)]
Rollup merge of #60951 - saleemjaffer:mir_better_error_enum, r=oli-obk

more specific errors in src/librustc/mir/interpret/error.rs

Implements [this](https://github.com/rust-rfcs/const-eval/issues/4)

4 years agorenames EvalErrorPanic to PanicMessage
Saleem Jaffer [Tue, 23 Jul 2019 11:12:46 +0000 (16:42 +0530)]
renames EvalErrorPanic to PanicMessage

4 years agoAuto merge of #61779 - Zoxc:sharded, r=oli-obk
bors [Tue, 23 Jul 2019 09:58:48 +0000 (09:58 +0000)]
Auto merge of #61779 - Zoxc:sharded, r=oli-obk

Use sharded maps for interning

Cuts down runtime from 5.5s to 3.8s for non-incremental `syntex_syntax` check builds with 16 threads / 8 cores.

r? @eddyb

4 years agomoving some variants from InterpError to EvalErrorPanic
Saleem Jaffer [Sat, 20 Jul 2019 13:27:46 +0000 (18:57 +0530)]
moving some variants from InterpError to EvalErrorPanic

4 years agoAuto merge of #62873 - Centril:rollup-ncnuelj, r=Centril
bors [Mon, 22 Jul 2019 17:08:25 +0000 (17:08 +0000)]
Auto merge of #62873 - Centril:rollup-ncnuelj, r=Centril

Rollup of 14 pull requests

Successful merges:

 - #62709 (Test that maplike FromIter satisfies uniqueness)
 - #62713 (Stabilize <*mut _>::cast and <*const _>::cast)
 - #62746 ( do not use assume_init in std::io)
 - #62787 (Fix typo in src/libstd/net/udp.rs doc comment)
 - #62788 (normalize use of backticks in compiler messages for libcore/ptr)
 - #62799 (use const array repeat expressions for uninit_array)
 - #62810 (normalize use of backticks in compiler messages for librustc_lint)
 - #62812 (normalize use of backticks in compiler messages for librustc_metadata)
 - #62832 (normalize use of backticks in compiler messages for librustc_incremental)
 - #62845 (read: fix doc comment)
 - #62853 (normalize use of backticks in compiler messages for librustc/hir)
 - #62854 (Fix typo in Unicode character name)
 - #62858 (Change wrong variable name.)
 - #62870 (fix lexing of comments with many \r)

Failed merges:

r? @ghost

4 years agoRollup merge of #62870 - matklad:issue-62863, r=petrochenkov
Mazdak Farrokhzad [Mon, 22 Jul 2019 13:32:29 +0000 (15:32 +0200)]
Rollup merge of #62870 - matklad:issue-62863, r=petrochenkov

fix lexing of comments with many \r

closes #62863

4 years agoRollup merge of #62858 - Rosto75:master, r=jonas-schievink
Mazdak Farrokhzad [Mon, 22 Jul 2019 13:32:27 +0000 (15:32 +0200)]
Rollup merge of #62858 - Rosto75:master, r=jonas-schievink

Change wrong variable name.

r? @steveklabnik

4 years agoRollup merge of #62854 - andrewda:fix-unicode-name, r=petrochenkov
Mazdak Farrokhzad [Mon, 22 Jul 2019 13:32:26 +0000 (15:32 +0200)]
Rollup merge of #62854 - andrewda:fix-unicode-name, r=petrochenkov

Fix typo in Unicode character name

There's a small typo in the Unicode character definitions: "Latin Epigraphic Letter Dideways" should be "Latin Epigraphic Letter Sideways I" (see [here](https://www.compart.com/en/unicode/U+A7F7)).

4 years agoRollup merge of #62853 - fakenine:normalize_use_of_backticks_compiler_messages_p13...
Mazdak Farrokhzad [Mon, 22 Jul 2019 13:32:24 +0000 (15:32 +0200)]
Rollup merge of #62853 - fakenine:normalize_use_of_backticks_compiler_messages_p13, r=Centril

normalize use of backticks in compiler messages for librustc/hir

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

4 years agoRollup merge of #62845 - RalfJung:read, r=rkruppe
Mazdak Farrokhzad [Mon, 22 Jul 2019 13:32:23 +0000 (15:32 +0200)]
Rollup merge of #62845 - RalfJung:read, r=rkruppe

read: fix doc comment

No idea how that happened...

4 years agoRollup merge of #62832 - fakenine:normalize_use_of_backticks_compiler_messages_p12...
Mazdak Farrokhzad [Mon, 22 Jul 2019 13:32:22 +0000 (15:32 +0200)]
Rollup merge of #62832 - fakenine:normalize_use_of_backticks_compiler_messages_p12, r=Centril

normalize use of backticks in compiler messages for librustc_incremental

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

4 years agoRollup merge of #62812 - fakenine:normalize_use_of_backticks_compiler_messages_p11...
Mazdak Farrokhzad [Mon, 22 Jul 2019 13:32:20 +0000 (15:32 +0200)]
Rollup merge of #62812 - fakenine:normalize_use_of_backticks_compiler_messages_p11, r=GuillaumeGomez

normalize use of backticks in compiler messages for librustc_metadata

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

4 years agoRollup merge of #62810 - fakenine:normalize_use_of_backticks_compiler_messages_p10...
Mazdak Farrokhzad [Mon, 22 Jul 2019 13:32:18 +0000 (15:32 +0200)]
Rollup merge of #62810 - fakenine:normalize_use_of_backticks_compiler_messages_p10, r=Centril

normalize use of backticks in compiler messages for librustc_lint

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

4 years agoRollup merge of #62799 - RalfJung:uninit-array, r=Centril
Mazdak Farrokhzad [Mon, 22 Jul 2019 13:32:17 +0000 (15:32 +0200)]
Rollup merge of #62799 - RalfJung:uninit-array, r=Centril

use const array repeat expressions for uninit_array

With a first implementation of https://github.com/rust-lang/rust/issues/49147 having landed, we can make this macro nicer and phase it out with the next bootstrap bump.

However, to make this work, we have to mark `MaybeUninit::uninit()` as promotable. I do feel uneasy about promoting stuff involving uninitialized memory, but OTOH no *operation* on `MaybeUninit` is promotable, so maybe this is okay?

r? @oli-obk @eddyb

4 years agoRollup merge of #62788 - fakenine:normalize_use_of_backticks_compiler_messages_p9...
Mazdak Farrokhzad [Mon, 22 Jul 2019 13:32:15 +0000 (15:32 +0200)]
Rollup merge of #62788 - fakenine:normalize_use_of_backticks_compiler_messages_p9, r=Centril

normalize use of backticks in compiler messages for libcore/ptr

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

4 years agoRollup merge of #62787 - Indy2222:master, r=Mark-Simulacrum
Mazdak Farrokhzad [Mon, 22 Jul 2019 13:32:14 +0000 (15:32 +0200)]
Rollup merge of #62787 - Indy2222:master, r=Mark-Simulacrum

Fix typo in src/libstd/net/udp.rs doc comment

Affect is usually used as a verb, effect as a verb.

4 years agoRollup merge of #62746 - RalfJung:deprecated, r=KodrAus
Mazdak Farrokhzad [Mon, 22 Jul 2019 13:32:12 +0000 (15:32 +0200)]
Rollup merge of #62746 - RalfJung:deprecated, r=KodrAus

 do not use assume_init in std::io

Cc https://github.com/rust-lang/rust/issues/62397

4 years agoRollup merge of #62713 - SimonSapin:cast, r=Centril
Mazdak Farrokhzad [Mon, 22 Jul 2019 13:32:11 +0000 (15:32 +0200)]
Rollup merge of #62713 - SimonSapin:cast, r=Centril

Stabilize <*mut _>::cast and <*const _>::cast

Fixes #60602.

FCP: https://github.com/rust-lang/rust/issues/60602#issuecomment-511146402

4 years agoRollup merge of #62709 - nhynes:test-maplike-fromiter, r=cuviper
Mazdak Farrokhzad [Mon, 22 Jul 2019 13:32:09 +0000 (15:32 +0200)]
Rollup merge of #62709 - nhynes:test-maplike-fromiter, r=cuviper

Test that maplike FromIter satisfies uniqueness

This PR adds a simple assertion to the `HashMap` and `HashSet` tests to ensure that uniqueness is satisfied when `FromIter`ing. This is useful for people who want to test their custom type against the Map/Set interfaces since they'll copy the tests wholesale but possibly miss this bug (where _they_ = _me_).

4 years agofix lexing of comments with many \r
Aleksey Kladov [Mon, 22 Jul 2019 09:59:18 +0000 (12:59 +0300)]
fix lexing of comments with many \r

closes #62863

4 years agoAuto merge of #62797 - petrochenkov:run-pass-hole, r=Mark-Simulacrum
bors [Mon, 22 Jul 2019 08:55:29 +0000 (08:55 +0000)]
Auto merge of #62797 - petrochenkov:run-pass-hole, r=Mark-Simulacrum

tests: Require run-pass tests without annotations to run successfully again

Fixes https://github.com/rust-lang/rust/issues/62775 (regression from https://github.com/rust-lang/rust/pull/61755)

4 years agoFix or ignore regressed tests
Vadim Petrochenkov [Fri, 19 Jul 2019 11:03:22 +0000 (14:03 +0300)]
Fix or ignore regressed tests

4 years agotests: Require run-pass tests without annotations to run successfully again
Vadim Petrochenkov [Fri, 19 Jul 2019 10:42:04 +0000 (13:42 +0300)]
tests: Require run-pass tests without annotations to run successfully again

4 years agoChange wrong variable name.
Tomasz Różański [Sun, 21 Jul 2019 19:07:38 +0000 (21:07 +0200)]
Change wrong variable name.

4 years agoAuto merge of #62856 - pietroalbini:fix-awscli, r=Mark-Simulacrum
bors [Sun, 21 Jul 2019 18:59:36 +0000 (18:59 +0000)]
Auto merge of #62856 - pietroalbini:fix-awscli, r=Mark-Simulacrum

ci: pin awscli dependencies

docutils 0.15, a dependency of awscli, broke our CI since it's not compatible with Python 2 due to a bug. This pins all the dependencies of awscli with docutils 0.14, to make sure this kind of regressions doesn't happen again.

r? @Mark-Simulacrum @alexcrichton

4 years agoci: pin awscli dependencies
Pietro Albini [Sun, 21 Jul 2019 18:42:08 +0000 (20:42 +0200)]
ci: pin awscli dependencies

docutils 0.15, a dependency of awscli, broke our CI since it's not
compatible with Python 2 due to a bug. This pins all the dependencies of
awscli with docutils 0.14, to make sure this kind of regressions doesn't
happen again.

4 years agonormalize use of backticks in compiler messages for librustc/hir
Samy Kacimi [Sun, 21 Jul 2019 13:51:43 +0000 (15:51 +0200)]
normalize use of backticks in compiler messages for librustc/hir

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

4 years agoFix typo in Unicode character name
Andrew Dassonville [Sun, 21 Jul 2019 14:49:26 +0000 (07:49 -0700)]
Fix typo in Unicode character name

4 years agotidy is being silly
Ralf Jung [Sun, 21 Jul 2019 10:59:51 +0000 (12:59 +0200)]
tidy is being silly

4 years agoread: fix doc comment
Ralf Jung [Sun, 21 Jul 2019 10:47:34 +0000 (12:47 +0200)]
read: fix doc comment

4 years agouse a const to hack around promotion limitations
Ralf Jung [Sun, 21 Jul 2019 10:02:28 +0000 (12:02 +0200)]
use a const to hack around promotion limitations

4 years agonormalize use of backticks in compiler messages for librustc_lint
Samy Kacimi [Thu, 18 Jul 2019 22:05:23 +0000 (00:05 +0200)]
normalize use of backticks in compiler messages for librustc_lint

4 years agoAuto merge of #59706 - matklad:the-essence-of-lexer, r=petrochenkov
bors [Sun, 21 Jul 2019 07:11:25 +0000 (07:11 +0000)]
Auto merge of #59706 - matklad:the-essence-of-lexer, r=petrochenkov

The essence of lexer

cc @eddyb

I would love to make a reusable library to lex rust code, which could be used by rustc, rust-analyzer, proc-macros, etc. This **draft** PR is my attempt at the API. Currently, the PR uses new lexer to lex comments and shebang, while using the old lexer for everything else. This should be enough to agree on the API though!

### High-level picture

An `rust_lexer` crate is introduced, with zero or minimal (for XID_Start and other unicode) dependencies. This crate basically exposes a single function: `next_token(&str) -> (TokenKind, usize)` which returns the first token of a non-empty string (`usize` is the length of the token). The main goal of the API is to be minimal. Non-strictly essential concerns, like string interning, are left to the clients.

### Finer Points

#### Iterator API

We probably should expose a convenience function `fn tokenize(&str) -> impl Iterator<Item = Token>`

EDIT: I've added `tokenize`

#### Error handling

The lexer itself provides only minimal amount of error detection and reporting. Additionally, it never fatal-errors and always produces some non-empty token. Examples of errors detected by the lexer:

* unterminated block comment
* unterminated string literals

Example of errors **not** detected by the lexer:

* invalid escape sequence in a string literal
* out of range integer literal
* bare `\r` in the doc comment.

The idea is that the clients are responsible for additional validation of tokens. This is the mode IDE operates in: you want to skip validation for library files, because you are not showing errors there anyway, and for user-code, you want to do a deep validation with quick fixes and suggestions, which is not really fit for the lexer itself.

In particular, in this PR unclosed `/*` comment is handled by the new lexer, bare `\r` and distinction between doc and non-doc comments is handled by the old lexer.

#### Performance

No attempt at performance measurement is made so far :) I think it is acceptable to regress perf here a bit in exchange for cleaner code, and I hope that regression wouldn't be too costly. In particular, because we validate tokens separately, we'll have to do one more pass for some of the tokens. I hope this is not a prohibitive cost. For example, for doc comments we already do two passes (lexing + interning), so adding a third one shouldn't be that much slower (and we also do an additional pass for utf-8 validation). And lexing is hopefully not a bottleneck. Note that for IDEs separate validation might actually improve performance, because we will be able to skip validation when, for example, computing completions.

Long term, I hope that this approach will allow for *better* performance. If we separate pure lexing, in the future we can code-gen super-optimizes state machine that walks utf-8 directly, instead of current manual char-by-char toil.

#### Cursor API

For implementation, I am going slightly unconventionally. Instead of defining a `Lexer` struct with a bunch of helper methods (`current`, `bump`) and a bunch of lexing methods (`lex_comment`, `lex_whitespace`), I define a `Cursor` struct which has only helpers, and define a top-level function with a `&mut Cursor` argument for each grammar production. I find this C-style more readable for parsers and lexers.

EDIT: swithced to a more conventional setup with lexing methods

So, what do folks think about this?

4 years agoAuto merge of #60913 - spastorino:place2_4, r=oli-obk
bors [Sun, 21 Jul 2019 03:25:05 +0000 (03:25 +0000)]
Auto merge of #60913 - spastorino:place2_4, r=oli-obk

Place 2.0 change from enum to struct

r? @oli-obk

4 years agonormalize use of backticks in compiler messages for librustc_incremental
Samy Kacimi [Sat, 20 Jul 2019 16:49:34 +0000 (18:49 +0200)]
normalize use of backticks in compiler messages for librustc_incremental

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

4 years agoIntroduce rustc_lexer
Aleksey Kladov [Mon, 6 May 2019 08:53:40 +0000 (11:53 +0300)]
Introduce rustc_lexer

The idea here is to make a reusable library out of the existing
rust-lexer, by separating out pure lexing and rustc-specific concerns,
like spans, error reporting an interning.

So, rustc_lexer operates directly on `&str`, produces simple tokens
which are a pair of type-tag and a bit of original text, and does not
report errors, instead storing them as flags on the token.

4 years agoAuto merge of #62789 - GuillaumeGomez:update-pulldown-cmark, r=Manishearth
bors [Sat, 20 Jul 2019 12:21:28 +0000 (12:21 +0000)]
Auto merge of #62789 - GuillaumeGomez:update-pulldown-cmark, r=Manishearth

Update pulldown-cmark version

Fixes https://github.com/rust-lang/rust/issues/62571.
Fixes #62770.
Fixes #62552.

cc @rust-lang/rustdoc @Centril @pietroalbini

4 years agoUpdate pulldown-cmark version
Guillaume Gomez [Thu, 18 Jul 2019 21:37:27 +0000 (23:37 +0200)]
Update pulldown-cmark version

4 years agoAuto merge of #62710 - estebank:bad-named-args, r=petrochenkov
bors [Sat, 20 Jul 2019 06:18:52 +0000 (06:18 +0000)]
Auto merge of #62710 - estebank:bad-named-args, r=petrochenkov

Specific error for positional args after named args in `format!()`

When writing positional arguments after named arguments in the
`format!()` and `println!()` macros, provide a targeted diagnostic.

Follow up to https://github.com/rust-lang/rust/pull/57522/files#r247278885

4 years agoalters the panic variant of InterpError
Saleem Jaffer [Sat, 20 Jul 2019 06:18:16 +0000 (11:48 +0530)]
alters the panic variant of InterpError

4 years agoAvoid cloning Place in check_and_patch
Santiago Pastorino [Sat, 20 Jul 2019 01:40:33 +0000 (03:40 +0200)]
Avoid cloning Place in check_and_patch

4 years agoAvoid cloning Place in visit_rvalue
Santiago Pastorino [Fri, 19 Jul 2019 20:49:58 +0000 (22:49 +0200)]
Avoid cloning Place in visit_rvalue

4 years agoAvoid cloning Place in assign #2
Santiago Pastorino [Fri, 19 Jul 2019 20:49:17 +0000 (22:49 +0200)]
Avoid cloning Place in assign #2

4 years agoAvoid cloning Place in assign #1
Santiago Pastorino [Fri, 19 Jul 2019 20:41:52 +0000 (22:41 +0200)]
Avoid cloning Place in assign #1

4 years agoAvoid cloning Place in in_projection_structurally
Santiago Pastorino [Fri, 19 Jul 2019 20:18:03 +0000 (22:18 +0200)]
Avoid cloning Place in in_projection_structurally

4 years agoAvoid cloning Place in is_stable
Santiago Pastorino [Fri, 19 Jul 2019 20:11:57 +0000 (22:11 +0200)]
Avoid cloning Place in is_stable

4 years agoAvoid unneeded else branches
Santiago Pastorino [Fri, 19 Jul 2019 19:58:03 +0000 (21:58 +0200)]
Avoid unneeded else branches

4 years agoAvoid cloning Place in gather_init
Santiago Pastorino [Fri, 19 Jul 2019 19:49:34 +0000 (21:49 +0200)]
Avoid cloning Place in gather_init

4 years agoAvoid cloning Place in calculate_fake_borrows
Santiago Pastorino [Fri, 19 Jul 2019 19:33:13 +0000 (21:33 +0200)]
Avoid cloning Place in calculate_fake_borrows

4 years agoAvoid cloning Place in limit_capture_mutability
Santiago Pastorino [Fri, 19 Jul 2019 18:59:59 +0000 (20:59 +0200)]
Avoid cloning Place in limit_capture_mutability

4 years agoAvoid cloning Place in report_cannot_move_from_borrowed_content
Santiago Pastorino [Fri, 19 Jul 2019 18:53:31 +0000 (20:53 +0200)]
Avoid cloning Place in report_cannot_move_from_borrowed_content

4 years agoAvoid cloning Place in report_cannot_move_from_static
Santiago Pastorino [Fri, 19 Jul 2019 18:46:16 +0000 (20:46 +0200)]
Avoid cloning Place in report_cannot_move_from_static

4 years agoAvoid cloning Place in check_access_permissions
Santiago Pastorino [Fri, 19 Jul 2019 18:42:58 +0000 (20:42 +0200)]
Avoid cloning Place in check_access_permissions

4 years agoAvoid cloning Place in append_place_to_string
Santiago Pastorino [Fri, 19 Jul 2019 17:55:49 +0000 (19:55 +0200)]
Avoid cloning Place in append_place_to_string

4 years agoAvoid cloning Place in classify_drop_access_kind
Santiago Pastorino [Fri, 19 Jul 2019 17:36:47 +0000 (19:36 +0200)]
Avoid cloning Place in classify_drop_access_kind

4 years agoAvoid cloning Place in describe_place_for_conflicting_borrow
Santiago Pastorino [Fri, 19 Jul 2019 17:04:01 +0000 (19:04 +0200)]
Avoid cloning Place in describe_place_for_conflicting_borrow

4 years agoAvoid cloning Place in report_use_of_moved_or_uninitialized and friends
Santiago Pastorino [Thu, 11 Jul 2019 17:25:37 +0000 (19:25 +0200)]
Avoid cloning Place in report_use_of_moved_or_uninitialized and friends

4 years agoRemove explicit lifetime
Santiago Pastorino [Wed, 3 Jul 2019 19:39:12 +0000 (21:39 +0200)]
Remove explicit lifetime

4 years agoRemove explicit return from last line of fn
Santiago Pastorino [Wed, 3 Jul 2019 04:20:07 +0000 (06:20 +0200)]
Remove explicit return from last line of fn

4 years agoAvoid cloning Place in codegen_place
Santiago Pastorino [Tue, 2 Jul 2019 18:29:45 +0000 (20:29 +0200)]
Avoid cloning Place in codegen_place

4 years agoImplement Place::as_place_ref
Santiago Pastorino [Tue, 2 Jul 2019 19:01:20 +0000 (21:01 +0200)]
Implement Place::as_place_ref

4 years agoAvoid cloning place in LocalAnalyzer visitor
Santiago Pastorino [Mon, 1 Jul 2019 21:30:38 +0000 (23:30 +0200)]
Avoid cloning place in LocalAnalyzer visitor

4 years agoMigrate from Place enum to Place struct
Santiago Pastorino [Tue, 30 Apr 2019 16:58:24 +0000 (18:58 +0200)]
Migrate from Place enum to Place struct

4 years agoAuto merge of #62008 - ia0:issues_61053, r=petrochenkov
bors [Sat, 20 Jul 2019 02:39:04 +0000 (02:39 +0000)]
Auto merge of #62008 - ia0:issues_61053, r=petrochenkov

Add meta-variable checks in macro definitions

This is an implementation of #61053. It is not sound (some errors are not reported) and not complete (reports may not be actual errors). This is due to the possibility to define macros in macros in indirect ways. See module documentation of `macro_check` for more details.

What remains to be done:
- [x] Migrate from an error to an allow-by-default lint.
- [x] Add more comments in particular for the handling of nested macros.
- [x] Add more tests if needed.
- [x] Try to avoid cloning too much (one idea is to use lists on the stack).
- [ ] Run crater with deny-by-default lint (measure rate of false positives).
    - [ ] Remove extra commit for deny-by-default lint
- [x] Create a PR to remove the old `question_mark_macro_sep` lint #62160

4 years agoUse sharded maps for interning
John Kåre Alsaker [Wed, 12 Jun 2019 12:39:12 +0000 (14:39 +0200)]
Use sharded maps for interning

4 years agoAuto merge of #62705 - petrochenkov:oh-bye-mark, r=matthewjasper
bors [Fri, 19 Jul 2019 21:11:23 +0000 (21:11 +0000)]
Auto merge of #62705 - petrochenkov:oh-bye-mark, r=matthewjasper

libsyntax: Rename `Mark` into `ExpnId`

"`Mark`" is an ID that identifies both a macro invocation (`foo!()`), and expansion process, and expansion result of that macro invocation.
The problem is that it's pretty hard to infer that from its name.

This PR renames it into `ExpnId` reflecting its meaning in most contexts.
(The contexts where it's meaning is closer to "macro invocation ID" are rarer.)

I've kept "mark" in the names of functions that add or remove marks to/from syntactic contexts, those marks are not just expansion IDs, but something more complex.

4 years agonormalize use of backticks in compiler messages for librustc_metadata
Samy Kacimi [Fri, 19 Jul 2019 18:08:21 +0000 (20:08 +0200)]
normalize use of backticks in compiler messages for librustc_metadata

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

4 years agoImplement checks for meta-variables in macros
Julien Cretin [Thu, 30 May 2019 10:53:27 +0000 (12:53 +0200)]
Implement checks for meta-variables in macros

4 years agoRemember the span of the Kleene operator in macros
Julien Cretin [Wed, 29 May 2019 18:29:51 +0000 (20:29 +0200)]
Remember the span of the Kleene operator in macros

This is needed for having complete error messages where reporting macro variable
errors. Here is what they would look like:

error: meta-variable repeats with different kleene operator
  --> $DIR/issue-61053-different-kleene.rs:3:57
   |
LL |     ( $( $i:ident = $($j:ident),+ );* ) => { $( $( $i = $j; )* )* };
   |                                 - expected repetition   ^^   - conflicting repetition

4 years agoAuto merge of #62690 - alexcrichton:azure-update, r=pietroalbini
bors [Fri, 19 Jul 2019 15:49:18 +0000 (15:49 +0000)]
Auto merge of #62690 - alexcrichton:azure-update, r=pietroalbini

azure: Prepare configuration for 4-core machines

This commit updates some of our assorted Azure/CI configuration to
prepare for some 4-core machines coming online. We're still in the
process of performance testing them to get final numbers, but some
changes are worth landing ahead of this. The updates here are:

* Use `C:/` instead of `D:/` for submodule checkout since it should have
  plenty of space and the 4-core machines won't have `D:/`

* Update `lzma-sys` to 0.1.14 which has support for VS2019, where 0.1.10
  doesn't.

* Update `src/ci/docker/run.sh` to work when it itself is running inside
  of a docker container (see the comment in the file for more info)

* Print step timings on the `try` branch in addition to the `auto`
  branch in. The logs there should be seen by similarly many humans (not
  many) and can be useful for performance analysis after a `try` build
  runs.

* Install the WIX and InnoSetup tools manually on Windows instead of
  relying on pre-installed copies on the VM. This gives us more control
  over what's being used on the Azure cloud right now (we control the
  version) and in the 4-core machines these won't be pre-installed. Note
  that on AppVeyor we actually already were installing InnoSetup, we
  just didn't carry that over on Azure!

4 years agoavoid uninit_array! macro where it is not needed
Ralf Jung [Fri, 19 Jul 2019 15:23:47 +0000 (17:23 +0200)]
avoid uninit_array! macro where it is not needed

4 years agoazure: Prepare configuration for 4-core machines
Alex Crichton [Mon, 15 Jul 2019 15:23:56 +0000 (08:23 -0700)]
azure: Prepare configuration for 4-core machines

This commit updates some of our assorted Azure/CI configuration to
prepare for some 4-core machines coming online. We're still in the
process of performance testing them to get final numbers, but some
changes are worth landing ahead of this. The updates here are:

* Use `C:/` instead of `D:/` for submodule checkout since it should have
  plenty of space and the 4-core machines won't have `D:/`

* Update `lzma-sys` to 0.1.14 which has support for VS2019, where 0.1.10
  doesn't.

* Update `src/ci/docker/run.sh` to work when it itself is running inside
  of a docker container (see the comment in the file for more info)

* Print step timings on the `try` branch in addition to the `auto`
  branch in. The logs there should be seen by similarly many humans (not
  many) and can be useful for performance analysis after a `try` build
  runs.

* Install the WIX and InnoSetup tools manually on Windows instead of
  relying on pre-installed copies on the VM. This gives us more control
  over what's being used on the Azure cloud right now (we control the
  version) and in the 4-core machines these won't be pre-installed. Note
  that on AppVeyor we actually already were installing InnoSetup, we
  just didn't carry that over on Azure!

4 years agouse const array repeat expressions for uninit_array
Ralf Jung [Fri, 19 Jul 2019 08:44:11 +0000 (10:44 +0200)]
use const array repeat expressions for uninit_array

4 years agoAuto merge of #62679 - Xanewok:after-expansion, r=Zoxc
bors [Fri, 19 Jul 2019 10:38:09 +0000 (10:38 +0000)]
Auto merge of #62679 - Xanewok:after-expansion, r=Zoxc

Add an `after_expansion` callback in the driver

To format a given file RLS needs to know the Rust edition associated with it. It's not enough to look at the `edition` key in Cargo.toml - each crate target can have a different edition associated with it so the sure way to fetch a correct edition is to scan the input files used to compile a given crate target.

Right now this was done in the `after_analysis` callback of our shim, however this leads to other problems - if a crate cannot be successfully compiled (e.g. it has a type error) then a callback would not be invoked meaning we can't populate the files -> edition mapping.

However, doing this only after parsing is not enough, since expansion can pull in additional source files (e.g. by invoking `macro_rules! include_my_mod { () => { mod some_mod; }; }`).

Without copy-pasting the entire driver setup it's also not possible to expand the crate ourselves in the `after_parsing` callback - to expand crate we'd need to register plugins and initialize session ourselves. However, this is done normally after executing the callback itself, thus triggering the `Once::set` assertions in `Session::init_features`.

r? @Zoxc

cc @RalfJung @oli-obk this affects public driver interface used by Miri and Clippy

4 years agohygiene: Tweak naming some more
Vadim Petrochenkov [Mon, 15 Jul 2019 23:59:53 +0000 (02:59 +0300)]
hygiene: Tweak naming some more

4 years agoAdjust other names after the `Mark` renaming
Vadim Petrochenkov [Mon, 15 Jul 2019 22:42:58 +0000 (01:42 +0300)]
Adjust other names after the `Mark` renaming

4 years agolibsyntax: Remove `Mark` into `ExpnId`
Vadim Petrochenkov [Mon, 15 Jul 2019 22:04:05 +0000 (01:04 +0300)]
libsyntax: Remove `Mark` into `ExpnId`

4 years agoONCE_INIT is deprecated-in-future only for bootstrap
Ralf Jung [Wed, 17 Jul 2019 08:34:34 +0000 (10:34 +0200)]
ONCE_INIT is deprecated-in-future only for bootstrap

4 years agodo not use mem::uninitialized in std::io
Ralf Jung [Wed, 17 Jul 2019 07:51:58 +0000 (09:51 +0200)]
do not use mem::uninitialized in std::io

4 years agowarn about deprecated-in-future in most of libstd
Ralf Jung [Wed, 17 Jul 2019 07:33:08 +0000 (09:33 +0200)]
warn about deprecated-in-future in most of libstd

4 years agoAuto merge of #62694 - lundibundi:help-infer-fn-ret, r=eddyb
bors [Fri, 19 Jul 2019 04:04:17 +0000 (04:04 +0000)]
Auto merge of #62694 - lundibundi:help-infer-fn-ret, r=eddyb

rustc_typeck: improve diagnostics for -> _ fn return type

This should implement IIUC the mentioned issue.

~~I'm not sure if there is a better way than `get_infer_ret_ty` to get/check the return type without code duplication.~~

~~Also, is this unwrap be okay `ty::Binder::bind(*tables.liberated_fn_sigs().get(hir_id).unwrap())`?~~

r? @eddyb
Closes: https://github.com/rust-lang/rust/issues/56132
4 years agoAuto merge of #62684 - petrochenkov:scopevisit, r=davidtwco
bors [Fri, 19 Jul 2019 00:24:39 +0000 (00:24 +0000)]
Auto merge of #62684 - petrochenkov:scopevisit, r=davidtwco

resolve: Improve candidate search for unresolved macro suggestions

Use same scope visiting machinery for both collecting suggestion candidates and actually resolving the names.

The PR is better read in per-commit fashion with whitespace changes ignored (the first commit in particular moves some code around).

This should be the last pre-requisite for https://github.com/rust-lang/rust/pull/62086.
r? @davidtwco

4 years agonormalize use of backticks in compiler messages for libcore/ptr
Samy Kacimi [Thu, 18 Jul 2019 20:32:24 +0000 (22:32 +0200)]
normalize use of backticks in compiler messages for libcore/ptr

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

4 years agoAuto merge of #61749 - davidtwco:rfc-2203-const-array-repeat-exprs, r=eddyb
bors [Thu, 18 Jul 2019 20:41:40 +0000 (20:41 +0000)]
Auto merge of #61749 - davidtwco:rfc-2203-const-array-repeat-exprs, r=eddyb

rustc/rustc_mir: Implement RFC 2203.

This PR implements RFC 2203, allowing constants in array repeat
expressions. Part of #49147.

r? @eddyb

4 years agoFix typo in src/libstd/net/udp.rs doc comment
Martin Indra [Thu, 18 Jul 2019 19:03:56 +0000 (21:03 +0200)]
Fix typo in src/libstd/net/udp.rs doc comment

Affect is usually used as a verb, effect as a verb.

4 years agoAuto merge of #62782 - Mark-Simulacrum:rollup-1hz5ya6, r=Mark-Simulacrum
bors [Thu, 18 Jul 2019 17:03:37 +0000 (17:03 +0000)]
Auto merge of #62782 - Mark-Simulacrum:rollup-1hz5ya6, r=Mark-Simulacrum

Rollup of 15 pull requests

Successful merges:

 - #61926 (Fix hyperlinks in From impls between Vec and VecDeque)
 - #62615 ( Only error about MSVC + PGO + unwind if we're generating code)
 - #62696 (Check that trait is exported or public before adding hint)
 - #62712 (Update the help message on error for self type)
 - #62728 (Fix repeated wording in slice documentation)
 - #62730 (Consolidate hygiene tests)
 - #62732 (Remove last use of mem::uninitialized from std::io::util)
 - #62740 (Add missing link to Infallible in TryFrom doc)
 - #62745 (update data_layout and features for armv7-wrs-vxworks)
 - #62749 (Document link_section arbitrary bytes)
 - #62752 (Disable Z3 in LLVM build)
 - #62764 (normalize use of backticks in compiler messages for librustc/lint)
 - #62774 (Disable simd_select_bitmask test on big endian)
 - #62777 (Self-referencial type now called a recursive type)
 - #62778 (Emit artifact notifications for dependency files)

Failed merges:

 - #62746 ( do not use mem::uninitialized in std::io)

r? @ghost

4 years agoRollup merge of #62778 - jsgf:notify-dep-info, r=petrochenkov
Mark Rousskov [Thu, 18 Jul 2019 15:29:58 +0000 (11:29 -0400)]
Rollup merge of #62778 - jsgf:notify-dep-info, r=petrochenkov

Emit artifact notifications for dependency files

Emit `dep-info` artifact notifications for `.d` files.

4 years agoRollup merge of #62777 - gilescope:self-referencial-to-recursion, r=eddyb
Mark Rousskov [Thu, 18 Jul 2019 15:29:57 +0000 (11:29 -0400)]
Rollup merge of #62777 - gilescope:self-referencial-to-recursion, r=eddyb

Self-referencial type now called a recursive type

As per Boat's suggestion - #62539, this makes the error message clearer.

4 years agoRollup merge of #62774 - smaeul:pr/simd-tests, r=petrochenkov
Mark Rousskov [Thu, 18 Jul 2019 15:29:55 +0000 (11:29 -0400)]
Rollup merge of #62774 - smaeul:pr/simd-tests, r=petrochenkov

Disable simd_select_bitmask test on big endian

Per #59356 it is expected that the interpretation of the bitmask depends
on target endianness.

Closes #59356

4 years agoRollup merge of #62764 - fakenine:normalize_use_of_backticks_compiler_messages_p7...
Mark Rousskov [Thu, 18 Jul 2019 15:29:53 +0000 (11:29 -0400)]
Rollup merge of #62764 - fakenine:normalize_use_of_backticks_compiler_messages_p7, r=alexreg

normalize use of backticks in compiler messages for librustc/lint

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

4 years agoRollup merge of #62752 - nikic:llvm-disable-z3, r=alexcrichton
Mark Rousskov [Thu, 18 Jul 2019 15:29:52 +0000 (11:29 -0400)]
Rollup merge of #62752 - nikic:llvm-disable-z3, r=alexcrichton

Disable Z3 in LLVM build

Avoid building LLVM with Z3 if it happens to be installed.

Fixes #62750.

r? @alexcrichton

4 years agoRollup merge of #62749 - chocol4te:fix_60633, r=estebank
Mark Rousskov [Thu, 18 Jul 2019 15:29:50 +0000 (11:29 -0400)]
Rollup merge of #62749 - chocol4te:fix_60633, r=estebank

Document link_section arbitrary bytes

Closes #60633.

4 years agoRollup merge of #62745 - BaoshanPang:master, r=nikic
Mark Rousskov [Thu, 18 Jul 2019 15:29:48 +0000 (11:29 -0400)]
Rollup merge of #62745 - BaoshanPang:master, r=nikic

update data_layout and features for armv7-wrs-vxworks

4 years agoRollup merge of #62740 - lzutao:patch-2, r=alexcrichton
Mark Rousskov [Thu, 18 Jul 2019 15:29:46 +0000 (11:29 -0400)]
Rollup merge of #62740 - lzutao:patch-2, r=alexcrichton

Add missing link to Infallible in TryFrom doc

4 years agoRollup merge of #62732 - nathanwhit:fix_mem_uninit, r=Amanieu
Mark Rousskov [Thu, 18 Jul 2019 15:29:45 +0000 (11:29 -0400)]
Rollup merge of #62732 - nathanwhit:fix_mem_uninit, r=Amanieu

Remove last use of mem::uninitialized from std::io::util

Addresses #62397 for std::io::util

4 years agoRollup merge of #62730 - matthewjasper:hygiene-tests, r=petrochenkov
Mark Rousskov [Thu, 18 Jul 2019 15:29:43 +0000 (11:29 -0400)]
Rollup merge of #62730 - matthewjasper:hygiene-tests, r=petrochenkov

Consolidate hygiene tests

Some general clean-up extracted out from another PR

4 years agoRollup merge of #62728 - DutchGhost:fix-double-wording, r=jonas-schievink
Mark Rousskov [Thu, 18 Jul 2019 15:29:42 +0000 (11:29 -0400)]
Rollup merge of #62728 - DutchGhost:fix-double-wording, r=jonas-schievink

Fix repeated wording in slice documentation

Changes `of the slice of the slice` to `of the slice` in the chunk- and friends documentation of slices

4 years agoRollup merge of #62712 - limira:self-type-help, r=estebank
Mark Rousskov [Thu, 18 Jul 2019 15:29:40 +0000 (11:29 -0400)]
Rollup merge of #62712 - limira:self-type-help, r=estebank

Update the help message on error for self type

Fix #62609

4 years agoRollup merge of #62696 - chocol4te:fix_#62194, r=estebank
Mark Rousskov [Thu, 18 Jul 2019 15:29:39 +0000 (11:29 -0400)]
Rollup merge of #62696 - chocol4te:fix_#62194, r=estebank

Check that trait is exported or public before adding hint

Closes #62194.

This PR checks the `AccessLevels` of a trait to check whether adding the intercrate ambiguity hint is valid or not.

I am unsure of both the use of `.unwrap()` as well as removing hints for [downstream *and* [upstream](https://github.com/rust-lang/rust/blob/92b0f52584c9375505ecdefdd7855b93a5919d51/src/librustc/traits/select.rs#L112-L142).

4 years agoRollup merge of #62615 - wesleywiser:pgo_error, r=nagisa
Mark Rousskov [Thu, 18 Jul 2019 15:29:37 +0000 (11:29 -0400)]
Rollup merge of #62615 - wesleywiser:pgo_error, r=nagisa

 Only error about MSVC + PGO + unwind if we're generating code

In #61853, we changed the error when using PGO & MSVC toolchain & panic=unwind into a warning. However, in the compiler team meeting on 2019-07-11, we found that not everybody was in favor of that change because of the possibility of broken binaries.

This PR reverts that change so this is again an error. However, to work around an [issue the Firefox team is having](https://github.com/rust-lang/rust/issues/61002#issuecomment-500075739), we will only emit the error if we're actually supposed to generate a binary. If the `rustc` is invoked with `--print` arguments (which means that no binary will actually be emitted), then we won't emit the error because there is not a possibility of the issue occurring.

cc @EricRahm @nikomatsakis @pnkfelix @Centril