]> git.lizzy.rs Git - rust.git/log
rust.git
23 months agoRollup merge of #99290 - compiler-errors:revert-98794, r=lcnr
Matthias Krüger [Sat, 16 Jul 2022 20:30:52 +0000 (22:30 +0200)]
Rollup merge of #99290 - compiler-errors:revert-98794, r=lcnr

Revert "Highlight conflicting param-env candidates"

This reverts #98794, commit 08135254dcf22be0d5661ea8f75e703b29a83514.

Seems to have caused an incremental compilation bug. The root cause of the incr comp bug is somewhat unrelated but is triggered by this PR, so I don't feel comfortable with having this PR in the codebase until it can be investigated further. Fixes #99233.

23 months agoRollup merge of #99287 - GuillaumeGomez:rustdoc-json-double-export, r=notriddle
Matthias Krüger [Sat, 16 Jul 2022 20:30:51 +0000 (22:30 +0200)]
Rollup merge of #99287 - GuillaumeGomez:rustdoc-json-double-export, r=notriddle

[rustdoc-json] JSON no longer inlines

Fixes #98007.
Fixes #96161.
Fixes https://github.com/rust-lang/rust/issues/83057.
Fixes https://github.com/rust-lang/rust/issues/83720.

I took over #93518 and applied the comments and added more tests.

There was one thing missing (which is in the second commit): if a non-exported item was used in a public API but not reexported, it was still missing.

cc `@CraftSpider` `@Urgau` `@Enselic`

r? `@notriddle`

23 months agoRollup merge of #99259 - RalfJung:visit-a-place, r=oli-obk
Matthias Krüger [Sat, 16 Jul 2022 20:30:51 +0000 (22:30 +0200)]
Rollup merge of #99259 - RalfJung:visit-a-place, r=oli-obk

interpret/visitor: support visiting with a PlaceTy

Finally we can visit a `PlaceTy` in a way that will only do `force_allocation` when needed ti visit a field. :)

r? `@oli-obk`

23 months agoRollup merge of #99258 - estebank:suggest-let, r=wesleywiser
Matthias Krüger [Sat, 16 Jul 2022 20:30:49 +0000 (22:30 +0200)]
Rollup merge of #99258 - estebank:suggest-let, r=wesleywiser

Provide structured suggestion for dropped temp value

23 months agoRollup merge of #99213 - davidtwco:translation-migrate-passes, r=compiler-errors
Matthias Krüger [Sat, 16 Jul 2022 20:30:48 +0000 (22:30 +0200)]
Rollup merge of #99213 - davidtwco:translation-migrate-passes, r=compiler-errors

migrate some of `rustc_passes::check_attr`'s diagnostics and derive improvements

- Implements `IntoDiagnosticArg` for `char` using its `Debug` implementation and introduces a macro for those types which just delegate the implementation to `ToString`.
- Apply the `#[rustc_lint_diagnostics]` attribute to `LintDiagnosticBuilder::build` so that diagnostic migration lints will trigger for it - some diagnostics in `rustc_privacy` need updated after this since the lints apply to that crate.
- Add support for `MultiSpan` with any of the attributes that work on a `Span` in the diagnostic derive (`SessionDiagnostic` + `LintDiagnostic`). Requires that diagnostic logic generated for these attributes are emitted in the by-move block rather than the by-ref block that they would normally have been generated in.
- Both diagnostic and subdiagnostic derives were missing the ability to add warnings to diagnostics - this is made more difficult by the `warn` attribute already existing, so this name being unavailable for the derives to use. `#[warn_]` is used instead, which requires special-casing so that `{span_,}warn` is called instead of `{span_,}warn_`.
- Migrate half of the `rustc_passes::check_attr` diagnostics to using diagnostic derives and being translatable. I got tired after a while. I modified some diagnostic output for consistency while doing this, nothing too crazy.

r? `@compiler-errors`

23 months agoRollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank
Matthias Krüger [Sat, 16 Jul 2022 20:30:47 +0000 (22:30 +0200)]
Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank

Allow destructuring opaque types in their defining scopes

fixes #96572

Before this PR, the following code snippet failed with an incomprehensible error, and similar code just ICEd in mir borrowck.

```rust
    type T = impl Copy;
    let foo: T = (1u32, 2u32);
    let (a, b) = foo;
```

The problem was that the last line created MIR projections of the form `foo.0` and `foo.1`, but `foo`'s type is `T`, which doesn't have fields (only its hidden type does). But the pattern supplies enough type information (a tuple of two different inference types) to bind a hidden type.

