Commit Graph

96377 Commits

Author SHA1 Message Date
Jonas Schievink
ba78db310b libsyntax: factor out file path resolving
This allows the same logic used by `include_X!` macros to be used by
`#[doc(include)]`.
2019-07-23 17:17:31 +02:00
bors
3ebca72a11 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
2019-07-23 09:58:48 +00:00
bors
e649e90344 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
2019-07-22 17:08:25 +00:00
Mazdak Farrokhzad
376382aff3
Rollup merge of #62870 - matklad:issue-62863, r=petrochenkov
fix lexing of comments with many \r

closes #62863
2019-07-22 15:32:29 +02:00
Mazdak Farrokhzad
e178a1e1b3
Rollup merge of #62858 - Rosto75:master, r=jonas-schievink
Change wrong variable name.

r? @steveklabnik
2019-07-22 15:32:27 +02:00
Mazdak Farrokhzad
d75151c546
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)).
2019-07-22 15:32:26 +02:00
Mazdak Farrokhzad
16f585ca1c
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
2019-07-22 15:32:24 +02:00
Mazdak Farrokhzad
b94e59cc41
Rollup merge of #62845 - RalfJung:read, r=rkruppe
read: fix doc comment

No idea how that happened...
2019-07-22 15:32:23 +02:00
Mazdak Farrokhzad
1289677821
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
2019-07-22 15:32:22 +02:00
Mazdak Farrokhzad
063268b2bc
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
2019-07-22 15:32:20 +02:00
Mazdak Farrokhzad
17ddfbe49c
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
2019-07-22 15:32:18 +02:00
Mazdak Farrokhzad
5a20745c96
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
2019-07-22 15:32:17 +02:00
Mazdak Farrokhzad
7dafdd21b1
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
2019-07-22 15:32:15 +02:00
Mazdak Farrokhzad
002f604bc9
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.
2019-07-22 15:32:14 +02:00
Mazdak Farrokhzad
1d7faafe47
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
2019-07-22 15:32:12 +02:00
Mazdak Farrokhzad
2567af67a6
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
2019-07-22 15:32:11 +02:00
Mazdak Farrokhzad
0de90c67dc
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_).
2019-07-22 15:32:09 +02:00
Aleksey Kladov
647bf96b79 fix lexing of comments with many \r
closes #62863
2019-07-22 15:39:06 +03:00
bors
4bc1ce7bdb 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)
2019-07-22 08:55:29 +00:00
Vadim Petrochenkov
39d144e808 Fix or ignore regressed tests 2019-07-22 11:50:21 +03:00
Vadim Petrochenkov
14f5160423 tests: Require run-pass tests without annotations to run successfully again 2019-07-22 11:50:21 +03:00
Tomasz Różański
e2ddb85416 Change wrong variable name. 2019-07-21 21:07:38 +02:00
bors
273f42b596 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
2019-07-21 18:59:36 +00:00
Pietro Albini
ace3684286
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.
2019-07-21 20:56:08 +02:00
Samy Kacimi
51ee196235
normalize use of backticks in compiler messages for librustc/hir
https://github.com/rust-lang/rust/issues/60532
2019-07-21 16:54:33 +02:00
Andrew Dassonville
1520fabd5f
Fix typo in Unicode character name 2019-07-21 07:49:26 -07:00
Ralf Jung
f3abbf7103 tidy is being silly 2019-07-21 12:59:51 +02:00
Ralf Jung
8dc5635e13 read: fix doc comment 2019-07-21 12:47:34 +02:00
Ralf Jung
4b47e78a16 use a const to hack around promotion limitations 2019-07-21 12:28:18 +02:00
Samy Kacimi
0385d64d19
normalize use of backticks in compiler messages for librustc_lint 2019-07-21 11:47:24 +02:00
bors
83dfe7b27c 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?
2019-07-21 07:11:25 +00:00
bors
1301422a6c Auto merge of #60913 - spastorino:place2_4, r=oli-obk
Place 2.0 change from enum to struct

r? @oli-obk
2019-07-21 03:25:05 +00:00
Samy Kacimi
60ca55cbda
normalize use of backticks in compiler messages for librustc_incremental
https://github.com/rust-lang/rust/issues/60532
2019-07-20 20:57:45 +02:00
Aleksey Kladov
395ee0b79f 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.
2019-07-20 21:12:34 +03:00
bors
95b1fe560d 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
2019-07-20 12:21:28 +00:00
Guillaume Gomez
9d6b29af5a Update pulldown-cmark version 2019-07-20 11:01:04 +02:00
bors
f69b07144a 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
2019-07-20 06:18:52 +00:00
Santiago Pastorino
a8ceeeb5a0 Avoid cloning Place in check_and_patch 2019-07-20 05:08:39 +02:00
Santiago Pastorino
b59ded8ae0 Avoid cloning Place in visit_rvalue 2019-07-20 05:08:39 +02:00
Santiago Pastorino
7789cbf700 Avoid cloning Place in assign #2 2019-07-20 05:08:39 +02:00
Santiago Pastorino
b490032893 Avoid cloning Place in assign #1 2019-07-20 05:08:39 +02:00
Santiago Pastorino
2a7d600ee0 Avoid cloning Place in in_projection_structurally 2019-07-20 05:08:39 +02:00
Santiago Pastorino
7b456df4ab Avoid cloning Place in is_stable 2019-07-20 05:08:39 +02:00
Santiago Pastorino
17a465cb85 Avoid unneeded else branches 2019-07-20 05:08:39 +02:00
Santiago Pastorino
9b549d3c9d Avoid cloning Place in gather_init 2019-07-20 05:08:39 +02:00
Santiago Pastorino
d77653e88b Avoid cloning Place in calculate_fake_borrows 2019-07-20 05:08:39 +02:00
Santiago Pastorino
2ffd3c64f9 Avoid cloning Place in limit_capture_mutability 2019-07-20 05:08:39 +02:00
Santiago Pastorino
10470797a6 Avoid cloning Place in report_cannot_move_from_borrowed_content 2019-07-20 05:08:39 +02:00
Santiago Pastorino
09014fc793 Avoid cloning Place in report_cannot_move_from_static 2019-07-20 05:08:39 +02:00
Santiago Pastorino
95e727a5c3 Avoid cloning Place in check_access_permissions 2019-07-20 05:08:39 +02:00