Commit graph

98487 commits

Author SHA1 Message Date
Mark Rousskov
57d57c6784 Mutate DocContext from LibEmbargoVisitor and RustdocVisitor
We have &mut access, so remove the RefCell borrowing
2019-08-26 18:51:34 -04:00
Mark Rousskov
e2b6f4c662 Move top-level Clean impl to function
This allows us to pass it a `&mut DocContext` which will allow removal
of RefCells, etc. in the following commits. It's also somewhat a unique
Clean impl in that it previously ignored `self` (re-retriveing
hir::Crate), which it no longer needs to do.
2019-08-26 18:51:34 -04:00
Mark Rousskov
a77247acb1 Move source HTML generation to own module 2019-08-26 18:51:34 -04:00
Vadim Petrochenkov
c476b55e52 proc_macro: Update Span::def_site to use the proc macro definition location
Which is no longer dummy and is available from metadata now.
2019-08-27 01:34:10 +03:00
Vadim Petrochenkov
2065ee9acc metadata: Eliminate FullProcMacro
Fix caching of loaded proc macros
2019-08-27 01:34:07 +03:00
Vadim Petrochenkov
52c62eaae4 Respect attributes on proc macro definitions 2019-08-27 01:33:13 +03:00
Mazdak Farrokhzad
9c5c124d78
Rollup merge of #63921 - RalfJung:file-check, r=alexcrichton
add link to FileCheck docs

Thanks @gnzlbg for pointing me to those docs.
2019-08-26 23:55:51 +02:00
Mazdak Farrokhzad
b005a89dae
Rollup merge of #63855 - killercup:refactor/feature-gates, r=Centril
Refactor feature gates

After #63824, this goes a few steps further by

- parsing doc comments in the macros to extract descriptions for feature gates, and
- introducing a common `Feature` type to replace the tuples used previously to improve readability.

The descriptions are not yet used, but I felt like this PR is a useful enough refactoring on its own.

r? @Centril
2019-08-26 23:55:49 +02:00
Mazdak Farrokhzad
59fa966a4d
Rollup merge of #63845 - DevQps:47091-remove-bad-example, r=nikomatsakis
Removed a confusing FnOnce example

# Description
See #47091 for a discussion.

## Changes
- Removed an example that might suggest readers that square_x is (only) FnOnce.

closes #47091
2019-08-26 23:55:47 +02:00
Mazdak Farrokhzad
9eeb7d566e
Rollup merge of #63836 - Wind-River:master_003, r=alexcrichton
VxWorks does not provide a way to set the task name except at creation time

Make set_name do thing as VxWorks does not provide a way to set the task name except at creation time.

r? @alexcrichton

cc @n-salim
2019-08-26 23:55:46 +02:00
Mazdak Farrokhzad
7dc3c934e8
Rollup merge of #63693 - Centril:polish-parse-or-pats, r=estebank
Fully implement or-pattern parsing

Builds upon the initial parsing in https://github.com/rust-lang/rust/pull/61708 to fully implement or-pattern (`p | q`) parsing as specified in [the grammar section of RFC 2535](https://github.com/rust-lang/rfcs/blob/master/text/2535-or-patterns.md#grammar).

Noteworthy:

- We allow or-patterns in `[p | q, ...]`.
- We allow or-patterns in `let` statements and `for` expressions including with leading `|`.
- We improve recovery for `p || q` (+ tests for that in `multiple-pattern-typo.rs`).
- We improve recovery for `| p | q` in inner patterns (tests in `or-patterns-syntactic-fail.rs`).
- We rigorously test or-pattern parsing (in `or-patterns-syntactic-{pass,fail}.rs`).
- We harden the feature gating tests.
- We do **_not_** change `ast.rs`. That is, `ExprKind::Let.0` and `Arm.pats` still accept `Vec<P<Pat>>`.
   I was starting work on that but it would be cleaner to do this in a separate PR so this one has a narrower scope.

cc @dlrobertson
cc the tracking issue https://github.com/rust-lang/rust/issues/54883.

r? @estebank
2019-08-26 23:55:44 +02:00
Mazdak Farrokhzad
44cfa7823d
Rollup merge of #63317 - estebank:dead-code, r=matthewjasper
Do not complain about unused code when used in `impl` `Self` type

