Commit graph

127204 commits

Author SHA1 Message Date
Jubilee Young
797cb9526a Fix to libstd test 2020-09-15 08:47:20 -07:00
Jubilee Young
247b73939a Move Wrapping<T> ui tests into library 2020-09-15 07:15:59 -07:00
bors
57c5f40cf4 Auto merge of #75740 - GuillaumeGomez:stabilize-doc-alias-feature, r=ollie27
Stabilize doc_alias feature

Fixes #50146.

This PR intend to stabilize the `doc_alias` feature. The last remaining bits were missing checks on the attribute usage and on its arguments. Both have been added so I think we can now move to the next step.

r? `@ollie27`

cc `@rust-lang/rustdoc`
2020-09-14 10:56:30 +00:00
Guillaume Gomez
d069c7e928 Stabilize doc_alias feature 2020-09-14 11:03:47 +02:00
bors
356d8ad1a3 Auto merge of #76571 - lzutao:rustdoc-private-traits, r=jyn514
Ignore rustc_private items from std docs

By ignoring rustc_private items for non local impl block,
this may fix #74672 and fix #75588 .

This might suppress #76529 if it is simple enough for backport.
2020-09-14 08:25:41 +00:00
bors
b5f55b7e15 Auto merge of #76549 - ehuss:lints-comments, r=wesleywiser
Auto-generate lint documentation.

This adds a tool which will generate the lint documentation in the rustc book automatically. This is motivated by keeping the documentation up-to-date, and consistently formatted. It also ensures the examples are correct and that they actually generate the expected lint. The lint groups table is also auto-generated. See https://github.com/rust-lang/compiler-team/issues/349 for the original proposal.

An outline of how this works:
- The `declare_lint!` macro now accepts a doc comment where the documentation is written. This is inspired by how clippy works.
- A new tool `src/tools/lint-docs` scrapes the documentation and adds it to the rustc book during the build.
    - It runs each example and verifies its output and embeds the output in the book.
    - It does a few formatting checks.
    - It verifies that every lint is documented.
- Groups are collected from `rustc -W help`.

I updated the documentation for all the missing lints. I have also added an "Explanation" section to each lint providing a reason for the lint and suggestions on how to resolve it.

This can lead towards a future enhancement of possibly showing these docs via the `--explain` flag to make them easily accessible and discoverable.
2020-09-14 05:54:44 +00:00
bors
56d8a933b3 Auto merge of #76195 - lcnr:const-Self, r=varkor
allow concrete self types in consts

This is quite a bad hack to fix #75486. There might be a better way to check if the self type depends on generic parameters, but I wasn't able to come up with one.

r? `@varkor` cc `@petrochenkov`
2020-09-14 04:07:08 +00:00
bors
0b65a3d0a6 Auto merge of #76123 - tmiasko:inline-args-storage, r=wesleywiser
inliner: Emit storage markers for introduced arg temporaries

When introducing argument temporaries during inlining, emit storage
marker statements just before the assignment and in the beginning of
the return block.

This ensures that such temporaries will not be considered live across
yield points after inlining inside a generator.

Fixes #71793.
2020-09-14 02:13:02 +00:00
bors
1eb00abf35 Auto merge of #76656 - jonas-schievink:fewer-unstable-metadata-queries, r=lcnr
Don't query stability data when `staged_api` is off

This data only needs to be encoded when `#![feature(staged_api)]` or `-Zforce-unstable-if-unmarked` is on. Running these queries takes measurable time on large crates with many items, so skip it when the unstable flags have not been enabled.
2020-09-14 00:26:43 +00:00
bors
f9a322a6fd Auto merge of #76678 - jonas-schievink:rollup-vzl9yhx, r=jonas-schievink
Rollup of 12 pull requests

