Commit Graph

106390 Commits

Author SHA1 Message Date
Dylan DPC
88573a7f61
Rollup merge of #68919 - Zoxc:ast-lifetime, r=nikomatsakis
Remove HashStable impl for ast::Lifetime
2020-02-07 17:00:25 +01:00
Dylan DPC
9047c57e9f
Rollup merge of #68910 - hanna-kruppe:master, r=Mark-Simulacrum
Add myself to .mailmap
2020-02-07 17:00:23 +01:00
Dylan DPC
f734e47516
Rollup merge of #68909 - tmandry:panic-abort-nocapture, r=alexcrichton
Respect --nocapture in panic=abort test mode

r? @alexcrichton
2020-02-07 17:00:21 +01:00
Dylan DPC
90f6267dea
Rollup merge of #68889 - Zoxc:hir-krate, r=eddyb
Move the `hir().krate()` method to a query and remove the `Krate` dep node

r? @eddyb cc @michaelwoerister
2020-02-07 17:00:19 +01:00
Dylan DPC
f9ebad33a2
Rollup merge of #68413 - XAMPPRocky:master, r=Mark-Simulacrum
Add GitHub issue templates

This PR adds GitHub's issue templates to the repository. Adding templates for two of the most common issues we create on the repository. We could add more specific templates (e.g. ICEs) depending on the response to initial templates. I've included a screenshot of what it looks like, and people can also try out the UI and specific templates, by going to [`XAMPPRocky/rust`](https://github.com/XAMPPRocky/rust/issues/new/choose).

<img width="1115" alt="Screenshot 2020-01-21 at 13 57 46" src="https://user-images.githubusercontent.com/4464295/72807027-c51baa00-3c56-11ea-8a4c-98238489b345.png">
2020-02-07 17:00:18 +01:00
Dylan DPC
2f1eaeea77
Rollup merge of #68164 - tmiasko:no-sanitize, r=nikomatsakis
Selectively disable sanitizer instrumentation

Add `no_sanitize` attribute that allows to opt out from sanitizer
instrumentation in an annotated function.
2020-02-07 17:00:16 +01:00
John Kåre Alsaker
44edbc0e90 Remove HashStable impl for ast::Lifetime 2020-02-07 08:07:06 +01:00
bors
b5e21dbb5c Auto merge of #68499 - ssomers:btree_search_tidying, r=Mark-Simulacrum
BtreeMap range_search spruced up

#39457 created a lower level entry point for `range_search` to operate on, but it's really not hard to move it up a level of abstraction, making it somewhat shorter and reusing existing unsafe code (`new_edge` is unsafe although it is currently not tagged as such).

Benchmark added. Comparison says there's no real difference:
```
>cargo benchcmp old3.txt new3.txt --threshold 5
 name                                           old3.txt ns/iter  new3.txt ns/iter  diff ns/iter   diff %  speedup
 btree::map::find_seq_100                       19                21                           2   10.53%   x 0.90
 btree::map::range_excluded_unbounded           3,117             2,838                     -279   -8.95%   x 1.10
 btree::map::range_included_unbounded           1,768             1,871                      103    5.83%   x 0.94
 btree::set::intersection_10k_neg_vs_10k_pos    35                37                           2    5.71%   x 0.95
 btree::set::intersection_staggered_100_vs_10k  2,488             2,314                     -174   -6.99%   x 1.08
 btree::set::is_subset_10k_vs_100               3                 2                           -1  -33.33%   x 1.50
```

r? @Mark-Simulacrum
2020-02-07 06:24:55 +00:00
Stein Somers
ae03e16d08 Lift range_search up one level of abstraction 2020-02-07 02:41:28 +01:00
bors
f8fd462447 Auto merge of #68907 - Dylan-DPC:rollup-osm5e8o, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #67359 (Rename -Zexternal-macro-backtrace to -Zmacro-backtrace and clean up implementation.)
 - #68524 (Generator Resume Arguments)
 - #68791 (implement proper linkchecker hardening)
 - #68886 (Mark fn map_or() as eagerly evaluated.)
 - #68888 (error code examples: replace some more ignore with compile_fail)
 - #68894 (Update E0565 examples)

Failed merges:

r? @ghost
2020-02-07 00:06:35 +00:00
Stein Somers
be051adb57 Create benchmarks for BTreeMap::range 2020-02-07 00:57:54 +01:00
Hanna Kruppe
c39f2092f7 Add myself to .mailmap 2020-02-06 23:45:20 +01:00
Tyler Mandry
861b328f7d Respect --nocapture in panic=abort test mode 2020-02-06 14:43:53 -08:00
Dylan DPC
7ef5b8951f
Rollup merge of #68894 - JohnTitor:update-e0565, r=Dylan-DPC
Update E0565 examples

Fixes #68892

r? @GuillaumeGomez
2020-02-06 22:38:39 +01:00
Dylan DPC
0e294cf395
Rollup merge of #68888 - tspiteri:ignore-to-compile_fail, r=petrochenkov
error code examples: replace some more ignore with compile_fail

Now that #68664 has been merged and `compile_fail` attempts a full build rather than `--emit=metadata`, these errors should be caught by `compile_fail` and do not need to be ignored.
2020-02-06 22:38:37 +01:00
Dylan DPC
cc3a0e458c
Rollup merge of #68886 - tom-a-wagner:master, r=Mark-Simulacrum
Mark fn map_or() as eagerly evaluated.

In the docs for option.rs and result.rs, it is noted for all *_or()
functions that they are eagerly evaluated, except for the map_or()
function.
This commit adds this missing documentation to the two files.

Closes #68866
2020-02-06 22:38:36 +01:00
Dylan DPC
4ce157d008
Rollup merge of #68791 - mark-i-m:proper-linkcheck, r=ehuss,JohnTitor
implement proper linkchecker hardening

r? @JohnTitor

This implements proper linkcheck filtering... we might need to fiddle with a bit to adjust what is or isn't filtered, but this seems to work reasonable locally.
2020-02-06 22:38:34 +01:00
Dylan DPC
2d8f6389d0
Rollup merge of #68524 - jonas-schievink:generator-resume-arguments, r=Zoxc
Generator Resume Arguments

cc https://github.com/rust-lang/rust/issues/43122 and https://github.com/rust-lang/rust/issues/56974

Blockers:
* [x] Fix miscompilation when resume argument is live across a yield point (https://github.com/rust-lang/rust/pull/68524#issuecomment-578459069)
* [x] Fix 10% compile time regression in `await-call-tree` benchmarks (https://github.com/rust-lang/rust/pull/68524#issuecomment-578487162)
  * [x] Fix remaining 1-3% regression (https://github.com/rust-lang/rust/pull/68524#issuecomment-579566255) - resolved (https://github.com/rust-lang/rust/pull/68524#issuecomment-581144901)
* [x] Make dropck rules account for resume arguments (https://github.com/rust-lang/rust/pull/68524#issuecomment-578541137)

Follow-up work:
* Change async/await desugaring to make use of this feature
* Rewrite [`box_region.rs`](3d8778d767/src/librustc_data_structures/box_region.rs) to use resume arguments (this shows up in profiles too)
2020-02-06 22:38:33 +01:00
Dylan DPC
26c86a6a28
Rollup merge of #67359 - eddyb:macro-backtrace-all-the-same, r=petrochenkov
Rename -Zexternal-macro-backtrace to -Zmacro-backtrace and clean up implementation.

This is my attempt at dealing with https://github.com/rust-lang/rust/pull/66364#issuecomment-565517232, although I'm not sure it's the least disruptive one.

The behavior of `-Zexternal-macro-backtrace` was already to enable full macro backtraces for *all* macros, the only part of it that was specific to cross-crate macros was showing this when *not used*:
```
note: this error originates in a macro outside of the current crate
  (in Nightly builds, run with -Z external-macro-backtrace for more info)
```

After this PR:
* the flag is renamed to `-Zmacro-backtrace`
  * do we need to have a deprecation period? cc @rust-lang/compiler
* the message informing you about the flag is always shown when an expansion of a bang macro/attribute/derive is involved, not just cross-crate ones
  * this accounts for most of the changes in tests
  * we could perhaps only show it for the bang macro case? feels odd for derives
* `fix_multispans_in_std_macros` is split into `fix_multispans_in_extern_macros` and `render_multispans_macro_backtrace`
  * this roughly reverts the non-behavioral parts of #46605, which combined the two functionalities
  * not sure where the old `std_macros` name came from, perhaps the `<std macros>` synthetic "file"? even then, odd that `std` specifically was mentioned
* `render_multispan_macro_backtrace`, by default (i.e. without `-Zmacro-backtrace`), hides the `in this macro invocation` label specifically to avoid redundancy in the diagnostic
  * that is, showing the macro use site is only useful when the diagnostic is inside the macro definition and the user can't otherwise tell which use site it applies to, not when the diagnostic is at/inside the use site already (which would make the label redundant)
  * before, it was only checking for the situation in which a cross-crate macro *definition* span would be replaced with the invocation span, which both made the connection to redundancy unobvious, and didn't help with other redundancy (e.g. when the diagnostic was pointing to an argument inside the macro invocation)
  * this accounts for the remaining test changes, which I've first noticed in https://github.com/rust-lang/rust/pull/66364#discussion_r356135967 but only later understood as part of this PR (hence the "redundancy" descriptions)

This PR is not needed for #66364, but it would help, as after this PR there's only one `.span_to_filename(...).is_macros()` check (i.e. for `<... macros>` synthetic "files") left in `rustc_errors`, and it's much more self-contained.

r? @petrochenkov
2020-02-06 22:38:31 +01:00
Eduard-Mihai Burtescu
96af578cd9 tests: add a revision to macro_backtrace without -Zmacro-backtrace. 2020-02-06 21:46:42 +02:00
Eduard-Mihai Burtescu
4c7eb59e81 rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
Eduard-Mihai Burtescu
ab080973cb rustc_errors: hide "in this macro invocation" when redundant, more explicitly. 2020-02-06 21:32:07 +02:00
Eduard-Mihai Burtescu
5eaa9a150d rustc_errors: deduplicate the -Zmacro-backtrace suggestion message. 2020-02-06 21:32:07 +02:00
Eduard-Mihai Burtescu
f6fc80206e rustc: rename -Zexternal-macro-backtrace to -Zmacro-backtrace. 2020-02-06 21:32:07 +02:00
Eduard-Mihai Burtescu
8f286dbf27 rustc_errors: split macro backtrace rendering from <*macros> hacks. 2020-02-06 21:32:07 +02:00
Tom A. Wagner
d646463a45 Mark fn map_or() as eagerly evaluated.
In the docs for option.rs and result.rs, it is noted for all *_or()
functions that they are eagerly evaluated, except for the map_or()
function.
This commit adds this missing documentation to the two files.
2020-02-06 19:56:25 +01:00
John Kåre Alsaker
a575495acc Make krate private 2020-02-06 17:14:38 +01:00
bors
442ae7f040 Auto merge of #68893 - Dylan-DPC:rollup-3f2421a, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #68691 (Remove `RefCell` usage from `ObligationForest`.)
 - #68751 (Implement `unused_parens` for `const` and `static` items)
 - #68788 (Towards unified `fn` grammar)
 - #68837 (Make associated item collection a query)
 - #68842 (or_patterns: add regression test for #68785)
 - #68844 (use def_path_str for missing_debug_impls message)
 - #68845 (stop using BytePos for computing spans in librustc_parse/parser/mod.rs)
 - #68869 (clean up E0271 explanation)
 - #68880 (Forbid using `0` as issue number)

Failed merges:

r? @ghost
2020-02-06 15:43:00 +00:00
Yuki Okushi
64450ac765 Update E0565 examples 2020-02-07 00:01:41 +09:00
Dylan DPC
1ad674afcf
Rollup merge of #68880 - JohnTitor:issue-non-zero, r=Dylan-DPC
Forbid using `0` as issue number

Fixes #67496

r? @Centril
2020-02-06 15:37:51 +01:00
Dylan DPC
2210d3f356
Rollup merge of #68869 - GuillaumeGomez:err-explanation-e0271, r=Dylan-DPC
clean up E0271 explanation

r? @Dylan-DPC
2020-02-06 15:37:49 +01:00
Dylan DPC
ec24833325
Rollup merge of #68845 - dwrensha:fix-68783, r=estebank
stop using BytePos for computing spans in librustc_parse/parser/mod.rs

Computing spans using logic such as `self.token.span.lo() + BytePos(1)` can cause internal compiler errors like #68730 when non-ascii characters are given as input.

#68735 partially addressed this problem, but only for one case. Moreover, its usage of `next_point()` does not actually align with what `bump_with()` expects. For example, given the token `>>=`, we should pass the span consisting of the final two characters `>=`, but `next_point()` advances the span beyond the end of the `=`.

This pull request instead computes the start of the new span by doing `start_point(self.token.span).hi()`. This matches `self.token.span.lo() + BytePos(1)` in the common case where the characters are ascii, and it gracefully handles multibyte characters.

Fixes #68783.
2020-02-06 15:37:47 +01:00
Dylan DPC
16e4e8f2de
Rollup merge of #68844 - euclio:debug-impl-def-path, r=petrochenkov
use def_path_str for missing_debug_impls message

The lint message will now use the full, correct path to the `Debug`
trait, even in `no_std`.
2020-02-06 15:37:46 +01:00
Dylan DPC
226a8e2932
Rollup merge of #68842 - Centril:issue-68785, r=estebank
or_patterns: add regression test for #68785

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

(Fixed by https://github.com/rust-lang/rust/pull/67668.)

cc https://github.com/rust-lang/rust/issues/54883
r? @estebank
2020-02-06 15:37:44 +01:00
Dylan DPC
f6bfdf4620
Rollup merge of #68837 - jonas-schievink:assoc-item-lookup-2, r=estebank
Make associated item collection a query

Before this change, every time associated items were iterated over (which rustc does *a lot* – this can probably be further optimized), there would be N+1 queries to fetch all assoc. items. Now there's just one after they've been computed once.
2020-02-06 15:37:43 +01:00
Dylan DPC
424304a14f
Rollup merge of #68788 - Centril:unified-fn-bodies, r=petrochenkov
Towards unified `fn` grammar

Part of https://github.com/rust-lang/rust/pull/68728.

- Syntactically, `fn` items in `extern { ... }` blocks can now have bodies (`fn foo() { ... }` as opposed to `fn foo();`). As above, we use semantic restrictions instead.

- Syntactically, `fn` items in free contexts (directly in a file or a module) can now be without bodies (`fn foo();` as opposed to `fn foo() { ... }`. As above, we use semantic restrictions instead, including for non-ident parameter patterns.

- We move towards unifying the `fn` front matter; this is fully realized in https://github.com/rust-lang/rust/pull/68728.

r? @petrochenkov
2020-02-06 15:37:41 +01:00
Dylan DPC
bf13861e6c
Rollup merge of #68751 - Tyg13:unused_parens_const_static, r=Centril
Implement `unused_parens` for `const` and `static` items

Fixes #67942
2020-02-06 15:37:39 +01:00
Dylan DPC
a1478b7604
Rollup merge of #68691 - nnethercote:rm-RefCell-from-ObligationForest, r=nikomatsakis
Remove `RefCell` usage from `ObligationForest`.

It's not needed.

This doesn't affect performance, it just simplifies the code a little.

r? @nikomatsakis
2020-02-06 15:37:38 +01:00
Trevor Spiteri
534c3eaf28 error code examples: replace some more ignore with compile_fail
Now that compile_fail attempts a full build rather than
--emit=metadata, these errors should be caught by compile_fail and do
not need to be ignored.
2020-02-06 15:31:21 +01:00
Jonas Schievink
9d7b214ac6 Ignore panic-drops-resume.rs on wasm/emscripten
It does not have unwinding support
2020-02-06 15:00:36 +01:00
John Kåre Alsaker
dc4fd3d724 Comment tweaks 2020-02-06 14:14:50 +01:00
John Kåre Alsaker
623dcb02db Remove the Forest type 2020-02-06 13:41:37 +01:00
John Kåre Alsaker
20ce2f6038 Move the krate method to Hir and remove the Krate dep node 2020-02-06 13:23:32 +01:00
Jonas Schievink
732913afcb Clarify comment about _2 living across a yield 2020-02-06 12:34:31 +01:00
Jonas Schievink
84dd07a2c4 Simplify implicit resume argument 2020-02-06 12:27:35 +01:00
John Kåre Alsaker
513e326f5b Add a hir_krate query 2020-02-06 12:16:51 +01:00
John Kåre Alsaker
63980cd0fb Add a Hir wrapper type 2020-02-06 12:05:40 +01:00
bors
1f8df2508f Auto merge of #68664 - tspiteri:no_run-complete-build, r=nikomatsakis
rustdoc: attempt full build for compile_fail test

Some code fails when doing a full build but does not fail when only emitting metadata. This commit makes sure compile_fail tests for such code behave as expected, that is, the test succeeds because the compilation fails.

Fixes #67771.
2020-02-06 08:48:01 +00:00
Yuki Okushi
bf269335d0 Forbid using 0 as issue number 2020-02-06 16:19:39 +09:00
bors
333c32a5a4 Auto merge of #68583 - estebank:hrlt, r=oli-obk
Account for HR lifetimes when suggesting introduction of named lifetime

```
error[E0106]: missing lifetime specifier
 --> src/test/ui/suggestions/fn-missing-lifetime-in-item.rs:2:32
  |
2 | struct S2<F: Fn(&i32, &i32) -> &i32>(F);
  |                 ----  ----     ^ expected named lifetime parameter
  |
  = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2
  = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'a` lifetime
  |
2 | struct S2<F: for<'a> Fn(&'a i32, &'a i32) -> &'a i32>(F);
  |              ^^^^^^^    ^^^^^^^  ^^^^^^^     ^^^
help: consider introducing a named lifetime parameter
  |
2 | struct S2<'a, F: Fn(&'a i32, &'a i32) -> &'a i32>(F);=
  |           ^^^       ^^^^^^^  ^^^^^^^     ^^^
```

Follow up to #68267. Addresses the diagnostics part of #49287.
2020-02-06 05:19:52 +00:00