23 months agoAuto merge of #99315 - JohnTitor:rollup-77wzoc1, r=JohnTitor
bors [Sat, 16 Jul 2022 16:30:25 +0000 (16:30 +0000)]
Auto merge of #99315 - JohnTitor:rollup-77wzoc1, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #98387 (Add new unstable API `downcast` to `std::io::Error`)
 - #98662 (Add std::fs::write documentation precision)
 - #99253 (Remove FIXME from MIR `always_storage_live_locals`)
 - #99264 (Fix typo in mod.rs)
 - #99270 (Add `#[must_use]` to `Box::from_raw`)
 - #99277 (Stabilize `core::ffi::CStr`, `alloc::ffi::CString`, and friends)
 - #99307 (Add regression test for #64401)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

23 months agoAuto merge of #99263 - compiler-errors:issue-99261, r=jyn514
bors [Sat, 16 Jul 2022 14:05:52 +0000 (14:05 +0000)]
Auto merge of #99263 - compiler-errors:issue-99261, r=jyn514

Fix ICE in `named_arguments_used_positionally` lint

Fixes #99261
Fixes #99289
Fixes #99284
Fixes #99273
Fixes #99297
Fixes #99271

This match pattern:

```
 FormatSpec { width: Count::CountIsName(s, _), .. }
| FormatSpec { precision: Count::CountIsName(s, _), .. }
```

does not account for when both `width` and `precision` are both `Count::CountIsName`, so split the check for these two fields into two separate `if let`.

Also, remove any future potential for ICEs by removing the index operator altogether.

---

It is still suspicious that this indexing was broken and caused the ICE, as opposed to just causing a spurious lint message.

cc `@PrestonFrom,` who may be familiar with this code because of implementing the lint this touches, perhaps you'd like to look into why named arguments in `FormatSpec.precision` seem to have indices that don't correspond to a span in `Context.arg_spans`?

Edit: Opened #99265 to track a (related?) incorrect argument indexing issue.

23 months agoAdd tests for JSON non-inlining
Guillaume Gomez [Fri, 15 Jul 2022 15:48:46 +0000 (17:48 +0200)]
Add tests for JSON non-inlining

23 months agoCorrectly handle usage of private items in public API for JSON output format
Guillaume Gomez [Fri, 15 Jul 2022 16:10:52 +0000 (18:10 +0200)]
Correctly handle usage of private items in public API for JSON output format

23 months agoFix rustdoc JSON inline
Guillaume Gomez [Fri, 15 Jul 2022 15:37:07 +0000 (17:37 +0200)]
Fix rustdoc JSON inline

23 months agoAuto merge of #96482 - willcrichton:fix-trait-suggestion-for-binops, r=estebank
bors [Sat, 16 Jul 2022 11:36:19 +0000 (11:36 +0000)]
Auto merge of #96482 - willcrichton:fix-trait-suggestion-for-binops, r=estebank

Add Output = expected type trait obligation for known binary operators

This PR is a follow-on to #94034 that addresses #96442. That is, after replacing the trait-suggestion logic in `op.rs` with a more generic path that analyzes a general set of `Obligation`s, then we lost some specificity in the suggestions where the bounds on the associated type `Output=` would not get suggested.

This PR fixes this issue by changing `FnCtxt::construct_obligation_for_trait` to include a new `ProjectionPredicate` obligation for binary operators that obliges that `Output` is the same as the expected type of the expression. Additionally, to get the expected type of the expression, this PR threads the `Expectation<'tcx>` structure throughout several functions.

See src/test/ui/generic-associated-types/missing-bounds.stderr for an example of how this works.

One side effect of this change is it causes type-check failures with binops to include additional information. Specifically, many now say

```
error: type mismatch resolving `<Lhs as TheBinop>::Output == ExpectedTy`
```

It's up for discussion whether this added context is worth it to the user.

r? `@estebank`

23 months agoRollup merge of #99307 - JohnTitor:issue-64401, r=compiler-errors
Yuki Okushi [Sat, 16 Jul 2022 08:53:05 +0000 (17:53 +0900)]
Rollup merge of #99307 - JohnTitor:issue-64401, r=compiler-errors

Add regression test for #64401

Closes #64401
r? `@compiler-errors`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoRollup merge of #99277 - joshtriplett:stabilize-core-cstr-alloc-cstring, r=Mark-Simul...
Yuki Okushi [Sat, 16 Jul 2022 08:53:04 +0000 (17:53 +0900)]
Rollup merge of #99277 - joshtriplett:stabilize-core-cstr-alloc-cstring, r=Mark-Simulacrum

Stabilize `core::ffi::CStr`, `alloc::ffi::CString`, and friends

Stabilize the `core_c_str` and `alloc_c_string` feature gates.

Change `std::ffi` to re-export these types rather than creating type
aliases, since they now have matching stability.

23 months agoRollup merge of #99270 - rhysd:issue-99269, r=Mark-Simulacrum
Yuki Okushi [Sat, 16 Jul 2022 08:53:03 +0000 (17:53 +0900)]
Rollup merge of #99270 - rhysd:issue-99269, r=Mark-Simulacrum