Successful merges:

 - #75559 (unions: test move behavior of non-Copy fields)
 - #76441 (Note that parallel-compiler = true causes tests to fail)
 - #76527 (Remove internal and unstable MaybeUninit::UNINIT.)
 - #76629 (Simplify iter zip struct doc)
 - #76640 (Simplify SyncOnceCell's `take` and `drop`.)
 - #76646 (Add mailmap entry)
 - #76651 (Remove Windows details from Unix and VmWorks symlink() docstrings)
 - #76663 (Simplify iter chain struct doc)
 - #76665 (slice::from_raw_parts: explicitly mention that data must be initialized)
 - #76667 (Fix CI LLVM to work on NixOS out of the box)
 - #76668 (Add visualization of rustc span in doc)
 - #76677 (note that test_stable_pointers does not reflect a stable guarantee)

Failed merges:

r? `@ghost`
2020-09-13 22:34:09 +00:00
Bastian Kauschke
90dd798cf5 bless tests 2020-09-13 23:02:43 +02:00
Bastian Kauschke
c552717e9d review, improve note span 2020-09-13 22:53:51 +02:00
Bastian Kauschke
e5b82a56c5 allow concrete self types in consts 2020-09-13 22:53:51 +02:00
Jonas Schievink
fe716d0447
Rollup merge of #76677 - RalfJung:stable-pointers, r=jonas-schievink
note that test_stable_pointers does not reflect a stable guarantee

Just to be sure...
2020-09-13 20:21:24 +02:00
Jonas Schievink
7b7f6f919d
Rollup merge of #76668 - pickfire:patch-9, r=jonas-schievink
Add visualization of rustc span in doc

It took me quite some time to figure out what Span::to means.
A picture is worth a thousand words.
2020-09-13 20:21:22 +02:00
Jonas Schievink
51cf121e6d
Rollup merge of #76667 - matklad:patch-llvm, r=Mark-Simulacrum
Fix CI LLVM to work on NixOS out of the box

r? @Mark-Simulacrum

Tested locally, seems to work!
2020-09-13 20:21:20 +02:00
Jonas Schievink
305d63c2a4
Rollup merge of #76665 - RalfJung:slice-from-raw, r=sfackler
slice::from_raw_parts: explicitly mention that data must be initialized

This reflects the status quo, until the discussion in https://github.com/rust-lang/unsafe-code-guidelines/issues/77 reaches a conclusion.
2020-09-13 20:21:19 +02:00
Jonas Schievink
11a63bcdde
Rollup merge of #76663 - pickfire:patch-7, r=jonas-schievink
Simplify iter chain struct doc
2020-09-13 20:21:17 +02:00
Jonas Schievink
e460f8508e
Rollup merge of #76651 - nicholasbishop:bishop-remove-windows-note, r=Mark-Simulacrum
Remove Windows details from Unix and VmWorks symlink() docstrings

This note is not relevant to other operating systems.
2020-09-13 20:21:16 +02:00
Jonas Schievink
3d0ac15958
Rollup merge of #76646 - CDirkx:mailmap, r=Mark-Simulacrum
Add mailmap entry
2020-09-13 20:21:14 +02:00
Jonas Schievink
f9b9467866
Rollup merge of #76640 - fusion-engineering-forks:synconcecell-drop, r=matklad
Simplify SyncOnceCell's `take` and `drop`.

Prevents copies by using `assume_init_read` and `assume_init_drop`.
2020-09-13 20:21:13 +02:00
Jonas Schievink
148b24f796
Rollup merge of #76629 - pickfire:patch-4, r=jonas-schievink
Simplify iter zip struct doc
2020-09-13 20:21:11 +02:00
Jonas Schievink
e5389a4a34
Rollup merge of #76527 - fusion-engineering-forks:cleanup-uninit, r=jonas-schievink
Remove internal and unstable MaybeUninit::UNINIT.

Looks like it is no longer necessary, as `uninit_array()` can be used instead in the few cases where it was needed.

