Commit Graph

96872 Commits

Author SHA1 Message Date
lqd
770129c280 Add test to check that assignments to projections do not kill too many loans 2019-07-22 12:46:54 +02:00
lqd
d41e002111 Add test checking various assignments are accepted in Polonius 2019-07-22 12:46:54 +02:00
lqd
2f3e36f51a Polonius: generate killed facts for assignments to projections 2019-07-22 12:46:53 +02:00
lqd
823ab42e66 Bless output of test unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs for Polonius 2019-07-22 11:36:47 +02:00
lqd
9e0fb6fad2 Make both polonius loans tests check-pass 2019-07-22 11:36:46 +02:00
lqd
606f7984e7 Rename test so that both "kills-loans" tests match names 2019-07-22 11:36:46 +02:00
lqd
9bd9b0d9bf Add test extracted from rand, checking that StorageDead kills loans
Like "call-kills-loans", Polonius didn't know about some `killed` facts.
2019-07-22 11:36:46 +02:00
lqd
40e6b025b2 Bless output of test nll/return-ref-mut-issue-46557.rs for Polonius 2019-07-22 11:36:45 +02:00
lqd
ed1625f29e Ignore test hrtb/issue-30786.rs in Polonius compare mode 2019-07-22 11:36:45 +02:00
lqd
0bd2b32358 Bless output of test borrowck/promote-ref-mut-in-let-issue-46557.rs for Polonius 2019-07-22 11:36:44 +02:00
lqd
6d9a4f9783 Polonius facts: kill loans on Call terminators and StorageDead 2019-07-22 11:36:42 +02: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
Ralf Jung
a7b9246540 weasle, weasle 2019-07-22 10:33:11 +02:00
lqd
9a82f52e59 Create a dedicated polonius test folder 2019-07-22 10:32:41 +02:00
lqd
08c25b5122 Bless output of test dropck/dropck_trait_cycle_checked.rs for Polonius 2019-07-22 10:32:41 +02:00
lqd
7db61e78c0 Bless output of test borrowck/two-phase-surprise-no-conflict.rs for Polonius 2019-07-22 10:32:40 +02:00
lqd
6fe52928a3 Bless output of test borrowck/borrowck-escaping-closure-error-2.rs for Polonius 2019-07-22 10:32:40 +02:00
lqd
292d5c18c9 Bless output of test generator/ref-escapes-but-not-over-yield.rs for Polonius 2019-07-22 10:32:40 +02:00
lqd
c5a1bc1e5c Bless output of test nll/get_default.rs for Polonius
2 of the 3 errors are "fixed by Polonius" 🎉
2019-07-22 10:32:39 +02:00
lqd
6a7c15ed25 Bless output of test consts/promote_const_let.rs for Polonius 2019-07-22 10:32:39 +02:00
lqd
94101046ff Bless output of test nll/loan_ends_mid_block_pair.rs for Polonius 2019-07-22 10:32:39 +02:00
lqd
2824db1388 Bless output of test save-analysis/emit-notifications.rs for Polonius 2019-07-22 10:32:39 +02:00
lqd
ff350f8efa Bless output of test ui/emit-artifact-notifications.rs for Polonius 2019-07-22 10:32:38 +02:00
lqd
51c15fae61 Ignore test issue-45696-scribble-on-boxed-borrow.rs in Polonius compare mode
Once again, the difference is in the test construction, it is ignored in compare-mode NLL and tested manually with revisions, and fails because the `migrate` revision is ran with `-Zpolonius`. There is no actual difference in the errors output by NLLs and Polonius.
2019-07-22 10:32:38 +02:00
lqd
63c837ef8d Ignore feature-gate-nll.rs in Polonius compare mode
This is a test about turning the NLL feature gate on, ignored by the NLL compare-mode.
2019-07-22 10:32:37 +02:00
lqd
273bfd43c1 Ignore two-phase-reservation-sharing-interference-2.rs in Polonius compare mode
This is just a difference from the test construction, it's ignore-compare-mode-nll and manually checks migrate/nll over edition2015/2018.

This failure is because the `migrate2015` and `migrate2018`  revisions are ran with `-Zpolonius`. There is no actual difference in the errors output by NLLs and Polonius.
2019-07-22 10:32:37 +02:00
lqd
d4ca9a349c Ignore test issue-45983 in the polonius compare mode
There is no difference between the NLL and Polonius outputs, and it manually tests NLLs.
2019-07-22 10:32:37 +02:00
lqd
c442dae5b8 Ignore NLL migrate mode test in the Polonius compare-mode
This is test specific to the NLL migrate mode which is irrelevant to -Z polonius.
It can't currently be encoded depending on migrate-mode and NLL/Polonius mode, so the NLL compare-mode also ignores it.
2019-07-22 10:32:36 +02:00
Baoshan Pang
279c399599 code cleanup 2019-07-21 18:29:24 -07:00
Santiago Pastorino
795d96d87b Place::as_place_ref is now Place::as_ref 2019-07-22 00:25:07 +02:00
Yuki Okushi
e75ae15fb9 Move into existential-type dir 2019-07-22 07:12:31 +09: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
Aleksey Kladov
e63fe150bf move unescape module to rustc_lexer 2019-07-21 16:46:11 +03:00
Ralf Jung
f3abbf7103 tidy is being silly 2019-07-21 12:59:51 +02:00
Luca Barbieri
44c165074b fix comment 2019-07-21 12:50:16 +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
Ralf Jung
10f877b5ea disable overlapping check with Miri (does not work without intptrcast) 2019-07-21 12:28:06 +02:00
Ralf Jung
dca61fb9f1 update Miri 2019-07-21 12:28:06 +02:00
Ralf Jung
40812224ca apply feedback 2019-07-21 12:13:57 +02:00
Ralf Jung
f502bf78cb sync with nomicon: raw ptr must be non-dangling and aligned every time it is dereferenced 2019-07-21 12:08:19 +02:00
Luca Barbieri
c7928f5af0 Expand comment on BorrowRef::new 2019-07-21 11:49:36 +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