Fix https://github.com/rust-lang/rust/issues/18290.
2019-08-26 23:55:42 +02:00
Vadim Petrochenkov
32e5acb3eb proc_macro: Turn quote into a regular built-in macro
Previously in was implemented using a special hack in the metadata loader
2019-08-27 00:37:13 +03:00
Vadim Petrochenkov
ec45b87957 resolve: Block expansion of a derive container until all its derives are resolved
Also mark derive helpers as known as a part of the derive container's expansion instead of expansion of the derives themselves which may happen too late.
2019-08-27 00:31:55 +03:00
Esteban Küber
7def99af8a review comment 2019-08-26 13:25:27 -07:00
Ralf Jung
04580b6235 adjust tests 2019-08-26 22:19:47 +02:00
Mazdak Farrokhzad
2bd27fbdfe parser: fix span for leading vert. 2019-08-26 22:14:31 +02:00
Ralf Jung
633f67ad74 add link to FileCheck docs 2019-08-26 20:40:30 +02:00
Ralf Jung
ae78862058 raw slices do not have to comply to the size limit 2019-08-26 20:14:58 +02:00
Lzu Tao
fa7ea104b2 Error when generator trait is not found 2019-08-26 17:51:52 +00:00
bors
9b91b9c10e Auto merge of #63901 - estebank:unknown-receiver-type, r=zackmdavis
Point at method call on missing annotation error

Make it clearer where the type name that couldn't be inferred comes from.

Before:

```
error[E0282]: type annotations needed
 --> src/test/ui/span/type-annotations-needed-expr.rs:2:13
  |
2 |     let _ = (vec![1,2,3]).into_iter().sum() as f64; //~ ERROR E0282
  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for `S`
  |
  = note: type must be known at this point
```
after
```
error[E0282]: type annotations needed
 --> src/test/ui/span/type-annotations-needed-expr.rs:2:39
  |
2 |     let _ = (vec![1,2,3]).into_iter().sum() as f64; //~ ERROR E0282
  |                                       ^^^ cannot infer type for `S`
  |
  = note: type must be known at this point
```

CC #63852.
2019-08-26 17:33:50 +00:00
bors
9fa8f14023 Auto merge of #63897 - petrochenkov:prettycomma, r=estebank
pprust: Do not print spaces before some tokens

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

r? @Mark-Simulacrum
2019-08-26 13:45:18 +00:00
Hristo Venev
c8a69e2567 ty: use Align for ReprOptions pack and align. 2019-08-26 13:16:28 +00:00
bors
555d7a2fd6 Auto merge of #63580 - wesleywiser:move_promoted_out, r=oli-obk
Move promoted MIR out of `mir::Body`

r? @oli-obk
2019-08-26 07:48:24 +00:00
bors
e2b4165a6c Auto merge of #62891 - vext01:improve-black-box-docs, r=RalfJung,Centril,gnzlbg
Improve the documentation for std::hint::black_box.

The other day a colleague was reviewing some of my code which was using `black_box` to block constant propogation. There was a little confusion because the documentation kind of implies that `black_box` is only useful for dead code elimination, and only in benchmarking scenarios.

The docs currently say:

> A function that is opaque to the optimizer, to allow benchmarks to pretend to use outputs to assist in avoiding dead-code elimination.

Here is our discussion, in which I show (using godbolt) that a black box can also block constant propagation:
https://github.com/softdevteam/yk/pull/21#discussion_r302985038

This change makes the docstring for `black_box` a little more general, and while we are here, I've added an example (the same one from our discussion).