Add `#[must_use]` to `Box::from_raw`

Fixes #99269

23 months agoRollup merge of #99264 - eltociear:patch-14, r=compiler-errors
Yuki Okushi [Sat, 16 Jul 2022 08:53:02 +0000 (17:53 +0900)]
Rollup merge of #99264 - eltociear:patch-14, r=compiler-errors

Fix typo in mod.rs

constuct -> construct

23 months agoRollup merge of #99253 - pierwill:pierwill/rm-storage-fixme, r=oli-obk
Yuki Okushi [Sat, 16 Jul 2022 08:53:01 +0000 (17:53 +0900)]
Rollup merge of #99253 - pierwill:pierwill/rm-storage-fixme, r=oli-obk

Remove FIXME from MIR `always_storage_live_locals`

See discussion in https://github.com/rust-lang/rust/pull/99025#issuecomment-1183347428.

23 months agoRollup merge of #98662 - LucasDumont:document_fs_write, r=thomcc
Yuki Okushi [Sat, 16 Jul 2022 08:53:00 +0000 (17:53 +0900)]
Rollup merge of #98662 - LucasDumont:document_fs_write, r=thomcc

Add std::fs::write documentation precision

Fixes #97947.

As mentioned in #97947, the documentation is updated

23 months agoRollup merge of #98387 - NobodyXu:feature/std_io_Error_try_downgrade_inner, r=yaahc
Yuki Okushi [Sat, 16 Jul 2022 08:52:59 +0000 (17:52 +0900)]
Rollup merge of #98387 - NobodyXu:feature/std_io_Error_try_downgrade_inner, r=yaahc

Add new unstable API `downcast` to `std::io::Error`

https://github.com/rust-lang/libs-team/issues/57

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
23 months agoAdd regression test for #64401
Yuki Okushi [Sat, 16 Jul 2022 01:25:00 +0000 (10:25 +0900)]
Add regression test for #64401

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoFix suggestion regression with incorrect syntactic combination of trait bounds
Will Crichton [Sat, 16 Jul 2022 01:02:26 +0000 (18:02 -0700)]
Fix suggestion regression with incorrect syntactic combination of trait bounds

23 months agoPropagate Expectation around binop typeck code to construct more precise trait obliga...
Will Crichton [Tue, 26 Apr 2022 20:59:08 +0000 (13:59 -0700)]
Propagate Expectation around binop typeck code to construct more precise trait obligations for binops.

23 months agoAuto merge of #95685 - oxidecomputer:restore-static-dwarf, r=pnkfelix
bors [Sat, 16 Jul 2022 00:18:54 +0000 (00:18 +0000)]
Auto merge of #95685 - oxidecomputer:restore-static-dwarf, r=pnkfelix

Revert "Work around invalid DWARF bugs for fat LTO"

Since September, the toolchain has not been generating reliable DWARF
information for static variables when LTO is on. This has affected
projects in the embedded space where the use of LTO is typical. In our
case, it has kept us from bumping past the 2021-09-22 nightly toolchain
lest our debugger break. This has been a pretty dramatic regression for
people using debuggers and static variables. See #90357 for more info
and a repro case.

This commit is a mechanical revert of
d5de680e20def848751cb3c11e1182408112b1d3 from PR #89041, which caused
the issue. (Note on that PR that the commit's author has requested it be
reverted.)

I have locally verified that this fixes #90357 by restoring the
functionality of both the repro case I posted on that bug, and debugger
behavior on real programs. There do not appear to be test cases for this
in the toolchain; if I've missed them, point me at 'em and I'll update
them.

23 months agoAuto merge of #99288 - Aaron1011:stable-intrinsics, r=yaahc
bors [Fri, 15 Jul 2022 21:38:02 +0000 (21:38 +0000)]
Auto merge of #99288 - Aaron1011:stable-intrinsics, r=yaahc

Mark stabilized intrinsics with `rustc_allowed_through_unstable_modules`

Fixes #99286

PR #95956 accidentally made these intrinsics unstable when
accessed through the unstable path segment 'std::intrinsics'

23 months agoSet minimum GDB version needed for basic-types-globals* tests.
Luqman Aden [Fri, 15 Jul 2022 20:46:14 +0000 (13:46 -0700)]
Set minimum GDB version needed for basic-types-globals* tests.

23 months agoApply suggestions from code review
Jane Losare-Lusby [Fri, 15 Jul 2022 20:17:44 +0000 (13:17 -0700)]
Apply suggestions from code review

23 months agoFix rebase
Esteban Küber [Fri, 15 Jul 2022 18:07:20 +0000 (11:07 -0700)]
Fix rebase

23 months agoMove tests to fit in limit
Esteban Küber [Fri, 15 Jul 2022 01:43:41 +0000 (18:43 -0700)]
Move tests to fit in limit

