Commit graph

153781 commits

Author SHA1 Message Date
Jakub Beránek
ccd550ee56
[rustdoc] Wrap code blocks in <code> tag 2021-08-19 10:30:08 +02:00
Michael Watzko
742d450783 Add and use saturating_div instead of impl inside Saturating 2021-08-19 10:08:58 +02:00
Michael Watzko
8049230852 Saturate negative division 2021-08-19 09:59:05 +02:00
bors
4968a8bbd1 Auto merge of #87986 - Aaron1011:incr-double-panic, r=estebank
Prevent double panic when handling incremental fingerprint mismatch

When an incremental fingerprint mismatch occurs, we debug-print
our `DepNode` and query result. Unfortunately, the debug printing
process may cause us to run additional queries, which can result
in a re-entrant fingerprint mismatch error.

To avoid a double panic, this commit adds a thread-local variable
to detect re-entrant calls.
2021-08-19 06:27:17 +00:00
Joshua Nelson
18f0f242e1 Give precedence to html_root_url over --extern-html-root-url by default, but add a way to opt-in to the previous behavior
## What is an HTML root url?

It tells rustdoc where it should link when documentation for a crate is
not available locally; for example, when a crate is a dependency of a
crate documented with `cargo doc --no-deps`.

 ## What is the difference between `html_root_url` and `--extern-html-root-url`?

Both of these tell rustdoc what the HTML root should be set to.
`doc(html_root_url)` is set by the crate author, while
`--extern-html-root-url` is set by the person documenting the crate.
These are often different. For example, docs.rs uses
`--extern-html-root-url https://docs.rs/crate-name/version` to ensure
all crates have documentation, even if `html_root_url` is not set.
Conversely, crates such as Rocket set `doc(html_root_url =
"https://api.rocket.rs")`, because they prefer users to view the
documentation on their own site.

Crates also set `html_root_url` to ensure they have
documentation when building locally when offline. This is unfortunate to
require, because it's more work from the library author. It also makes
it impossible to distinguish between crates that want to be viewed on a
different site (e.g. Rocket) and crates that just want documentation to
be visible offline at all (e.g. Tokio). I have authored a separate
change to the API guidelines to no longer recommend doing this:
https://github.com/rust-lang/api-guidelines/pull/230.

 ## Why change the default?