(I wanted to just add `#[doc(hidden)]` to remove clutter from the documentation, but looks like it can just be removed entirely.)
2020-09-13 20:21:09 +02:00
Jonas Schievink
581524e537
Rollup merge of #76441 - jyn514:parallel, r=jonas-schievink
Note that parallel-compiler = true causes tests to fail

Mentioning #75760.
2020-09-13 20:21:07 +02:00
Jonas Schievink
409eb89b3b
Rollup merge of #75559 - RalfJung:union-test-move, r=joshtriplett
unions: test move behavior of non-Copy fields

This test ensures the behaviors suggested by @petrochenkov [here](https://github.com/rust-lang/rust/issues/32836#issuecomment-242511491).
2020-09-13 20:21:05 +02:00
Eric Huss
49a61f59df Make const_evaluatable_unchecked lint example not depend on the architecture pointer size. 2020-09-13 11:13:59 -07:00
Ralf Jung
71a5c464d1 note that test_stable_pointers does not reflect a stable guarantee 2020-09-13 18:55:08 +02:00
bors
7402a39447 Auto merge of #76244 - vandenheuvel:remove__paramenv__def_id, r=nikomatsakis
Removing the `def_id` field from hot `ParamEnv` to make it smaller

This PR addresses https://github.com/rust-lang/rust/issues/74865.
2020-09-13 16:28:22 +00:00
Ralf Jung
5dfe015ba5 rebase fallout 2020-09-13 18:15:19 +02:00
Eric Huss
c04973585d Support ignore for lint examples. 2020-09-13 08:48:03 -07:00
Eric Huss
ce014be0b9 Link rustdoc lint docs to the rustdoc book. 2020-09-13 08:48:03 -07:00
Eric Huss
45c1e0ae07 Auto-generate lint documentation. 2020-09-13 08:48:03 -07:00
Ralf Jung
e55896aff7 make union-drop mem::forget test meaningful 2020-09-13 16:13:20 +02:00
Ralf Jung
0ea53f9901 please tidy 2020-09-13 16:13:20 +02:00
Ralf Jung
c95fa0ac76 unions: test move behavior of non-Copy fields 2020-09-13 16:13:20 +02:00
bors
a055c5a1bd Auto merge of #76623 - slightlyoutofphase:master, r=jyn514
Use `is_unstable_const_fn` instead of `is_min_const_fn` in rustdoc where appropriate

This closes #76501. Specifically, it allows for nightly users with the `#![feature(const_fn)]` flag enabled to still have their `const fn` declarations documented as such, while retaining the desired behavior that rustdoc *not* document functions that have the `rustc_const_unstable` attribute as `const`.
2020-09-13 13:36:31 +00:00
Ivan Tham
5dc9790e10
Add visualization of rustc span in doc
It took me quite some time to figure out what Span::to means.
A picture is worth a thousand words.
2020-09-13 20:48:15 +08:00
Aleksey Kladov
cf0720146e Fix CI LLVM to work on NixOS out of the box 2020-09-13 14:47:15 +02:00
Ralf Jung
46767b1665 slice::from_raw_parts: explicitly mention that data must be initialized 2020-09-13 14:02:01 +02:00
Ivan Tham
20a2e095ec
Simplify iter chain struct doc 2020-09-13 19:20:57 +08:00
bors
17d3277064 Auto merge of #76598 - ad-anssi:diagnostic_errors_fix, r=estebank
Fixing memory exhaustion when formatting short code suggestion

Details can be found in issue #76597. This PR replaces substractions with `saturating_sub`'s to avoid usize wrapping leading to memory exhaustion when formatting short suggestion messages.
2020-09-13 11:08:41 +00:00
bors
b6c84553c4 Auto merge of #76658 - Aaron1011:fix/encode-dummy-loc-span, r=lcnr
Properly encode spans with a dummy location and non-root `SyntaxContext`

Previously, we would throw away the `SyntaxContext` of any span with a
dummy location during metadata encoding. This commit makes metadata Span
encoding consistent with incr-cache Span encoding - an 'invalid span'
tag is only used when it doesn't lose any information.
2020-09-13 09:18:14 +00:00
bors
4e48010b95 Auto merge of #76588 - guswynn:debug_logging, r=jyn514,Mark-Simulacrum
Add a dedicated debug-logging option to config.toml

`@Mark-Simulacrum` and I were talking in zulip and we found that turning on debug/trace logging in rustc is fairly confusing, as it effectively depends on debug-assertions and is not documented as such. `@Mark-Simulacrum` mentioned that we should probably have a separate option for logging anyways.

this diff adds that, having the option follow debug-assertions (so everyone's existing config.toml should be fine) and if the option is false

to test I ran ./x.py test <something> twice, once with `debug-logging = false` and once with `debug-logging = true` and made sure i only saw trace's when it was true
2020-09-13 07:21:31 +00:00
Lzu Tao
c743fc4342 Ignore rustc_private items from std docs
Apply suggestions from code review

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-13 05:30:49 +00:00
Lzu Tao
7dd4582f95 Add ui test for 74672 and 76571
These tests will fall without the next commit.
2020-09-13 05:27:10 +00:00
bors
dd33766e4a Auto merge of #76585 - Aaron1011:ignore-vert-plus, r=petrochenkov
Ignore `|` and `+` tokens during proc-macro pretty-print check

Fixes #76182

This is an alternative to PR #76188

These tokens are not preserved in the AST in certain cases
(e.g. a leading `|` in a pattern or a trailing `+` in a trait bound).

This PR ignores them entirely during the pretty-print/reparse check
to avoid spuriously using the re-parsed tokenstream.
2020-09-13 05:16:36 +00:00
Aaron Hill
a67d248b13
Properly encode spans with a dummy location and non-root SyntaxContext
Previously, we would throw away the `SyntaxContext` of any span with a
dummy location during metadata encoding. This commit makes metadata Span
encoding consistent with incr-cache Span encoding - an 'invalid span'
tag is only used when it doesn't lose any information.
2020-09-12 23:26:17 -04:00
bors
04b72b4697 Auto merge of #76349 - Mark-Simulacrum:dl-llvm, r=alexcrichton
Download LLVM from CI to bootstrap (linux-only to start)

This follows #76332, adding support for using CI-built LLVM rather than building it locally. This should essentially "just work," but is left off by default in this PR.

While we can support downloading LLVM for multiple host triples, this currently only downloads it for the build triple. That said, it should be possible to expand this relatively easily should multiple host triples be desired. Most people shouldn't be adjusting host/target triples though, so this should cover most use cases.

Currently this downloads LLVM for the last bors-authored commit in the `git log`. This is a bit suboptimal -- we want the last bors-authored commit that touched the llvm-project submodule in basically all cases. But for now this just adds an extra ~20 MB download when rebasing atop latest master. Once we have a submodule bump landing after #76332, we can fix this behavior to reduce downloads further.
2020-09-13 02:16:18 +00:00
bors
498dab0256 Auto merge of #76306 - tmiasko:nrvo-debuginfo, r=ecstatic-morse
NRVO: Allow occurrences of the return place in var debug info

The non-use occurrence of the return place in var debug info does not
currently inhibit NRVO optimization, but it will fail assertion in
`visit_place` when optimization is performed.

Relax assertion check to allow the return place in var debug info.

This case might be impossible to hit in optimization pipelines as of
now, but can be encountered in customized mir-opt-level=2 pipeline with
copy propagation disabled. For example in:

```rust
pub fn b(s: String) -> String {
    a(s)
}

#[inline]
pub fn a(s: String) -> String {
    let x = s;
    let y = x;
    y
}
```
2020-09-13 00:33:04 +00:00
Jonas Schievink
a447c21afa Don't query unstable data when staged_api is off 2020-09-13 02:10:39 +02:00