23 months agoAvoid incorrect suggestion
Esteban Küber [Fri, 15 Jul 2022 01:41:12 +0000 (18:41 -0700)]
Avoid incorrect suggestion

We check that there's a single level of block nesting to ensure always
correct suggestions. If we don't, then we only provide a free-form
message to avoid misleading users in cases like
`src/test/ui/nll/borrowed-temporary-error.rs`.

We could expand the analysis to suggest hoising all of the relevant
parts of the users' code to make the code compile, but that could be
too much.

23 months agoProvide structured suggestion for dropped temp value
Esteban Küber [Fri, 15 Jul 2022 00:12:01 +0000 (17:12 -0700)]
Provide structured suggestion for dropped temp value

23 months agoOnly suggest if span is not erroneous
Michael Goulet [Fri, 15 Jul 2022 17:32:15 +0000 (17:32 +0000)]
Only suggest if span is not erroneous

23 months agoFix ICE in named_arguments_used_positionally lint
Michael Goulet [Fri, 15 Jul 2022 03:45:23 +0000 (20:45 -0700)]
Fix ICE in named_arguments_used_positionally lint

23 months agoRevert "Highlight conflicting param-env candidates"
Michael Goulet [Fri, 15 Jul 2022 16:30:07 +0000 (16:30 +0000)]
Revert "Highlight conflicting param-env candidates"

This reverts commit 08135254dcf22be0d5661ea8f75e703b29a83514.

23 months agoAuto merge of #99015 - lcnr:fn-ctxt-no-more, r=compiler-errors
bors [Fri, 15 Jul 2022 17:11:07 +0000 (17:11 +0000)]
Auto merge of #99015 - lcnr:fn-ctxt-no-more, r=compiler-errors

stop using `FnCtxt` outside of hir typeck

the requirements between **hir typeck**™, and **not hir typeck**™ are different enough to warrant a full split. with this PR `FnCtxt` is now only used for hir typeck (and for one clippy lint which seems to be emulating hir typeck).

Once this PR has landed I intend to move `FnCtxt` into a new crate. This should also allow some further general improvements here.

r? rust-lang/types

23 months agoMark stabilized intrinsics with `rustc_allowed_through_unstable_modules`
Aaron Hill [Fri, 15 Jul 2022 16:17:17 +0000 (11:17 -0500)]
Mark stabilized intrinsics with `rustc_allowed_through_unstable_modules`

Fixes #99286

PR #95956 accidentally made these intrinsics unstable when
accessed through the unstable path segment 'std::intrinsics'

23 months agoInfer wildcard type from other patterns at every pattern level
Oli Scherer [Tue, 28 Jun 2022 11:19:38 +0000 (11:19 +0000)]
Infer wildcard type from other patterns at every pattern level

23 months agoMove constructor into the branch that actually uses it
Oli Scherer [Tue, 28 Jun 2022 10:49:55 +0000 (10:49 +0000)]
Move constructor into the branch that actually uses it

23 months agoRevert a hack that only ever worked on level deep
Oli Scherer [Tue, 28 Jun 2022 08:00:25 +0000 (08:00 +0000)]
Revert a hack that only ever worked on level deep

23 months agoMake destructuring a defining use
Oli Scherer [Tue, 28 Jun 2022 07:17:43 +0000 (07:17 +0000)]
Make destructuring a defining use

23 months agoAllow destructuring opaque types, since the patterns constrain the opaque types
Oli Scherer [Mon, 27 Jun 2022 16:26:41 +0000 (16:26 +0000)]
Allow destructuring opaque types, since the patterns constrain the opaque types

23 months agoSome tracing helpers
Oli Scherer [Mon, 27 Jun 2022 16:16:11 +0000 (16:16 +0000)]
Some tracing helpers

23 months agoReuse a helper method instead of manually rolling it
Oli Scherer [Mon, 27 Jun 2022 14:46:36 +0000 (14:46 +0000)]
Reuse a helper method instead of manually rolling it

23 months agoRemove early return that would likely have caused miscompilations if it ever happened
Oli Scherer [Fri, 24 Jun 2022 14:53:59 +0000 (14:53 +0000)]
Remove early return that would likely have caused miscompilations if it ever happened

23 months agoPass one argument instead of fetching two fields of it at every call site
Oli Scherer [Thu, 23 Jun 2022 16:08:02 +0000 (16:08 +0000)]
Pass one argument instead of fetching two fields of it at every call site

23 months agoAdd some tracing instrumentation
Oli Scherer [Thu, 23 Jun 2022 14:32:01 +0000 (14:32 +0000)]
Add some tracing instrumentation

23 months agointerpret/visitor: support visiting with a PlaceTy
Ralf Jung [Fri, 15 Jul 2022 00:32:45 +0000 (20:32 -0400)]
interpret/visitor: support visiting with a PlaceTy

