Commit Graph

115597 Commits

Author SHA1 Message Date
Tomasz Miąsko 49431909a6 Validate rustc_layout_scalar_valid_range_{start,end} attributes 2021-03-11 00:00:00 +00:00
Nixon Enraght-Moony 5f24798b9e Improve some jsondocck errors 2021-03-10 22:06:05 +00:00
Nixon Enraght-Moony 9925ecb392 Add reexport tests 2021-03-10 22:06:05 +00:00
bors 066f01d81b Auto merge of #82960 - camelid:masked_crates, r=jyn514
Remove `masked_crates` from `clean::Crate`

Previously, `masked_crates` existed both on `Cache` and on
`clean::Crate`. During cache population, the `clean::Crate` version was
`take`n and moved to `Cache`.

This change removes the version on `clean::Crate` and instead directly
mutates `Cache.masked_crates` to initialize it. This has the advantage
of avoiding duplication and avoiding unnecessary allocation, as well as
making the flow of information through rustdoc less confusing.

The one downside I see is that `clean::utils::krate()` now uses the side
effect of mutating `DocContext.cache` instead of returning the data
directly, but it already mutated the `Cache` for other things (e.g.,
`deref_trait_did`) so it's not really new behavior. Also,
`clean::utils::krate()` is only called once (and is meant to only be
called once since it performs expensive and potentially destructive
operations) so the mutation shouldn't be an issue.

Follow-up to https://github.com/rust-lang/rust/pull/82018#discussion_r584197747.

cc `@jyn514`
2021-03-10 21:54:06 +00:00
bors f98721f886 Auto merge of #82982 - Dylan-DPC:rollup-mt497z7, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #81309 (always eagerly eval consts in Relate)
 - #82217 (Edition-specific preludes)
 - #82807 (rustdoc: Remove redundant enableSearchInput function)
 - #82924 (WASI: Switch to crt1-command.o to enable support for new-style commands)
 - #82949 (Do not attempt to unlock envlock in child process after a fork.)
 - #82955 (fix: wrong word)
 - #82962 (Treat header as first paragraph for shortened markdown descriptions)
 - #82976 (fix error message for copy(_nonoverlapping) overflow)
 - #82977 (Rename `Option::get_or_default` to `get_or_insert_default`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-10 19:12:53 +00:00
François Mockers 06669056b5 remove slice linkcheck exceptions 2021-03-10 18:18:56 +01:00
Dylan DPC f5196aea65
Rollup merge of #82976 - RalfJung:copy-nonoverlapping, r=oli-obk
fix error message for copy(_nonoverlapping) overflow

Fixes an error message regression introduced in https://github.com/rust-lang/rust/pull/77511 (and adds tests).

r? `@oli-obk`
2021-03-10 17:55:46 +01:00
Dylan DPC 5c62a182a1
Rollup merge of #82962 - notriddle:cleanup-index, r=jyn514
Treat header as first paragraph for shortened markdown descriptions

"The Rust Standard LibraryThe Rust Standard Library is the …" is an awful description.
2021-03-10 17:55:45 +01:00
Dylan DPC d01648b60e
Rollup merge of #82949 - the8472:forget-envlock-on-fork, r=joshtriplett
Do not attempt to unlock envlock in child process after a fork.

This implements the first two points from https://github.com/rust-lang/rust/issues/64718#issuecomment-793030479

This is a breaking change for cases where the environment is accessed in a Command::pre_exec closure. Except for single-threaded programs these uses were not correct anyway since they aren't async-signal safe.

Note that we had a ui test that explicitly tried `env::set_var` in `pre_exec`. As expected it failed with these changes when I tested locally.
2021-03-10 17:55:43 +01:00
Dylan DPC 881bbb758a
Rollup merge of #82924 - sunfishcode:wasi-command, r=alexcrichton
WASI: Switch to crt1-command.o to enable support for new-style commands

This switches Rust's WASI target to use crt1-command.o instead of
crt1.o, which enables support for new-style commands. By default,
new-style commands work the same way as old-style commands, so nothing
immediately changes here, but this will be needed by later changes to
enable support for typed arguments.

See here for more information on new-style commands:
 - https://github.com/WebAssembly/wasi-libc/pull/203
 - https://reviews.llvm.org/D81689

r? ```@alexcrichton```
2021-03-10 17:55:41 +01:00
Dylan DPC 9ac57b1520
Rollup merge of #82807 - notriddle:cleanup-js, r=jyn514
rustdoc: Remove redundant enableSearchInput function

enableSearchInput was called from two places:

- setupSearchLoader
- addSearchOptions, which is itself called from setupSearchLoader only

This commit can safely get rid of the addSearchOptions calls entirely, and since the setupSearchLoader call is immediately preceded by other method calls on search_input, there's no need to check if it's set.
2021-03-10 17:55:40 +01:00
Dylan DPC 759204ffc4
Rollup merge of #82217 - m-ou-se:edition-prelude, r=nikomatsakis
Edition-specific preludes

