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 11 pull requests #91485

Closed
wants to merge 44 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

lilasta and others added 30 commits October 26, 2021 00:41
* Add a few missing tracking issues in Configurations.md

* fix: tracking issue for imports_granularity stabilization

Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
Prevents wrap_comments from incorrectly wrapping reference-style doc
links.
Don't preload italic font faces because they aren't used on all pages,
and when they are used, they are used sparingly so it's okay if they are
slower to load.
Use the available Generics span field to avoid issues with `T: Fn()` bounds.

This is necessary to land rust-lang#85346.
Adds the ``nightly_only_test`` and ``stable_only_test`` attribute macros
that prevent or allow certain tests to compile on nightly and stable
respectively. This is achieved through conditionally outputting the
tests TokenStream.

If CFG_RELEASE_CHANNEL is not set, it's assumed that we're running in a
nightly environment.

To mark a test as nightly only:

    #[nightly_only_test]
    #[test]
    fn only_run_on_nightly() {
        ...
    }

To mark a test a stable only:

    #[stable_only_test]
    #[test]
    fn only_run_on_stable() {
        ...
    }
Fixes 5088

Previously, rustfmt would add a new comment line anytime it reformatted
an itemized block within a comment when ``wrap_comments=true``. This
would lead to rustfmt adding empty comments with trailing whitespace.

Now, new comment lines are only added if the original comment spanned
multiple lines, if the comment needs to be wrapped, or if the comment
originally started with an empty comment line.
This adds method similar to `MaybeUninit::write` main difference being
it returns owned `Box`. This can be used to elide copy from stack
safely, however it's not currently tested that the optimization actually
occurs.

Analogous methods are not provided for `Rc` and `Arc` as those need to
handle the possibility of sharing. Some version of them may be added in
the future.

This was discussed in rust-lang#63291 which this change extends.
When we point at a binding to suggest giving it a type, erase all the
type for ADTs that have been resolved, leaving only the ones that could
not be inferred. For small shallow types this is not a problem, but for
big nested types with lots of params, this can otherwise cause a lot of
unnecessary visual output.
When the value of a const param isn't inferred, replace it with the
param name from the definition.
Other targets allow this function to be unused, DragonFly just
misses out due to providing a specialization.
calebcartwright and others added 14 commits December 2, 2021 21:02
…tolnay

Implement write() method for Box<MaybeUninit<T>>

This adds method similar to `MaybeUninit::write` main difference being
it returns owned `Box`. This can be used to elide copy from stack
safely, however it's not currently tested that the optimization actually
occurs.

Analogous methods are not provided for `Rc` and `Arc` as those need to
handle the possibility of sharing. Some version of them may be added in
the future.

This was discussed in rust-lang#63291 which this change extends.
Make `Option::expect` unstably const

Tracking issue: rust-lang#67441
…=nagisa

Only shown relevant type params in E0283 label

When we point at a binding to suggest giving it a type, erase all the
type for ADTs that have been resolved, leaving only the ones that could
not be inferred. For small shallow types this is not a problem, but for
big nested types with lots of params, this can otherwise cause a lot of
unnecessary visual output.
…estebank

Type can be unsized and uninhabited

Fix rust-lang#88150.
rustdoc: preload fonts

Follow-up from rust-lang#82315.

I noticed that font loading was so slow that even when loading from local disk, we get a flash of unstyled text (FOUT) followed by a reflow when the fonts load. With this change, we reliably get the appropriate fonts in the first render pass when loading locally, and we get it some of the time when loading from a website.

This only preloads woff2 versions. According to https://caniuse.com/?search=preload and https://caniuse.com/?search=woff2, all browsers that support preload also support woff2, so this is fine; we will never load two copies of a font.

Don't preload italic font faces because they aren't used on all pages.

Demo: https://rustdoc.crud.net/jsha/preload-fonts/std/string/struct.String.html
Fix ICE rust-lang#91268 by checking that the snippet ends with a `)`

Fix rust-lang#91268

Previously it was assumed that the last character of `snippet` will be a `)`, so using `snippet.len() - 1` as an index should be safe. However as we see in the test, it is possible to enter that branch without a closing `)`, and it will trigger the panic if the last character happens to be multibyte.

