Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #83096

Closed
wants to merge 18 commits into from

Conversation

Dylan-DPC-zz
Copy link

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

alexcrichton and others added 18 commits March 5, 2021 08:43
This commit fixes an issue pointed out in rust-lang#82758 where LTO changed the
behavior of a program. It turns out that LTO was not at fault here, it
simply uncovered an existing bug. The bindings to
`__wasilibc_find_relpath` assumed that the relative portion of the path
returned was always contained within thee input `buf` we passed in. This
isn't actually the case, however, and sometimes the relative portion of
the path may reference a sub-portion of the input string itself.

The fix here is to use the relative path pointer coming out of
`__wasilibc_find_relpath` as the source of truth. The `buf` used for
local storage is discarded in this function and the relative path is
copied out unconditionally. We might be able to get away with some
`Cow`-like business or such to avoid the extra allocation, but for now
this is probably the easiest patch to fix the original issue.
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.
Fixes issue rust-lang#82920

Even if an item does not change between compilation sessions, it may end
up with a different `DefId`, since inserting/deleting an item affects
the `DefId`s of all subsequent items. Therefore, we use a `DefPathHash`
in the incremental compilation system, which is stable in the face of
changes to unrelated items.

In particular, the query system will consider the inputs to a query to
be unchanged if any `DefId`s in the inputs have their `DefPathHash`es
unchanged. Queries are pure functions, so the query result should be
unchanged if the query inputs are unchanged.

Unfortunately, it's possible to inadvertantly make a query result
incorrectly change across compilations, by relying on the specific value
of a `DefId`. Specifically, if the query result is a slice that gets
sorted by `DefId`, the precise order will depend on how the `DefId`s got
assigned in a particular compilation session. If some definitions end up
with different `DefId`s (but the same `DefPathHash`es) in a subsequent
compilation session, we will end up re-computing a *different* value for
the query, even though the query system expects the result to unchanged
due to the unchanged inputs.

It turns out that we have been sorting the predicates computed during
`astconv` by their `DefId`. These predicates make their way into the
`super_predicates_that_define_assoc_type`, which ends up getting used to
compute the vtables of trait objects. This, re-ordering these predicates
between compilation sessions can lead to undefined behavior at runtime -
the query system will re-use code built with a *differently ordered*
vtable, resulting in the wrong method being invoked at runtime.

This PR avoids sorting by `DefId` in `astconv`, fixing the
miscompilation. However, it's possible that other instances of this
issue exist - they could also be easily introduced in the future.

To fully fix this issue, we should
1. Turn on `-Z incremental-verify-ich` by default. This will cause the
   compiler to ICE whenver an 'unchanged' query result changes between
   compilation sessions, instead of causing a miscompilation.
2. Remove the `Ord` impls for `CrateNum` and `DefId`. This will make it
   difficult to introduce ICEs in the first place.
Get with field index from pattern slice instead of directly indexing

Closes rust-lang#82772
r? `@estebank`

rust-lang#82789 (comment)
> `@estebank` So the real cause is we only generate single pattern for Box here
https://github.com/csmoe/rust/blob/615b03aeaa8ce9819de7828740ab3cd7def4fa76/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs#L1130-L1132
But in the replacing function, it tries to index on the 1-length pattern slice with field 1, thus out of bounds.
https://github.com/csmoe/rust/blob/615b03aeaa8ce9819de7828740ab3cd7def4fa76/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs#L1346
…,GuillaumeGomez

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.

Follow-up to rust-lang#80527.
r? `@Manishearth`
std: Fix a bug on the wasm32-wasi target opening files

This commit fixes an issue pointed out in rust-lang#82758 where LTO changed the
behavior of a program. It turns out that LTO was not at fault here, it
simply uncovered an existing bug. The bindings to
`__wasilibc_find_relpath` assumed that the relative portion of the path
returned was always contained within thee input `buf` we passed in. This
isn't actually the case, however, and sometimes the relative portion of
the path may reference a sub-portion of the input string itself.

The fix here is to use the relative path pointer coming out of
`__wasilibc_find_relpath` as the source of truth. The `buf` used for
local storage is discarded in this function and the relative path is
copied out unconditionally. We might be able to get away with some
`Cow`-like business or such to avoid the extra allocation, but for now
this is probably the easiest patch to fix the original issue.
…no-filter, r=Nemo157

Prevent JS error when there is no dependency or other crate documented (or --disable-per-crate-search has been used)

When there is only one crate, the dropdown is removed, creating an error (that you can see pretty easily on docs.rs for example).

r? ``@jyn514``
Update cargo