This changes `{std,core}::prelude` to export edition-specific preludes under `rust_2015`, `rust_2018` and `rust_2021`. (As suggested in https://github.com/rust-lang/rust/issues/51418#issuecomment-395630382.) For now they all just re-export `v1::*`, but this allows us to add things to the 2021edition prelude soon.

This also changes the compiler to make the automatically injected prelude import dependent on the selected edition.

cc `@rust-lang/libs` `@djc`
2021-03-10 17:55:38 +01:00
Dylan DPC 49bf48a33d
Rollup merge of #81309 - lcnr:lazy-norm-err-msgh, r=nikomatsakis
always eagerly eval consts in Relate

r? ```@nikomatsakis``` cc ```@varkor```
2021-03-10 17:55:37 +01:00
bors 17a07d71bf Auto merge of #76570 - cratelyn:implement-rfc-2945-c-unwind-abi, r=Amanieu
Implement RFC 2945: "C-unwind" ABI

## Implement RFC 2945: "C-unwind" ABI

This branch implements [RFC 2945]. The tracking issue for this RFC is #74990.

The feature gate for the issue is `#![feature(c_unwind)]`.

This RFC was created as part of the ffi-unwind project group tracked at rust-lang/lang-team#19.

### Changes

Further details will be provided in commit messages, but a high-level overview
of the changes follows:

* A boolean `unwind` payload is added to the `C`, `System`, `Stdcall`,
and `Thiscall` variants, marking whether unwinding across FFI boundaries is
acceptable. The cases where each of these variants' `unwind` member is true
correspond with the `C-unwind`, `system-unwind`, `stdcall-unwind`, and
`thiscall-unwind` ABI strings introduced in RFC 2945 [3].

* This commit adds a `c_unwind` feature gate for the new ABI strings.
Tests for this feature gate are included in `src/test/ui/c-unwind/`, which
ensure that this feature gate works correctly for each of the new ABIs.
A new language features entry in the unstable book is added as well.

* We adjust the `rustc_middle::ty::layout::fn_can_unwind` function,
used to compute whether or not a `FnAbi` object represents a function that
should be able to unwind when `panic=unwind` is in use.

* Changes are also made to
`rustc_mir_build::build::should_abort_on_panic` so that the function ABI is
used to determind whether it should abort, assuming that the `panic=unwind`
strategy is being used, and no explicit unwind attribute was provided.

[RFC 2945]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md
2021-03-10 16:44:04 +00:00
Guillaume Gomez a4d7046714 Fix "run" button position in error index 2021-03-10 16:40:27 +01:00
Ralf Jung 55c88f594c fix error message for copy(_nonoverlapping) overflow 2021-03-10 15:50:44 +01:00
bors 5fe790e3c4 Auto merge of #82884 - nagisa:nagisa/remove-most-of-sideeffect-inserts, r=nikic
Remove the -Zinsert-sideeffect

This removes all of the code we had in place to work-around LLVM's
handling of forward progress. From this removal excluded is a workaround
where we'd insert a `sideeffect` into clearly infinite loops such as
`loop {}`. This code remains conditionally effective when the LLVM
version is earlier than 12.0, which fixed the forward progress related
miscompilations at their root.
2021-03-10 14:03:00 +00:00
bors a4d9624242 Auto merge of #82967 - RalfJung:copy-nonoverlap, r=oli-obk
fix copy_nonoverlapping

Fixes a bug introduced by https://github.com/rust-lang/rust/pull/77511

r? `@oli-obk`
Fixes https://github.com/rust-lang/rust/issues/82961
2021-03-10 11:21:46 +00:00
Simonas Kazlauskas 0517acd543 Remove the -Zinsert-sideeffect
This removes all of the code we had in place to work-around LLVM's
handling of forward progress. From this removal excluded is a workaround
where we'd insert a `sideeffect` into clearly infinite loops such as
`loop {}`. This code remains conditionally effective when the LLVM
version is earlier than 12.0, which fixed the forward progress related
miscompilations at their root.
2021-03-10 12:21:43 +02:00
Ralf Jung 4d748624c0 add regression test 2021-03-10 10:20:27 +01:00
Guillaume Gomez bbbefa3edc Allow doc alias attributes to use both list and value 2021-03-10 10:17:37 +01:00
bors dff1edf919 Auto merge of #79519 - cjgillot:noattr, r=wesleywiser
Store HIR attributes in a side table

Same idea as #72015 but for attributes.
The objective is to reduce incr-comp invalidations due to modified attributes.
Notably, those due to modified doc comments.

Implementation:
- collect attributes during AST->HIR lowering, in `LocalDefId -> ItemLocalId -> &[Attributes]` nested tables;
- access the attributes through a `hir_owner_attrs` query;
- local refactorings to use this access;
- remove `attrs` from HIR data structures one-by-one.

Change in behaviour:
- the HIR visitor traverses all attributes at once instead of parent-by-parent;
- attribute arrays are sometimes duplicated: for statements and variant constructors;
- as a consequence, attributes are marked as used after unused-attribute lint emission to avoid duplicate lints.

~~Current bug: the lint level is not correctly applied in `std::backtrace_rs`, triggering an unused attribute warning on `#![no_std]`. I welcome suggestions.~~
2021-03-10 08:40:51 +00:00
Erin Power a6624d3c98 Add spirv extension handling in compiletest 2021-03-10 07:54:26 +01:00
Michael Howell 66b65043df Simplify some of the rendering code in the index
It's kinda silly using serde seq for fixed-length stuff.
2021-03-09 22:52:52 -07:00
Camelid b7d91b0ae4 Remove `masked_crates` from `clean::Crate`
Previously, `masked_crates` existed both on `Cache` and on
`clean::Crate`. During cache population, the `clean::Crate` version was
`take`n and moved to `Cache`.

This change removes the version on `clean::Crate` and instead directly
mutates `Cache.masked_crates` to initialize it. This has the advantage
of avoiding duplication and avoiding unnecessary allocation, as well as
making the flow of information through rustdoc less confusing.

The one downside I see is that `clean::utils::krate()` now uses the side
effect of mutating `DocContext.cache` instead of returning the data
directly, but it already mutated the `Cache` for other things (e.g.,
`deref_trait_did`) so it's not really new behavior. Also,
`clean::utils::krate()` is only called once (and is meant to only be
called once since it performs expensive and potentially destructive
operations) so the mutation shouldn't be an issue.
2021-03-09 20:02:52 -08:00
Aman Arora 612a9b2f95 2229: Handle capturing a reference into a repr packed struct
RFC 1240 states that it is unsafe to capture references into a
packed-struct. This PR ensures that when a closure captures a precise
path, we aren't violating this safety constraint.

To acheive so we restrict the capture precision to the struct itself.

An interesting edge case:
```rust
struct Foo(String);

let foo: Foo;
let c = || {
    println!("{}", foo.0);
    let x = foo.0;
}
```

Given how closures get desugared today, foo.0 will be moved into the
closure, making the `println!`, safe. However this can be very subtle
and also will be unsafe if the closure gets inline.

Closes: https://github.com/rust-lang/project-rfc-2229/issues/33
2021-03-09 20:23:02 -05:00
Michael Howell e40b3d6a38 Treat header as first paragraph for shortened markdown descriptions
"The Rust Standard LibraryThe Rust Standard Library is the …" is an awful description.
2021-03-09 17:48:14 -07:00
bstrie 49aa79ec11 Deprecate items that accidentally weren't deprecated
Fixes #82080
2021-03-09 19:09:20 -05:00
Yuki Okushi 56b5393cc2
Rollup merge of #82938 - oli-obk:tracing_tree_bump, r=Mark-Simulacrum
Bump tracing-tree dependency

This bump fixes two small rendering things that were annoying me:

* The first level didn't have an opening line
* When wraparound happens, there was no warning, the levels just disappeared. Now there is a line that shows that wraparound is happening

See https://github.com/davidbarsky/tracing-tree/pull/31/files for how the look changes
2021-03-10 08:01:36 +09:00
Yuki Okushi 641b971a24
Rollup merge of #82908 - lnicola:rust-analyzer-2021-03-08, r=jonas-schievink
⬆️ rust-analyzer
2021-03-10 08:01:33 +09:00
Yuki Okushi 48a393e10b
Rollup merge of #82802 - jyn514:build-rustdoc-fullmake, r=Mark-Simulacrum
Build rustdoc for run-make tests, not just run-make-fulldeps

Rustdoc almost never needs a full stage 2 compiler, and requiring
rustdoc tests to be in run-make-fulldeps adds a lot of compile time for
no reason.

This is the same change from https://github.com/rust-lang/rust/pull/81197, but separated into its own PR. I ran into this again today while working on https://github.com/rust-lang/docs.rs/issues/1302.
r? ```@Mark-Simulacrum```
2021-03-10 08:01:30 +09:00
Yuki Okushi 761a2b389d
Rollup merge of #82733 - Yn0ga:master, r=estebank
Add powerpc-unknown-openbsd target
2021-03-10 08:01:29 +09:00
Yuki Okushi c46f948a80
Rollup merge of #79208 - LeSeulArtichaut:stable-unsafe_op_in_unsafe_fn, r=nikomatsakis
Stabilize `unsafe_op_in_unsafe_fn` lint

This makes it possible to override the level of the `unsafe_op_in_unsafe_fn`, as proposed in https://github.com/rust-lang/rust/issues/71668#issuecomment-729770896.

Tracking issue: #71668
r? ```@nikomatsakis``` cc ```@SimonSapin``` ```@RalfJung```

# Stabilization report

This is a stabilization report for `#![feature(unsafe_block_in_unsafe_fn)]`.

## Summary

Currently, the body of unsafe functions is an unsafe block, i.e. you can perform unsafe operations inside.

The `unsafe_op_in_unsafe_fn` lint, stabilized here, can be used to change this behavior, so performing unsafe operations in unsafe functions requires an unsafe block.

For now, the lint is allow-by-default, which means that this PR does not change anything without overriding the lint level.

For more information, see [RFC 2585](https://github.com/rust-lang/rfcs/blob/master/text/2585-unsafe-block-in-unsafe-fn.md)

### Example

```rust
// An `unsafe fn` for demonstration purposes.
// Calling this is an unsafe operation.
unsafe fn unsf() {}

// #[allow(unsafe_op_in_unsafe_fn)] by default,
// the behavior of `unsafe fn` is unchanged
unsafe fn allowed() {
    // Here, no `unsafe` block is needed to
    // perform unsafe operations...
    unsf();

    // ...and any `unsafe` block is considered
    // unused and is warned on by the compiler.
    unsafe {
        unsf();
    }
}

#[warn(unsafe_op_in_unsafe_fn)]
unsafe fn warned() {
    // Removing this `unsafe` block will
    // cause the compiler to emit a warning.
    // (Also, no "unused unsafe" warning will be emitted here.)
    unsafe {
        unsf();
    }
}

#[deny(unsafe_op_in_unsafe_fn)]
unsafe fn denied() {
    // Removing this `unsafe` block will
    // cause a compilation error.
    // (Also, no "unused unsafe" warning will be emitted here.)
    unsafe {
        unsf();
    }
}
```
2021-03-10 08:01:25 +09:00
The8472 d854789ce1 Do not attempt to unlock envlock in child process after a fork.
This is a breaking change for cases where the environment is
accessed in a Command::pre_exec closure. Except for
single-threaded programs these uses were not correct
anyway since they aren't async-signal safe.
2021-03-09 22:14:07 +01:00
Guillaume Gomez 40adb9aeab Add test to ensure the attributes position when js is disabled 2021-03-09 21:40:04 +01:00
Guillaume Gomez 09cb84048b Fix typo 2021-03-09 21:40:04 +01:00
Guillaume Gomez 3d9aceb238 Fix CSS issues when javascript is disabled 2021-03-09 21:40:04 +01:00
katelyn a. martin 05bf037fec address pr review comments
### Add debug assertion to check `AbiDatas` ordering

    This makes a small alteration to `Abi::index`, so that we include a
    debug assertion to check that the index we are returning corresponds
    with the same abi in our data array.

    This will help prevent ordering bugs in the future, which can
    manifest in rather strange errors.

 ### Using exhaustive ABI matches

    This slightly modifies the changes from our previous commits,
    favoring exhaustive matches in place of `_ => ...` fall-through
    arms.

    This should help with maintenance in the future, when additional
    ABI's are added, or when existing ABI's are modified.

 ### List all `-unwind` ABI's in unstable book

    This updates the `c-unwind` page in the unstable book to list _all_
    of the other ABI strings that are introduced by this feature gate.

    Now, all of the ABI's specified by RFC 2945 are shown.

Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2021-03-09 14:40:33 -05:00
katelyn a. martin baf227ea0c add integration tests, unwind across FFI boundary
### Integration Tests

    This commit introduces some new fixtures to the `run-make-fulldeps`
    test suite.

        * c-unwind-abi-catch-panic: Exercise unwinding a panic. This
          catches a panic across an FFI boundary and downcasts it into
          an integer.

        * c-unwind-abi-catch-lib-panic: This is similar to the previous
         `*catch-panic` test, however in this case the Rust code that
         panics resides in a separate crate.

 ### Add `rust_eh_personality` to `#[no_std]` alloc tests

    This commit addresses some test failures that now occur in the
    following two tests:

        * no_std-alloc-error-handler-custom.rs
        * no_std-alloc-error-handler-default.rs

    Each test now defines a `rust_eh_personality` extern function, in
    the same manner as shown in the "Writing an executable without
    stdlib" section of the `lang_items` documentation here:
    https://doc.rust-lang.org/unstable-book/language-features/lang-items.html#writing-an-executable-without-stdlib

    Without this change, these tests would fail to compile due to a
    linking error explaining that there was an "undefined reference
    to `rust_eh_personality'."

 ### Updated hash

    * update 32-bit hash in `impl1` test

 ### Panics

    This commit uses `panic!` macro invocations that return a string,
    rather than using an integer as a panic payload.

    Doing so avoids the following warnings that were observed during
    rollup for the `*-msvc-1` targets:

    ```
    warning: panic message is not a string literal
      --> panic.rs:10:16
       |
    10 |         panic!(x); // That is too big!
       |                ^
       |
       = note: `#[warn(non_fmt_panic)]` on by default
       = note: this is no longer accepted in Rust 2021
    help: add a "{}" format string to Display the message
       |
    10 |         panic!("{}", x); // That is too big!
       |                ^^^^^
    help: or use std::panic::panic_any instead
       |
    10 |         std::panic::panic_any(x); // That is too big!
       |         ^^^^^^^^^^^^^^^^^^^^^

    warning: 1 warning emitted
    ```

    See: https://github.com/rust-lang-ci/rust/runs/1992118428

    As these errors imply, panicking without a format string will be
    disallowed in Rust 2021, per #78500.
2021-03-09 14:40:33 -05:00
katelyn a. martin 0f33e9f281 implement unwinding abi's (RFC 2945)
### Changes

    This commit implements unwind ABI's, specified in RFC 2945.

    We adjust the `rustc_middle::ty::layout::fn_can_unwind` function,
    used to compute whether or not a `FnAbi` object represents a
    function that should be able to unwind when `panic=unwind` is in
    use.

    Changes are also made to
    `rustc_mir_build::build::should_abort_on_panic` so that the
    function ABI is used to determind whether it should abort, assuming
    that the `panic=unwind` strategy is being used, and no explicit
    unwind attribute was provided.

 ### Tests

    Unit tests, checking that the behavior is correct for `C-unwind`,
    `stdcall-unwind`, `system-unwind`, and `thiscall-unwind`, are
    included. These alternative `unwind` ABI strings are specified in
    RFC 2945, in the "_Other `unwind` ABI strings_" section.

    Additionally, a test case is included to assert that the LLVM IR
    generated for an external function defined with the `C-unwind` ABI
    will be appropriately labeled with the `nounwind` LLVM attribute
    when the `panic=abort` compilation flag is used.

 ### Ignore Directives

    This commit uses `ignore-*` directives in two of our `*-unwind` ABI
    test cases.

    Specifically, the `stdcall-unwind` and `thiscall-unwind` test cases
    ignore architectures that do not support `stdcall` and `thiscall`,
    respectively.

    These directives are cribbed from
    `src/test/ui/c-variadic/variadic-ffi-1.rs` for `stdcall`, and
    `src/test/ui/extern/extern-thiscall.rs` for `thiscall`.
2021-03-09 14:38:29 -05:00
katelyn a. martin df45c579de rustc_target: add "unwind" payloads to `Abi`
### Overview

    This commit begins the implementation work for RFC 2945. For more
    information, see the rendered RFC [1] and tracking issue [2].

    A boolean `unwind` payload is added to the `C`, `System`, `Stdcall`,
    and `Thiscall` variants, marking whether unwinding across FFI
    boundaries is acceptable. The cases where each of these variants'
    `unwind` member is true correspond with the `C-unwind`,
    `system-unwind`, `stdcall-unwind`, and `thiscall-unwind` ABI strings
    introduced in RFC 2945 [3].

 ### Feature Gate and Unstable Book

    This commit adds a `c_unwind` feature gate for the new ABI strings.
    Tests for this feature gate are included in `src/test/ui/c-unwind/`,
    which ensure that this feature gate works correctly for each of the
    new ABIs.

    A new language features entry in the unstable book is added as well.

 ### Further Work To Be Done

    This commit does not proceed to implement the new unwinding ABIs,
    and is intentionally scoped specifically to *defining* the ABIs and
    their feature flag.

 ### One Note on Test Churn

    This will lead to some test churn, in re-blessing hash tests, as the
    deleted comment in `src/librustc_target/spec/abi.rs` mentioned,
    because we can no longer guarantee the ordering of the `Abi`
    variants.

    While this is a downside, this decision was made bearing in mind
    that RFC 2945 states the following, in the "Other `unwind` Strings"
    section [3]:

    >  More unwind variants of existing ABI strings may be introduced,
    >  with the same semantics, without an additional RFC.

    Adding a new variant for each of these cases, rather than specifying
    a payload for a given ABI, would quickly become untenable, and make
    working with the `Abi` enum prone to mistakes.

    This approach encodes the unwinding information *into* a given ABI,
    to account for the future possibility of other `-unwind` ABI
    strings.

 ### Ignore Directives

    `ignore-*` directives are used in two of our `*-unwind` ABI test
    cases.

    Specifically, the `stdcall-unwind` and `thiscall-unwind` test cases
    ignore architectures that do not support `stdcall` and
    `thiscall`, respectively.

    These directives are cribbed from
    `src/test/ui/c-variadic/variadic-ffi-1.rs` for `stdcall`, and
    `src/test/ui/extern/extern-thiscall.rs` for `thiscall`.

    This would otherwise fail on some targets, see:
    fcf697f902

 ### Footnotes

[1]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md
[2]: https://github.com/rust-lang/rust/issues/74990
[3]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md#other-unwind-abi-strings
2021-03-09 14:38:29 -05:00
Camille GILLOT 77c0f217ff Rebase fallout. 2021-03-09 19:28:01 +01:00
Camille GILLOT 12ce80a9ea Fix ui-fulldeps tests. 2021-03-09 19:28:00 +01:00
Camille GILLOT 6b5d2de97e Bless tests. 2021-03-09 19:27:59 +01:00
Camille GILLOT fb753cced8 Remove hir::Expr::attrs. 2021-03-09 19:27:58 +01:00
Camille GILLOT c701872a6c Remove hir::Item::attrs. 2021-03-09 19:27:50 +01:00
Camille GILLOT 5474f17011 Remove hir::ImplItem::attrs. 2021-03-09 19:23:08 +01:00
Camille GILLOT c49359add2 Remove hir::TraitItem::attrs. 2021-03-09 19:23:08 +01:00
Camille GILLOT c298744da7 Remove hir::StructField::attrs. 2021-03-09 19:23:07 +01:00
Camille GILLOT 3c0afc3e1c Remove hir::Variant::attrs. 2021-03-09 19:23:06 +01:00
Camille GILLOT 96788df68c Remove hir::Arm::attrs. 2021-03-09 19:23:05 +01:00
Camille GILLOT a987bbb97c Remove hir::Crate::attrs. 2021-03-09 19:22:55 +01:00
Camille GILLOT 7ea1eacb17 Remove hir::Local::attrs. 2021-03-09 19:09:35 +01:00
Camille GILLOT ff79ad394f Remove hir::StmtKind::attrs. 2021-03-09 19:09:35 +01:00
Camille GILLOT 4bb07bedf5 Visit attributes in one go. 2021-03-09 19:09:34 +01:00
Camille GILLOT 8e816056a5 Do not store attrs in FnKind. 2021-03-09 19:09:33 +01:00
Camille GILLOT f5dc5dcca3 Simplify clippy author. 2021-03-09 19:09:32 +01:00
Camille GILLOT 3137f81c13 Access attrs directly from HirId in rustdoc::doctest. 2021-03-09 19:09:32 +01:00
kadmin 217ff6b7ea Switch to changing cp_non_overlap in tform
It was suggested to lower this in MIR instead of ssa, so do that instead.
2021-03-09 16:54:14 +00:00
kadmin 982382dc03 Update cranelift 2021-03-09 16:54:14 +00:00
kadmin 89f45ed9f3 Update match branches
This updates all places where match branches check on StatementKind or UseContext.
This doesn't properly implement them, but adds TODOs where they are, and also adds some best
guesses to what they should be in some cases.
2021-03-09 16:54:13 +00:00
Oli Scherer 62f2d72330 Bump tracing-tree dependency 2021-03-09 16:44:51 +00:00
Ömer Sinan Ağacan 98fbc09f02 Allow calling *const methods on *mut values
Fixes #80258
2021-03-09 13:40:08 +03:00
Mara Bos bf1580279e
Rollup merge of #82883 - Aaron1011:update-cargo, r=ehuss
Update Cargo

Output of `git log --oneline  c68432f1e..970bc67c3`:

970bc67c3 (HEAD, origin/master, origin/auto-cargo, origin/HEAD) Auto merge of #9243 - wickerwaka:configurable-env-doc, r=ehuss
4d7a29b75 Document the configurable-env usntable option
f7a7a3f91 Auto merge of #9229 - alexcrichton:fix-borrow-mut, r=ehuss
3f2ece7a9 Fix a `BorrowMut` error when stdout is closed
7441e8c23 Auto merge of #8825 - Aaron1011:feature/report-future-incompat, r=ehuss
139ed73f5 Add future-incompat tracking issue number.
9ea350368 Fix some minor formatting issues.
f03d47ce4 Address review comments
6177c6584 Implement future incompatibility report support
c69409658 Auto merge of #9022 - nagisa:nagisa/manifest_path, r=alexcrichton
548300b20 Add the path to the manifest in json output
99e714c05 Auto merge of #9230 - kornelski:nobinaries, r=alexcrichton
61a31bc5f Auto merge of #9236 - kornelski:track-assert, r=Eh2406
3f7f0942c track_caller on custom assert functions
6977dee10 Explain `cargo install` is not for libraries
e4aebf0a0 Auto merge of #9231 - joshtriplett:clear-to-eol-if-color, r=alexcrichton
b219f0eb7 Auto merge of #9181 - jyn514:computer-says-no, r=ehuss
0b1816578 Remove unhelpful link to Cargo book
ea46f5ce3 Use ANSI clear-to-EOL if color is force-enabled
a6394bcc1 Remove unnecessary `config` argument to `Features::add`
3a86ecf2d Fix TODO about nightly features
09677c83c Be less unix-centric in error messages
ecfdced0d Fix test that assumed tests always were run on the stable channel
eba541994 Update comment in build_script_env
a5720117f Make `nightly_features_allowed` a field instead of a function
169b09ce7 Compute `enable_nightly_features` once instead of on each call
8fc86e155 Remove unused thread_locals
4b096beae Fix `masquerade_as_nightly_cargo` in work threads
e56417c8c Suggest RUSTC_BOOTSTRAP=crate instead of RUSTC_BOOTSTRAP=1
418129dae Downgrade error to a warning when `RUSTC_BOOTSTRAP` is set or this is the nightly channel
6c422a2c0 Restrict RUSTC_BOOTSTRAP in build.rs
2021-03-09 09:05:25 +00:00
Mara Bos bb9542b016
Rollup merge of #82841 - hvdijk:x32, r=joshtriplett
Change x64 size checks to not apply to x32.

Rust contains various size checks conditional on target_arch = "x86_64", but these checks were never intended to apply to x86_64-unknown-linux-gnux32. Add target_pointer_width = "64" to the conditions.
2021-03-09 09:05:24 +00:00
Mara Bos a315442729
Rollup merge of #82799 - bugadani:codegen-tests, r=nagisa
Add regression test for #75525
2021-03-09 09:05:23 +00:00
Mara Bos 0d97f9b22a
Rollup merge of #82048 - mark-i-m:or-pat-type-ascription, r=petrochenkov
or-patterns: disallow in `let` bindings

~~Blocked on https://github.com/rust-lang/rust/pull/81869~~

Disallows top-level or-patterns before type ascription. We want to reserve this syntactic space for possible future generalized type ascription.

r? ``@petrochenkov``
2021-03-09 09:05:20 +00:00
asquared31415 4b13b8120e Test x86 and arm outputs 2021-03-08 23:48:08 -05:00
bors 4b9f5cc4c1 Auto merge of #82356 - camelid:render-cleanup, r=GuillaumeGomez
rustdoc: Cleanup `html::render::Context`

- Move most shared fields to `SharedContext` (except for `cache`, which
  isn't mutated anyway)
- Replace a use of `Arc` with `Rc`
- Make a bunch of fields private
- Add static size assertion for `Context`
- Don't share `id_map` and `deref_id_map`
2021-03-09 04:33:43 +00:00
Henry Boisdequin bba2bac9fe improve `const fn` `RepeatVec` diagnostics 2021-03-09 08:20:50 +05:30
Dan Gohman fdb899ba4b WASI: Switch to crt1-command.o to enable support for new-style commands
This switches Rust's WASI target to use crt1-command.o instead of
crt1.o, which enables support for new-style commands. By default,
new-style commands work the same way as old-style commands, so nothing
immediately changes here, but this will be needed by later changes to
enable support for typed arguments.

See here for more information on new-style commands:
 - https://github.com/WebAssembly/wasi-libc/pull/203
 - https://reviews.llvm.org/D81689
2021-03-08 17:49:34 -08:00
mark 402a00a15d clippy: fix or-pattern in let binding 2021-03-08 13:16:00 -06:00
Mara Bos 3908eec60f
Rollup merge of #82881 - Manishearth:crate-root, r=estebank
diagnostics: Be clear about "crate root" and `::foo` paths in resolve diagnostics

Various changes to make sure the diagnostics are clear about the differences in `::foo` paths across editions:

 - `::foo` will say "crate root" in 2015 and "list of imported crates" in 2018
 - `crate::` will never reference imported crates in 2018

Fixes https://github.com/rust-lang/rust/issues/82876
2021-03-08 20:09:06 +01:00
Mara Bos a5035c9995
Rollup merge of #82874 - erikdesjardins:cgtests, r=nagisa
Add codegen tests for some issues closed by LLVM 12

Namely #73031, #75546, and #77812
2021-03-08 20:09:04 +01:00
Mara Bos 6a55aa1246
Rollup merge of #82854 - estebank:issue-82827, r=oli-obk
Account for `if (let pat = expr) {}`

Fix #82827.
2021-03-08 20:09:02 +01:00
Mara Bos 0ee2f4c3e0
Rollup merge of #82829 - JohnTitor:handle-neg-val, r=estebank
Handle negative literals in cast overflow warning

Closes #48535
r? `@estebank`
2021-03-08 20:09:01 +01:00
Mara Bos 09b17a1c2d
Rollup merge of #82810 - amaurremi:source-based-coverage-typo, r=ehuss
Typo fix in Unstable book: `cargo cov` -> `cargo profdata`
2021-03-08 20:09:00 +01:00
Mara Bos 5ff52cbdb7
Rollup merge of #82800 - jyn514:group-rustdoc-tests, r=Mark-Simulacrum
Move rustdoc UI tests into a subdirectory

Helps with https://github.com/rust-lang/rust/issues/73494.
2021-03-08 20:08:59 +01:00
Mara Bos 6e9a94a72b
Rollup merge of #82767 - GuillaumeGomez:update-minifier-crate-version, r=jyn514
Update minifier dependency version

Very small PR simply upgrading the minifier-rs version we use in rustdoc.

Some details might be useful: there were a few bug fixes and a lot of cleanup/code improvements.

r? `@camelid`
2021-03-08 20:08:57 +01:00
Laurențiu Nicola 50bdd51ea8 ⬆️ rust-analyzer 2021-03-08 17:30:42 +02:00
bors 8f349be278 Auto merge of #82896 - Dylan-DPC:rollup-9setmme, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #82047 (bypass auto_da_alloc for metadata files)
 - #82415 (expand: Refactor module loading)
 - #82557 (Add natvis for Result, NonNull, CString, CStr, and Cow)
 - #82613 (Remove Item::kind, use tagged enum. Rename variants to match)
 - #82642 (Fix jemalloc usage on OSX)
 - #82682 (Implement built-in attribute macro `#[cfg_eval]` + some refactoring)
 - #82684 (Disable destination propagation on all mir-opt-levels)
 - #82755 (Refactor confirm_builtin_call, remove partial if)
 - #82857 (Edit ructc_ast_lowering docs)
 - #82862 (Generalize Write impl for Vec<u8> to Vec<u8, A>)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-08 14:59:20 +00:00
Joshua Nelson bc1fbf55db Move rustdoc UI tests into a subdirectory
This also adds a little leeway to the test limit.
2021-03-08 09:17:04 -05:00
bors d0d5232c72 Auto merge of #6834 - hyd-dev:clippy-args, r=phansch,flip1995,oli-obk
Let Cargo track CLIPPY_ARGS

This PR makes `clippy-driver` emit `CLIPPY_ARGS` in its `dep-info` output.

Just like #6441, this allows this workflow to work:
```shell
cargo clippy # warning: empty `loop {}` wastes CPU cycles
cargo clippy -- -A clippy::empty_loop # no warnings emitted
```
But without rebuilding all dependencies.

cc https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/CLIPPY_ARGS.20is.20not.20tracked.20by.20Cargo/near/228599088

changelog: Cargo now re-runs Clippy if arguments after `--` provided to `cargo clippy` are changed.
2021-03-08 13:18:39 +00:00
Dylan DPC dd7a606804
Rollup merge of #82684 - tmiasko:dest-prop, r=jonas-schievink
Disable destination propagation on all mir-opt-levels

The new `// compile-flags: -Zunsound-mir-opts` are inserted without an extra newline to avoid introducing a large mir-opt diff.
2021-03-08 13:13:24 +01:00
Dylan DPC 9c310571a8
Rollup merge of #82682 - petrochenkov:cfgeval, r=Aaron1011
Implement built-in attribute macro `#[cfg_eval]` + some refactoring

This PR implements a built-in attribute macro `#[cfg_eval]` as it was suggested in https://github.com/rust-lang/rust/pull/79078 to avoid `#[derive()]` without arguments being abused as a way to configure input for other attributes.

The macro is used for eagerly expanding all `#[cfg]` and `#[cfg_attr]` attributes in its input ("fully configuring" the input).
The effect is identical to effect of `#[derive(Foo, Bar)]` which also fully configures its input before passing it to macros `Foo` and `Bar`, but unlike `#[derive]` `#[cfg_eval]` can be applied to any syntax nodes supporting macro attributes, not only certain items.

`cfg_eval` was the first name suggested in https://github.com/rust-lang/rust/pull/79078, but other alternatives are also possible, e.g. `cfg_expand`.

```rust
#[cfg_eval]
#[my_attr] // Receives `struct S {}` as input, the field is configured away by `#[cfg_eval]`
struct S {
    #[cfg(FALSE)]
    field: u8,
}
```

Tracking issue: https://github.com/rust-lang/rust/issues/82679
2021-03-08 13:13:23 +01:00
Dylan DPC 0681951287
Rollup merge of #82613 - CraftSpider:fix-de, r=aDotInTheVoid
Remove Item::kind, use tagged enum. Rename variants to match

Fixes #82299, by making the ItemEnum tagged. Doesn't remove ItemKind as it's still used in other places.

r? `````@jyn514`````
`````@rustbot````` label: +A-rustdoc-json +T-rustdoc
2021-03-08 13:13:21 +01:00
Dylan DPC 298c31b04a
Rollup merge of #82557 - rylev:natvis-improvements, r=varkor
Add natvis for Result, NonNull, CString, CStr, and Cow

This adds natvis support (used for Windows debugging) to the following types: `Result`, `NonNull`, `CString`, `CStr`, and `Cow`.
2021-03-08 13:13:20 +01:00
Dylan DPC 4a4e3e667d
Rollup merge of #82415 - petrochenkov:modin3, r=davidtwco
expand: Refactor module loading

This is an accompanying PR to https://github.com/rust-lang/rust/pull/82399, but they can be landed independently.
See individual commits for more details.

Anyone should be able to review this equally well because all people actually familiar with this code left the project.
2021-03-08 13:13:19 +01:00
bors 1d6b0f626a Auto merge of #82783 - nikic:llvm-ct-backports, r=nagisa
Backport some LLVM compile-time improvements

Pick up two LLVM patches that reduce number of alias analysis queries, to see whether that gives any visible improvement.

r? `@ghost`
2021-03-08 11:39:32 +00:00
hyd-dev 3cd5f44ec4
Don't panic if `CLIPPY_ARGS` is not Unicode 2021-03-08 18:50:08 +08:00
hyd-dev 2d07c33c86
Rename `ClippyArgsCallbacks` to `RustcCallbacks` 2021-03-08 18:28:43 +08:00
bors 27885a94c6 Auto merge of #82727 - oli-obk:shrinkmem, r=pnkfelix
Test the effect of shrinking the size of Rvalue by 16 bytes

r? `@ghost`
2021-03-08 08:39:24 +00:00
bors 76c500ec6c Auto merge of #81635 - michaelwoerister:structured_def_path_hash, r=pnkfelix
Let a portion of DefPathHash uniquely identify the DefPath's crate.

This allows to directly map from a `DefPathHash` to the crate it originates from, without constructing side tables to do that mapping -- something that is useful for incremental compilation where we deal with `DefPathHash` instead of `DefId` a lot.

It also allows to reliably and cheaply check for `DefPathHash` collisions which allows the compiler to gracefully abort compilation instead of running into a subsequent ICE at some random place in the code.

The following new piece of documentation describes the most interesting aspects of the changes:

```rust
/// A `DefPathHash` is a fixed-size representation of a `DefPath` that is
/// stable across crate and compilation session boundaries. It consists of two
/// separate 64-bit hashes. The first uniquely identifies the crate this
/// `DefPathHash` originates from (see [StableCrateId]), and the second
/// uniquely identifies the corresponding `DefPath` within that crate. Together
/// they form a unique identifier within an entire crate graph.
///
/// There is a very small chance of hash collisions, which would mean that two
/// different `DefPath`s map to the same `DefPathHash`. Proceeding compilation
/// with such a hash collision would very probably lead to an ICE and, in the
/// worst case, to a silent mis-compilation. The compiler therefore actively
/// and exhaustively checks for such hash collisions and aborts compilation if
/// it finds one.
///
/// `DefPathHash` uses 64-bit hashes for both the crate-id part and the
/// crate-internal part, even though it is likely that there are many more
/// `LocalDefId`s in a single crate than there are individual crates in a crate
/// graph. Since we use the same number of bits in both cases, the collision
/// probability for the crate-local part will be quite a bit higher (though
/// still very small).
///
/// This imbalance is not by accident: A hash collision in the
/// crate-local part of a `DefPathHash` will be detected and reported while
/// compiling the crate in question. Such a collision does not depend on
/// outside factors and can be easily fixed by the crate maintainer (e.g. by
/// renaming the item in question or by bumping the crate version in a harmless
/// way).
///
/// A collision between crate-id hashes on the other hand is harder to fix
/// because it depends on the set of crates in the entire crate graph of a
/// compilation session. Again, using the same crate with a different version
/// number would fix the issue with a high probability -- but that might be
/// easier said then done if the crates in questions are dependencies of
/// third-party crates.
///
/// That being said, given a high quality hash function, the collision
/// probabilities in question are very small. For example, for a big crate like
/// `rustc_middle` (with ~50000 `LocalDefId`s as of the time of writing) there
/// is a probability of roughly 1 in 14,750,000,000 of a crate-internal
/// collision occurring. For a big crate graph with 1000 crates in it, there is
/// a probability of 1 in 36,890,000,000,000 of a `StableCrateId` collision.
```

Given the probabilities involved I hope that no one will ever actually see the error messages. Nonetheless, I'd be glad about some feedback on how to improve them. Should we create a GH issue describing the problem and possible solutions to point to? Or a page in the rustc book?

r? `@pnkfelix` (feel free to re-assign)
2021-03-07 23:45:57 +00:00
Aaron Hill 2550d5b15c
Update Cargo
Output of `git log --oneline  c68432f1e..970bc67c3`:

970bc67c3 (HEAD, origin/master, origin/auto-cargo, origin/HEAD) Auto merge of #9243 - wickerwaka:configurable-env-doc, r=ehuss
4d7a29b75 Document the configurable-env usntable option
f7a7a3f91 Auto merge of #9229 - alexcrichton:fix-borrow-mut, r=ehuss
3f2ece7a9 Fix a `BorrowMut` error when stdout is closed
7441e8c23 Auto merge of #8825 - Aaron1011:feature/report-future-incompat, r=ehuss
139ed73f5 Add future-incompat tracking issue number.
9ea350368 Fix some minor formatting issues.
f03d47ce4 Address review comments
6177c6584 Implement future incompatibility report support
c69409658 Auto merge of #9022 - nagisa:nagisa/manifest_path, r=alexcrichton
548300b20 Add the path to the manifest in json output
99e714c05 Auto merge of #9230 - kornelski:nobinaries, r=alexcrichton
61a31bc5f Auto merge of #9236 - kornelski:track-assert, r=Eh2406
3f7f0942c track_caller on custom assert functions
6977dee10 Explain `cargo install` is not for libraries
e4aebf0a0 Auto merge of #9231 - joshtriplett:clear-to-eol-if-color, r=alexcrichton
b219f0eb7 Auto merge of #9181 - jyn514:computer-says-no, r=ehuss
0b1816578 Remove unhelpful link to Cargo book
ea46f5ce3 Use ANSI clear-to-EOL if color is force-enabled
a6394bcc1 Remove unnecessary `config` argument to `Features::add`
3a86ecf2d Fix TODO about nightly features
09677c83c Be less unix-centric in error messages
ecfdced0d Fix test that assumed tests always were run on the stable channel
eba541994 Update comment in build_script_env
a5720117f Make `nightly_features_allowed` a field instead of a function
169b09ce7 Compute `enable_nightly_features` once instead of on each call
8fc86e155 Remove unused thread_locals
4b096beae Fix `masquerade_as_nightly_cargo` in work threads
e56417c8c Suggest RUSTC_BOOTSTRAP=crate instead of RUSTC_BOOTSTRAP=1
418129dae Downgrade error to a warning when `RUSTC_BOOTSTRAP` is set or this is the nightly channel
6c422a2c0 Restrict RUSTC_BOOTSTRAP in build.rs
2021-03-07 18:45:08 -05:00
Manish Goregaokar 0eeae1abfc diagnostics: Don't mention external crates when hitting import errors on crate imports in 2018 2021-03-07 15:15:19 -08:00
Esteban Küber aa7ac6e957 Remove notes, increase S/N ratio 2021-03-07 15:03:46 -08:00
Erik Desjardins 938637033c add codegen tests for some issues closed by LLVM 12 2021-03-07 17:56:09 -05:00
Esteban Küber 63fb294a74 Add help for `matches` for `if let` in arm guard 2021-03-07 14:44:21 -08:00
Manish Goregaokar 9d5d669b77 diagnostics: Differentiate between edition meanings of ::foo in resolve diagnostics for ::foo::Bar 2021-03-07 14:24:47 -08:00
Manish Goregaokar ac7f9ccb6f diagnostics: Differentiate between edition meanings of ::foo in resolve diagnostics (for bare `::foo`) 2021-03-07 14:21:48 -08:00
Esteban Küber 23bcea4249 Add help suggesting `matches` to `let_chains` lint 2021-03-07 14:17:10 -08:00
Esteban Küber e62a543344 Account for `if (let pat = expr) {}`
Partially address #82827.
2021-03-07 13:49:36 -08:00
Yuki Okushi 379679b913
Rollup merge of #82803 - jyn514:unversioned-files, r=GuillaumeGomez
rustdoc: Add an unstable option to print all unversioned files

This allows sharing those files between different doc invocations
without having to know their names ahead of time.

Helps with https://github.com/rust-lang/docs.rs/issues/1302.
r? ````@GuillaumeGomez```` cc ````@pietroalbini```` ````@Nemo157````
2021-03-07 10:41:18 +09:00
Yuki Okushi a0dcfdfb76
Rollup merge of #82793 - JohnTitor:move-ui-tests, r=petrochenkov
Move some tests to more suitable subdirs

## The results from classifui

(The full results can be found here: https://gist.github.com/JohnTitor/c9e00840990b5e4a8fc562ec3571e427)

- [lint-expr-stmt-attrs-for-early-lints.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/lint-expr-stmt-attrs-for-early-lints.rs) <sup>unknown</sup>: lint (1.566), feature-gates (-0.632), numbers-arithmetic (-0.955)
- [try-block.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/try-block.rs) <sup>unknown</sup>: binding (1.385), try-block (-0.097), lint (-0.932)
- [backtrace-debuginfo.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/backtrace-debuginfo.rs) <sup>unknown</sup>: macros (1.365), cfg (-0.279), drop (-0.291)
- [issues/issue-3521.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-3521.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/3521)</sup>: consts (1.298), enum (-0.872), in-band-lifetimes (-0.978)
- [impl-bounds-checking.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/impl-bounds-checking.rs) <sup>unknown</sup>: traits (1.243), for (-0.999), shadowed (-0.999)
- [issues/issue-17718.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-17718.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/17718)</sup>: binding (1.236), consts (0.315), extern (-0.779)
- [issue-6157.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issue-6157.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/6157)</sup>: regions (1.213), unboxed-closures (-0.285), traits (-0.510)
- [issues/issue-44373.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-44373.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/44373)</sup>: consts (1.187), nll (0.427), borrowck (-0.704)
- [nullable-pointer-ffi-compat.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/nullable-pointer-ffi-compat.rs) <sup>unknown</sup>: regions (1.184), consts (0.650), traits (-0.571)
- [issues/issue-52992.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-52992.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/52992)</sup>: nll (1.132), associated-types (-0.628), parser (-0.893)
- [issues/issue-2330.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-2330.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/2330)</sup>: traits (1.116), directory_ownership (-0.691), compare-method (-0.981)
- [issue-74047.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issue-74047.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/74047)</sup>: async-await (1.109), impl-trait (-0.629), resolve (-0.781)
- [issues/issue-33140.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-33140.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/33140)</sup>: traits (1.063), coherence (-0.832), codemap_tests (-0.944)
- [issues/issue-28576.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-28576.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/28576)</sup>: traits (1.062), associated-types (-0.333), impl-trait (-0.697)
- [issues/issue-7222.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-7222.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/7222)</sup>: binding (1.062), consts (-0.226), numbers-arithmetic (-0.294)
- [tup.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/tup.rs) <sup>unknown</sup>: structs-enums (1.061), threads-sendsync (-0.550), moves (-0.790)
- [issues/issue-15261.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-15261.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/15261)</sup>: consts (1.052), where-clauses (-0.833), macros (-0.862)
- [issues/issue-76179.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-76179.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/76179)</sup>: associated-types (1.048), process (-0.887), rfc-2457 (-0.984)
- [issues/issue-42344.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-42344.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/42344)</sup>: borrowck (1.043), macros (-0.481), specialization (-0.966)
- [issues/issue-18661.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-18661.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/18661)</sup>: unboxed-closures (1.038), mir (-0.648), higher-rank-trait-bounds (-0.688)
- [issues/issue-2633.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-2633.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/2633)</sup>: structs-enums (1.020), functions-closures (-0.722), lint (-0.967)

Some notes:
- If there are related tests (e.g. it's for the same issue), they are moved along with it.
- Moved try-block.rs to the `try-block` dir.
- Moved tup.rs to the `tuple` dir.
- Moved some tests that classified as consts to the `statics` dir, as it seems they have statics actually.
- Skipped backtrace-debuginfo.rs because I think classifui overrates their helper macros.

cc #73494
r? ```@petrochenkov```
2021-03-07 10:41:17 +09:00
Yuki Okushi a5a825e6a3
Rollup merge of #82720 - henryboisdequin:fix-79040, r=oli-obk
Fix diagnostic suggests adding type `[type error]`

Fixes #79040

### Unresolved questions:

<del>Why does this change output the diagnostic twice (`src/test/ui/79040.rs`)?</del> Thanks `````@oli-obk`````
2021-03-07 10:41:15 +09:00
Yuki Okushi f3218dfa57
Rollup merge of #82651 - jyn514:rustdoc-warnings, r=GuillaumeGomez
Cleanup rustdoc warnings

## Clean up error reporting for deprecated passes

Using `error!` here goes all the way back to the original commit, https://github.com/rust-lang/rust/pull/8540. I don't see any reason to use logging; rustdoc should use diagnostics wherever possible. See https://github.com/rust-lang/rust/pull/81932#issuecomment-785291244 for further context.

- Use spans for deprecated attributes
- Use a proper diagnostic for unknown passes, instead of error logging
- Add tests for unknown passes
- Improve some wording in diagnostics

##  Report that `doc(plugins)` doesn't work using diagnostics instead of `eprintln!`

This also adds a test for the output.

This was added in https://github.com/rust-lang/rust/pull/52194. I don't see any particular reason not to use diagnostics here, I think it was just missed in https://github.com/rust-lang/rust/pull/50541.
2021-03-07 10:41:13 +09:00
Yuki Okushi 3d762a7f36
Rollup merge of #82402 - jyn514:module-cache-refcell, r=GuillaumeGomez
Remove RefCell around `module_trait_cache`

This builds on https://github.com/rust-lang/rust/pull/82018 and should not be merged before.

## Don't require a `DocContext` for `report_diagnostic`

This is needed for the next commit, which needs mutable access to the `cx` from
within the `decorate` closure.

- Change `as_local_hir_id` to an associated function, since it only
  needs a `TyCtxt`
- Change `source_span_for_markdown_range` to only take a `TyCtxt`

##  Remove RefCell around module_trait_cache

This is mostly just changing lots of functions from `&DocContext` to `&mut DocContext`.
2021-03-07 10:41:11 +09:00
Yuki Okushi d1dc16623f
Rollup merge of #77916 - QuiltOS:kernel-code-targets-os-none, r=joshtriplett
Change built-in kernel targets to be os = none throughout

Whether for Rust's own `target_os`, LLVM's triples, or GNU config's, the
OS-related have fields have been for code running *on* that OS, not code
hat is *part* of the OS.

The difference is huge, as syscall interfaces are nothing like
freestanding interfaces. Kernels are (hypervisors and other more exotic
situations aside) freestanding programs that use the interfaces provided
by the hardware. It's *those* interfaces, the ones external to the
program being built and its software dependencies, that are the content
of the target.

For the Linux Kernel in particular, `target_env: "gnu"` is removed for
the same reason: that `-gnu` refers to glibc or GNU/linux, neither of
which applies to the kernel itself.

Relates to #74247
2021-03-07 10:41:04 +09:00
Rune Tynan 18841ec342
Revert fmt version, add rustdoc-json-types to bootstrap tests 2021-03-06 15:50:30 -05:00
Rune Tynan 70c9b370e8
x.py fmt 2021-03-06 15:50:29 -05:00
Rune Tynan 83cece468e
Move tests to own file 2021-03-06 15:50:29 -05:00
Rune Tynan ca48d1566e
Add roundtrip testing and bump format version 2021-03-06 15:50:28 -05:00
Rune Tynan cf5246915b
Remove Item::kind, use tagged enum. Rename variants to match 2021-03-06 15:50:20 -05:00
Vadim Petrochenkov 5dad6c2575 Implement built-in attribute macro `#[cfg_eval]` 2021-03-06 23:03:19 +03:00
Harald van Dijk 95e096d623
Change x64 size checks to not apply to x32.
Rust contains various size checks conditional on target_arch = "x86_64",
but these checks were never intended to apply to
x86_64-unknown-linux-gnux32. Add target_pointer_width = "64" to the
conditions.
2021-03-06 16:02:48 +00:00
Yuki Okushi eb9abea295 Move some tests to more suitable subdirs 2021-03-06 18:24:53 +09:00
Yuki Okushi 6e4dcea0d9 Handle negative literals in cast overflow warning 2021-03-06 17:33:21 +09:00
Camelid 5b74097975 Undo addition of boxes
I don't think the boxing helped performance, in fact I think it
potentially made it worse. The data was still being copied, but now it
was through a pointer. Thinking about it more, I think boxing might only
help when you're passing a big object around by value all the time,
rather than the slowdown being that you're cloning it.
2021-03-05 20:01:52 -08:00
Camelid c09d9d34f0 Don't unnecessarily clone some fields in `Context`
There was no need to clone `id_map` because it was reset before each
item was rendered. `deref_id_map` was not reset, but it was keyed by
`DefId` and thus was unlikely to have collisions (at least for now).

Now we just clone the fields that need to be cloned, and instead create
fresh versions of the others.
2021-03-05 19:41:37 -08:00
Camelid ff39c46959 Box some fields to reduce `Context` size
Reduced from 152 bytes to 88 bytes.
2021-03-05 19:41:27 -08:00
Camelid 4c51a66d67 Don't share `id_map` and `deref_id_map`
All the tests passed, so it doesn't seem they need to be shared.
Plus they should be item/page-specific.

I'm not sure why they were shared before. I think the reason `id_map`
worked as a shared value before is that it is cleared before rendering
each item (in `render_item`). And then I'm guessing `deref_id_map`
worked because it's a hashmap keyed by `DefId`, so there was no overlap
(though I'm guessing we could have had issues in the future).

Note that `id_map` currently still has to be cleared because otherwise
child items would inherit the `id_map` of their parent. I'm hoping to
figure out a way to stop cloning `Context`, but until then we have to
reset `id_map`.
2021-03-05 19:40:54 -08:00
Camelid 3bc879e76b rustdoc: Add static size assertion for `Context`
It's cloned a lot, so we don't want it to grow in size unexpectedly.

Only run the assert on x86-64 since the size is architecture-dependent.
2021-03-05 19:39:17 -08:00
Camelid b3d2a371bb rustdoc: Make a bunch of fields private
Also create issue for removing shared mutable state.
2021-03-05 19:39:08 -08:00
Henry Boisdequin 7d3a6f1655 address comments 2021-03-06 08:21:08 +05:30
Camelid c4bb66c284 rustdoc: Replace `Arc` around `SharedContext` with `Rc`
It doesn't look like it's shared across threads, so it doesn't need to
be thread-safe. Of course, since we're using Rust, we'll get an error if
we try to share it across threads, so this should be safe :)
2021-03-05 18:08:01 -08:00
Camelid 9763eb87a3 rustdoc: Move most shared fields to `SharedContext`
...and remove `Rc`s for the moved fields.

The only shared one that I didn't move was `cache`; see the doc-comment
I added to `cache` for details.
2021-03-05 17:57:58 -08:00
Tomasz Miąsko 6f49aadabb Disable destination propagation on all mir-opt-levels 2021-03-06 00:00:00 +00:00
Guillaume Gomez 8dfbc00d27
Rollup merge of #82809 - notriddle:microoptimize-main-js, r=GuillaumeGomez
rustdoc: Use substrings instead of split to grab enum variant paths

Both versions are about equally readable, but this version avoids scanning the entire path and building an intermediate array (`split()` in Rust is a lazy iterator, but not in JavaScript).
2021-03-05 21:44:44 +01:00
Guillaume Gomez 1a08cb6a36
Rollup merge of #82797 - henryboisdequin:name-issue-num, r=Xanewok
Update tests names to start with `issue-`

See ``@JohnTitor's`` [comment](https://github.com/rust-lang/rust/pull/82720#discussion_r586488083)

``@rustbot`` label +C-cleanup
2021-03-05 21:44:42 +01:00
Guillaume Gomez ef17859e35
Rollup merge of #82782 - pnkfelix:include-crate-being-compiled-in-bootstrap-verbose-output, r=Mark-Simulacrum
Make rustc shim's verbose output include crate_name being compiled.

This change is mainly motivated by an issue with the environment printing I added in PR 82403: multiple rustc invocations progress in parallel, and the environment output, spanning multiple lines, gets interleaved in ways make it difficult to extra the enviroment settings.

(This aforementioned difficulty is more of a hiccup than an outright show-stopper, because the environment variables tend to be the same for all of the rustc invocations, so it doesn't matter too much if one mixes up which lines one is looking at. But still: Better to fix it.)
2021-03-05 21:44:41 +01:00
Guillaume Gomez 15c148b4f2
Rollup merge of #82736 - spastorino:mir-opt-level-perf-changes, r=oli-obk
Bump optimization from mir_opt_level 2 to 3 and 3 to 4 and make "release" be level 2 by default

r? `@oli-obk`
2021-03-05 21:44:40 +01:00
Guillaume Gomez 34b2caa79f
Rollup merge of #82714 - estebank:missing-braces, r=oli-obk
Detect match arm body without braces

Fix #82524.
2021-03-05 21:44:39 +01:00
Guillaume Gomez 8867f7f650
Rollup merge of #82708 - GuillaumeGomez:doc-test-attr-check, r=Manishearth
Warn on `#![doc(test(...))]` on items other than the crate root and use future incompatible lint

Part of #82672.

This PR does multiple things:
 * Create a new `INVALID_DOC_ATTRIBUTE` lint which is also "future incompatible", allowing us to use it as a warning for the moment until it turns (eventually) into a hard error.
 * Use this link when `#![doc(test(...))]` isn't used at the crate level.
 * Make #82702 use this new lint as well.

r? ``@jyn514``
2021-03-05 21:44:38 +01:00
Guillaume Gomez 92861c7927
Rollup merge of #80845 - GuillaumeGomez:item-kind-transition, r=jyn514
Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to make transition over hir::ItemKind simpler

It was surprisingly difficult to make this change, mostly because of two issues:

* We now store the `ExternCrate` name in the parent struct (`clean::Item`), which forced me to modify the json conversion code a bit more than expected.
* The second problem was that, since we now have a `Some(name)`, it was trying to render it, ending up in a panic because we ended up in a `unreachable` statement. The solution was simply to add `!item.is_extern_crate()` in `formats::renderer` before calling `cx.item(item, &cache)?;`.

I'll continue to replace all the `clean::ItemKind` variants one by one until it looks exactly like `hir::ItemKind`. Then we'll simply discard the rustdoc type. Once this done, we'll be able to discard `clean::Item` too to use `hir::Item`.

r? ``@jyn514``
2021-03-05 21:44:37 +01:00
Santiago Pastorino 11d9390c93
bless mir-inlining warning message 2021-03-05 17:40:34 -03:00
Joshua Nelson 173d2aaa00 Add an unstable option to print all unversioned files
This allows sharing those files between different doc invocations
without having to know their names ahead of time.
2021-03-05 15:31:30 -05:00
Joshua Nelson 45229b0777 Rename `rustdoc` to `rustdoc::all`
When rustdoc lints were changed to be tool lints, the `rustdoc` group
was removed, leading to spurious warnings like

```
warning: unknown lint: `rustdoc`
```

The lint group still worked when rustdoc ran, since rustdoc added the group itself.

This renames the group to `rustdoc::all` for consistency with
`clippy::all` and the rest of the rustdoc lints.
2021-03-05 15:26:55 -05:00
Guillaume Gomez 6052211982 Update minifier dependency version 2021-03-05 21:17:48 +01:00
Santiago Pastorino 0941fc0bb5 Make clippy set mir_opt_level using Option 2021-03-05 17:13:57 -03:00
Santiago Pastorino af63afc09a
Bump mir-opt-level from 2 to 3 in tests 2021-03-05 17:13:57 -03:00
Santiago Pastorino 705813c84b
Bump mir-opt-level from 3 to 4 in tests 2021-03-05 17:13:57 -03:00
Santiago Pastorino 03c1f1762c
Make clippy set mir_opt_level using Option 2021-03-05 17:13:57 -03:00
Marianna Rapoport 2a57a5dcc4 Typo fix: cargo cov -> cargo profdata 2021-03-05 20:08:58 +01:00
Michael Howell 0571bc4263 Use substrings instead of split to grab enum variant paths
Both versions are about equally readable, but this version avoids scanning
the entire path and building an intermediate array (`split()` in Rust is
a lazy iterator, but not in JavaScript).
2021-03-05 11:20:31 -07:00
Michael Howell 28135b79d7 Remove redundant enableSearchInput function
enableSearchInput was called from two places:

- setupSearchLoader
- addSearchOptions, which is itself called from setupSearchLoader only

This commit can safely get rid of the addSearchOptions calls entirely,
and since the setupSearchLoader call is immediately preceded by other
method calls on search_input, there's no need to check if it's set.
2021-03-05 10:04:33 -07:00
Nikita Popov c484bfe8fc Backport some LLVM compile-time improvements
This backports two compile-time improvements from the LLVM 13
branch, which reduce the number of alias analysis queries.
2021-03-05 17:59:28 +01:00
Felix S. Klock II 444a756769 Revise prefix a bit, adding both `--test` (conditionally) and `[RUSTC-SHIM]` unconditionally.
1. I added `--test` based on review feedback from simulacrum: I decided I would
rather include such extra context than get confused later on by its absence.
(However, I chose to encode it differently than how `[RUSTC-TIMING]` does... I
don't have much basis for doing so, other than `--test` to me more directly
reflects what it came from.)

2. I also decided to include `[RUSTC-SHIM]` at start of all of these lines
driven by the verbosity level, to make to clear where these lines of text
originate from. (Basically, I skimmed over the output and realized that a casual
observer might not be able to tell where this huge set of new lines were coming
from.)
2021-03-05 11:46:04 -05:00
mark e64138c534 use pat<no_top_alt> for patterns in let bindings 2021-03-05 10:10:04 -06:00
Joshua Nelson 69a879f3d1 Store `UNVERSIONED_FILES` in a data structure
This allows querying it programatically.
2021-03-05 10:55:15 -05:00
Joshua Nelson a05a890c35 Build rustdoc for run-make tests, not just run-make-fulldeps
Rustdoc almost never needs a full stage 2 compiler, and requiring
rustdoc tests to be in run-make-fulldeps adds a lot of compile time for
no reason.
2021-03-05 10:48:21 -05:00
Guillaume Gomez 286a357045 Refactor from_clean_item_kind to improve ExternCrateItem handling 2021-03-05 16:05:07 +01:00
Guillaume Gomez f879ecc4ef Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to make transition over hir::ItemKind simpler 2021-03-05 16:04:24 +01:00
Dániel Buga 10a4c67a61 Add regression test for #75525 2021-03-05 16:01:46 +01:00
Guillaume Gomez a11e87e74d Make invalid_doc_attribute lint plural 2021-03-05 14:44:31 +01:00
Ryan Levick 0201e2bbde Add more windows specific numbers 2021-03-05 14:38:52 +01:00
bors 8fd946c63a Auto merge of #82795 - m-ou-se:rollup-uzx0b92, r=m-ou-se
Rollup of 10 pull requests

Successful merges:

 - #80723 (Implement NOOP_METHOD_CALL lint)
 - #80763 (resolve: Reduce scope of `pub_use_of_private_extern_crate` deprecation lint)
 - #81136 (Improved IO Bytes Size Hint)
 - #81939 (Add suggestion `.collect()` for iterators in iterators)
 - #82289 (Fix underflow in specialized ZipImpl::size_hint)
 - #82728 (Avoid unnecessary Vec construction in BufReader)
 - #82764 (Add {BTreeMap,HashMap}::try_insert)
 - #82770 (Add assert_matches macro.)
 - #82773 (Add diagnostic item to `Default` trait)
 - #82787 (Remove unused code from main.js)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-05 13:34:33 +00:00
Henry Boisdequin cb9b10cbd2 Update tests names to start with `issue-`
See @JohnTitor's [comment](https://github.com/rust-lang/rust/pull/82720#discussion_r586488083)

@rustbot label +C-cleanup
2021-03-05 17:04:58 +05:30
flip1995 3c502ec8a5
Remove hack that forces dogfood to run on nightly
This isn't necessary anymore, since we don't use a custom toolchain anymore
2021-03-05 11:10:29 +01:00
Mara 16518e70fb
Rollup merge of #82787 - notriddle:main-js-cleanup, r=GuillaumeGomez
Remove unused code from main.js

It looks like `lev_distance` was used in a very old version of the function, since it was written but never read, and Blame reports that it was added before the `checkGenerics` function header itself.

`convertHTMLToPlaintext` is was removed by 768d5e9509
2021-03-05 10:57:25 +01:00
Mara 20887b7ebf
Rollup merge of #81939 - kper:fixing-81584-allocate-in-iter, r=davidtwco
Add suggestion `.collect()` for iterators in iterators

Closes #81584

```
error[E0515]: cannot return value referencing function parameter `y`
 --> main3.rs:4:38
  |
4 | ...                   .map(|y| y.iter().map(|x| x + 1))
  |                                -^^^^^^^^^^^^^^^^^^^^^^
  |                                |
  |                                returns a value referencing data owned by the current function
  |                                `y` is borrowed here
  |                                help: Maybe use `.collect()` to allocate the iterator
```

Added the suggestion: `help: Maybe use `.collect()` to allocate the iterator`
2021-03-05 10:57:18 +01:00
Mara ec2619ca62
Rollup merge of #80763 - petrochenkov:pubusecrate, r=estebank
resolve: Reduce scope of `pub_use_of_private_extern_crate` deprecation lint

This lint was deny-by-default since July 2017, crater showed 7 uses on crates.io back then (https://github.com/rust-lang/rust/pull/42894#issuecomment-311921147).

Unfortunately, the construction `pub use foo as bar` where `foo` is `extern crate foo;` was used by an older version `bitflags`, so turning it into an error causes too many regressions.
So, this PR reduces the scope of the lint instead of turning it into a hard error, and only turns some more rarely used components of it into errors.
2021-03-05 10:57:15 +01:00
Mara e6a6df5daa
Rollup merge of #80723 - rylev:noop-lint-pass, r=estebank
Implement NOOP_METHOD_CALL lint

Implements the beginnings of https://github.com/rust-lang/lang-team/issues/67 - a lint for detecting noop method calls (e.g, calling `<&T as Clone>::clone()` when `T: !Clone`).

This PR does not fully realize the vision and has a few limitations that need to be addressed either before merging or in subsequent PRs:
* [ ] No UFCS support
* [ ] The warning message is pretty plain
* [ ] Doesn't work for `ToOwned`

The implementation uses [`Instance::resolve`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/instance/struct.Instance.html#method.resolve) which is normally later in the compiler. It seems that there are some invariants that this function relies on that we try our best to respect. For instance, it expects substitutions to have happened, which haven't yet performed, but we check first for `needs_subst` to ensure we're dealing with a monomorphic type.

Thank you to ```@davidtwco,``` ```@Aaron1011,``` and ```@wesleywiser``` for helping me at various points through out this PR ❤️.
2021-03-05 10:57:14 +01:00
Oli Scherer 9a2362e5a9 Shrink the size of Rvalue by 16 bytes 2021-03-05 09:33:01 +00:00
bors 8ccc89bc31 Auto merge of #82777 - GuillaumeGomez:rollup-etcsupl, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #76716 (Don't warn for `missing_doc_examples` when item is #[doc(hidden)])
 - #82088 (Shorten html::render)
 - #82690 (Update rustdoc documentation)
 - #82752 (Add a regression test for issue-81712)
 - #82765 (Fix polymorphization ICE on associated types in trait decls using const generics in bounds)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-05 09:28:07 +00:00
bors a0d66b54fb Auto merge of #71481 - estebank:inherit-stability, r=nikomatsakis
Inherit `#[stable(..)]` annotations in enum variants and fields from its item

Lint changes for #65515. The stdlib will have to be updated once this lands in beta and that version is promoted in master.
2021-03-05 05:28:07 +00:00
Michael Howell ad91915455 Remove unused code from main.js
It looks like `lev_distance` was used in a very old version of the function,
since it was written but never read, and Blame reports that it was added
before the `checkGenerics` function header itself.

`convertHTMLToPlaintext` is was removed by 768d5e9509
2021-03-04 19:41:20 -07:00
Vadim Petrochenkov 1fe2eb83ec expand: Introduce enum for module loading errors and make module loading speculative 2021-03-05 01:33:43 +03:00
Vadim Petrochenkov 39052c55bb expand: Move module file path stack from global session to expansion data
Also don't push the paths on the stack directly in `fn parse_external_mod`, return them instead.
2021-03-05 01:33:43 +03:00
Vadim Petrochenkov bc18eb4717 expand: Remove obsolete `DirectoryOwnership::UnownedViaMod`
This ownership kind is only constructed in the case of path attributes like `#[path = ".."]` without a file name segment, which always represent some kind of directories and will produce and error on attempt to parse them as a module file.
2021-03-05 01:33:43 +03:00
Felix S. Klock II f5eb5c884f Make rustc shim's verbose output include crate_name being compiled.
This change is mainly motivated by an issue with the environment
printing I added in PR 82403: multiple rustc invocations progress
in parallel, and the environment output, spanning multiple lines,
gets interleaved in ways make it difficult to extra the enviroment settings.

(This aforementioned difficulty is more of a hiccup than an outright
show-stopper, because the environment variables tend to be the same for all of
the rustc invocations, so it doesn't matter too much if one mixes up which lines
one is looking at. But still: Better to fix it.)
2021-03-04 17:19:41 -05:00
yn0ga ccca767834 Add powerpc-unknown-openbsd target
Add powerpc-unknown-openbsd target

* Fix missing abi::endian crate
* Missing platform-support.md
2021-03-04 22:43:34 +01:00
Guillaume Gomez e89276baba
Rollup merge of #82752 - JohnTitor:gat-ice-test, r=jackh726
Add a regression test for issue-81712

Fixes #81712, also fixes #79768 as duplicate.
r? `@jackh726`
2021-03-04 21:56:34 +01:00
Guillaume Gomez 2a5ecb2927
Rollup merge of #82690 - jyn514:remove-pass-docs, r=Manishearth
Update rustdoc documentation

- Remove most of the information about passes. Passes are deprecated.
- Add `--document-private-items`; it was missing before.
- Update `--output-format json`; it was very outdated.
- Note that `--input-format` is deprecated.
- Move deprecated options to the very end.

Closes https://github.com/rust-lang/rust/issues/82675.

r? `@Manishearth`
2021-03-04 21:56:33 +01:00
Guillaume Gomez 2f28361936
Rollup merge of #82088 - Nicholas-Baron:shorten_html_render, r=GuillaumeGomez
Shorten html::render

The `mod.rs` for librustdoc's `html::render` was over 3,000 lines. This PR reduces it to around 2,300 by
1. Moving `Context` and associated `impl`s to a separate file
2. Moving the `print_item` function and its helpers to a separate file
3. Moving `write_shared` and `write_minify` to their own file

Related to issue #60302.
Edit 1: `SharedContext` and related `impl`s is only 72 lines and so will not be moved.
2021-03-04 21:56:27 +01:00
Guillaume Gomez 55cec9079d Also use INVALID_DOC_ATTRIBUTE for "unknown doc attribute" warnings 2021-03-04 21:48:07 +01:00
Guillaume Gomez 85c3d102bb Add tests for #[doc(test(...)] check 2021-03-04 21:24:35 +01:00
Guillaume Gomez 1683cb12e4 Use cache access levels 2021-03-04 21:22:44 +01:00
Guillaume Gomez e4287992a7 No more need for borrow call 2021-03-04 21:22:44 +01:00
Guillaume Gomez ad30c39918 Pass TyCtxt directly instead of DocContext in librustdoc::visit_ast::inherits_doc_hidden 2021-03-04 21:22:43 +01:00
Guillaume Gomez 186f13914a Move visibility check inside the should_have_doc_example function 2021-03-04 21:22:43 +01:00
Guillaume Gomez 91095b1be5 Update missing code example test 2021-03-04 21:22:43 +01:00
Guillaume Gomez 4b30625094 Don't warn for `missing_doc_examples` when item is #[doc(hidden)] 2021-03-04 21:22:42 +01:00
bors 45b3c28518 Auto merge of #82747 - JohnTitor:pin-es-check-version, r=Mark-Simulacrum
Pin es-check version to prevent unrelated CI failures

es-check v5.2.1 causes a lot of unrelated CI failures on mingw-check, e.g. https://github.com/rust-lang/rust/pull/80723#issuecomment-790294196.
es-check v5.2.2 fixes it but let's pin its version to prevent further failures.
2021-03-04 19:24:21 +00:00
Joshua Nelson dbdaa12486 Update rustdoc documentation
- Remove most of the information about passes. Passes are deprecated.
- Add `--document-private-items`; it was missing before.
- Update `--output-format json`; it was very outdated.
- Note that `--input-format` is deprecated.
- Move deprecated options to the very end.
- Move `passes.html` to the end of the table of contents. Ideally it
  would be removed altogether, but that causes mdbook not to generate the
  docs.
2021-03-04 14:07:34 -05:00
Nicholas-Baron afb8220d0a Corrected imports for render tests and mod files
Due to a rebase, some edits were needed in the mod file.
2021-03-04 10:25:00 -08:00
Nicholas-Baron fd14e38612 Moved `write_shared` to its own file 2021-03-04 10:24:56 -08:00
Nicholas-Baron 14983b9812 Moved the `make_item_keywords` function to `context.rs` as it is only used there 2021-03-04 10:01:22 -08:00
Nicholas-Baron 6c7d7a6bf4 Moved `print_item` and helpers to a separate file 2021-03-04 10:01:22 -08:00
Nicholas-Baron 48167c499a Moved Context and its impls to a separate file 2021-03-04 10:01:22 -08:00
Joshua Nelson 675edd0231 Remove RefCell around module_trait_cache 2021-03-04 11:53:40 -05:00
Joshua Nelson b3c4e25e17 Don't require a `DocContext` for `report_diagnostic`
This is needed for the next commit, which needs access to the `cx` from
within the `decorate` closure.

- Change `as_local_hir_id` to an associated function, since it only
  needs a `TyCtxt`
- Change `source_span_for_markdown_range` to only take a `TyCtxt`
2021-03-04 11:30:38 -05:00
bors 409920873c Auto merge of #81451 - nikic:llvm-12, r=nagisa
Upgrade to LLVM 12

This implements the necessary adjustments to make rustc work with LLVM 12. I didn't encounter any major issues so far.

r? `@cuviper`
2021-03-04 15:16:44 +00:00
Yuki Okushi 06630f7b5f
Rollup merge of #82744 - camelid:cratenum-byval, r=GuillaumeGomez
Pass `CrateNum` by value instead of by reference

It's more idiomatic to pass a small Copy type by value and `CrateNum` is
half the size of `&CrateNum` on 64-bit systems. The memory use change is
almost certainly insignificant, but why not!
2021-03-04 20:01:12 +09:00
Yuki Okushi 17121f2959
Rollup merge of #82740 - jyn514:proper-history, r=Mark-Simulacrum
Fix commit detected when using `download-rustc`

On reflection on the issue in https://github.com/rust-lang/rust/pull/79540#discussion_r572572280, I think the bug was actually using the `compiler/` filter, not using `--author=bors`. 9a1d6174c9 has no CI artifacts because it was merged as part of a rollup:
```
$ curl -I https://ci-artifacts.rust-lang.org/rustc-builds/96e843ce6ae42e0aa519ba45e148269de347fd84/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz
HTTP/2 404
```
So 9a1d6174c9 is the correct commit to download, and that's what `--author=bors` does:

$ git log --author=bors 4aec8a5da5
commit 9a1d6174c9

Ideally it would look for "the most recent bors commit not followed by a change to `compiler/`", which would exclude things like documentation changes and avoid redownloading more than necessary, but
- Redownloading isn't the end of the world,
- That metric is hard to implement, and
- Documentation-only or library-only changes are very rare anyway since they're usually rolled up with changes to the compiler.

Helps with https://github.com/rust-lang/rust/issues/81930.

r? `@Mark-Simulacrum`
2021-03-04 20:01:10 +09:00
Yuki Okushi c398871341
Rollup merge of #82717 - estebank:issue-70152, r=lcnr
Account for macros when suggesting adding lifetime

Fix #70152.
2021-03-04 20:01:09 +09:00
Yuki Okushi 569f0330d8
Rollup merge of #82315 - jsha:font-display-swap, r=GuillaumeGomez
Improve page load performance in rustdoc

Add an explicit height to icons (which already had an explicit width) to allow browsers to lay out the page more accurately before the icons have been loaded. https://web.dev/optimize-cls/.

Add min-width: 115px to the crate search dropdown. When the HTML first loads, this dropdown includes only the text "All crates." Later, JS loads the items underneath it, some of which are wider. That causes the dropdown to get wider, causing a distracting reflow. This sets a min-width based on the size that the dropdown eventually becomes based on the crates on doc.rust-lang.org, reducing page movement during load.

Add font-display: swap. Per https://web.dev/font-display/, this prevents "flash of invisible text" during load by using a system font until the custom font is available. I've noticed this flash of invisible text occasionally when reading Rust docs. Note that users without cached fonts will see text, and then see it reflow. For `docs.rust-lang.org`, [setting caching headers will help a lot](https://github.com/rust-lang/simpleinfra/issues/62).

Generated output at https://jacob.hoffman-andrews.com/rust/flow-improvements/std/string/struct.String.html.
2021-03-04 20:01:04 +09:00
Yuki Okushi 36b7bef1cb
Rollup merge of #82310 - jsha:rustdoc-search-onfocus, r=GuillaumeGomez
Load rustdoc's JS search index on-demand.

Instead of being loaded on every page, the JS search index is now loaded when either (a) there is a `?search=` param, or (b) the search input is focused.

This saves both CPU and bandwidth. As of Feb 2021, https://doc.rust-lang.org/search-index1.50.0.js is 273,838 bytes gzipped or 2,544,939 bytes uncompressed. Evaluating it takes 445 ms of CPU time in Chrome 88 on a i7-10710U CPU (out of a total ~2,100 ms page reload).

Tested on Firefox and Chrome.

New:
https://jacob.hoffman-andrews.com/rust/search-on-demand/std/primitive.slice.html
https://jacob.hoffman-andrews.com/rust/search-on-demand/std/primitive.slice.html?search=fn

Old:
https://jacob.hoffman-andrews.com/rust/search-on-load/std/primitive.slice.html
https://jacob.hoffman-andrews.com/rust/search-on-load/std/primitive.slice.html?search=fn
2021-03-04 20:01:03 +09:00
Yuki Okushi f898aa3f5b
Rollup merge of #80527 - jyn514:rustdoc-lints, r=GuillaumeGomez
Make rustdoc lints a tool lint instead of built-in

- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links` (and similar for other rustdoc lints; I don't expect any others to be used frequently, though).
- Ensure that the old lint names still work and give deprecation errors
- Register lints even when running doctests
- Move lint machinery into a separate file
- Add `declare_rustdoc_lint!` macro

Unblocks https://github.com/rust-lang/rust/pull/80300, https://github.com/rust-lang/rust/pull/79816, https://github.com/rust-lang/rust/pull/80965. Makes the strangeness in https://github.com/rust-lang/rust/pull/77364 more apparent to the end user (note that `missing_docs` is *not* moved to rustdoc in this PR). Closes https://github.com/rust-lang/rust/issues/78786.

## Current status

This is blocked on #82620 (see https://github.com/rust-lang/rust/pull/80527#issuecomment-787401519)
2021-03-04 20:01:01 +09:00
Ryan Levick 8c718bd3f6 Attempt to gather similar stats as rusage on Windows 2021-03-04 11:24:54 +01:00
Yuki Okushi 0ae72509a7 Add a regression test for issue-81712 2021-03-04 18:03:21 +09:00
Yuki Okushi ed473af951 Pin es-check version to prevent unrelated CI failures 2021-03-04 15:03:01 +09:00
Camelid c79af86240 Pass `CrateNum` by value instead of by reference
It's more idiomatic to pass a small Copy type by value and `CrateNum` is
half the size of `&CrateNum` on 64-bit systems. The memory use change is
almost certainly insignificant, but why not!
2021-03-03 20:07:15 -08:00
Joshua Nelson a705a58fe9 Fix commit detected when using `download-rustc`
On reflection on the issue in https://github.com/rust-lang/rust/pull/79540#discussion_r572572280,  I think the bug was actually using the `compiler/` filter, not using `--author=bors`. 9a1d6174c9 has no CI artifacts because it was merged as part of a rollup:
```
$ curl -I https://ci-artifacts.rust-lang.org/rustc-builds/96e843ce6ae42e0aa519ba45e148269de347fd84/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz
HTTP/2 404
```
So 9a1d6174c9 is the correct commit to download, and that's what `--author=bors` does:

$ git log --author=bors 4aec8a5da5
commit 9a1d6174c9

Ideally it would look for "the most recent bors commit not followed by a change to `compiler/`", which would exclude things like documentation changes and avoid redownloading more than necessary, but
- Redownloading isn't the end of the world,
- That metric is hard to implement, and
- Documentation-only or library-only changes are very rare anyway since they're usually rolled up with changes to the compiler.
2021-03-03 22:11:07 -05:00
bors 1c77a1fa3c Auto merge of #82702 - jyn514:downgrade-err, r=Manishearth
Change error about unknown attributes to a warning

Hard errors should go through a future-compatibility phase first, especially since these attributes only have no effect and don't actively cause bugs.

Follow-up to https://github.com/rust-lang/rust/pull/82662. Fixes ecosystem breakage like https://github.com/rust-lang/rust-clippy/issues/6832.

r? `@GuillaumeGomez`
2021-03-03 21:35:32 +00:00
Esteban Küber ae494d147a Detect match arm body without braces
Fix #82524.
2021-03-03 12:17:26 -08:00
Esteban Küber 5d0697b1be reworded message 2021-03-03 12:15:26 -08:00
Nikita Popov ab03c56ba2 Explicitly disable preinline during pgo-use test
We previously used -Os to disable this pass, but since
https://reviews.llvm.org/D91673 this no longer works. Explicitly
disable it using -Cllvm-args instead.
2021-03-03 20:48:37 +01:00
hyd-dev 03e72d5446
Let Cargo track `CLIPPY_ARGS` 2021-03-04 03:29:21 +08:00
bors 476acbf1e9 Auto merge of #82553 - tmiasko:update-tracing, r=Mark-Simulacrum
Update tracing to 0.1.25

* Update tracing from 0.1.18 to 0.1.25
* Update tracing-subscriber from 0.2.13 to 0.2.16
* Update tracing-tree from 0.1.6 to 0.1.8
* Add pin-project-lite to the list of allowed dependencies (it is now a direct dependency of tracing).
2021-03-03 18:01:29 +00:00
Joshua Nelson 4b2e4e69df Change error about unknown doc attributes to a warning
This prevents breakage across the ecosystem, since the error was just
introduced recently without first having a warning period.
2021-03-03 10:04:36 -05:00
Henry Boisdequin d9d69212c3 Fix diagnostic suggests adding type `[type error]`
Fixes #79040

Unresolved questions:

Why does this change output the diagnostic twice?

Why does the CI fail when the errors are pointed out (UI tests)?
2021-03-03 16:50:07 +05:30
bors 939b14334d Auto merge of #82704 - RalfJung:miri-atomic-minmax, r=oli-obk
enable atomic_min/max tests in Miri

Thanks to `@henryboisdequin` and `@GregBowyer,` Miri now supports these intrinsics. :)
Also includes the necessary Miri update.
2021-03-03 11:05:01 +00:00
Ryan Levick 1999a3147f Fix borrow and deref 2021-03-03 11:23:29 +01:00
Ryan Levick da3995f0ec Remove lint pass on borrow and deref 2021-03-03 11:23:14 +01:00
Ryan Levick 6bf6652616 Move unrelated ui test back to what it was before 2021-03-03 11:22:59 +01:00
Ryan Levick 4be7052b1a Allow noop_method_call in clippy ui test 2021-03-03 11:22:58 +01:00
Esteban Küber e48670c34a Increase accuracy of lint trigger 2021-03-03 11:22:56 +01:00
Ryan Levick 49f32e0c8e Improve error messages 2021-03-03 11:22:55 +01:00
Ryan Levick 316e9db0cf Fix tidy error 2021-03-03 11:22:55 +01:00
Ryan Levick 95e330bd01 Update error message 2021-03-03 11:22:54 +01:00
Ryan Levick 16c4afbde4 Fix tidy errors 2021-03-03 11:22:53 +01:00
Ryan Levick 217c88655b Improve warning 2021-03-03 11:22:52 +01:00
Ryan Levick 618c395a8d Bless test where order of error message changed 2021-03-03 11:22:48 +01:00
Ryan Levick a6d926d80d Fix tests 2021-03-03 11:22:44 +01:00
Ryan Levick f49ed7a6b7 Add tests and support two more noop methods 2021-03-03 11:22:17 +01:00
Yuki Okushi 374c90b4c6
Rollup merge of #82713 - ehuss:update-cargo, r=ehuss
Update cargo

12 commits in 572e201536dc2e4920346e28037b63c0f4d88b3c..c68432f1e5cbbc09833699a951b1b5b059651dff
2021-02-24 16:51:20 +0000 to 2021-03-02 18:26:29 +0000
- Don't panic when printing JSON with non-utf8 paths (rust-lang/cargo#9226)
- Detect changes for JSON spec targets. (rust-lang/cargo#9223)
- Fix `cargo_target_empty_cfg` test with env var. (rust-lang/cargo#9225)
- Correct default cargo new edition (rust-lang/cargo#9202)
- Update split-debuginfo docs around the default. (rust-lang/cargo#9224)
- Minor update to registry API error messages. (rust-lang/cargo#9213)
- Some minor code cleanup. (rust-lang/cargo#9214)
- doc: Fix spelling worksapce-&gt;workspace (rust-lang/cargo#9212)
- Update SPDX version in docs. (rust-lang/cargo#9209)
- Throw error if CARGO_TARGET_DIR is an empty string (rust-lang/cargo#8939)
- testsuite: Use split debuginfo on macos. (rust-lang/cargo#9207)
- testsuite: Improve performance when using rustup. (rust-lang/cargo#9206)
2021-03-03 16:27:48 +09:00
Yuki Okushi 64b76da4b6
Rollup merge of #82695 - XAMPPRocky:remove-non-power-of-two-limit, r=nagisa
Revert non-power-of-two vector restriction

Removes the power of two restriction from rustc. As discussed in https://github.com/rust-lang/stdsimd/issues/63

r? ```@calebzulawski```

cc ```@workingjubilee``` ```@thomcc```
2021-03-03 16:27:44 +09:00
Yuki Okushi 0c7e8983b0
Rollup merge of #82469 - notriddle:bring-our-own-diff, r=Mark-Simulacrum
Use a crate to produce rustdoc tree comparisons instead of the `diff` command

It doesn't come with Windows, so bring [our own](https://github.com/notriddle/rust-unified-diff/).

Fixes #82409

![image](https://user-images.githubusercontent.com/1593513/109230755-9a1d5700-7782-11eb-8359-353a506875ab.png)
2021-03-03 16:27:40 +09:00
Yuki Okushi 9a827d9f7e
Rollup merge of #81223 - GuillaumeGomez:generate-redirect-map, r=jyn514
[rustdoc] Generate redirect map file

Fixes #81134.

So with this code:

```rust
#![crate_name = "foo"]

pub use private::Quz;
pub use hidden::Bar;

mod private {
    pub struct Quz;
}

#[doc(hidden)]
pub mod hidden {
    pub struct Bar;
}

#[macro_export]
macro_rules! foo {
() => {}
}
```

It generates:

```json
{
  "foo/macro.foo!.html": "foo/macro.foo.html",
  "foo/private/struct.Quz.html": "foo/struct.Quz.html",
  "foo/hidden/struct.Bar.html": "foo/struct.Bar.html"
}
```

Do the pathes look as you expected ````@pietroalbini?````

r? ````@jyn514````
2021-03-03 16:27:38 +09:00
Jacob Hoffman-Andrews f9cfe1583b Use Arial as fallback font instead of sans-serif.
On most platforms and browsers, `sans-serif` is equivalent to Arial.
However, on Firefox on Ubuntu (and possibly other Linuxes), `sans-serif`
is DejaVu Sans, a much wider font. This creates a larger shift in text
when the custom fonts finally load. Arial is a web-safe font, and
specifying it explicitly gives us more cross-platform consistency, as
well as reducing the layout shift that happens when fonts load.
2021-03-02 18:27:34 -08:00
Esteban Küber 5824917dbb Account for macros when suggesting adding lifetime
Fix #70152.
2021-03-02 18:24:13 -08:00
Jacob Hoffman-Andrews d3e7ffa7f5 Improve page load performance in rustdoc.
Add font-display: swap. Per https://web.dev/font-display/, this prevents
"flash of invisible text" during load by using a system font until the
custom font is available. I've noticed this flash of invisible text
occasionally when reading Rust docs.

Add an explicit height to icons (which already had an explicit width)
to allow browsers to lay out the page more accurately before the icons
have been loaded. https://web.dev/optimize-cls/.

Add min-width: 115px to the crate search dropdown. When the HTML first
loads, this dropdown includes only the text "All crates." Later, JS
loads the items underneath it, some of which are wider. That causes
the dropdown to get wider, causing a distracting reflow. This sets a
min-width based on the size that the dropdown eventually becomes based
on the crates on doc.rust-lang.org, reducing page movement during load.
2021-03-02 17:23:51 -08:00
Eric Huss db17e0a80b Update cargo 2021-03-02 16:24:14 -08:00
Jacob Hoffman-Andrews 768d5e9509 Load rustdoc's JS search index on-demand.
Instead of being loaded on every page, the JS search index is now
loaded when either (a) there is a `?search=` param, or (b) the search
input is focused.

This saves both CPU and bandwidth. As of Feb 2021,
https://doc.rust-lang.org/search-index1.50.0.js is 273,838 bytes
gzipped or 2,544,939 bytes uncompressed. Evaluating it takes 445 ms
of CPU time in Chrome 88 on a i7-10710U CPU (out of a total ~2,100
ms page reload).

Generate separate JS file with crate names.

This is much smaller than the full search index, and is used in the "hot
path" to draw the page. In particular it's used to crate the dropdown
for the search bar, and to append a list of crates to the sidebar (on
some pages).

Skip early search that can bypass 500ms timeout.

This was occurring when someone had typed some text during the load of
search-index.js. Their query was usually not ready to execute, and the
search itself is fairly expensive, delaying the overall load, which
delayed the input / keyup events, which delayed eventually executing the
query.
2021-03-02 13:55:25 -08:00
Ralf Jung be958e1c4e update Miri 2021-03-02 20:01:25 +01:00
Joshua Nelson d5c300b1f2 Report that `doc(plugins)` doesn't work using diagnostics instead of `println!`
This also adds a test for the output and fixes `rustc_attr` to properly
know that `plugins` is a valid attribute.
2021-03-02 11:38:07 -05:00
Joshua Nelson 44c2794976 Clean up error reporting for deprecated passes
- Use spans for deprecated attributes
- Use a proper diagnostic for unknown passes, instead of error logging
- Add tests for unknown passes
- Improve some wording in diagnostics
2021-03-02 09:31:38 -05:00
Yuki Okushi 97f9b186ae
Rollup merge of #82691 - ehuss:update-books, r=ehuss
Update books

## reference

2 commits in 361367c126290ac17cb4089f8d38fd8b2ac43f98..3b6fe80c205d2a2b5dc8a276192bbce9eeb9e9cf
2021-02-15 09:58:13 -0800 to 2021-02-22 22:09:17 -0800
- Add an extra fn() entry to the variance table in the subtyping chapter (rust-lang-nursery/reference#874)
- Turbofish: Explain what the example is of. (rust-lang-nursery/reference#966)

## book

28 commits in db5e8a5105aa22979490dce30e33b68d8645761d..0f87daf683ae3de3cb725faecb11b7e7e89f0e5a
2021-02-12 16:58:20 -0500 to 2021-03-01 08:54:04 -0500
- Ohhh the should_panic was for mdbook test. Oops
- Fix bad regex in the update rustc script and regenerate broken output
- Clarify that we only mentioned unwrap_or_else, but haven't explained it
- Add ferris to some listings that don't compile. Fixes rust-lang/book#2598
- Remove fancy quote from a code comment
- Panic now points at our code, not stdlib slice code
- Disable playground on thread::sleep examples
- Disable playground button on listings in ch 12 that use CLI args
- Reword ambiguous sentence. Fixes rust-lang/book#2317.
- Rename shoes_in_my_size to shoes_in_size to be a better example
- Fix visible "ANCHOR: here" in listing 13-21 (rust-lang/book#2628)
- minor clarification about deriving Copy and Clone (rust-lang/book#2627)
- Clarify relationship of trait to mock object
- Fix "message" that should be "method"
- Fix rust-lang/book#2625 (rust-lang/book#2626)
- fix misleading hash claim (rust-lang/book#2621)
- Make link syntax consistent and word wrap
- Added hyperlinks to Appendices
- Use console syntax highlighting in some more places
- Merge remote-tracking branch 'origin/pr/2615'
- Fix broken blockquote
- Update one more bit of output caught by the update rust script
- Update and clarify some text affected by the rand update
- Update lock files and output
- Update error output for changes to chapter 10 listings
- Merge remote-tracking branch 'origin/pr/2542'
- Tweak wording in for loop explanation
- Merge remote-tracking branch 'origin/pr/2460'

## rust-by-example

1 commits in 551cc4bc8394feccea6acd21f86d9a4e1d2271a0..3e0d98790c9126517fa1c604dc3678f396e92a27
2021-02-03 17:12:37 -0300 to 2021-02-25 08:23:10 -0300
- Make flow_control/for/.into_iter() example run (rust-lang/rust-by-example#1415)

## rustc-dev-guide

530 commits in 7adfab42bab045a848126895c2f1e09927c1331a..c431f8c29a41413dddcb3bfa0d71c9cabe366317
2020-04-08 08:52:05 +0200 to 2021-02-28 16:35:20 -0500

... Many updates.

## embedded-book

1 commits in 4cf7981696a85c3e633076c6401611bd3f6346c4..a96d096cffe5fa2c84af1b4b61e1492f839bb2e1
2021-02-11 10:55:22 +0000 to 2021-02-17 08:08:52 +0000
- Add note about using more recent openocd interface file. Closes rust-embedded/book#277 and rust-embedded/book#263  (rust-embedded/book#284)
2021-03-02 21:23:22 +09:00
Yuki Okushi 738cacffd1
Rollup merge of #82661 - lnicola:rust-analyzer-2021-03-01, r=jonas-schievink
⬆️ rust-analyzer
2021-03-02 21:23:21 +09:00
Yuki Okushi 2c40e13b84
Rollup merge of #82627 - JohnTitor:issue-82612, r=estebank
Erase late bound regions to avoid ICE

Fixes #82612, which is caused by #81769.

r? `@estebank`
2021-03-02 21:23:20 +09:00
Yuki Okushi 43bcfdb0d0
Rollup merge of #82597 - noslaver:fix-82137, r=nagisa
Get TyCtxt from self instead of passing as argument in AutoTraitFinder

First contribution 🦀, let me know if anything is amiss.

Fix #82137.
2021-03-02 21:23:19 +09:00
Yuki Okushi 543ef7f13c
Rollup merge of #82593 - sunfishcode:wasi-docs, r=alexcrichton
Teach rustdoc how to display WASI.

As a followup to [this comment] in #82420, this patch teaches rustdoc
how to display WASI.

[this comment]: https://github.com/rust-lang/rust/pull/82420#issuecomment-784523826

r? `@alexcrichton`
2021-03-02 21:23:18 +09:00
Yuki Okushi 906e535205
Rollup merge of #82579 - osa1:issue82566, r=estebank
Fix turbofish recovery with multiple generic args

This consists of two commits, each can be individually reviewed.

- First commit fixes the issue in [this comment](https://github.com/rust-lang/rust/issues/82566#issuecomment-786924466).
- Second commit fixes #82566

---

r? ````@estebank````
2021-03-02 21:23:17 +09:00
Yuki Okushi 5e68c60406
Rollup merge of #82516 - PoignardAzur:inherent-impl-ty, r=oli-obk
Add incomplete feature gate for inherent associate types.

Mentored by ``````@oli-obk``````

So far the only change is that instead of giving an automatic error, the following code compiles:

```rust
struct Foo;

impl Foo {
    type Bar = isize;
}
```

The backend work to make it actually usable isn't there yet. In particular, this:

```rust
let x : Foo::Bar;
```

will give you:

```sh
error[E0223]: ambiguous associated type
  --> /$RUSTC_DIR/src/test/ui/assoc-inherent.rs:15:13
   |
LL |     let x : Foo::Bar;
   |             ^^^^^^^^ help: use fully-qualified syntax: `<Foo as Trait>::Bar`
```
2021-03-02 21:23:15 +09:00
Yuki Okushi a9339ed531
Rollup merge of #80874 - jyn514:intra-doc-docs, r=Manishearth
Update intra-doc link documentation to match the implementation

r? `@Manishearth`
cc `@camelid` `@m-ou-se`

Relevant PRs:
- https://github.com/rust-lang/rust/pull/74489
- https://github.com/rust-lang/rust/pull/80181
- https://github.com/rust-lang/rust/pull/76078
- https://github.com/rust-lang/rust/pull/77519
- https://github.com/rust-lang/rust/pull/73101

Relevant issues:
- https://github.com/rust-lang/rust/issues/78800
- https://github.com/rust-lang/rust/issues/77200
- https://github.com/rust-lang/rust/issues/77199 / https://github.com/rust-lang/rust/issues/54191/

I haven't documented things that I consider 'just bugs', like https://github.com/rust-lang/rust/issues/77732, but I have documented features that aren't implemented, like https://github.com/rust-lang/rust/issues/78800.
2021-03-02 21:23:13 +09:00
Erin Power 5f344a2883 Fix UI errors 2021-03-02 12:18:46 +01:00
Erin Power 79c5fa1f0c Revert non-power-of-two vector restriction 2021-03-02 09:41:41 +01:00
Eric Huss b840304d8b Update books 2021-03-01 18:00:56 -08:00
Joshua Nelson 75efb6efa3 Test that using the previous lint names still applies the lint 2021-03-01 20:26:15 -05:00
Joshua Nelson 0517ea7cdc Address review comments
- Move MISSING_CRATE_LEVEL_DOCS to rustdoc directly
- Update documentation

This also takes the opportunity to make the `no-crate-level-doc-lint`
test more specific.
2021-03-01 19:29:15 -05:00