Commit Graph

5315 Commits

Author SHA1 Message Date
Guillaume Gomez e365120243 Prevent invalid html characters in themes name 2019-11-18 16:43:48 +01:00
Guillaume Gomez f3e4279ccc Apply review comments 2019-11-18 16:43:47 +01:00
Guillaume Gomez dcccd28e42 Warn instead of failing for themes 2019-11-18 16:43:47 +01:00
Guillaume Gomez add6204484 Stabilize rustdoc theme options 2019-11-18 16:43:47 +01:00
Guillaume Gomez 00ef5c1b98 Fix selected crate search filter 2019-11-18 14:15:00 +01:00
bors d67ca28354 Auto merge of #66238 - ehuss:stabilize-rustdoc-edition, r=GuillaumeGomez
rustdoc: Stabilize `edition` annotation.

The rustdoc `edition` annotation is currently ignored on stable. This means that the tests will be ignored, unless there is a `rust` annotation, then it will use the global edition. I suspect this was just an oversight during the edition stabilization, but I don't know. Example:

```rust
/// ```edition2018
/// // This code block was ignored on stable.
/// ```

/// ```rust,edition2018
/// // This code block would use whatever edition is passed on the command line.
/// ```
```

AFAIK, it is not possible to write a test that verifies stable behavior, as all tests appear to set RUSTC_BOOTSTRAP which forces all tests to run as "nightly", even on a stable release.

Closes #65980
2019-11-18 03:06:42 +00:00
Yuki Okushi 6e6c46c694
Rollup merge of #66456 - Centril:driver-codes, r=Mark-Simulacrum
Move `DIAGNOSTICS` usage to `rustc_driver`

Remove `rustc_interface`'s dependency on `rustc_error_codes` and centralize all usages of `DIAGNOSTICS` in `rustc_driver`. Once we remove all references to `rustc_error_codes` in all other crates but `rustc_driver`, this should allow for incremental recompilation of the compiler to be smoother when tweaking error codes. This works towards https://github.com/rust-lang/rust/issues/66210#issuecomment-551862528.

(May include traces of minor drive-by cleanup.)

r? @Mark-Simulacrum
2019-11-17 13:36:18 +09:00
Mazdak Farrokhzad 8444e1628c move DIAGNOSTICS usage to rustc_driver 2019-11-16 02:32:33 +01:00
Mazdak Farrokhzad ae0c8b5f09
Rollup merge of #66427 - Mark-Simulacrum:errors-json, r=Centril
Move the JSON error emitter to librustc_errors

This is done both as a cleanup (it makes little sense for this emitter to be in libsyntax), but also as part of broader work to decouple Session from librustc itself.

Along the way, this also moves SourceMap to syntax_pos, which is also nice for the above reasons, as well as allowing dropping the SourceMapper trait from code. This had the unfortunate side-effect of moving `FatalError` to rustc_data_structures (it's needed in syntax_pos, due to SourceMap, but putting it there feels somehow worse).
2019-11-15 18:02:02 +01:00
Mark Rousskov c31a8754e3 Move JSON emitter to rustc_errors 2019-11-15 08:45:49 -05:00
Stefan Schindler 1bbb8168ec Prevent jumps when selecting one or many lines 2019-11-15 02:30:44 +01:00
Stefan Schindler 71cf364c3c Fix the source code highlighting on source comments 2019-11-15 02:02:09 +01:00
Stefan Schindler cee0403b5c Code cleanup to remove douplacte var definition
Also move the declaration outside the loop since they accumulate state with each iteration
2019-11-15 00:45:08 +01:00
Stefan Schindler e3afe6ac23 Remove unused argument 2019-11-15 00:27:53 +01:00
bors 5e380b797b Auto merge of #66233 - cjgillot:constkind, r=oli-obk
Split ConstValue into two enums

Hello,

Issue #59210 appeared abandoned, so I gave it a go.
Some further cleanup and refactoring may be mandated.

I did not test beyond `x.py check`, since my home computer dies compiling librustc.

Fixes #59210
2019-11-14 04:54:51 +00:00
bors 3f07f1cd78 Auto merge of #66211 - kinnison:kinnison/fix-66159, r=GuillaumeGomez
Fix ICE when documentation includes intra-doc-link

When collecting intra-doc-links we could trigger the loading of extra crates into the crate store due to name resolution finding crates referred to in documentation but not in code.  This might be due to
configuration differences or simply referring to something else.

This would cause an ICE because the newly loaded crate metadata existed in a crate store associated with the rustdoc global context, but the resolver had its own crate store cloned just before the documentation processing began and as such it could try and look up crates in a store which lacked them.

In this PR, I add support for `--extern-private` to the `rustdoc` tool so that it is supported for `compiletest` to then pass the crates in; and then I fix the issue by forcing the resolver to look over all the crates before we then lower the input ready for processing into documentation.

The first commit (the `--extern-private`) could be replaced with a commit which adds support for `--extern` to `compiletest` if preferred, though I think that adding `--extern-private` to `rustdoc` is more useful anyway since it makes the CLI a little more like `rustc`'s which might help reduce surprise for someone running it by hand or in their own test code.

The PR is meant to fix #66159 though it may also fix #65840.

cc @GuillaumeGomez
2019-11-13 23:22:03 +00:00
Yuki Okushi c75a48a924
Rollup merge of #66297 - vakaras:edit-queries, r=oli-obk
Add a callback that allows compiler consumers to override queries.

This pull request adds an additional callback that allows compiler consumers such as Prusti and MIRAI to override queries. My hope is that in this way it will be possible to get access to the internal compiler information (e.g. borrow checker) without major changes to the compiler.

This pull request is work in progress because I am still testing if I can get the information which I need.

cc @nikomatsakis

r? @oli-obk
2019-11-13 22:09:22 +09:00
Yuki Okushi 6eea5001b5
Rollup merge of #66166 - GuillaumeGomez:rename-rustdoc-to-doc, r=QuietMisdreavus
rename cfg(rustdoc) into cfg(doc)

Needed by https://github.com/rust-lang/rust/pull/61351

r? @QuietMisdreavus
2019-11-13 22:09:13 +09:00
Camille GILLOT 3ebfa1856e Rename in librustdoc. 2019-11-12 20:50:47 +01:00
Yuki Okushi 4134a4acf5
Rollup merge of #66299 - rossmacarthur:fix-41260-avoid-issue-0, r=varkor
support issue = "none" in unstable attributes

This works towards fixing #41260.

This PR allows the use of `issue = "none"` in unstable attributes and makes changes to internally store the issue number as an `Option<NonZeroU32>`. For example:

```rust
#[unstable(feature = "unstable_test_feature", issue = "none")]
fn unstable_issue_none() {}
```

It was not made optional because feedback seen here #60860 suggested that people might forget the issue field if it was optional.

I could not remove the current uses of `issue = "0"` (of which there are a lot) because the stage 0 compiler expects the old syntax. Once this is available in the stage 0 compiler we can replace all uses of `"0"` with `"none"` and no longer allow `"0"`. This is my first time contributing, so I'm not sure what the protocol is with two-part things like this, so some guidance would be appreciated.

r? @varkor
2019-11-12 16:36:16 +09:00
Vytautas Astrauskas f9f5a88bc4 Add a callback that allows compiler consumers to override queries. 2019-11-11 19:29:34 +01:00
Ross MacArthur 3ba8257253 support issue = "none" in unstable attributes
- Use `Option<NonZeroU32>` to represent issue numbers.
2019-11-11 19:33:30 +02:00
bors 56237d75b4 Auto merge of #66252 - cjgillot:trees, r=oli-obk
Merge repeated definitions

Step forward on #66149

I may need further context to understand the need for a separate crate.

Also, please tell me if you think of other definitions to merge.
2019-11-11 14:05:43 +00:00
Camille GILLOT ed640c6a27 Merge hir::Mutability into ast::Mutability. 2019-11-10 12:21:05 +01:00
Mazdak Farrokhzad 4ae2728fa8 move syntax::parse -> librustc_parse
also move MACRO_ARGUMENTS -> librustc_parse
2019-11-10 03:57:18 +01:00
Mazdak Farrokhzad be023ebe85 move config.rs to libsyntax_expand 2019-11-10 02:46:17 +01:00
Eric Huss 1907589fbb rustdoc: Stabilize `edition` annotation. 2019-11-08 16:15:17 -08:00
Mazdak Farrokhzad 27511b22df hir::MethodSig -> hir::FnSig 2019-11-08 09:32:20 +01:00
Mazdak Farrokhzad 30d7279628 hir::ItemKind::Fn: use hir::MethodSig 2019-11-08 09:32:20 +01:00
Daniel Silverstone 33ded3ec7f
rustdoc: Deliberately load extern crates before processing docs
In order that we can successfully later resolve paths in crates
which weren't loaded as a result of merely parsing the crate
we're documenting, we force the resolution of the path to each
crate before cloning the resolver to use later.  Closes #66159

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-11-08 07:41:40 +00:00
Daniel Silverstone 2c33568a77
rustdoc: Support --extern-private but treat as --extern
This makes `rustdoc` support `--extern-private` but treats it
the same as `--extern` which is useful for making the CLI more
similar to `rustc` to ease test suite integration.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-11-08 07:31:24 +00:00
Yuki Okushi 392ebad5c6
Rollup merge of #66123 - GuillaumeGomez:no-more-hidden-elements, r=Dylan-DPC
No more hidden elements

Fixes #66046.

Follow-up of #66082.

r? @kinnison
2019-11-08 13:42:19 +09:00
bors d2574403b3 Auto merge of #64882 - ehuss:stabilize-bare-extern, r=eddyb
Stabilize --extern flag without a path.

This stabilizes the `--extern` flag without a path, implemented in #54116.

This flag is used to add a crate that may be found in the search path to the extern prelude. The intent of stabilizing this now is to change Cargo to emit this flag for `proc_macro` when building a proc-macro crate. This will allow the ability to elide `extern crate proc_macro;` for proc-macros, one of the few places where it is still necessary.

It is intended that Cargo may also use this flag for other cases in the future as part of the [std-aware work](https://github.com/rust-lang/wg-cargo-std-aware/). There will likely be some kind of syntax where users may declare dependencies on other crates (such as `alloc`), and Cargo will use this flag so that they may be used like any other crate. At this time there are no short-term plans to use it for anything other than proc-macro.

This will not help for non-proc-macro crates that use `proc_macro`, which I believe is not too common?

An alternate approach for proc-macro is to use the `meta` crate, but from my inquiries there doesn't appear to be anyone interested in pushing that forward. The `meta` crate also doesn't help with things like `alloc` or `test`.

cc #57288
2019-11-08 01:15:50 +00:00
Eric Huss 4bf411ea6d Update built-in help for --extern. 2019-11-07 05:51:17 -08:00
Eric Huss b47e3d8fe4 Stabilize --extern flag without a path. 2019-11-07 05:51:17 -08:00
Mazdak Farrokhzad 28c1136970
Rollup merge of #65916 - Centril:split-syntax-3, r=davidtwco
syntax: move stuff around

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

r? @davidtwco
cc @estebank @petrochenkov
2019-11-07 14:27:23 +01:00
Mazdak Farrokhzad 59e79ff137
Rollup merge of #64696 - GuillaumeGomez:rustdoc-sub-settings, r=kinnison
[rustdoc] add sub settings

This PR is to give a finer control over what types are automatically expanded or not as well as the possibility to add sub-settings in the settings page.

![Screenshot from 2019-09-23 00-46-14](https://user-images.githubusercontent.com/3050060/65395521-15aff300-dd9c-11e9-9437-429ca347d455.png)

r? @Mark-Simulacrum
2019-11-07 14:27:21 +01:00
Mazdak Farrokhzad 27f97aa468 move syntax::parse::lexer::comments -> syntax::util::comments 2019-11-07 13:59:13 +01:00
Mazdak Farrokhzad 9d6768a478 syntax::parser::token -> syntax::token 2019-11-07 13:50:12 +01:00
Guillaume Gomez d4527b7e00 Only call onHashChange instead of both functions 2019-11-07 10:39:53 +01:00
Guillaume Gomez 24e093c5c3 Remove old isHidden function 2019-11-07 10:13:44 +01:00
Mazdak Farrokhzad d7f1406378
Rollup merge of #59789 - eddyb:typeck-reverts, r=nikomatsakis
Revert two unapproved changes to rustc_typeck.

There was a breakdown in process (https://github.com/rust-lang/rust/pull/59004#issuecomment-477600735, https://github.com/rust-lang/rust/pull/58894#discussion_r272795560) and two changes were made to `rustc_typeck`'s "collect" queries, for rustdoc, that were neither needed *nor* correct.
I'm reverting them here, and will fix up rustdoc *somehow*, if necessary.

cc @rust-lang/compiler How do we ensure this doesn't happen again?

r? @nikomatsakis or @oli-obk
2019-11-07 08:51:52 +01:00
Guillaume Gomez 0282c27781 rename cfg(rustdoc) into cfg(doc) 2019-11-06 18:32:51 +01:00
Nicholas Nethercote eea6f23a0e Make doc comments cheaper with `AttrKind`.
`AttrKind` is a new type with two variants, `Normal` and `DocComment`. It's a
big performance win (over 10% in some cases) because `DocComment` lets doc
comments (which are common) be represented very cheaply.

`Attribute` gets some new helper methods to ease the transition:
- `has_name()`: check if the attribute name matches a single `Symbol`; for
  `DocComment` variants it succeeds if the symbol is `sym::doc`.
- `is_doc_comment()`: check if it has a `DocComment` kind.
- `{get,unwrap}_normal_item()`: extract the item from a `Normal` variant;
  panic otherwise.

Fixes #60935.
2019-11-06 23:05:07 +11:00
Guillaume Gomez f66a331335 When a URL hash refers to a hidden element, it makes the element visible 2019-11-06 10:10:56 +01:00
Mazdak Farrokhzad a0b4b4dafa
Rollup merge of #65776 - nnethercote:rename-LocalInternedString-and-more, r=estebank
Rename `LocalInternedString` and more

This PR renames `LocalInternedString` as `SymbolStr`, removes an unnecessary `impl` from it, improves comments, and cleans up some `SymbolStr` uses.

r? @estebank
2019-11-06 07:03:01 +01:00
Mazdak Farrokhzad f5c54896b9
Rollup merge of #66068 - euclio:null-emitter, r=estebank
use silent emitter for rustdoc highlighting pass

Partially addresses #63284.
2019-11-06 03:28:11 +01:00
Guillaume Gomez 1c78af7de2 clean highlightSourceLines code 2019-11-04 13:28:50 +01:00
Guillaume Gomez 8784b074e7 Change sub-setting CSS class to sub-settings 2019-11-04 11:39:00 +01:00
Andy Russell d06a4ded13
use silent emitter for rustdoc highlighting pass 2019-11-03 22:19:34 -05:00
bors 0d5264a03c Auto merge of #65780 - GuillaumeGomez:move-help-popup-generation-code, r=Mark-Simulacrum
Move help popup generation code

The first commit is just a small cleanup.

The idea behind this PR is to reduce a bit more the generated HTML files by moving the duplicated code into one place instead.

r? @kinnison
2019-11-03 21:55:48 +00:00
Eduard-Mihai Burtescu 9e528ffe9c Revert "Greatly improve generics handling in rustdoc search"
This reverts commit 64382f4b78.
2019-11-03 10:17:06 +02:00
Nicholas Nethercote b9cef6984b Simplify various `Symbol` use points.
Including removing a bunch of unnecessary `.as_str()` calls, and a bunch
of unnecessary sigils.
2019-11-02 09:01:02 +11:00
Nicholas Nethercote 5bc7084f7e Convert `x.as_str().to_string()` to `x.to_string()` where possible. 2019-11-02 09:01:00 +11:00
Daniel Silverstone c24a099e8b
rustdoc: Resolve module-level doc references more locally
Module level docs should resolve intra-doc links as locally as
possible.  As such, this commit alters the heuristic for finding
intra-doc links such that we attempt to resolve names mentioned
in *inner* documentation comments within the (sub-)module rather
that from the context of its parent.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-10-31 07:49:54 +00:00
Tyler Mandry c4960c2602
Rollup merge of #65741 - GuillaumeGomez:help-popup, r=Dylan-DPC
Prevent help popup to disappear when clicking on it

Fixes #65736.

r? @kinnison
2019-10-29 12:01:37 -07:00
Guillaume Gomez 79956b96e8 add sub settings in rustdoc 2019-10-29 13:54:11 +01:00
Mazdak Farrokhzad fb12c70852 rustc, rustc_passes: don't depend on syntax_expand.
This is done by moving some data definitions to syntax::expand.
2019-10-27 17:05:57 +01:00
Guillaume Gomez 91ef9600db reduce size of generated HTML files by moving the popup helper code to the JS 2019-10-27 11:42:38 +01:00
Guillaume Gomez 1d2808341a Cleanup search element getter 2019-10-27 11:40:47 +01:00
bors fae75cd216 Auto merge of #65167 - hermitcore:rusty-hermit, r=alexcrichton
Redesign the interface to the unikernel HermitCore

We are developing the unikernel HermitCore, where the kernel is written in Rust and is already part of the Rust Standard Library. The interface between the standard library and the kernel based on a small C library. With this pull request, we remove completely the dependency to C and use lld as linker. Currently, the kernel will be linked to the application as static library, which is published at https://github.com/hermitcore/libhermit-rs.

We don’t longer support the C interface to the kernel. Consequently, we remove this part from the Rust Standard Library.
2019-10-26 19:35:59 +00:00
Guillaume Gomez 1f25fd74a0 Add more information on search 2019-10-26 12:59:54 +02:00
Guillaume Gomez 863796be7d Improve help popup detection 2019-10-25 13:43:25 +02:00
Mazdak Farrokhzad cbcbba24ac
Rollup merge of #65789 - Centril:with-desugared-doc, r=davidtwco
move Attribute::with_desugared_doc to librustdoc

From https://github.com/rust-lang/rust/pull/65324.

r? @varkor
2019-10-25 13:12:54 +02:00
Mazdak Farrokhzad 07b5c2a46e
Rollup merge of #65740 - GuillaumeGomez:fix-disable-shortcut-feature, r=Dylan-DPC
Fix default "disable-shortcuts" feature value

Follow-up of https://github.com/rust-lang/rust/pull/65656

It fixes the bad handling of the default value of the feature (which would disable shortcut by default, which is bad!).

r? @Dylan-DPC
cc @kinnison
2019-10-25 13:12:51 +02:00
Mazdak Farrokhzad 9e3e3a470e
with_desugared_doc: correctly refer to `attr` instead of `self`
Co-Authored-By: David Wood <Q0KPU0H1YOEPHRY1R2SN5B5RL@david.davidtw.co>
2019-10-25 10:43:08 +02:00
Stefan Lankes d349e32fc7 Merge branch 'master' into rusty-hermit, resolve conflicts 2019-10-25 09:09:55 +02:00
Mazdak Farrokhzad 0a5b38f9c3 move Attribute::with_desugared_doc to librustdoc 2019-10-25 04:38:42 +02:00
Guillaume Gomez e836b1b9d0 Prevent help popup to disappear when clicking on it 2019-10-24 22:52:54 +02:00
Vadim Petrochenkov 3534ca8f49 Turn crate store into a resolver output 2019-10-24 20:54:16 +03:00
Vadim Petrochenkov fb353f050a resolve: Privatize all resolver fields 2019-10-24 20:51:33 +03:00
Guillaume Gomez 01a1bcb7f9 Fix default "disable-shortcuts" feature value 2019-10-24 00:25:04 +02:00
Mazdak Farrokhzad a649b1666c
Rollup merge of #65657 - nnethercote:rm-InternedString-properly, r=eddyb
Remove `InternedString`

This PR removes `InternedString` by converting all occurrences to `Symbol`. There are a handful of places that need to use the symbol chars instead of the symbol index, e.g. for stable sorting; local conversions `LocalInternedString` is used in those places.

r? @eddyb
2019-10-23 22:19:19 +02:00
Mazdak Farrokhzad 7c043e284a
Rollup merge of #65193 - Mark-Simulacrum:lockless-lintstore, r=nikomatsakis
Lockless LintStore

This removes mutability from the lint store after registration. Each commit stands alone, for the most part, though they don't make sense out of sequence.

The intent here is to move LintStore to a more parallel-friendly architecture, although also just a cleaner one from an implementation perspective. Specifically, this has the following changes:
 * We no longer implicitly register lints when registering lint passes
    * For the most part this means that registration calls now likely want to call something like:
       `lint_store.register_lints(&Pass::get_lints())` as well as `register_*_pass`.
    * In theory this is a simplification as it's much easier for folks to just register lints and then have passes that implement whichever lint however they want, rather than necessarily tying passes to lints.
 * Lint passes still have a list of associated lints, but a followup PR could plausibly change that
   * This list must be known for a given pass type, not instance, i.e., `fn get_lints()` is the signature instead of `fn get_lints(&self)` as before.
 * We do not store pass objects, instead storing constructor functions. This means we always get new passes when running lints (this happens approximately once though for a given compiler session, so no behavior change is expected).
 * Registration API is _much_ simpler: generally all functions are just taking `Fn() -> PassObject` rather than several different `bool`s.
2019-10-23 22:19:10 +02:00
Yuki Okushi 1df9081413
Rollup merge of #65706 - popzxc:add-missing-space, r=Mark-Simulacrum
Add missing space in librustdoc

It just hurts my eyes...

r? @Centril
2019-10-23 17:14:47 +09:00
Yuki Okushi 88e3ae2eb4
Rollup merge of #65656 - GuillaumeGomez:option-disable-shortcut, r=Dylan-DPC
Add option to disable keyboard shortcuts in docs

Fixes #65211.

r? @Manishearth
2019-10-23 17:14:37 +09:00
Igor Aleksanov 8497f793d5 Add missing space in librustdoc 2019-10-22 20:14:34 +03:00
Stefan Lankes ddcd157d03
Merge branch 'master' into rusty-hermit 2019-10-22 19:01:09 +02:00
Mazdak Farrokhzad 9072e108b5
Rollup merge of #65647 - nnethercote:rm-unnecessary-traits, r=Centril
Remove unnecessary trait bounds and derivations

This PR removes unnecessary trait bounds and derivations from many types.

r? @nikomatsakis
2019-10-21 22:00:50 +02:00
Trevor Spiteri ea9519bf16 Update Source Code Pro and include italics 2019-10-21 16:25:03 +02:00
Nicholas Nethercote ac6daed384 Remove many unnecessary trait derivations. 2019-10-21 20:59:18 +11:00
Guillaume Gomez 87744841c8 Add option to disable keyboard shortcuts in docs 2019-10-21 11:36:52 +02:00
Nicholas Nethercote 78c3427308 Remove unnecessary `impl Clean<String> for InternedString`. 2019-10-21 11:33:52 +11:00
Nicholas Nethercote 02edd14cde Convert some `InternedString`s to `Symbols`.
This avoids the needs for various conversions, and makes the code
slightly faster, because `Symbol` comparisons and hashing is faster.
2019-10-21 11:31:02 +11:00
Mazdak Farrokhzad 194d1935d3
Rollup merge of #65314 - tmiasko:rustdoc-z, r=ollie27
rustdoc: forward -Z options to rustc

Currently rustdoc does not forward `-Z` options to rustc when building
test executables. This makes impossible to use rustdoc to run test
samples when crate under test is instrumented with one of sanitizers
`-Zsanitizer=...`, since the final linking step will not include
sanitizer runtime library.

Forward `-Z` options to rustc to solve the issue.

Helps with #43031.
2019-10-21 01:39:11 +02:00
Stefan Lankes b6801b7dcd
Merge branch 'master' into rusty-hermit 2019-10-20 10:48:58 +02:00
Mark Rousskov bc3ed3241b Preserve whitespace inside one-backtick codeblocks
Previously this was only done inside short docblocks (e.g., summary
lines), but we should also do so in general.
2019-10-19 19:21:31 -04:00
Mazdak Farrokhzad d945f9860f move parse_cfgspecs to rustc_interface 2019-10-19 13:25:46 +02:00
Tyler Mandry bc85061203
Rollup merge of #65535 - eddyb:sliced-predicates, r=nikomatsakis
rustc: arena-allocate the slice in `ty::GenericsPredicate`, not the whole struct.

While rebasing #59789 I noticed we can do this now. However, it doesn't help much without changing `inferred_outlives_of` to the same type, which I might try next.
2019-10-18 13:48:34 -07:00
Eduard-Mihai Burtescu cd9e4441eb rustc: arena-allocate the slice in `ty::GenericsPredicate`, not the whole struct. 2019-10-18 03:14:57 +03:00
Mark Rousskov 6be0a7081a Update API to be more compatible with plugin needs
Move to using Box<dyn Fn() -> ...> so that we can let plugins register
state.

This also adds a callback that'll get called from plugin registration so
that Clippy and other tools can register lints without using the plugin
API. The plugin API still works, but this new API is more compatible
with drivers other than rustc.
2019-10-17 19:41:21 -04:00
Mark Rousskov 7fef39791a Make get_lints be a static function
This moves from calling get_lints on instantiated pass objects to the
raw object
2019-10-17 19:16:41 -04:00
Mazdak Farrokhzad accc6e7e4a
Rollup merge of #65465 - Centril:split-syntax-1, r=petrochenkov
Move syntax::ext to a syntax_expand and refactor some attribute logic

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

r? @petrochenkov
2019-10-17 13:46:11 +02:00
Thomas Lively 2bf59bea48 Upgrade Emscripten targets to use upstream LLVM backend
- Compatible with Emscripten 1.38.46-upstream or later upstream.
 - Refactors the Emscripten target spec to share code with other wasm
   targets.
 - Replaces the old incorrect wasm32 C call ABI with the correct one,
   preserving the old one as wasm32_bindgen_compat for wasm-bindgen
   compatibility.
 - Updates the varargs ABI used by Emscripten and deletes the old one.
 - Removes the obsolete wasm32-experimental-emscripten target.
 - Uses EMCC_CFLAGS on CI to avoid the timeout problems with #63649.
2019-10-16 17:06:48 -07:00
Mazdak Farrokhzad d420d719c4 move syntax::ext to new crate syntax_expand 2019-10-16 10:59:53 +02:00
Mazdak Farrokhzad ae156a56d4 syntax::parse::sess -> syntax::sess 2019-10-15 09:41:58 +02:00
Mazdak Farrokhzad 2800bc240e
Rollup merge of #65363 - Centril:less-pprust, r=Mark-Simulacrum
Remove implicit dependencies on syntax::pprust

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

The main goal here is to facilitate the eventual move of pprust out from libsyntax and because an AST definition typically should not depend on its pretty printer.

r? @estebank
2019-10-14 07:36:57 +02:00
Mazdak Farrokhzad 742ec4b9bf ast: remove implicit pprust dependency via Display.
Instead just use `pprust::path_to_string(..)` where needed.

This has two benefits:

a) The AST definition is now independent of printing it.
   (Therefore we get closer to extracting a data-crate.)

b) Debugging should be easier as program flow is clearer.
2019-10-13 06:58:51 +02:00
bors 80b861bed1 Auto merge of #64873 - popzxc:prettify-test-time, r=wesleywiser
Enhance report-time option

## Short overview

This PR is a follow-up to a previously closed #64714 PR.

## Changes introduced by this PR

* `libtest` now retrieves the type of the test within `TestDesc` (available types are: `UnitTest`, `IntegrationTest`, `DocTest`, `Unknown`).
* `--report-time` subcommand of the `libtest` now supports colored output (disabled by default).
* Colorized output depends on the threshold values. Default values (proposed by @wesleywiser):
  - For unit-tests: 50ms warn/100ms critical,
  - For integration-tests: 500ms warn/1000ms critical,
  - For doctests: same as for integration tests,
  - For unknown tests: `TEST_WARN_TIMEOUT_S` warn/ `TEST_WARN_TIMEOUT_S * 2` critical (it will only applied single-threaded mode, because otherwise test will be interrupted after reaching `TEST_WARN_TIMEOUT_S`).
  - These values can be overrided by setting environment variables (since those thresholds are somewhat constant for every project, it's more flexible to use environment variables than command line arguments).
* New optional flag `--ensure-test-time` for `libtest`. With this flag applied, exectuion time limit excesss will cause test failure.

## What have not been done

There was a comment that it would be nice to have an entry in the Cargo book about it.

However, changes introduced by this PR (and #64663 in which `report-time` flag was added) aren't related directly to `cargo`, it's more about `libtest` itself.
I'm considering that [The Unstable Book](https://doc.rust-lang.org/unstable-book/) is more appropriate place, but not sure if I'm right (and if so, how exactly it should be described).

As one possible option, this PR may be merged without denoting it in the documentation, and in the next PR adding support of this feature to the `cargo` itself, I'll add a note in the Cargo book.

## Scope of this PR

Logical scope of this PR is `libtest` only. However, to get test types, I had to modify also `libsyntax_ext` and `librustdoc` for them to provide information about test type.

## Rationale

Rationale for colored output was submitted in #64714

Providing the information about kind of test was also proposed in #64714, and as an additional benefit this information may be useful for the tools using `libtest` (e.g. `cargo`).

Adding flag to treat time limits excess seems logical to me, so projects that do care about test execution time won't have to invent a wheel.

## Backward compatibility

All the changes are completely backward compatible.

## Demo

![rustc_enhanced_time](https://user-images.githubusercontent.com/12111581/65818381-c04f6800-e219-11e9-9875-322463abe24f.gif)

r? @wesleywiser
2019-10-12 23:47:27 +00:00
bors 152527f443 Auto merge of #65190 - GuillaumeGomez:dont-pass-doctest-feature-by-default, r=Mark-Simulacrum
Don't pass doctest feature by default

As asked in https://github.com/rust-lang/rust/pull/63803#issuecomment-539064434.

r? @QuietMisdreavus
2019-10-12 11:39:20 +00:00
Tomasz Miąsko 5db17335a1 rustdoc: forward -Z options to rustc
Currently rustdoc does not forward `-Z` options to rustc when building
test executables. This makes impossible to use rustdoc to run test
samples when crate under test is instrumented with one of sanitizers
`-Zsanitizer=...`, since the final linking step will not include
sanitizer runtime library.

Forward `-Z` options to rustc to solve the issue.

Helps with #43031.
2019-10-11 22:29:11 +02:00
Guillaume Gomez 169a1cac8d Don't pass doctest feature by default 2019-10-10 11:37:13 +02:00
Jon Gjengset 45aca119a6
Stabilize mem::take (mem_take)
Tracking issue: https://github.com/rust-lang/rust/issues/61129
2019-10-08 18:04:18 -04:00
Josh Stone 33c4125fbe Rebase rustc-rayon on rayon-1.2
See also https://github.com/rust-lang/rustc-rayon/pull/3
2019-10-07 13:20:17 -07:00
Tyler Mandry c071083732
Rollup merge of #65155 - Avi-D-coder:fix-lints, r=Mark-Simulacrum
Use shorthand initialization in rustdoc

This just fixes a few lints I rust-analyzer was showing. Is this sort of PR useful? Should the lints be fixed as apart of the otherwise unrelated PR I was working on?
2019-10-06 11:41:59 -07:00
Stefan Lankes c1e440a90f redesign of the interface to the unikernel HermitCore
- the old interface between HermitCore and the Rust Standard Library
  based on a small C library (newlib)
- remove this interface and call directly the unikernel
- remove the dependency to the HermitCore linker
- use rust-lld as linker
2019-10-06 15:26:14 +00:00
Avi Dessauer c087111345 Use shorthand initialization in rustdoc 2019-10-06 03:42:53 -04:00
Tyler Mandry 69598dc3cf
Rollup merge of #65151 - tmandry:revert-emscripten-upgrade, r=tmandry
Revert #63649 - "Upgrade Emscripten targets to use upstream LLVM backend"

This change caused the runtime of the linux-asmjs builder to nearly double from 2+ hours to about 4 hours, which happens to be the bors timeout. (It made it in barely under 4 hours when it was merged.) This is causing timeouts on all new changes.

This reverts commit 7870050796, reversing
changes made to 2e7244807a.
2019-10-05 21:55:13 -07:00
Tyler Mandry 008526340a
Rollup merge of #64708 - SimonSapin:option-deref, r=Centril
Stabilize `Option::as_deref` and `Option::as_deref_mut`

The tracking issue https://github.com/rust-lang/rust/issues/50264 still has unresolved question for the corresponding `Result` methods.
2019-10-05 21:54:47 -07:00
Tyler Mandry d16b7f705b Revert "Auto merge of #63649 - tlively:emscripten-upstream-upgrade, r=alexcrichton"
This reverts commit 7870050796, reversing
changes made to 2e7244807a.
2019-10-05 21:38:45 -07:00
bors 7870050796 Auto merge of #63649 - tlively:emscripten-upstream-upgrade, r=alexcrichton
Upgrade Emscripten targets to use upstream LLVM backend

 - Refactors the Emscripten target spec to share code with other wasm
   targets.
 - Replaces the incorrect wasm32 C call ABI with the old asmjs
   version, which is correct for both wasm32 and JS.
 - Updates the varargs ABI used by Emscripten and deletes the old one.
 - Removes the obsolete wasm32-experimental-emscripten target.
 - Temporarily makes Emscripten targets use panic=abort by default
   because supporting unwinding will require an LLVM patch.
2019-10-04 20:33:02 +00:00
bors 2e7244807a Auto merge of #64994 - GuillaumeGomez:fix-rustdoc-display-js-disabled, r=Mark-Simulacrum
Fix rustdoc display with js disabled

Fixes #64988.

Currently, all sections are collapsed when the page is loading, and then is displayed once done. However, if js is disabled, they never get expanded. Therefore, they need to be shown by default.

r? @Mark-Simulacrum
2019-10-04 12:17:13 +00:00
Thomas Lively 9a55103b98 Upgrade Emscripten targets to use upstream LLVM backend
- Refactors the Emscripten target spec to share code with other wasm
   targets.
 - Replaces the incorrect wasm32 C call ABI with the old asmjs
   version, which is correct for both wasm32 and JS.
 - Updates the varargs ABI used by Emscripten and deletes the old one.
 - Removes the obsolete wasm32-experimental-emscripten target.
 - Temporarily makes Emscripten targets use panic=abort by default
   because supporting unwinding will require an LLVM patch.
2019-10-04 00:47:21 -07:00
Tyler Mandry 69837b14d6
Rollup merge of #64741 - GuillaumeGomez:prevent-rustdoc-feature-doctests, r=QuietMisdreavus
Prevent rustdoc feature doctests

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

cc @ollie27
2019-10-03 16:25:41 -07:00
Mazdak Farrokhzad 1c8ef985f2
Rollup merge of #64948 - GuillaumeGomez:improve-sidebar-styling, r=Mark-Simulacrum
Improve sidebar styling to make its integration easier

Part of https://github.com/rust-lang/docs.rs/issues/417

Setting the height was an error: forcing the element bottom to be at the bottom allows to change to top of the sidebar.

r? @Mark-Simulacrum
2019-10-02 18:24:35 +02:00
Guillaume Gomez de961a7e12 Fix rustdoc display with js disabled 2019-10-02 14:21:25 +02:00
Guillaume Gomez 445e7350f2 Prevent rustdoc feature to be passed down to doctests 2019-10-01 14:38:36 +02:00
Guillaume Gomez 4aa526f809 Improve sidebar styling to make its integration easier 2019-10-01 10:32:45 +02:00
bors 22bc9e1d9c Auto merge of #64778 - csmoe:index, r=eddyb
Introduce librustc_index crate

Closes #50592
2019-09-30 13:33:15 +00:00
Oliver Middleton dc295318fc rustdoc: Fix default logo filename 2019-09-29 22:17:03 +01:00
Igor Aleksanov 75a297573f Enhance report-time option 2019-09-29 21:22:30 +03:00
csmoe 64f61c7888 remove indexed_vec re-export from rustc_data_structures 2019-09-29 16:48:31 +00:00
Eduard-Mihai Burtescu a88d181a02 rustc: rely on c_variadic == true instead of CVarArgs in HIR/Ty fn signatures. 2019-09-28 17:39:00 +03:00
Eduard-Mihai Burtescu 7683d1c3aa rustc: don't store a lifetime in hir::TyKind::CVarArgs. 2019-09-28 17:39:00 +03:00
bors a37fe2de69 Auto merge of #63937 - Nashenas88:rustdoc_57180, r=GuillaumeGomez
Fix ICE in rustdoc when merging generic and where bounds of an Fn with an output

Fixes #57180
2019-09-27 13:51:25 +00:00
varkor 80b63ddca5 Fix librustcdoc test 2019-09-27 01:37:14 +01:00
varkor 38121173e2 Rename `MetaItem.node` to `MetaItem.kind` 2019-09-26 18:21:48 +01:00
varkor b474867961 Rename `ForeignItem.node` to `ForeignItem.kind` 2019-09-26 18:21:48 +01:00
varkor 7bc94cc3c2 Rename `Item.node` to `Item.kind` 2019-09-26 18:21:48 +01:00
varkor c3d8791373 Rename `Ty.node` to `Ty.kind` 2019-09-26 18:21:10 +01:00
varkor d4573c9c1e Rename `TraitItem.node` to `TraitItem.kind` 2019-09-26 18:21:09 +01:00
varkor 17726f6b52 Rename `Lit.node` to `Lit.kind` 2019-09-26 18:21:09 +01:00
varkor ce6aabbaa1 Rename `ImplItem.node` to `ImplItem.kind` 2019-09-26 18:21:09 +01:00
varkor 8bd0382134 Rename `Pat.node` to `Pat.kind` 2019-09-26 18:21:09 +01:00
bors ddf43867a9 Auto merge of #64515 - varkor:kindedterm, r=oli-obk
Rename `subst::Kind` to `subst::GenericArg`

And `subst::UnpackedKind` to `subst::GenericArgKind`. Individual variable names (e.g. `kind`) are not renamed, which would be an infeasible mission.

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

r? @eddyb
2019-09-26 12:34:54 +00:00
varkor e3fb05dc3c Rename some `_sty` variables to `_kind` 2019-09-26 12:10:43 +01:00
varkor bea3d67c77 Rename `subst::Kind` to `subst::GenericArg` 2019-09-26 11:48:05 +01:00
bors 134004f74d Auto merge of #62661 - arielb1:never-reserve, r=nikomatsakis
reserve `impl<T> From<!> for T`

this is necessary for never-type stabilization.

cc #57012 #35121

I think we wanted a crater run for this @nikomatsakis?

r? @nikomatsakis
2019-09-26 08:42:34 +00:00
bors dc45735f29 Auto merge of #64513 - varkor:sty-begone, r=eddyb
Rename `TyS.sty` to `TyS.kind`

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

r? @eddyb
2019-09-26 04:29:18 +00:00
varkor e2e0f9af85 Rename `sty` to `kind` 2019-09-25 15:50:04 +01:00
Mark Rousskov f359a94849 Snap cfgs to new beta 2019-09-25 08:42:46 -04:00
Mazdak Farrokhzad 34067ee961
Rollup merge of #64599 - csmoe:doc_async_reexport, r=nikomatsakis
Rustdoc render async function re-export

Closes #63710
r? @nikomatsakis
2019-09-25 03:48:27 +02:00
Mazdak Farrokhzad 4a58b14db5
Rollup merge of #64443 - Mark-Simulacrum:rustdoc-clean-1, r=GuillaumeGomez
rustdoc: general cleanup

Review should be conducted commit-by-commit.

There are some general cleanup commits in the end, which are somewhat related but can be easily split into another PR, so just let me know.
2019-09-24 23:45:20 +02:00
Ariel Ben-Yehuda 1ec7ae14fa resolve the rustc_reservation_impl attribute in 1 place 2019-09-24 21:11:50 +03:00
Simon Sapin 0797712e29 Stabilize Option::deref and Option::deref_mut
The tracking issue https://github.com/rust-lang/rust/issues/50264
still has unresolved question for the corresponding `Result` methods.
2019-09-23 17:14:26 +02:00
Mark Rousskov 059163fad7 Remove needless `mut` in paths 2019-09-23 07:48:24 -04:00
Mark Rousskov cac7e5faed Remove unused arguments 2019-09-23 07:48:24 -04:00
Mark Rousskov 53acfc3f8a Utilize shared error codes rather than re-querying env 2019-09-23 07:48:24 -04:00
Mark Rousskov 583a81dc5e Remove pointless or 2019-09-23 07:48:24 -04:00
Mark Rousskov 61f16920b3 Remove needless Rc<RefCell<...>> 2019-09-23 07:48:24 -04:00