7 commits in 970bc67c3775781b9708c8a36893576b9459c64a..32da9eaa5de5be241cf8096ca6b749a157194f77
2021-03-07 18:09:40 +0000 to 2021-03-13 01:18:40 +0000
- Fix logic for determining prefer-dynamic for a dylib. (rust-lang/cargo#9252)
- Fix issue with filtering exclusive target dependencies. (rust-lang/cargo#9255)
- Update pkgid-spec docs. (rust-lang/cargo#9249)
- Wordsmith the edition documentation a bit more (rust-lang/cargo#9233)
- Package ID specification urls must contain a host (rust-lang/cargo#9188)
- Add documentation for JSON message_path. (rust-lang/cargo#9247)
- Fix filter_platform to run on targets other than x86. (rust-lang/cargo#9246)
Avoid sorting predicates by `DefId`

Fixes issue rust-lang#82920

Even if an item does not change between compilation sessions, it may end
up with a different `DefId`, since inserting/deleting an item affects
the `DefId`s of all subsequent items. Therefore, we use a `DefPathHash`
in the incremental compilation system, which is stable in the face of
changes to unrelated items.

In particular, the query system will consider the inputs to a query to
be unchanged if any `DefId`s in the inputs have their `DefPathHash`es
unchanged. Queries are pure functions, so the query result should be
unchanged if the query inputs are unchanged.

Unfortunately, it's possible to inadvertantly make a query result
incorrectly change across compilations, by relying on the specific value
of a `DefId`. Specifically, if the query result is a slice that gets
sorted by `DefId`, the precise order will depend on how the `DefId`s got
assigned in a particular compilation session. If some definitions end up
with different `DefId`s (but the same `DefPathHash`es) in a subsequent
compilation session, we will end up re-computing a *different* value for
the query, even though the query system expects the result to unchanged
due to the unchanged inputs.

It turns out that we have been sorting the predicates computed during
`astconv` by their `DefId`. These predicates make their way into the
`super_predicates_that_define_assoc_type`, which ends up getting used to
compute the vtables of trait objects. This, re-ordering these predicates
between compilation sessions can lead to undefined behavior at runtime -
the query system will re-use code built with a *differently ordered*
vtable, resulting in the wrong method being invoked at runtime.

This PR avoids sorting by `DefId` in `astconv`, fixing the
miscompilation. However, it's possible that other instances of this
issue exist - they could also be easily introduced in the future.

To fully fix this issue, we should
1. Turn on `-Z incremental-verify-ich` by default. This will cause the
   compiler to ICE whenver an 'unchanged' query result changes between
   compilation sessions, instead of causing a miscompilation.
2. Remove the `Ord` impls for `CrateNum` and `DefId`. This will make it
   difficult to introduce ICEs in the first place.
Fix panic message of `assert_failed_inner`

cc rust-lang#79100 (comment)

r? `@m-ou-se`
…r=Nemo157

crates.js should use root_path and not static_root_path

r? ``@Nemo157``
@rustbot rustbot added the rollup A PR which is a rollup label Mar 13, 2021
@Dylan-DPC-zz
Copy link
Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Mar 13, 2021

📌 Commit 2ca9afc has been approved by Dylan-DPC

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 13, 2021
@bors
Copy link
Contributor

bors commented Mar 13, 2021

⌛ Testing commit 2ca9afc with merge 247d0ff600e9f8749f5a2be24232259ca69ceb4b...

@rust-log-analyzer
Copy link
Collaborator

The job dist-x86_64-linux-alt failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking chalk-solve v0.55.0
[RUSTC-TIMING] rustc_errors test:false 1.097
    Checking rustc_session v0.0.0 (/checkout/compiler/rustc_session)
 Documenting rustc_session v0.0.0 (/checkout/compiler/rustc_session)
error[E0275]: overflow evaluating the requirement `std::boxed::Box<rustc_ast::Local>: std::marker::Send`
  |
  = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`rustc_session`)
  = note: required because it appears within the type `rustc_ast::ptr::P<rustc_ast::Local>`
  = note: required because it appears within the type `rustc_ast::StmtKind`
  = note: required because it appears within the type `rustc_ast::Stmt`
  = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<rustc_ast::Stmt>`
  = note: required because it appears within the type `alloc::raw_vec::RawVec<rustc_ast::Stmt>`
  = note: required because it appears within the type `std::vec::Vec<rustc_ast::Stmt>`
  = note: required because it appears within the type `rustc_ast::Block`
  = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<rustc_ast::Block>`
  = note: required because it appears within the type `std::boxed::Box<rustc_ast::Block>`
  = note: required because it appears within the type `rustc_ast::ptr::P<rustc_ast::Block>`
  = note: required because it appears within the type `std::option::Option<rustc_ast::ptr::P<rustc_ast::Block>>`
  = note: required because it appears within the type `rustc_ast::FnKind`
  = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<rustc_ast::FnKind>`
  = note: required because it appears within the type `std::boxed::Box<rustc_ast::FnKind>`
  = note: required because it appears within the type `rustc_ast::ItemKind`
  = note: required because it appears within the type `rustc_ast::Item`
  = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<rustc_ast::Item>`
  = note: required because it appears within the type `std::boxed::Box<rustc_ast::Item>`
  = note: required because it appears within the type `rustc_ast::ptr::P<rustc_ast::Item>`
  = note: required because it appears within the type `rustc_ast::token::Nonterminal`
  = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<rustc_ast::token::Nonterminal>`
  = note: required because it appears within the type `rustc_ast::token::TokenKind`
  = note: required because it appears within the type `rustc_ast::token::Token`
  = note: required because it appears within the type `rustc_ast::tokenstream::TokenTree`
  = note: required because it appears within the type `(rustc_ast::tokenstream::TokenTree, rustc_ast::tokenstream::Spacing)`
  = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<(rustc_ast::tokenstream::TokenTree, rustc_ast::tokenstream::Spacing)>`
  = note: required because it appears within the type `alloc::raw_vec::RawVec<(rustc_ast::tokenstream::TokenTree, rustc_ast::tokenstream::Spacing)>`
  = note: required because it appears within the type `std::vec::Vec<(rustc_ast::tokenstream::TokenTree, rustc_ast::tokenstream::Spacing)>`
  = note: required because of the requirements on the impl of `std::marker::Sync` for `std::sync::Arc<std::vec::Vec<(rustc_ast::tokenstream::TokenTree, rustc_ast::tokenstream::Spacing)>>`
  = note: required because it appears within the type `rustc_ast::tokenstream::TokenStream`
  = note: required because it appears within the type `rustc_ast::MacArgs`
  = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<rustc_ast::MacArgs>`
  = note: required because it appears within the type `std::boxed::Box<rustc_ast::MacArgs>`
  = note: required because it appears within the type `rustc_ast::ptr::P<rustc_ast::MacArgs>`
  = note: required because it appears within the type `rustc_ast::MacCall`
  = note: required because it appears within the type `rustc_ast::PatKind`
  = note: required because it appears within the type `rustc_ast::Pat`
  = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<rustc_ast::Pat>`
  = note: required because it appears within the type `std::boxed::Box<rustc_ast::Pat>`
  = note: required because it appears within the type `rustc_ast::ptr::P<rustc_ast::Pat>`
  = note: required because it appears within the type `rustc_ast::ExprKind`
  = note: required because it appears within the type `rustc_ast::Expr`
  = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<rustc_ast::Expr>`
  = note: required because it appears within the type `std::boxed::Box<rustc_ast::Expr>`
  = note: required because it appears within the type `rustc_ast::ptr::P<rustc_ast::Expr>`
  = note: required because it appears within the type `rustc_ast::AnonConst`
  = note: required because it appears within the type `rustc_ast::TyKind`
  = note: required because it appears within the type `rustc_ast::Ty`
  = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<rustc_ast::Ty>`
  = note: required because it appears within the type `std::boxed::Box<rustc_ast::Ty>`
  = note: required because it appears within the type `rustc_ast::ptr::P<rustc_ast::Ty>`
  = note: required because it appears within the type `rustc_ast::GenericArg`
  = note: required because it appears within the type `rustc_ast::AngleBracketedArg`
  = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<rustc_ast::AngleBracketedArg>`
  = note: required because it appears within the type `alloc::raw_vec::RawVec<rustc_ast::AngleBracketedArg>`
  = note: required because it appears within the type `std::vec::Vec<rustc_ast::AngleBracketedArg>`
  = note: required because it appears within the type `rustc_ast::AngleBracketedArgs`
  = note: required because it appears within the type `rustc_ast::GenericArgs`
  = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<rustc_ast::GenericArgs>`
  = note: required because it appears within the type `std::boxed::Box<rustc_ast::GenericArgs>`
  = note: required because it appears within the type `rustc_ast::ptr::P<rustc_ast::GenericArgs>`
  = note: required because it appears within the type `std::option::Option<rustc_ast::ptr::P<rustc_ast::GenericArgs>>`
  = note: required because it appears within the type `rustc_ast::PathSegment`
  = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<rustc_ast::PathSegment>`
  = note: required because it appears within the type `alloc::raw_vec::RawVec<rustc_ast::PathSegment>`
  = note: required because it appears within the type `std::vec::Vec<rustc_ast::PathSegment>`
  = note: required because it appears within the type `rustc_ast::Path`
  = note: required because it appears within the type `rustc_ast::AttrItem`
  = note: required because it appears within the type `rustc_ast::AttrKind`
  = note: required because it appears within the type `rustc_ast::Attribute`
  = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<rustc_ast::Attribute>`
  = note: required because it appears within the type `alloc::raw_vec::RawVec<rustc_ast::Attribute>`
  = note: required because it appears within the type `std::vec::Vec<rustc_ast::Attribute>`
error: aborting due to previous error

For more information about this error, try `rustc --explain E0275`.
error: could not document `rustc_session`
error: could not document `rustc_session`

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustdoc --edition=2018 --crate-type lib --crate-name rustc_session compiler/rustc_session/src/lib.rs --target x86_64-unknown-linux-gnu -o /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/release/deps --extern bitflags=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-2f4ad6ed99e8eeca.rmeta --extern getopts=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/libgetopts-a25ab4e91ddfcdce.rmeta --extern num_cpus=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/libnum_cpus-25a116dd079bd38c.rmeta --extern rustc_ast=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_ast-8b6de646b17f7698.rmeta --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-1bcd359aa30f6700.rmeta --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-f614fa518bdbe09c.rmeta --extern rustc_feature=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_feature-be31542a4bd19f99.rmeta --extern rustc_fs_util=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_fs_util-94dd2387e0d3e1ef.rmeta --extern rustc_lint_defs=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_lint_defs-973b98ea4e610604.rmeta --extern rustc_macros=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/release/deps/librustc_macros-e1634dc0d7ab121f.so --extern rustc_serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_serialize-b9a24f71da7b43c7.rmeta --extern rustc_span=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_span-d61d80cbdc5cb0d4.rmeta --extern rustc_target=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_target-925ae0a0d65cf69a.rmeta --extern tracing=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/libtracing-27629d44cb623deb.rmeta -Dwarnings '-Wrustdoc::invalid_codeblock_attributes' --crate-version '1.52.0-nightly
  (247d0ff60
  2021-03-13)' --document-private-items --enable-index-page -Zunstable-options -Znormalize-docs` (exit code: 1)
[RUSTC-TIMING] rustc_hir test:false 2.578
[RUSTC-TIMING] rustc_session test:false 1.415
[RUSTC-TIMING] chalk_solve test:false 2.911
error: build failed
error: build failed


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "doc" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--locked" "--color" "always" "--features" "jemalloc llvm max_level_info" "--manifest-path" "/checkout/compiler/rustc/Cargo.toml" "--no-deps" "-p" "rustc_symbol_mangling" "-p" "rustc_driver" "-p" "rustc_parse" "-p" "rustc_hir_pretty" "-p" "rustc_query_impl" "-p" "rustc_mir" "-p" "rustc_builtin_macros" "-p" "rustc_infer" "-p" "rustc_serialize" "-p" "rustc_save_analysis" "-p" "rustc_middle" "-p" "rustc_codegen_llvm" "-p" "rustc_session" "-p" "rustc_feature" "-p" "rustc_ast_passes" "-p" "rustc_mir_build" "-p" "rustc_type_ir" "-p" "rustc_arena" "-p" "coverage_test_macros" "-p" "rustc_errors" "-p" "rustc_attr" "-p" "rustc_resolve" "-p" "rustc_passes" "-p" "rustc_ast" "-p" "rustc_plugin_impl" "-p" "rustc_ty_utils" "-p" "rustc_metadata" "-p" "rustc_graphviz" "-p" "rustc_parse_format" "-p" "rustc_target" "-p" "rustc_hir" "-p" "rustc_index" "-p" "rustc_error_codes" "-p" "rustc_interface" "-p" "rustc_lint_defs" "-p" "rustc_traits" "-p" "rustc_privacy" "-p" "rustc_expand" "-p" "rustc_ast_lowering" "-p" "rustc_codegen_ssa" "-p" "rustc_apfloat" "-p" "rustc_lexer" "-p" "rustc_lint" "-p" "rustc_llvm" "-p" "rustc_macros" "-p" "rustc_typeck" "-p" "rustc_ast_pretty" "-p" "rustc_data_structures" "-p" "rustc_query_system" "-p" "rustc_fs_util" "-p" "rustc_incremental" "-p" "rustc_span" "-p" "rustc_trait_selection"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap dist --host x86_64-unknown-linux-gnu --target x86_64-unknown-linux-gnu --include-default-paths src/tools/build-manifest --rust-profile-use=/tmp/rustc-pgo.profdata
Build completed unsuccessfully in 0:08:03

@bors
Copy link
Contributor

bors commented Mar 13, 2021

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 13, 2021
@JohnTitor
Copy link
Member

Turned out #83074 was the cause, closing.

@JohnTitor JohnTitor closed this Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.