![image](https://user-images.githubusercontent.com/604955/61701322-ddf1e400-ad35-11e9-878c-b5b44a20770c.png)

OK to go in?
2019-08-26 04:10:54 +00:00
Nathan
0e3bc62f39 Allow checking of both compile & run output for run-pass tests 2019-08-25 21:09:19 -04:00
bors
4c58535d09 Auto merge of #62603 - cuviper:no-unwind-abort, r=joshtriplett
Permit unwinding through FFI by default

This repeats #62505 for master (Rust 1.38+), as #58794 is not yet resolved. This is a stopgap until a stable alternative is available, like [RFC 2699](https://github.com/rust-lang/rfcs/pull/2699), as long as progress is being made to that end.

r? @joshtriplett
2019-08-26 00:27:17 +00:00
Esteban Küber
8458eba41b Point at method call on missing annotation error
Make it clearer where the type name that couldn't be infered comes from.
2019-08-25 13:39:11 -07:00
bors
521d784074 Auto merge of #61613 - sinkuu:impl_trait_inline, r=ollie27
Support `impl Trait` in inlined documentation

`impl Trait` in argument position was not properly rendered when inlined from other crates. ([a live example on docs.rs](https://docs.rs/libp2p/0.8.1/libp2p/floodsub/struct.Floodsub.html#method.unsubscribe))

![old](https://user-images.githubusercontent.com/7091080/59089838-14ba9900-8946-11e9-830b-53b317bdecb4.png)
↓
![new](https://user-images.githubusercontent.com/7091080/59089844-16845c80-8946-11e9-9fe3-8998af9d73ce.png)
2019-08-25 19:20:20 +00:00
Pascal Hertleif
94e8ff4f0b Refactor feature gate checking code
Tries to clarify the filtering of active features and make the code more
expressive.
2019-08-25 20:53:37 +02:00
Vadim Petrochenkov
5b7df0922e pprust: Do not print spaces before some tokens 2019-08-25 21:23:17 +03:00
Josh Stone
367b793790 Force #[unwind(aborts)] in test/codegen/c-variadic.rs 2019-08-25 09:47:50 -07:00
Josh Stone
d810e77f4e Revert "Allow a dirty MirBuilt for make_extern and make_method_extern"
This reverts commit b4a6f59793.
2019-08-25 09:47:50 -07:00
Mark Rousskov
39412ca969 Permit unwinding through FFI by default
See #58794 for context.
2019-08-25 09:47:50 -07:00
bors
b1522e6023 Auto merge of #63878 - phansch:update_clippy_submodule, r=Manishearth
submodules: update Clippy from 2bcb615 to 05f603e

changes: 2bcb615...05f603e

Should fix the Clippy toolstate.
2019-08-25 15:42:13 +00:00
Ralf Jung
0c1cb32b84 test for too long slices 2019-08-25 14:47:01 +02:00
Ralf Jung
96baf1c54e validate raw wide pointers 2019-08-25 14:27:35 +02:00
Ralf Jung
92e75c0f88 factor wide ptr metadata checking into separate method
also fat -> wide
2019-08-25 14:09:32 +02:00
Philipp Hansch
4f30d2ae5a
submodules: update clippy from 2bcb615594 to 05f603e6ce 2019-08-25 12:54:31 +02:00
Guillaume Gomez
fcbbf8d312 Fix system theme detection 2019-08-25 12:37:24 +02:00
Pascal Hertleif
c9d9616e82 Introduce and use Feature type for feature gates
This replaces the ad-hoc tuples used in the different feature gate files
and unifies their content into a common type, leading to more readable
matches and other good stuff that comes from having named fields. It
also contains the description of each feature as extracted from the doc
comment.
2019-08-25 11:07:16 +02:00
bors
d760df5aea Auto merge of #63874 - spastorino:places-drive-by-cleanups, r=Centril
Places drive by cleanups

Small fixes of things meanwhile I was doing the box part of Place 2.0, based on @centril reviews.
2019-08-25 08:06:06 +00:00
bors
783469ca09 Auto merge of #63862 - Centril:match-cleanup, r=oli-obk
typeck: refactor patterns => `pat.rs`  + make the `def_bm` algo more declarative

Spurred by the relative difficulty I had in working up an explanation of how default match bindings work in https://github.com/rust-lang/rust/pull/63118#issuecomment-524161584, this PR refactors the type checking of patterns into `pat.rs`.

The PR is probably best read commit-by-commit and includes various changes beyond the following, which are the most important highlights:

- The algorithm for determining `def_bm` is encoded in a more declarative fashion now with important sub-steps divided into functions that make sense as logical units (and as described in the reference). This is done starting with *"extract `is_no_ref_pat`."* to *"extract `calc_default_binding_mode`"*.

- Dedicated functions like `check_pat_{lit,range,ident,tuple,box,ref,slice}` are then introduced for the various kinds of patterns to make things overall more readable.

- `fn check_pat_top(...)` becomes the sole entry point to type checking patterns.

   This will take care of initializing the default binding mode (hence: `def_bm`) to `BindByValue` and is called by all contexts that have a pattern that needs to be type checked (functions, `match`, `if let`, `let`, ...). The overall result is that the notion of `def_bm` is internal to checking patterns.

- Various diagnostics are extracted to dedicated functions to disturb the flow of type checking logic less.

r? @oli-obk
2019-08-25 04:26:26 +00:00
Mazdak Farrokhzad
acb11305e8 parser: TopLevel -> RecoverComma. 2019-08-25 06:15:11 +02:00
Mazdak Farrokhzad
6a73199da6 or_patterns: add run-rustfix tests. 2019-08-25 05:45:51 +02:00
Mazdak Farrokhzad
1caaa40768 parser: gracefully handle fn foo(A | B: type). 2019-08-25 05:45:19 +02:00
Philip Craig
fbe3f3e98f debuginfo: give unique names to closure and generator types
Closure types have been moved to the namespace where they
are defined, and both closure and generator type names now
include the disambiguator.

This fixes an exception when lldb prints nested closures.

Fixes #57822
2019-08-25 13:12:24 +10:00
Santiago Pastorino
53f4734794
Add a period at the end of the sentence 2019-08-24 21:00:50 -04:00
Santiago Pastorino
717e8a5219
Join arms patterns, body is empty in all arms 2019-08-24 21:00:50 -04:00
Santiago Pastorino
59c063302f
Allow lifetime parameters to be inferred 2019-08-24 21:00:36 -04:00