In the past, docs.rs has been the main user of `--extern-html-root-url`.
However, it's useful for other projects as well. In particular, Cargo
wants to pass it by default when running `--no-deps`
(https://github.com/rust-lang/cargo/issues/8296).

Unfortunately, for these other use cases, the priority order is
inverted. They want to give *precedence* to the URL the crate picks, and
only fall back to the `--extern-html-root` if no `html_root_url` is
present. That allows passing `--extern-html-root` unconditionally,
without having to parse the source code to see what attributes are
present.

For docs.rs, however, we still want to keep the old behavior, so that
all links on docs.rs stay on the site.
2021-08-19 05:11:22 +00:00
bors
ad1eaffc7e Auto merge of #88143 - GuillaumeGomez:rollup-sgh318f, r=GuillaumeGomez
Rollup of 10 pull requests

Successful merges:

 - #87818 (Fix anchors display in rustdoc)
 - #87983 (Use more accurate spans when proposing adding lifetime to item)
 - #88012 (Change WASI's `RawFd` from `u32` to `c_int` (`i32`).)
 - #88031 (Make `BuildHasher` object safe)
 - #88036 (Fix dead code warning when inline const is used in pattern)
 - #88082 (Take into account jobs number for rustdoc GUI tests)
 - #88109 (Fix environment variable getter docs)
 - #88111 (Add background-color on clickable definitions in source code)
 - #88129 (Fix dataflow graphviz bug, make dataflow graphviz modules public)
 - #88136 (Move private_unused.rs test to impl-trait)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-08-19 03:45:50 +00:00
bors
6d300391ed Auto merge of #87818 - GuillaumeGomez:anchors-display-rustdoc, r=camelid
Fix anchors display in rustdoc

Fixes https://github.com/rust-lang/rust/issues/87611 (it simplifies the positioning and fix the background).

![Screenshot from 2021-08-06 16-47-03](https://user-images.githubusercontent.com/3050060/128531105-61d1c21f-4a4d-4d68-aedf-9bfe0332f8ae.png)
![Screenshot from 2021-08-06 16-47-10](https://user-images.githubusercontent.com/3050060/128531109-b2ea8065-10b0-4400-9507-322122e42e78.png)
![Screenshot from 2021-08-06 16-47-14](https://user-images.githubusercontent.com/3050060/128531111-8a17cbdb-29e8-4baa-a0d6-81aa4f6ac6ed.png)

r? `@camelid`
2021-08-19 01:05:03 +00:00
Vadim Petrochenkov
1fdea560d2 rustc_privacy: Replace HirIds and DefIds with LocalDefIds where possible 2021-08-19 00:01:12 +03:00
Ellen
0d9ea42579 add tests 2021-08-18 21:15:33 +01:00
Guillaume Gomez
9bbb57c6ab
Rollup merge of #88136 - spastorino:fix-test-directory, r=oli-obk
Move private_unused.rs test to impl-trait

This test was added to fix this issue #55124 which is about impl traits but not related with type alias impl traits.

r? `@oli-obk`

`@bors` rollup=always
2021-08-18 19:55:06 +02:00
Guillaume Gomez
e2271cd422
Rollup merge of #88129 - willcrichton:expose-graphviz-modules, r=ecstatic-morse
Fix dataflow graphviz bug, make dataflow graphviz modules public

I'm working on a rustc plugin that uses the dataflow framework for MIR analysis. I've found the graphviz utilities extremely helpful for debugging. However, I had to fork the compiler to expose them since they're currently private. I would appreciate if they could be made public so I can build against a nightly instead of a custom fork. Specifically, this PR:

* Makes public the `rustc_mir::dataflow::framework::graphviz` module.
* Makes public the `rustc_mir::util::pretty::write_mir_fn` function.

Here's a concrete example of how I'm using the graphviz module: 97b843b8b0/src/slicing/mod.rs (L186-L203)

Additionally, this PR fixes a small bug in the diff code that incorrectly shows the updated object as the old object.

r? `@ecstatic-morse`
2021-08-18 19:55:04 +02:00
Guillaume Gomez
75c6a9190d
Rollup merge of #88111 - GuillaumeGomez:background-color-jump-to-def, r=jhpratt
Add background-color on clickable definitions in source code

Someone suggested to add a decoration on clickable elements in the source code pages:

![Screenshot from 2021-08-17 14-49-39](https://user-images.githubusercontent.com/3050060/129728911-def74f9e-50e2-40d2-b512-e23f1b3d0409.png)
![Screenshot from 2021-08-17 14-49-47](https://user-images.githubusercontent.com/3050060/129728925-14aec500-82ff-4336-955a-4173c769deeb.png)
![Screenshot from 2021-08-17 14-49-52](https://user-images.githubusercontent.com/3050060/129728927-a8a89d7a-e837-4ff5-b094-35be23629d14.png)

The idea is to not disturb the reading while telling the reader "you can click on this one", which is why it's not a text decoration.

What do you think `@rust-lang/rustdoc` ?

r? `@Nemo157`
2021-08-18 19:55:03 +02:00
Guillaume Gomez
fbaa4a2a17
Rollup merge of #88109 - inquisitivecrystal:env-docs, r=m-ou-se
Fix environment variable getter docs

`@RalfJung` pointed out a number of errors and suboptimal choices I made in my documentation for #86183. This PR should (hopefully) fix the problems they've identified.
2021-08-18 19:55:02 +02:00
Guillaume Gomez
fe025a71a1
Rollup merge of #88082 - GuillaumeGomez:rustdoc-gui-jobs-opt, r=dns2utf8
Take into account jobs number for rustdoc GUI tests

Fixes #88054.

r? `@Mark-Simulacrum`
2021-08-18 19:55:00 +02:00
Guillaume Gomez
016f691068
Rollup merge of #88036 - nbdd0121:const3, r=petrochenkov
Fix dead code warning when inline const is used in pattern

Fixes #78171
2021-08-18 19:54:59 +02:00
Guillaume Gomez
9b7c771713
Rollup merge of #88031 - ibraheemdev:build-hasher-object-safe, r=m-ou-se
Make `BuildHasher` object safe

Resolves #87991
2021-08-18 19:54:57 +02:00
Guillaume Gomez
627bc60702
Rollup merge of #88012 - sunfishcode:sunfishcode/wasi-raw-fd-c-int, r=alexcrichton
Change WASI's `RawFd` from `u32` to `c_int` (`i32`).

WASI previously used `u32` as its `RawFd` type, since its "file descriptors"
are unsigned table indices, and there's no fundamental reason why WASI can't
have more than 2^31 handles.

However, this creates myriad little incompability problems with code
that also supports Unix platforms, where `RawFd` is `c_int`. While WASI
isn't a Unix, it often shares code with Unix, and this difference made
such shared code inconvenient. #87329 is the most recent example of such
code.

So, switch WASI to use `c_int`, which is `i32`. This will mean that code
intending to support WASI should ideally avoid assuming that negative file
descriptors are invalid, even though POSIX itself says that file descriptors
are never negative.

This is a breaking change, but `RawFd` is considerd an experimental
feature in [the documentation].

[the documentation]: https://doc.rust-lang.org/stable/std/os/wasi/io/type.RawFd.html

r? `@alexcrichton`
2021-08-18 19:54:56 +02:00
Guillaume Gomez
7449c6edf9
Rollup merge of #87983 - estebank:smaller-lt-spans, r=oli-obk
Use more accurate spans when proposing adding lifetime to item
2021-08-18 19:54:55 +02:00
Guillaume Gomez
e89c7d0b2f
Rollup merge of #87818 - GuillaumeGomez:anchors-display-rustdoc, r=camelid
Fix anchors display in rustdoc

Fixes https://github.com/rust-lang/rust/issues/87611 (it simplifies the positioning and fix the background).

![Screenshot from 2021-08-06 16-47-03](https://user-images.githubusercontent.com/3050060/128531105-61d1c21f-4a4d-4d68-aedf-9bfe0332f8ae.png)
![Screenshot from 2021-08-06 16-47-10](https://user-images.githubusercontent.com/3050060/128531109-b2ea8065-10b0-4400-9507-322122e42e78.png)
![Screenshot from 2021-08-06 16-47-14](https://user-images.githubusercontent.com/3050060/128531111-8a17cbdb-29e8-4baa-a0d6-81aa4f6ac6ed.png)

r? `@camelid`
2021-08-18 19:54:54 +02:00
bors
3d0774d0dc Auto merge of #86700 - lqd:matthews-nll-hrtb-errors, r=nikomatsakis
Matthew's work on improving NLL's "higher-ranked subtype error"s

This PR rebases `@matthewjasper's` [branch](https://github.com/matthewjasper/rust/tree/nll-hrtb-errors) which has great work to fix the obscure higher-ranked subtype errors that are tracked in #57374.

These are a blocker to turning full NLLs on, and doing some internal cleanups to remove some of the old region code.

The goal is so `@nikomatsakis` can take a look at this early, and I'll then do my best to help do the changes and followup work to land this work, and move closer to turning off the migration mode.

I've only updated the branch and made it compile, removed a warning or two.

r? `@nikomatsakis`

(Here's the [zulip topic to discuss this](https://rust-lang.zulipchat.com/#narrow/stream/122657-t-compiler.2Fwg-nll/topic/.2357374.3A.20improving.20higher-ranked.20subtype.20errors.20via.20.2386700) that Niko wanted)
2021-08-18 15:54:59 +00:00
lcnr
3329f67f17 marker_traits: require EvaluatedToOk 2021-08-18 16:34:54 +02:00
Esteban Kuber
9349046ed5 review comment: use newtype to deduplicate logic 2021-08-18 14:05:15 +00:00
bors
29d61427ac Auto merge of #88127 - ehuss:update-cargo, r=ehuss
Update cargo

8 commits in b51439fd8b505d4800a257acfecf3c69f81e35cf..e96bdb0c3d0a418e7fcd7fbd69be08abf830b4bc
2021-08-09 18:40:05 +0000 to 2021-08-17 22:58:47 +0000
- Support using rustbot to ping the Windows group (rust-lang/cargo#9802)
- Show information about abnormal `fix` errors. (rust-lang/cargo#9799)
- Bump jobserver. (rust-lang/cargo#9798)
- Render build-std web links as hyperlinks (rust-lang/cargo#9795)
- Teach cargo to failfast on recursive/corecursive aliases (rust-lang/cargo#9791)
- Fix value-after-table error with profiles. (rust-lang/cargo#9789)
- Fix plugin registrar change. (rust-lang/cargo#9790)
- Ability to specify the output name for a bin target different from the crate name (rust-lang/cargo#9627)
2021-08-18 13:24:17 +00:00
Santiago Pastorino
dcb97b6b3c
Move private_unused.rs test to impl-trait 2021-08-18 09:11:43 -03:00
Esteban Kuber
12a776b41d review comment: reduce duplication 2021-08-18 11:29:29 +00:00
Guillaume Gomez
dc24f02bc4 Fix anchors display in rustdoc 2021-08-18 13:27:45 +02:00
Charles Lew
e1e0989a0d Add a new test case to verify behavior. 2021-08-18 19:02:28 +08:00
bors
ba8cda2fa2 Auto merge of #87781 - est31:remove_box, r=oli-obk
Remove box syntax from compiler and tools

Removes box syntax from the compiler and tools. In #49733, the future of box syntax is uncertain and the use in the compiler was listed as one of the reasons to keep it. Removal of box syntax [might affect the code generated](https://github.com/rust-lang/rust/pull/49646#issuecomment-379219615) and slow down the compiler so I'd recommend doing a perf run on this.
2021-08-18 10:43:27 +00:00
Esteban Kuber
14add46e94 Use more accurate spans when proposing adding lifetime to item 2021-08-18 10:25:15 +00:00
Ryan Levick
d70056e30c Error when warnings lint group is used with force-warn 2021-08-18 11:53:59 +02:00
Ryan Levick
0d2fd70dab Improve force-warn tests 2021-08-18 11:05:59 +02:00
bors
896f058f13 Auto merge of #87985 - nbdd0121:asm, r=Amanieu
Forbid `!` from being used in `asm!` output

Fixes #87802

r? `@Amanieu`
2021-08-18 08:14:16 +00:00
Rémy Rakic
8343806ff5 add fixme about the type_op_normalize query in NLL HRTB diagnostics 2021-08-18 09:49:32 +02:00
Marcel Hellwig
0f081832b4 remove box_syntax uses from cranelift and tools 2021-08-18 09:31:51 +02:00
est31
dd4cc0c57d Remove box syntax from rustc_lint 2021-08-18 09:31:51 +02:00
est31
99db8fa9c2 Remove box syntax from rustc_mir 2021-08-18 09:31:51 +02:00
est31
dcdadc4d8d Remove box syntax from rustc_middle 2021-08-18 09:25:26 +02:00
est31
8830f8e30c Remove box syntax from rustc_parse 2021-08-18 09:25:26 +02:00
est31
823e6f161a Remove box syntax from rustc_serialize 2021-08-18 09:25:26 +02:00
est31
395e7dfc2a Remove box syntax from rustc_typeck 2021-08-18 09:25:26 +02:00
est31
15672dc695 Remove box syntax from rustc_infer 2021-08-18 09:25:26 +02:00
est31
489744f900 Remove box syntax from rustc_builtin_macros 2021-08-18 09:25:26 +02:00
est31
1cd1cd034b Remove box syntax from rustc_ast 2021-08-18 09:25:26 +02:00
est31
8b0b7ef812 Remove box syntax from rustc_mir_build 2021-08-18 09:25:26 +02:00
bors
679dea4cc3 Auto merge of #87738 - lqd:polonius-master, r=nikomatsakis
Update `polonius-engine` to 0.13.0

This PR updates the use of `polonius-engine` to the recently released 0.13.0:
- this version renamed a lot of relations to match the current terminology
- "illegal subset relationships errors" (AKA "subset errors" or "universal region errors" in rustc parlance) have been implemented in all variants, and therefore the `Hybrid` variant can be the rustc default once again
- some of the blessed expectations were updated: new tests have been added since the last time I updated the tests, diagnostics have changed, etc.

In particular:
- a few tests had trivial expectations changes such as basic diagnostics changes for the migrate-mode and full NLLs
- others were recursion and lengths limits which emits a file, and under the polonius compare-mode, the folder has a different name
- a few tests were ignored in the NLL compare-mode for reasons that obviously also apply to Polonius
- some diagnostics were unified so that older expectations no longer made sense: the NLL and Polonius outputs were identical.
- in a few cases Polonius gets a chance to emit more errors than NLLs

A few tests in the compare-mode still are super slow and trigger the 60s warning, or OOM rustc during fact generation, and I've detailed these [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/186049-t-compiler.2Fwg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60):
- `src/test/ui/numbers-arithmetic/saturating-float-casts.rs` -> OOM during rustc fact generation
- `src/test/ui/numbers-arithmetic/num-wrapping.rs`
- `src/test/ui/issues/issue-72933-match-stack-overflow.rs`
- `src/test/ui/issues/issue-74564-if-expr-stack-overflow.rs`
- `src/test/ui/repr/repr-no-niche.rs`

In addition, 2 tests don't currently pass and I didn't want to bless them now: they deal with HRTBs and miss errors that NLLs emit. We're currently trying to see if we need chalk to deal with HRTB errors (as we thought we would have to) but during the recent sprint, we discovered that we may be able to detect some of these errors in a way that resembles subset errors:
- `ui/hrtb/hrtb-just-for-static.rs` -> 3 errors in NLL, 2 in polonius: a missing error about HRTB + needing to outlive 'static
- `ui/issues/issue-26217.rs` -> missing HRTB that makes the test compile instead of emitting an error

We'll keep talking about this at the next sprint as well.

cc `@rust-lang/wg-polonius` r? `@nikomatsakis`
2021-08-18 05:50:55 +00:00
Charles Lew
6b1c52ff25 Fold vtable_trait_upcasting_coercion_new_vptr_slot logic into obligation processing. 2021-08-18 13:00:27 +08:00
Charles Lew
1e605023ec Properly generate multiple candidates for trait upcasting coercion. 2021-08-18 13:00:27 +08:00
Will Crichton
0ce96bdcfa Fix bug in fmt_diff_with 2021-08-17 20:55:15 -07:00
bors
cbe3afece5 Auto merge of #87728 - GuillaumeGomez:doc-test-attr-checks, r=jyn514
Add "doc(test(...))" attribute checks

Fixes #82672.

r? `@camelid`
2021-08-18 03:21:12 +00:00
Josh Stone
35fd99c779 Add needs-asm-support to more tests
These were found as test failures on s390x for RHEL and Fedora.
2021-08-17 18:43:09 -07:00