23 months agoIntroduce opaque type to hidden type projection
Oli Scherer [Wed, 22 Jun 2022 15:28:28 +0000 (15:28 +0000)]
Introduce opaque type to hidden type projection

23 months agopasses: migrate half of `check_attr`
David Wood [Mon, 11 Jul 2022 17:59:04 +0000 (18:59 +0100)]
passes: migrate half of `check_attr`

Migrate half of the `rustc_passes::check_attr` diagnostics to using
diagnostic derives and being translatable.

23 months agomacros: support adding warnings to diags
David Wood [Mon, 11 Jul 2022 17:46:24 +0000 (18:46 +0100)]
macros: support adding warnings to diags

Both diagnostic and subdiagnostic derives were missing the ability to
add warnings to diagnostics - this is made more difficult by the `warn`
attribute already existing, so this name being unavailable for the
derives to use. `#[warn_]` is used instead, which requires
special-casing so that `{span_,}warn` is called instead of
`{span_,}warn_`.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agomacros: support `MultiSpan` in diag derives
David Wood [Mon, 11 Jul 2022 16:15:31 +0000 (17:15 +0100)]
macros: support `MultiSpan` in diag derives

Add support for `MultiSpan` with any of the attributes that work on a
`Span` - requires that diagnostic logic generated for these attributes
are emitted in the by-move block rather than the by-ref block that they
would normally have been generated in.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agoerrors: lint on `LintDiagnosticBuilder::build`
David Wood [Mon, 11 Jul 2022 15:29:24 +0000 (16:29 +0100)]
errors: lint on `LintDiagnosticBuilder::build`

Apply the `#[rustc_lint_diagnostics]` attribute to
`LintDiagnosticBuilder::build` so that diagnostic migration lints will
trigger for it.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agoerrors: impl `IntoDiagnosticArg` for `char`
David Wood [Mon, 11 Jul 2022 15:28:38 +0000 (16:28 +0100)]
errors: impl `IntoDiagnosticArg` for `char`

Implements `IntoDiagnosticArg` for `char` using its `Debug`
implementation and introduces a macro for those types which just
delegate the implementation to `ToString`.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agohir typeck: `fulfillment_cx` ignore regions
lcnr [Fri, 8 Jul 2022 09:17:12 +0000 (11:17 +0200)]
hir typeck: `fulfillment_cx` ignore regions

23 months agoprovide `generic_param_scope` for region errors
lcnr [Fri, 8 Jul 2022 08:59:35 +0000 (10:59 +0200)]
provide `generic_param_scope` for region errors

23 months agodon't require `FnCtxt` to check global asm
lcnr [Thu, 7 Jul 2022 14:14:27 +0000 (16:14 +0200)]
don't require `FnCtxt` to check global asm

23 months agotry to avoid `FnCtxt` during wf
lcnr [Thu, 7 Jul 2022 13:12:32 +0000 (15:12 +0200)]
try to avoid `FnCtxt` during wf

23 months agoremove unnecessary `select_obligations_where_possible`
lcnr [Thu, 7 Jul 2022 11:43:01 +0000 (13:43 +0200)]
remove unnecessary `select_obligations_where_possible`

this was previously used for opaque types but became unnecessary
after #89024

23 months agoremove `impl_implied_bounds` from `FnCtxt`
lcnr [Thu, 7 Jul 2022 09:05:02 +0000 (11:05 +0200)]
remove `impl_implied_bounds` from `FnCtxt`

23 months ago`QueryNormalizer` bug on ambiguity
lcnr [Thu, 7 Jul 2022 09:04:36 +0000 (11:04 +0200)]
`QueryNormalizer` bug on ambiguity

23 months agoAuto merge of #99046 - nnethercote:final-derive-output-improvements, r=Mark-Simulacrum
bors [Fri, 15 Jul 2022 14:30:14 +0000 (14:30 +0000)]
Auto merge of #99046 - nnethercote:final-derive-output-improvements, r=Mark-Simulacrum

Final derive output improvements

With all these changes, the derive output in `deriving-all-codegen.stdout` is pretty close to optimal, i.e. very similar to what you'd write by hand.

r? `@ghost`

23 months agoAuto merge of #99278 - Dylan-DPC:rollup-fcln6st, r=Dylan-DPC
bors [Fri, 15 Jul 2022 11:44:20 +0000 (11:44 +0000)]
Auto merge of #99278 - Dylan-DPC:rollup-fcln6st, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #88991 (Add Nintendo Switch as tier 3 target)
 - #98869 (Remove some usages of `guess_head_span`)
 - #99119 (Refactor: remove a string matching about methods)
 - #99209 (Correctly handle crate level page on docs.rs as well)
 - #99246 (Update RLS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