The fix is to ensure that the snippet ends with `)`, and skip the suggestion otherwise.
Android: -ldl must appear after -lgcc when linking

rust-lang#90846 accidentally broke Android builds because it causes the standard library to no longer use `dlsym` on Android. This results in `libdl` being ignored by the linker since no symbols are needed from it. However, we later import `libgcc` for unwinding which *does* depend on `libdl` for `dl_iterate_phdr`. Since linkers don't revisit previous libraries when resolving symbols, this causes a linker error due to an undefined reference to `dl_iterate_phdr`.

This is resolved by adding a second `-ldl` after `-lgcc` in the linker command-line.
…olnay

Document Windows TLS drop behaviour

The way Windows TLS destructors are run has some "interesting" properties. They should be documented.

Fixes rust-lang#74875
…egions, r=jackh726

Use try_normalize_erasing_regions in needs_drop

Fixes rust-lang#81199

r? `@jackh726`
suppress warning about set_errno being unused on DragonFly

Other targets allow this function to be unused, DragonFly just misses out due to providing a specialization.

This fixes a build error for DragonFly.
…e, r=calebcartwright

Sync rustfmt subtree
@rustbot rustbot added the rollup A PR which is a rollup label Dec 3, 2021
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=11

@bors
Copy link
Contributor

bors commented Dec 3, 2021

📌 Commit d1096fd has been approved by matthiaskrgr

@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 Dec 3, 2021
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_passes v0.0.0 (/checkout/compiler/rustc_passes)
    Checking rustc_monomorphize v0.0.0 (/checkout/compiler/rustc_monomorphize)
    Checking rustc_query_impl v0.0.0 (/checkout/compiler/rustc_query_impl)
    Checking rustc_save_analysis v0.0.0 (/checkout/compiler/rustc_save_analysis)
error[E0053]: method `fold_ty` has an incompatible type for trait
   --> compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:913:43
    |