23 months agoRollup merge of #99246 - Xanewok:update-rls, r=jyn514
Dylan DPC [Fri, 15 Jul 2022 10:23:40 +0000 (15:53 +0530)]
Rollup merge of #99246 - Xanewok:update-rls, r=jyn514

Update RLS

Fixes #99234

r? `@jyn514`
cc `@Mark-Simulacrum`

23 months agoRollup merge of #99209 - GuillaumeGomez:crate-level-sidebar, r=jsha
Dylan DPC [Fri, 15 Jul 2022 10:23:39 +0000 (15:53 +0530)]
Rollup merge of #99209 - GuillaumeGomez:crate-level-sidebar, r=jsha

Correctly handle crate level page on docs.rs as well

Fixes #99121.

On docs.rs, they move the `class` attribute into a child which still has `rustdoc`. So instead of using the `<body>`, we can simply use this one directly.

r? `@jsha`

23 months agoRollup merge of #99119 - TaKO8Ki:remove-string-matching-about-methods, r=cjgillot
Dylan DPC [Fri, 15 Jul 2022 10:23:38 +0000 (15:53 +0530)]
Rollup merge of #99119 - TaKO8Ki:remove-string-matching-about-methods, r=cjgillot

Refactor: remove a string matching about methods

This patch remove a string matching about methods and adds some rustfix tests.

23 months agoRollup merge of #98869 - compiler-errors:stop_guessing_head_span, r=cjgillot
Dylan DPC [Fri, 15 Jul 2022 10:23:37 +0000 (15:53 +0530)]
Rollup merge of #98869 - compiler-errors:stop_guessing_head_span, r=cjgillot

Remove some usages of `guess_head_span`

No need to pass things through `guess_head_span` if they already point to the head span.

Only major change is that we point to the head span of `enum`s on some errors now, which I prefer.

r? `@cjgillot`

23 months agoRollup merge of #88991 - libstd-switch:aarch64-nintendo-switch, r=wesleywiser
Dylan DPC [Fri, 15 Jul 2022 10:23:36 +0000 (15:53 +0530)]
Rollup merge of #88991 - libstd-switch:aarch64-nintendo-switch, r=wesleywiser

Add Nintendo Switch as tier 3 target

[Relevant Zulip Discussion](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Upstreaming.20Nintendo.20Switch.20Support/near/253445503)

This is the first step towards working on incrementally adding support for the Nintendo Switch. After this lands `@leo60228` and I will work on ensuring further work is cleared from a legal perspective before continuing on to work on an allocator and porting libstd.

The plan is to keep these changes small and incremental enough so as to not cause unneeded burden on reviewers by submitting a single large patch, as was felt to be the case last attempt at upstreaming (#74567).

All this specific patch does is add the target itself without and std support, which has been tested on-device and is working as expected.

Designated Target Maintainers:
* `@leo60228`
* `@jam1garner`

23 months agoStabilize `core::ffi::CStr`, `alloc::ffi::CString`, and friends
Josh Triplett [Fri, 15 Jul 2022 10:10:35 +0000 (03:10 -0700)]
Stabilize `core::ffi::CStr`, `alloc::ffi::CString`, and friends

Stabilize the `core_c_str` and `alloc_c_string` feature gates.

Change `std::ffi` to re-export these types rather than creating type
aliases, since they now have matching stability.

23 months agoAuto merge of #99013 - RalfJung:dont-poison-my-places, r=oli-obk
bors [Fri, 15 Jul 2022 08:57:59 +0000 (08:57 +0000)]
Auto merge of #99013 - RalfJung:dont-poison-my-places, r=oli-obk

interpret: get rid of MemPlaceMeta::Poison

This is achieved by refactoring the projection code (`{mplace,place,operand}_{downcast,field,index,...}`) so that we no longer need to call `assert_mem_place` in the operand handling.

23 months agoadd `#[must_use]` to `Box::from_raw`
rhysd [Fri, 15 Jul 2022 08:05:50 +0000 (17:05 +0900)]
add `#[must_use]` to `Box::from_raw`

23 months agoAuto merge of #99267 - Dylan-DPC:rollup-d8l7y1o, r=Dylan-DPC
bors [Fri, 15 Jul 2022 06:14:51 +0000 (06:14 +0000)]
Auto merge of #99267 - Dylan-DPC:rollup-d8l7y1o, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #99113 (Simplify [a]rc code a little)
 - #99131 (Add label for generic arg (+ APIT) and RPIT callables in `label_fn_like`)
 - #99237 (removed unused CSS and unused HTML IDs)
 - #99239 (Add myself to the set of people notified when MIR changes.)
 - #99241 (Remove comment referring to constness.rs)
 - #99257 (Add regression test for #89436)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

23 months agosimplify `suggest_deref_ref_or_into`
Takayuki Maeda [Fri, 15 Jul 2022 05:29:15 +0000 (14:29 +0900)]
simplify `suggest_deref_ref_or_into`

23 months agoRemove some more usages of guess_head_span
Michael Goulet [Fri, 15 Jul 2022 05:23:47 +0000 (05:23 +0000)]
Remove some more usages of guess_head_span

23 months agoRollup merge of #99257 - Manishearth:regression, r=jackh726
Dylan DPC [Fri, 15 Jul 2022 05:09:47 +0000 (10:39 +0530)]
Rollup merge of #99257 - Manishearth:regression, r=jackh726

Add regression test for #89436

I never got around to adding such a test.

In general I think the `yoke` crate has a bunch of interesting testcases that exercise various edges of the algorithms here, it would be nice if we could simply depend on the crate and add some tests that exercise it, but I don't think that's possible. Do you or `@eddyb` think there's any use trying to upstream a bunch of common yoke minimal working example code to the testsuite and having a ton of yoke tests?

23 months agoRollup merge of #99241 - danbev:intrinsics-comment, r=fee1-dead
Dylan DPC [Fri, 15 Jul 2022 05:09:46 +0000 (10:39 +0530)]
Rollup merge of #99241 - danbev:intrinsics-comment, r=fee1-dead

Remove comment referring to constness.rs

This commit removes the comment in emulate_intrinsic, which is
currently referring to `src/librustc_middle/ty/constness.rs`.

23 months agoRollup merge of #99239 - vakaras:add-myself-to-mir-followers, r=tmiasko
Dylan DPC [Fri, 15 Jul 2022 05:09:45 +0000 (10:39 +0530)]
Rollup merge of #99239 - vakaras:add-myself-to-mir-followers, r=tmiasko

Add myself to the set of people notified when MIR changes.

I would like to be notified when changes to MIR are made.

23 months agoRollup merge of #99237 - GuillaumeGomez:rustdoc-css-cleanup, r=notriddle
Dylan DPC [Fri, 15 Jul 2022 05:09:44 +0000 (10:39 +0530)]
Rollup merge of #99237 - GuillaumeGomez:rustdoc-css-cleanup, r=notriddle

removed unused CSS and unused HTML IDs

I think that should cover most remaining unused CSS/HTML IDs.

r? `@notriddle`

23 months agoRollup merge of #99131 - compiler-errors:label-fn, r=cjgillot
Dylan DPC [Fri, 15 Jul 2022 05:09:43 +0000 (10:39 +0530)]
Rollup merge of #99131 - compiler-errors:label-fn, r=cjgillot

Add label for generic arg (+ APIT) and RPIT callables in `label_fn_like`

Fixes #98308

23 months agoRollup merge of #99113 - WaffleLapkin:arc_simplify, r=Mark-Simulacrum
Dylan DPC [Fri, 15 Jul 2022 05:09:41 +0000 (10:39 +0530)]
Rollup merge of #99113 - WaffleLapkin:arc_simplify, r=Mark-Simulacrum

Simplify [a]rc code a little

Nothing interesting, just make [a]rc code a little nicer by using `byte_sub` and `let`-`else`.

23 months agoFix typo in mod.rs
Ikko Ashimine [Fri, 15 Jul 2022 03:57:46 +0000 (12:57 +0900)]
Fix typo in mod.rs

constuct -> construct

23 months agoAuto merge of #97406 - aliemjay:verify-bounds-fix-master, r=oli-obk
bors [Fri, 15 Jul 2022 03:44:53 +0000 (03:44 +0000)]
Auto merge of #97406 - aliemjay:verify-bounds-fix-master, r=oli-obk

Make outlives::{components,verify} agree

fixes #97405

cc `@oli-obk` this is should fix https://github.com/rust-lang/rust/pull/95474#discussion_r880660075

r? `@oli-obk`

23 months agoRemove some span_of_impl+unwrap
Michael Goulet [Fri, 8 Jul 2022 02:41:41 +0000 (02:41 +0000)]
Remove some span_of_impl+unwrap

23 months agoMove item_span from check_item_type into each function
Michael Goulet [Fri, 8 Jul 2022 02:32:51 +0000 (02:32 +0000)]
Move item_span from check_item_type into each function

23 months agoremove tcx from ObligationCauseCode::span
Michael Goulet [Fri, 8 Jul 2022 02:02:08 +0000 (02:02 +0000)]
remove tcx from ObligationCauseCode::span

23 months agoRemove some more usages of guess_head_span
Michael Goulet [Fri, 8 Jul 2022 02:10:15 +0000 (02:10 +0000)]
Remove some more usages of guess_head_span

23 months agoRemove some usages of guess_head_span from typeck
Michael Goulet [Thu, 7 Jul 2022 06:52:27 +0000 (06:52 +0000)]
Remove some usages of guess_head_span from typeck

23 months agoMake item spans more consistent
Michael Goulet [Fri, 8 Jul 2022 01:50:10 +0000 (01:50 +0000)]
Make item spans more consistent

23 months agoImprove example of `downcast`
Jiahao XU [Fri, 15 Jul 2022 03:04:06 +0000 (13:04 +1000)]
Improve example of `downcast`

Co-authored-by: Jane Losare-Lusby <jlusby42@gmail.com>
23 months agoAuto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, r=cjgillot
bors [Fri, 15 Jul 2022 01:03:55 +0000 (01:03 +0000)]
Auto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, r=cjgillot

gather body owners

Issue #96341

23 months agoPoint out custom Fn-family trait impl
Michael Goulet [Wed, 13 Jul 2022 05:39:01 +0000 (05:39 +0000)]
Point out custom Fn-family trait impl

23 months agoAdd support for APIT and RPIT callables in label_fn_like
Michael Goulet [Sun, 10 Jul 2022 21:59:31 +0000 (21:59 +0000)]
Add support for APIT and RPIT callables in label_fn_like

23 months agointerpret/validity: improve some comments
Ralf Jung [Thu, 14 Jul 2022 23:19:15 +0000 (19:19 -0400)]
interpret/validity: improve some comments

23 months agoAdd regression test for #89436
Manish Goregaokar [Thu, 14 Jul 2022 22:40:46 +0000 (15:40 -0700)]
Add regression test for #89436

23 months agoAuto merge of #96544 - m-ysk:feature/issue-96358, r=cjgillot
bors [Thu, 14 Jul 2022 21:50:14 +0000 (21:50 +0000)]
Auto merge of #96544 - m-ysk:feature/issue-96358, r=cjgillot

Stop keeping metadata in memory before writing it to disk

Fixes #96358

I created this PR according with the instruction given in the issue except for the following points:

- While the issue says "Write metadata into the temporary file in `encode_and_write_metadata` even if `!need_metadata_file`", I could not do that. That is because though I tried to do that and run `x.py test`, I got a lot of test failures as follows.

<details>
<summary>List of failed tests</summary>
<pre>
<code>
failures:
    [ui] src/test/ui/json-multiple.rs
    [ui] src/test/ui/json-options.rs
    [ui] src/test/ui/rmeta/rmeta-rpass.rs
    [ui] src/test/ui/save-analysis/emit-notifications.rs
    [ui] src/test/ui/svh/changing-crates.rs
    [ui] src/test/ui/svh/svh-change-lit.rs
    [ui] src/test/ui/svh/svh-change-significant-cfg.rs
    [ui] src/test/ui/svh/svh-change-trait-bound.rs
    [ui] src/test/ui/svh/svh-change-type-arg.rs
    [ui] src/test/ui/svh/svh-change-type-ret.rs
    [ui] src/test/ui/svh/svh-change-type-static.rs
    [ui] src/test/ui/svh/svh-use-trait.rs

test result: FAILED. 12915 passed; 12 failed; 100 ignored; 0 measured; 0 filtered out; finished in 71.41s

Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
Build completed unsuccessfully in 0:01:58
</code>
</pre>
</details>

- I could not resolve the extra tasks about `create_rmeta_file` and `create_compressed_metadata_file` for my lack of ability.

23 months agoRemove FIXME from MIR `always_storage_live_locals`
pierwill [Thu, 14 Jul 2022 20:30:36 +0000 (15:30 -0500)]
Remove FIXME from MIR `always_storage_live_locals`

23 months agoRename aarch64-nintendo-switch to aarch64-nintendo-switch-freestanding
leo60228 [Fri, 17 Sep 2021 17:29:49 +0000 (13:29 -0400)]
Rename aarch64-nintendo-switch to aarch64-nintendo-switch-freestanding

23 months agoAdd aarch64-nintendo-switch.md to SUMMARY.md
leo60228 [Fri, 17 Sep 2021 14:44:59 +0000 (10:44 -0400)]
Add aarch64-nintendo-switch.md to SUMMARY.md

I can't think of any other reason CI might be failing, and I should've
done this anyway.

23 months agoAdd docs for Switch target
leo60228 [Fri, 17 Sep 2021 14:11:19 +0000 (10:11 -0400)]
Add docs for Switch target

23 months agoRemove obsolete crt0 references in linker script
leo60228 [Wed, 15 Sep 2021 22:21:34 +0000 (18:21 -0400)]
Remove obsolete crt0 references in linker script

23 months agoRemove unneeded options from Nintendo Switch target
jam1garner [Wed, 15 Sep 2021 21:57:43 +0000 (17:57 -0400)]
Remove unneeded options from Nintendo Switch target

23 months agoDon't build std for switch
leo60228 [Wed, 15 Sep 2021 19:30:00 +0000 (15:30 -0400)]
Don't build std for switch