913 |     fn fold_ty(&mut self, t: Ty<'tcx>) -> Result<Ty<'tcx>, !> {
    |                                           |
    |                                           |
    |                                           expected `&TyS<'tcx>`, found enum `Result`
    |                                           help: change the output type to match the trait: `&'tcx TyS<'tcx>`
    |
    = note: expected fn pointer `fn(&mut ResolvedTypeParamEraser<'tcx>, &'tcx TyS<'tcx>) -> &'tcx TyS<'tcx>`
               found fn pointer `fn(&mut ResolvedTypeParamEraser<'tcx>, &'tcx TyS<'tcx>) -> Result<&'tcx TyS<'tcx>, !>`

error[E0053]: method `fold_ty` has an incompatible type for trait
   --> compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:991:43
    |
991 |     fn fold_ty(&mut self, t: Ty<'tcx>) -> Result<Ty<'tcx>, !> {
    |                                           |
    |                                           |
    |                                           expected `&TyS<'tcx>`, found enum `Result`
    |                                           help: change the output type to match the trait: `&'tcx TyS<'tcx>`
    |
    = note: expected fn pointer `fn(&mut ErrTypeParamEraser<'tcx>, &'tcx TyS<'tcx>) -> &'tcx TyS<'tcx>`
               found fn pointer `fn(&mut ErrTypeParamEraser<'tcx>, &'tcx TyS<'tcx>) -> Result<&'tcx TyS<'tcx>, !>`

error[E0599]: no method named `unwrap` found for reference `&TyS<'_>` in the current scope
   --> compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:602:77
    |
602 |                 let ty = ResolvedTypeParamEraser::new(self.tcx).fold_ty(ty).unwrap();
    |                                                                             ^^^^^^ method not found in `&TyS<'_>`

error[E0599]: no method named `unwrap` found for reference `&TyS<'_>` in the current scope
   --> compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:603:67
    |
603 |                 let ty = ErrTypeParamEraser(self.tcx).fold_ty(ty).unwrap();
    |                                                                   ^^^^^^ method not found in `&TyS<'_>`

error[E0308]: `match` arms have incompatible types
   --> compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:930:30
    |
925 |                       .map(|(subst, param)| match &(subst.unpack(), &param.kind) {
    |  ___________________________________________-
926 | |                         (_, ty::GenericParamDefKind::Type { has_default: true, .. }) => Ok(subst),
    | |                                                                                         --------- this is found to be of type `Result<rustc_middle::ty::subst::GenericArg<'_>, _>`
927 | |                         (crate::infer::GenericArgKind::Const(c), _) => {
928 | |                             Ok(self.replace_infers(c, param.index, param.name).into())
    | |                             ---------------------------------------------------------- this is found to be of type `Result<rustc_middle::ty::subst::GenericArg<'_>, _>`
929 | |                         }
930 | |                         _ => subst.super_fold_with(self),
    | |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Result`, found struct `rustc_middle::ty::subst::GenericArg`
931 | |                     })
    | |_____________________- `match` arms have incompatible types
    |
    = note: expected enum `Result<rustc_middle::ty::subst::GenericArg<'_>, _>`
             found struct `rustc_middle::ty::subst::GenericArg<'_>`
help: try wrapping the expression in a variant of `Result`
    |
930 |                         _ => Ok(subst.super_fold_with(self)),
    |                              +++                           +
930 |                         _ => Err(subst.super_fold_with(self)),
    |                              ++++                           +
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
   --> compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:951:26
    |
    |
951 |                 let ty = self.fold_ty(ty)?;
    |                          ^^^^^^^^^^^^^^^^^ the `?` operator cannot be applied to type `&TyS<'_>`
    |
    = help: the trait `std::ops::Try` is not implemented for `&TyS<'_>`
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
   --> compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:955:26
    |
    |
955 |                     _ => t.super_fold_with(self)?,
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^ the `?` operator cannot be applied to type `&TyS<'_>`
    |
    = help: the trait `std::ops::Try` is not implemented for `&TyS<'_>`
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
   --> compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:966:28
    |
    |
966 |             | ty::Never => t.super_fold_with(self)?,
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^ the `?` operator cannot be applied to type `&TyS<'_>`
    |
    = help: the trait `std::ops::Try` is not implemented for `&TyS<'_>`
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
   --> compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:968:17
    |
    |
968 |                 self.fold_ty(ty)?,
    |                 ^^^^^^^^^^^^^^^^^ the `?` operator cannot be applied to type `&TyS<'_>`
    |
    = help: the trait `std::ops::Try` is not implemented for `&TyS<'_>`
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
   --> compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:976:37
    |
    |
976 |             _ if self.level == 1 => t.super_fold_with(self)?,
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^ the `?` operator cannot be applied to type `&TyS<'_>`
    |
    = help: the trait `std::ops::Try` is not implemented for `&TyS<'_>`

error[E0308]: `match` arms have incompatible types
   --> compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:994:18
992 | /         match t.kind() {
992 | /         match t.kind() {
993 | |             ty::Error(_) => Ok(self.tcx().mk_ty_var(ty::TyVid::from_u32(0))),
    | |                             ------------------------------------------------ this is found to be of type `Result<&'tcx TyS<'tcx>, !>`
994 | |             _ => t.super_fold_with(self),
    | |                  ^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Result`, found `&TyS<'_>`
995 | |         }
    | |_________- `match` arms have incompatible types
    |
    = note:   expected enum `Result<&'tcx TyS<'tcx>, !>`
            found reference `&TyS<'_>`
help: try wrapping the expression in `Ok`
    |
994 |             _ => Ok(t.super_fold_with(self)),
    |                  +++                       +
    Checking rustc_codegen_ssa v0.0.0 (/checkout/compiler/rustc_codegen_ssa)
    Checking rustc_resolve v0.0.0 (/checkout/compiler/rustc_resolve)
Some errors have detailed explanations: E0053, E0277, E0308, E0599.
For more information about an error, try `rustc --explain E0053`.

@matthiaskrgr matthiaskrgr deleted the rollup-a81n4r1 branch December 12, 2021 09:58
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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.