]> git.lizzy.rs Git - rust.git/log
rust.git
17 months agofix rebase
Esteban Küber [Thu, 5 Jan 2023 17:06:34 +0000 (17:06 +0000)]
fix rebase

17 months agoreview comments: reword
Esteban Küber [Thu, 5 Jan 2023 01:26:44 +0000 (01:26 +0000)]
review comments: reword

17 months agoreview comment: potentially produce more suggestions for arg type mismatch
Esteban Küber [Thu, 5 Jan 2023 01:00:21 +0000 (01:00 +0000)]
review comment: potentially produce more suggestions for arg type mismatch

17 months agoSuggest changing argument on type error
Esteban Küber [Thu, 5 Jan 2023 00:37:53 +0000 (00:37 +0000)]
Suggest changing argument on type error

17 months agoAccount for type error on method arg caused by earlier inference
Esteban Küber [Thu, 5 Jan 2023 00:18:57 +0000 (00:18 +0000)]
Account for type error on method arg caused by earlier inference

```rust
fn main() {
    let v = Vec::new();
    v.push(0);
    v.push(0);
    v.push("");
}
```

now produces

```
error[E0308]: mismatched types
  --> $DIR/point-at-inference-3.rs:6:12
   |
LL |     v.push(0);
   |            - this is of type `{integer}`, which makes `v` to be inferred as `Vec<{integer}>`
...
LL |     v.push("");
   |       ---- ^^ expected integer, found `&str`
   |       |
   |       arguments to this function are incorrect
   |
note: associated function defined here
  --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
```

17 months agoUse `BottomUpFolder`
Esteban Küber [Wed, 4 Jan 2023 04:49:47 +0000 (20:49 -0800)]
Use `BottomUpFolder`

17 months agoFormatting
Esteban Küber [Wed, 4 Jan 2023 04:32:15 +0000 (20:32 -0800)]
Formatting

17 months agoTweak output
Esteban Küber [Wed, 4 Jan 2023 04:20:31 +0000 (20:20 -0800)]
Tweak output

- Only point at a the single expression where the found type was first
  inferred.
- Find method call argument that might have caused the found type to be
  inferred.
- Provide structured suggestion.
- Apply some review comments.
- Tweak wording.

17 months agoreview comments: do not always point at init expr
Esteban Küber [Tue, 3 Jan 2023 07:34:26 +0000 (23:34 -0800)]
review comments: do not always point at init expr

17 months agoMore eagerly resolve expr `ty`s before writing them
Esteban Küber [Tue, 3 Jan 2023 06:25:50 +0000 (22:25 -0800)]
More eagerly resolve expr `ty`s before writing them

This allows the expressions to have more accurate types
when showing inference steps.

17 months agoSkip macros to avoid talking about bindings the user can't see
Esteban Küber [Tue, 3 Jan 2023 05:56:19 +0000 (21:56 -0800)]
Skip macros to avoid talking about bindings the user can't see

17 months agoPoint at expressions where inference refines an unexpected type
Esteban Küber [Tue, 3 Jan 2023 00:23:08 +0000 (16:23 -0800)]
Point at expressions where inference refines an unexpected type

Address #106355.

17 months agoAuto merge of #106406 - nikic:update-llvm-11, r=cuviper
bors [Thu, 5 Jan 2023 12:45:43 +0000 (12:45 +0000)]
Auto merge of #106406 - nikic:update-llvm-11, r=cuviper

Update LLVM submodule

Fixes #104099.

17 months agoAuto merge of #106404 - tmiasko:dedup-box-derefs, r=wesleywiser
bors [Thu, 5 Jan 2023 09:50:05 +0000 (09:50 +0000)]
Auto merge of #106404 - tmiasko:dedup-box-derefs, r=wesleywiser

Remove duplicated elaborate box derefs pass

The pass runs earlier as a part of `run_runtime_lowering_passes`.

The duplicate was added in #99102.

17 months agoAuto merge of #106482 - compiler-errors:rollup-g7n1p39, r=compiler-errors
bors [Thu, 5 Jan 2023 06:47:02 +0000 (06:47 +0000)]
Auto merge of #106482 - compiler-errors:rollup-g7n1p39, r=compiler-errors

Rollup of 6 pull requests

Successful merges:

 - #105846 (Account for return-position `impl Trait` in trait in `opt_suggest_box_span`)
 - #106385 (Split `-Zchalk` flag into `-Ztrait-solver=(classic|chalk|next)` flag)
 - #106403 (Rename `hir::Map::{get_,find_}parent_node` to `hir::Map::{,opt_}parent_id`, and add `hir::Map::{get,find}_parent`)
 - #106462 (rustdoc: remove unnecessary wrapper around sidebar and mobile logos)
 - #106464 (Update Fuchsia walkthrough with new configs)
 - #106478 (Tweak wording of fn call with wrong number of args)

Failed merges:

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

17 months agoRollup merge of #106478 - estebank:tweak-fn-mismatch, r=compiler-errors
Michael Goulet [Thu, 5 Jan 2023 04:36:29 +0000 (20:36 -0800)]
Rollup merge of #106478 - estebank:tweak-fn-mismatch, r=compiler-errors

Tweak wording of fn call with wrong number of args

17 months agoRollup merge of #106464 - djkoloski:update_fuchsia_platform_support_docs, r=tmandry
Michael Goulet [Thu, 5 Jan 2023 04:36:28 +0000 (20:36 -0800)]
Rollup merge of #106464 - djkoloski:update_fuchsia_platform_support_docs, r=tmandry

Update Fuchsia walkthrough with new configs

The new `download-ci-llvm` configuration option dosn't work with `lld = true` (see #100853). The Fuchsia walkthrough should recommend setting it to `false`.

r? `@tmandry`

17 months agoRollup merge of #106462 - notriddle:notriddle/logo-container-sidebar, r=GuillaumeGomez
Michael Goulet [Thu, 5 Jan 2023 04:36:28 +0000 (20:36 -0800)]
Rollup merge of #106462 - notriddle:notriddle/logo-container-sidebar, r=GuillaumeGomez

rustdoc: remove unnecessary wrapper around sidebar and mobile logos

This commit changes `.sidebar a:hover:not(.logo-container)` to add the `:not()` pseudo-class, retaining the old appearance of the logo when mousing over it.

This didn't used to be necessary because the `a.sidebar-logo` was `display:inline`, and was what got the `background` changed on hover, while the `div.logo-container` inside it was `display:block`. This resulted in the hover rule not having any effect, because the logo-container box was not actually nested inside the sidebar-logo box:

https://www.w3.org/TR/CSS2/visuren.html#anonymous-block-level

> When an inline box contains an in-flow block-level box, the inline box (and its inline ancestors within the same line box) are broken around the block-level box (and any block-level siblings that are consecutive or separated only by collapsible whitespace and/or out-of-flow elements), splitting the inline box into two boxes (even if either side is empty), one on each side of the block-level box(es). The line boxes before the break and after the break are enclosed in anonymous block boxes, and the block-level box becomes a sibling of those anonymous boxes. When such an inline box is affected by relative positioning, any resulting translation also affects the block-level box contained in the inline box.

17 months agoRollup merge of #106403 - compiler-errors:rename-hir-methods, r=cjgillot
Michael Goulet [Thu, 5 Jan 2023 04:36:28 +0000 (20:36 -0800)]
Rollup merge of #106403 - compiler-errors:rename-hir-methods, r=cjgillot

Rename `hir::Map::{get_,find_}parent_node` to `hir::Map::{,opt_}parent_id`, and add `hir::Map::{get,find}_parent`

The `hir::Map::get_parent_node` function doesn't return a `Node`, and I think that's quite confusing. Let's rename it to something that sounds more like something that gets the parent hir id => `hir::Map::parent_id`. Same with `find_parent_node` => `opt_parent_id`.

Also, combine `hir.get(hir.parent_id(hir_id))` and similar `hir.find(hir.parent_id(hir_id))` function into new functions that actually retrieve the parent node in one call. This last commit is the only one that might need to be looked at closely.

17 months agoRollup merge of #106385 - compiler-errors:new-solver-flag, r=jackh726
Michael Goulet [Thu, 5 Jan 2023 04:36:27 +0000 (20:36 -0800)]
Rollup merge of #106385 - compiler-errors:new-solver-flag, r=jackh726

Split `-Zchalk` flag into `-Ztrait-solver=(classic|chalk|next)` flag

We'll eventually need a way to select more than chalk + not-chalk.

Does this need an MCP since it's touching a `-Z` flag? Or perhaps I should preserve `-Zchalk` for the time being... maybe I could make it a warning to use that flag? cc ``@rust-lang/types``

r? types

17 months agoRollup merge of #105846 - compiler-errors:issue-105838, r=jackh726
Michael Goulet [Thu, 5 Jan 2023 04:36:27 +0000 (20:36 -0800)]
Rollup merge of #105846 - compiler-errors:issue-105838, r=jackh726

Account for return-position `impl Trait` in trait in `opt_suggest_box_span`

RPITITs are the only types where their opaque bounds might normalize to some other self type than the opaque type itself. To avoid needing to do normalization, let's just match on either alias kind.

Ideally, we'd just get rid of `opt_suggest_box_span`. It's kind of a wart on type-checking `if`/`match`. I've recently refactored this expression for being confusing/wrong, but moving it into the error path is pretty hard.

Fixes #105838

17 months agoAuto merge of #105409 - compiler-errors:closure-infer-cycle, r=jackh726
bors [Thu, 5 Jan 2023 03:59:31 +0000 (03:59 +0000)]
Auto merge of #105409 - compiler-errors:closure-infer-cycle, r=jackh726

Don't deduce a signature that makes a closure cyclic

Sometimes when elaborating supertrait bounds for closure signature inference, we end up deducing a closure signature that is cyclical because either a parameter or the return type references a projection mentioning `Self` that also has escaping bound vars, which means that it's not eagerly replaced with an inference variable.

Interestingly, this is not *just* related to my PR that elaborates supertrait bounds for closure signature deduction. The committed test `supertrait-hint-cycle-3.rs` shows **stable** code that is fixed by this PR:

```rust
trait Foo<'a> {
    type Input;
}

impl<F: Fn(u32)> Foo<'_> for F {
    type Input = u32;
}

fn needs_super<F: for<'a> Fn(<F as Foo<'a>>::Input) + for<'a> Foo<'a>>(_: F) {}

fn main() {
    needs_super(|_: u32| {});
}
```

Fixes #105401
Fixes #105396

r? types

17 months agoTweak wording of fn call with wrong number of args
Esteban Küber [Thu, 5 Jan 2023 03:02:10 +0000 (03:02 +0000)]
Tweak wording of fn call with wrong number of args

17 months agoAuto merge of #106472 - matthiaskrgr:rollup-4w4v50e, r=matthiaskrgr
bors [Thu, 5 Jan 2023 01:06:05 +0000 (01:06 +0000)]
Auto merge of #106472 - matthiaskrgr:rollup-4w4v50e, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #106391 (rustdoc: allow popover child links to work)
 - #106398 (Fix a few clippy lints in libtest)
 - #106412 (Fix link generation for local primitive types in rustdoc JSON output)
 - #106437 (rustdoc: fix buggy JS check for absolute URL)
 - #106451 (Merge borrowck permission checks)
 - #106460 (Move tests)
 - #106461 (docs: fix broken link "search bar")

Failed merges:

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

17 months agoRollup merge of #106461 - notriddle:notriddle/window-searchstate-focus, r=GuillaumeGomez
Matthias Krüger [Wed, 4 Jan 2023 22:39:52 +0000 (23:39 +0100)]
Rollup merge of #106461 - notriddle:notriddle/window-searchstate-focus, r=GuillaumeGomez

docs: fix broken link "search bar"

Regression introduced by #84150

17 months agoRollup merge of #106460 - c410-f3r:moar-errors, r=compiler-errors
Matthias Krüger [Wed, 4 Jan 2023 22:39:51 +0000 (23:39 +0100)]
Rollup merge of #106460 - c410-f3r:moar-errors, r=compiler-errors

Move tests

r? `@petrochenkov`

17 months agoRollup merge of #106451 - Zeegomo:merge-borrowck-access, r=estebank
Matthias Krüger [Wed, 4 Jan 2023 22:39:51 +0000 (23:39 +0100)]
Rollup merge of #106451 - Zeegomo:merge-borrowck-access, r=estebank

Merge borrowck permission checks

Merge `check_access_permission` and `check_if_reassignment_to_immutable_state`.
The goal of this commit is twofold:
* simplify the codebase by removing duplicate logic.
* avoid duplicate reporting of illegal reassignment errors by reusing the exiting de-duplicating logic of access_place.

17 months agoRollup merge of #106437 - notriddle:notriddle/http-url, r=GuillaumeGomez
Matthias Krüger [Wed, 4 Jan 2023 22:39:50 +0000 (23:39 +0100)]
Rollup merge of #106437 - notriddle:notriddle/http-url, r=GuillaumeGomez

rustdoc: fix buggy JS check for absolute URL

The old code did the wrong thing when faced with a crate named "http".

17 months agoRollup merge of #106412 - GuillaumeGomez:fix-links-to-primitive-rustdoc-json, r=aDotI...
Matthias Krüger [Wed, 4 Jan 2023 22:39:50 +0000 (23:39 +0100)]
Rollup merge of #106412 - GuillaumeGomez:fix-links-to-primitive-rustdoc-json, r=aDotInTheVoid

Fix link generation for local primitive types in rustdoc JSON output

Fixes https://github.com/rust-lang/rust/issues/104064.

As mentioned in the issue, I'm not super happy about this fix which is more a hack rather than a sound-proof solution. However I couldn't find a better way to fix it.

r? `@aDotInTheVoid`

17 months agoRollup merge of #106398 - jyn514:fix-clippy, r=thomcc
Matthias Krüger [Wed, 4 Jan 2023 22:39:49 +0000 (23:39 +0100)]
Rollup merge of #106398 - jyn514:fix-clippy, r=thomcc

Fix a few clippy lints in libtest

- Remove unnecessary references and dereferences
- Use `.contains` instead of `a <= x && x <= b`
- Use `mem::take` instead of `mem::replace` where possible

cc https://github.com/rust-lang/rust/pull/106394 :)

17 months agoRollup merge of #106391 - ardislu:fix-popover-child-link, r=GuillaumeGomez
Matthias Krüger [Wed, 4 Jan 2023 22:39:49 +0000 (23:39 +0100)]
Rollup merge of #106391 - ardislu:fix-popover-child-link, r=GuillaumeGomez

rustdoc: allow popover child links to work

No need to prevent default click behavior on a `<div>`, it will also disable all child click behavior.

Closes #106390

17 months agoAuto merge of #106224 - bjorn3:staticlib_fixes, r=wesleywiser
bors [Wed, 4 Jan 2023 21:35:15 +0000 (21:35 +0000)]
Auto merge of #106224 - bjorn3:staticlib_fixes, r=wesleywiser

Small fixes for --crate-type staticlib

The first commit doesn't have an effect until we start translating error messages. The second commit fixes potential linker errors when combining `--crate-type staticlib` with another crate type and I think `-Cprefer-dynamic`.

17 months agoUpdate Fuchsia walkthrough with new configs
David Koloski [Wed, 4 Jan 2023 20:55:48 +0000 (15:55 -0500)]
Update Fuchsia walkthrough with new configs

The new `download-ci-llvm` configuration option dosn't work with `lld =
true` (see #100853). The Fuchsia walkthrough should recommend setting it
to `false`.

17 months agoRemove unused match pattern for primitive types
Guillaume Gomez [Wed, 4 Jan 2023 20:54:32 +0000 (21:54 +0100)]
Remove unused match pattern for primitive types

17 months agorustdoc: remove unnecessary wrapper around sidebar and mobile logos
Michael Howell [Wed, 4 Jan 2023 20:04:30 +0000 (13:04 -0700)]
rustdoc: remove unnecessary wrapper around sidebar and mobile logos

This commit changes `.sidebar a:hover:not(.logo-container)` to add the `:not()` pseudo-class, retaining the old appearance of the logo when mousing over it.

This didn't used to be necessary because the `a.sidebar-logo` was `display:inline`, and was what got the `background` changed on hover, while the `div.logo-container` inside it was `display:block`. This resulted in the hover rule not having any effect, because the logo-container box was not actually nested inside the sidebar-logo box:

https://www.w3.org/TR/CSS2/visuren.html#anonymous-block-level

> When an inline box contains an in-flow block-level box, the inline box (and its inline ancestors within the same line box) are broken around the block-level box (and any block-level siblings that are consecutive or separated only by collapsible whitespace and/or out-of-flow elements), splitting the inline box into two boxes (even if either side is empty), one on each side of the block-level box(es). The line boxes before the break and after the break are enclosed in anonymous block boxes, and the block-level box becomes a sibling of those anonymous boxes. When such an inline box is affected by relative positioning, any resulting translation also affects the block-level box contained in the inline box.

17 months agodocs: fix broken link "search bar"
Michael Howell [Wed, 4 Jan 2023 19:47:24 +0000 (12:47 -0700)]
docs: fix broken link "search bar"

17 months agoMove tests
Caio [Wed, 4 Jan 2023 19:44:30 +0000 (16:44 -0300)]
Move tests

17 months agoAuto merge of #106330 - weihanglo:update-cargo, r=weihanglo
bors [Wed, 4 Jan 2023 18:43:32 +0000 (18:43 +0000)]
Auto merge of #106330 - weihanglo:update-cargo, r=weihanglo

Update cargo

8 commits in 2381cbdb4e9b07090f552d34a44a529b6e620e44..8c460b2237a6359a7e3335890db8da049bdd62fc
2022-12-23 12:19:27 +0000 to 2023-01-04 14:30:01 +0000
- test: revive nightly plugin tests to work (rust-lang/cargo#11534)
- Add note to release notes about rejecting multiple registries. (rust-lang/cargo#11531)
- Fix a typo `fresheness` -&gt; `freshness` (rust-lang/cargo#11529)
- Reasons for rebuilding (rust-lang/cargo#11407)
- Asymmetric tokens (rust-lang/cargo#10771)
- Use proper git URL for GitHub repos (rust-lang/cargo#11517)
- Add `registry.default` example (rust-lang/cargo#11516)
- Support vendoring with different revs from same git repo (rust-lang/cargo#10690)

Also update license exceptions and permitted dependencies
for new cargo dependency "pasetors".

A new dependency `getrandom` is added into `rustc-workspace-hacks`,
since it requires feature `js`.

r? `@ghost`

17 months agoRename stock solver to classic
Michael Goulet [Wed, 4 Jan 2023 16:49:38 +0000 (16:49 +0000)]
Rename stock solver to classic

17 months agoUpdate tests, etc
Michael Goulet [Mon, 2 Jan 2023 23:18:00 +0000 (23:18 +0000)]
Update tests, etc

17 months agoSplit `-Zchalk` flag into `-Ztrait-solver=(stock|chalk|next)` flag
Michael Goulet [Mon, 2 Jan 2023 23:12:47 +0000 (23:12 +0000)]
Split `-Zchalk` flag into `-Ztrait-solver=(stock|chalk|next)` flag

17 months agoUpdate cargo
Weihang Lo [Wed, 4 Jan 2023 15:33:59 +0000 (15:33 +0000)]
Update cargo

8 commits in 2381cbdb4e9b07090f552d34a44a529b6e620e44..8c460b2237a6359a7e3335890db8da049bdd62fc
2022-12-23 12:19:27 +0000 to 2023-01-04 14:30:01 +0000
- test: revive nightly plugin tests to work (rust-lang/cargo#11534)
- Add note to release notes about rejecting multiple registries. (rust-lang/cargo#11531)
- Fix a typo `fresheness` -&gt; `freshness` (rust-lang/cargo#11529)
- Reasons for rebuilding (rust-lang/cargo#11407)
- Asymmetric tokens (rust-lang/cargo#10771)
- Use proper git URL for GitHub repos (rust-lang/cargo#11517)
- Add `registry.default` example (rust-lang/cargo#11516)
- Support vendoring with different revs from same git repo (rust-lang/cargo#10690)

Also update license exceptions and permitted dependencies
for new cargo dependency "pasetors".

A new dependency `getrandom` is added into `rustc-workspace-hacks`,
since it requires feature `js`.

17 months agoAuto merge of #106382 - tmiasko:sdniwnu-daed, r=wesleywiser
bors [Wed, 4 Jan 2023 15:48:47 +0000 (15:48 +0000)]
Auto merge of #106382 - tmiasko:sdniwnu-daed, r=wesleywiser

Fix handling of dead unwinds in backward analyses

Dead unwinds set contains a head of an unreachable unwind edge.

17 months agoMerge borrowck permission checks
Giacomo Pasini [Sat, 31 Dec 2022 12:45:22 +0000 (13:45 +0100)]
Merge borrowck permission checks

Merge `check_access_permission` and
`check_if_reassignment_to_immutable_state`.
The goal of this commit is twofold:
First, we simplify the codebase by removing duplicate logic.
Second, we avoid duplicate reporting of illegal reassignment
errors by reusing the exiting de-duplicating logic of
access_place.

17 months agoFix each_linked_rlib when the current crate has 0 crate types
bjorn3 [Wed, 4 Jan 2023 13:37:38 +0000 (13:37 +0000)]
Fix each_linked_rlib when the current crate has 0 crate types

17 months agoAuto merge of #106239 - LegionMammal978:thin-box-drop-guard, r=Amanieu
bors [Wed, 4 Jan 2023 12:55:22 +0000 (12:55 +0000)]
Auto merge of #106239 - LegionMammal978:thin-box-drop-guard, r=Amanieu

Deallocate ThinBox even if the value unwinds on drop

This makes it match the behavior of an ordinary `Box`.

17 months agoAuto merge of #106442 - matthiaskrgr:rollup-wivf7gh, r=matthiaskrgr
bors [Wed, 4 Jan 2023 09:41:43 +0000 (09:41 +0000)]
Auto merge of #106442 - matthiaskrgr:rollup-wivf7gh, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #106200 (Suggest `impl Fn*` and `impl Future` in `-> _` return suggestions)
 - #106274 (Add JSON output to -Zdump-mono-stats)
 - #106292 (Add codegen test for `Box::new(uninit)` of big arrays)
 - #106327 (Add tidy check for dbg)
 - #106361 (Note maximum integer literal for `IntLiteralTooLarge`)
 - #106396 (Allow passing a specific date to `bump-stage0`)
 - #106436 (Enable doctests for rustc_query_impl)

Failed merges:

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

17 months agoAdd hardcoded wait time for external navigation to load
Ardis Lu [Wed, 4 Jan 2023 07:44:35 +0000 (23:44 -0800)]
Add hardcoded wait time for external navigation to load

17 months agoRollup merge of #106436 - CarsonV:doctest_query_impl, r=jyn514
Matthias Krüger [Wed, 4 Jan 2023 06:28:57 +0000 (07:28 +0100)]
Rollup merge of #106436 - CarsonV:doctest_query_impl, r=jyn514

Enable doctests for rustc_query_impl

doctests worked out of the box for query_impl on my local machine. Working towards #99144

17 months agoRollup merge of #106396 - jyn514:bump-stage-date, r=pietroalbini
Matthias Krüger [Wed, 4 Jan 2023 06:28:56 +0000 (07:28 +0100)]
Rollup merge of #106396 - jyn514:bump-stage-date, r=pietroalbini

Allow passing a specific date to `bump-stage0`

This allows regenerating `src/stage0.json` on changes to the tool, without needing to hard-code the date in the source. It was useful for https://github.com/rust-lang/rust/pull/106394, which added clippy to the list of required components.

r? `@pietroalbini`

17 months agoRollup merge of #106361 - clubby789:int-literal-too-large, r=estebank
Matthias Krüger [Wed, 4 Jan 2023 06:28:56 +0000 (07:28 +0100)]
Rollup merge of #106361 - clubby789:int-literal-too-large, r=estebank

Note maximum integer literal for `IntLiteralTooLarge`

Closes #105908

`@rustbot` label +A-diagnostics

17 months agoRollup merge of #106327 - gimbles:dbg, r=jyn514
Matthias Krüger [Wed, 4 Jan 2023 06:28:55 +0000 (07:28 +0100)]
Rollup merge of #106327 - gimbles:dbg, r=jyn514

Add tidy check for dbg

Fixes #106169

17 months agoRollup merge of #106292 - Nilstrieb:box-uninit-test, r=RalfJung
Matthias Krüger [Wed, 4 Jan 2023 06:28:55 +0000 (07:28 +0100)]
Rollup merge of #106292 - Nilstrieb:box-uninit-test, r=RalfJung

Add codegen test for `Box::new(uninit)` of big arrays

Closes #58201

r? `@RalfJung`

17 months agoRollup merge of #106274 - jyn514:dump-mono-stats, r=lqd
Matthias Krüger [Wed, 4 Jan 2023 06:28:54 +0000 (07:28 +0100)]
Rollup merge of #106274 - jyn514:dump-mono-stats, r=lqd

Add JSON output to -Zdump-mono-stats

Follow-up to https://github.com/rust-lang/rust/pull/105481

r? `@lqd` cc `@wesleywiser`

17 months agoRollup merge of #106200 - compiler-errors:suggest-impl-trait, r=estebank
Matthias Krüger [Wed, 4 Jan 2023 06:28:54 +0000 (07:28 +0100)]
Rollup merge of #106200 - compiler-errors:suggest-impl-trait, r=estebank

Suggest `impl Fn*` and `impl Future` in `-> _` return suggestions

Follow-up to #106172, only the last commit is relevant. Can rebase once that PR is landed for easier review.

Suggests `impl Future` and `impl Fn{,Mut,Once}` in `-> _` return suggestions.

r? `@estebank`

17 months agoAuto merge of #104376 - compiler-errors:thin-metadata-implies-thin-ptr, r=wesleywiser
bors [Wed, 4 Jan 2023 06:28:05 +0000 (06:28 +0000)]
Auto merge of #104376 - compiler-errors:thin-metadata-implies-thin-ptr, r=wesleywiser

layout_of: `T: Thin` implies `sizeof(&T) == sizeof(usize)`

Use the `<T as Pointee>::Metadata` associated type to calculate the layout of a pointee's metadata, instead of hard-coding rules about certain types.

Maybe this approach is overkill -- we could instead hard-code this approach as a fallback, with the matching on `Slice`/`Dynamic`/etc. happening first

Fixes this issue here https://github.com/rust-lang/rust/pull/104338#issuecomment-1312595844 .. But is also useful with transmutes, for example, given the UI test I added below.

17 months agoAdd test case to click popover child link
Ardis Lu [Wed, 4 Jan 2023 04:38:07 +0000 (20:38 -0800)]
Add test case to click popover child link

17 months agoAuto merge of #106432 - compiler-errors:rollup-lzj0lnp, r=compiler-errors
bors [Wed, 4 Jan 2023 03:37:21 +0000 (03:37 +0000)]
Auto merge of #106432 - compiler-errors:rollup-lzj0lnp, r=compiler-errors

Rollup of 8 pull requests

Successful merges:

 - #104748 (Ensure `lld` is supported with `download-ci-llvm`)
 - #105541 (Simplify some iterator combinators)
 - #106045 (default OOM handler: use non-unwinding panic, to match std handler)
 - #106157 (Don't trim path for `unsafe_op_in_unsafe_fn` lints)
 - #106353 (Reduce spans for `unsafe impl` errors)
 - #106381 (Jsondoclint: Add `--verbose` and `--json-output` options)
 - #106411 (rustdoc: remove legacy font-feature-settings CSS)
 - #106414 (Add cuviper to the review rotation for libs)

Failed merges:

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

17 months agorustdoc: fix buggy JS check for absolute URL
Michael Howell [Wed, 4 Jan 2023 02:46:40 +0000 (19:46 -0700)]
rustdoc: fix buggy JS check for absolute URL

The old code did the wrong thing when faced with a crate named "http".

17 months agoEnable query_impl doctests
CarsonV [Wed, 4 Jan 2023 02:12:09 +0000 (20:12 -0600)]
Enable query_impl doctests

17 months agoRollup merge of #106414 - cuviper:libs-review, r=Mark-Simulacrum
Michael Goulet [Wed, 4 Jan 2023 01:19:28 +0000 (17:19 -0800)]
Rollup merge of #106414 - cuviper:libs-review, r=Mark-Simulacrum

Add cuviper to the review rotation for libs

17 months agoRollup merge of #106411 - notriddle:notriddle/font-feature-settings, r=GuillaumeGomez
Michael Goulet [Wed, 4 Jan 2023 01:19:28 +0000 (17:19 -0800)]
Rollup merge of #106411 - notriddle:notriddle/font-feature-settings, r=GuillaumeGomez

rustdoc: remove legacy font-feature-settings CSS

According to [caniuse], these vendor prefixes aren't needed in any supported web browsers as defined in [RFC 1985].

* The last version of Chrome that required a vendor prefix was version 47. The current version is 108.
* Firefox 33 is the last version that required a vendor prefix. The [current Firefox ESR] is version 102.
* The last version of Safari that required a vendor prefix was version 9.1. The current version is 16.
* The last version of Safari/iOS that required a vendor prefix was version 9.3. The current version is 16.
* Edge never required vendor prefixes.
* UCAndroid never required vendor prefixes.

[caniuse]: https://caniuse.com/?search=font-feature-settings
[RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html
[current Firefox ESR]: https://wiki.mozilla.org/Releases

17 months agoRollup merge of #106381 - aDotInTheVoid:jsondoclint-more-options, r=notriddle
Michael Goulet [Wed, 4 Jan 2023 01:19:27 +0000 (17:19 -0800)]
Rollup merge of #106381 - aDotInTheVoid:jsondoclint-more-options, r=notriddle

Jsondoclint: Add `--verbose` and `--json-output` options

There quite helpful for manually using jsondoclint as a debugging tool, especially on large files (these were written to look into core.json).

r? rustdoc

17 months agoRollup merge of #106353 - lukas-code:reduce-red-lines-in-my-ide, r=wesleywiser
Michael Goulet [Wed, 4 Jan 2023 01:19:27 +0000 (17:19 -0800)]
Rollup merge of #106353 - lukas-code:reduce-red-lines-in-my-ide, r=wesleywiser

Reduce spans for `unsafe impl` errors

Because huge spans aren't great for IDEs.

Prior art: https://github.com/rust-lang/rust/pull/103749

17 months agoRollup merge of #106157 - LeSeulArtichaut:106126-thir-unsafeck-good-path-bug-2, r...
Michael Goulet [Wed, 4 Jan 2023 01:19:26 +0000 (17:19 -0800)]
Rollup merge of #106157 - LeSeulArtichaut:106126-thir-unsafeck-good-path-bug-2, r=compiler-errors

Don't trim path for `unsafe_op_in_unsafe_fn` lints

Fixes #106126, alternative to #106127.
r? `@ghost` for now.

17 months agoRollup merge of #106045 - RalfJung:oom-nounwind-panic, r=Amanieu
Michael Goulet [Wed, 4 Jan 2023 01:19:26 +0000 (17:19 -0800)]
Rollup merge of #106045 - RalfJung:oom-nounwind-panic, r=Amanieu

default OOM handler: use non-unwinding panic, to match std handler

The OOM handler in std will by default abort. This adjusts the default in liballoc to do the same, using the `can_unwind` flag on the panic info to indicate a non-unwinding panic.

In practice this probably makes little difference since the liballoc default will only come into play in no-std situations where people write a custom panic handler, which most likely will not implement unwinding. But still, this seems more consistent.

Cc `@rust-lang/wg-allocators,` https://github.com/rust-lang/rust/issues/66741

17 months agoRollup merge of #105541 - compiler-errors:iter-comb, r=cjgillot
Michael Goulet [Wed, 4 Jan 2023 01:19:25 +0000 (17:19 -0800)]
Rollup merge of #105541 - compiler-errors:iter-comb, r=cjgillot

Simplify some iterator combinators

Saw a `flat_map().next()` instead of a `find_map()` in some method probe code, so did a quick search for some similar usages.

17 months agoRollup merge of #104748 - lqd:download_lld, r=jyn514
Michael Goulet [Wed, 4 Jan 2023 01:19:25 +0000 (17:19 -0800)]
Rollup merge of #104748 - lqd:download_lld, r=jyn514

Ensure `lld` is supported with `download-ci-llvm`

This PR:
- ensures LLD's step in bootstrap's dist, but it's not strictly necessary since dist will already package it when it's present.
- makes bootstrap's `native::LLD` step support using the packaged `ci-llvm/bin/lld`, instead of building it from source (which would most likely not be available today, nor in the future where `download-ci-llvm = if-available` is the default).

If I understand correctly, `--enable-full-tools` will also enable `rust.lld`, and this is why LLD is already packaged today in the `rust-dev` component on the main targets (and why `-Zgcc-ld=lld` does work there).

That means it's likely that this PR will not be able to land before I've reworked and landed #101792: if LLD is available in `download-ci-llvm`, the `needs-rust-lld` tests should start being executed on the x64 macOS test builders, and CI would fail today.

I've tested locally that building with `download-ci-llvm = true` and `lld = true` with the LLVM submodule unregistered was successful, and that `rust-lld` and the various `lld-wrapper`s are present and `-Zgcc-ld=lld` works as well, on a few different platforms:
- `x86_64-unknown-linux-gnu`
- `aarch64-apple-darwin`
- `x86_64-pc-windows-msvc` (with `-Clinker=rust-lld` rather than `-Zgcc-ld=lld`)
- `x86_64-apple-darwin`, with the `MACOSX_DEPLOYMENT_TARGET` workaround for #101653

I don't think we really need to bump the `download-ci-llvm-stamp` in this case, since `./build/$triple/ci-llvm/bin/lld` is present on all the above targets already, but have added it mechanically, and it should probably be removed to avoid unnecessary downloads/churn.

Fixes #98340
Supersedes #100010

17 months agoreview comment: Deduplicate dyn ty_and_layout_field code
Michael Goulet [Wed, 4 Jan 2023 01:02:52 +0000 (01:02 +0000)]
review comment: Deduplicate dyn ty_and_layout_field code

17 months agoMirror metadata changes in layout sanity check
Michael Goulet [Sun, 13 Nov 2022 21:49:54 +0000 (21:49 +0000)]
Mirror metadata changes in layout sanity check

17 months agolayout_of: `T: Thin` implies `sizeof(&T) == sizeof(usize)`
Michael Goulet [Sat, 12 Nov 2022 23:54:39 +0000 (23:54 +0000)]
layout_of: `T: Thin` implies `sizeof(&T) == sizeof(usize)`

17 months agoAddress comments
Michael Goulet [Tue, 27 Dec 2022 17:53:29 +0000 (17:53 +0000)]
Address comments

17 months agoSimplify some iterator combinators
Michael Goulet [Sat, 10 Dec 2022 20:31:01 +0000 (20:31 +0000)]
Simplify some iterator combinators

17 months agoget_parent and find_parent
Michael Goulet [Tue, 3 Jan 2023 17:30:35 +0000 (17:30 +0000)]
get_parent and find_parent

17 months agorename find_parent_node to opt_parent_id
Michael Goulet [Tue, 3 Jan 2023 07:31:33 +0000 (07:31 +0000)]
rename find_parent_node to opt_parent_id

17 months agorename get_parent_node to parent_id
Michael Goulet [Tue, 3 Jan 2023 07:31:04 +0000 (07:31 +0000)]
rename get_parent_node to parent_id

17 months agoRestore Fn trait note
Michael Goulet [Wed, 4 Jan 2023 00:26:53 +0000 (00:26 +0000)]
Restore Fn trait note

17 months agoSuggest more impl Trait on `-> _`
Michael Goulet [Tue, 27 Dec 2022 23:56:46 +0000 (23:56 +0000)]
Suggest more impl Trait on `-> _`

17 months agoAuto merge of #105712 - amg98:feat/vita-support, r=wesleywiser
bors [Tue, 3 Jan 2023 23:38:28 +0000 (23:38 +0000)]
Auto merge of #105712 - amg98:feat/vita-support, r=wesleywiser

PlayStation Vita support

Just the compiler definitions for no-std projects and std support using newlib

Earlier PR: https://github.com/rust-lang/rust/pull/105606

17 months agoAuto merge of #105752 - chenyukang:yukang/refactor-method-error, r=compiler-errors
bors [Tue, 3 Jan 2023 20:44:40 +0000 (20:44 +0000)]
Auto merge of #105752 - chenyukang:yukang/refactor-method-error, r=compiler-errors

Refactoring report_method_error

While working on #105732, I found it's hard to follow this long function,
so I tried to make it shorter.

It's not easy for code reviewing, since so many lines of code changes,
but only the positions are changed.

Generally, I extract two sub-methods from `report_method_error`:

https://github.com/rust-lang/rust/blob/397b66e77b279de5006facf87979f9ecff5c7f87/compiler/rustc_hir_typeck/src/method/suggest.rs#L117
to `note_candidates_on_method_error`

And this long block:
https://github.com/rust-lang/rust/blob/397b66e77b279de5006facf87979f9ecff5c7f87/compiler/rustc_hir_typeck/src/method/suggest.rs#L263

to `report_no_match_method_error`.

r? `@compiler-errors`

17 months agoensure lld's step unconditionally for RustDev component
Rémy Rakic [Tue, 3 Jan 2023 20:21:49 +0000 (20:21 +0000)]
ensure lld's step unconditionally for RustDev component

17 months agobump download-ci-llvm-stamp
Rémy Rakic [Tue, 22 Nov 2022 22:38:53 +0000 (22:38 +0000)]
bump download-ci-llvm-stamp

17 months agoturn a comment into an actual doc comment
Rémy Rakic [Wed, 23 Nov 2022 18:16:37 +0000 (18:16 +0000)]
turn a comment into an actual doc comment

17 months agoslight cleanup
Rémy Rakic [Wed, 23 Nov 2022 18:12:58 +0000 (18:12 +0000)]
slight cleanup

17 months agomake the `native::LLD` step able to use an already built lld
Rémy Rakic [Wed, 23 Nov 2022 18:08:15 +0000 (18:08 +0000)]
make the `native::LLD` step able to use an already built lld

Makes the lld step avoid building it from source when possible: when
dist has packaged it along the other LLVM binaries for the rust-dev
component.

17 months agobootstrap dist: ensure LLD's step
Rémy Rakic [Wed, 23 Nov 2022 18:20:57 +0000 (18:20 +0000)]
bootstrap dist: ensure LLD's step

17 months agoFix a few clippy lints in libtest
Joshua Nelson [Tue, 3 Jan 2023 04:13:19 +0000 (04:13 +0000)]
Fix a few clippy lints in libtest

- Remove unnecessary references and dereferences
- Use `.contains` instead of `a <= x && x <= b`
- Use `mem::take` instead of `mem::replace` where possible

17 months agoAdd cuviper to the review rotation for libs
Josh Stone [Tue, 3 Jan 2023 17:47:03 +0000 (09:47 -0800)]
Add cuviper to the review rotation for libs

17 months agoAdd regression test for #104064
Guillaume Gomez [Tue, 3 Jan 2023 17:29:40 +0000 (18:29 +0100)]
Add regression test for #104064

17 months agoFix link generation for local primitive types in rustdoc JSON output
Guillaume Gomez [Tue, 3 Jan 2023 17:10:32 +0000 (18:10 +0100)]
Fix link generation for local primitive types in rustdoc JSON output

17 months agorustdoc: remove legacy font-feature-settings CSS
Michael Howell [Tue, 3 Jan 2023 17:23:55 +0000 (10:23 -0700)]
rustdoc: remove legacy font-feature-settings CSS

According to [caniuse], these vendor prefixes aren't needed in any supported
web browsers as defined in [RFC 1985].

* The last version of Chrome that required a vendor prefix was version 47.
  The current version is 108.
* Firefox 33 is the last version that required a vendor prefix. The
  [current Firefox ESR] is version 102.
* The last version of Safari that required a vendor prefix was version 9.1.
  The current version is 16.
* The last version of Safari/iOS that required a vendor prefix was version
  9.3. The current version is 16.
* Edge never required vendor prefixes.
* UCAndroid never required vendor prefixes.

[caniuse]: https://caniuse.com/?search=font-feature-settings
[RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html
[current Firefox ESR]: https://wiki.mozilla.org/Releases

17 months agoAuto merge of #106409 - matthiaskrgr:rollup-b58z1hz, r=matthiaskrgr
bors [Tue, 3 Jan 2023 17:08:17 +0000 (17:08 +0000)]
Auto merge of #106409 - matthiaskrgr:rollup-b58z1hz, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #104552 (warn newer available version of the x tool)
 - #105681 (some fixes/improvements to mir::visit module)
 - #106005 (Test the borrowck behavior of if-let guards)
 - #106356 (clean: Remove `ctor_kind` from `VariantStruct`.)
 - #106365 (Grammar : Missing "is" in format specifier diagnostic)
 - #106388 (rustdoc: remove legacy box-sizing CSS)
 - #106392 (`has_overflow` only if value is *not* within limit)
 - #106402 (Fix dupe word typos)

Failed merges:

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

17 months agoRollup merge of #106402 - Rageking8:fix_dupe_word_typos, r=Nilstrieb
Matthias Krüger [Tue, 3 Jan 2023 16:12:13 +0000 (17:12 +0100)]
Rollup merge of #106402 - Rageking8:fix_dupe_word_typos, r=Nilstrieb

Fix dupe word typos

r? `@Nilstrieb`
Thanks!

17 months agoRollup merge of #106392 - compiler-errors:new-trait-solver-overflow, r=lcnr
Matthias Krüger [Tue, 3 Jan 2023 16:12:13 +0000 (17:12 +0100)]
Rollup merge of #106392 - compiler-errors:new-trait-solver-overflow, r=lcnr

`has_overflow` only if value is *not* within limit

New solver forgot a not operator, I think.

17 months agoRollup merge of #106388 - notriddle:notriddle/box-sizing, r=camelid
Matthias Krüger [Tue, 3 Jan 2023 16:12:12 +0000 (17:12 +0100)]
Rollup merge of #106388 - notriddle:notriddle/box-sizing, r=camelid

rustdoc: remove legacy box-sizing CSS

According to [caniuse], these vendor prefixes aren't needed in any supported web browsers as defined in [RFC 1985]

* The last version of Chrome that required a vendor prefix was version 9. The current version is 108.
* Firefox 28 is the last version that required a vendor prefix. The [current Firefox ESR] is version 102.
* The last version of Safari that required a vendor prefix was version 5. The current version is 16.
* The last version of Safari/iOS that required a vendor prefix was version 4. The current version is 16.
* Edge never required vendor prefixes.
* UCAndroid never required vendor prefixes.

[caniuse]: https://caniuse.com/?search=box-sizing
[RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html
[current Firefox ESR]: https://wiki.mozilla.org/Releases

17 months agoRollup merge of #106365 - gimbles:patch-1, r=jyn514
Matthias Krüger [Tue, 3 Jan 2023 16:12:12 +0000 (17:12 +0100)]
Rollup merge of #106365 - gimbles:patch-1, r=jyn514

Grammar : Missing "is" in format specifier diagnostic

17 months agoRollup merge of #106356 - aDotInTheVoid:del-ctor-kind, r=jyn514
Matthias Krüger [Tue, 3 Jan 2023 16:12:11 +0000 (17:12 +0100)]
Rollup merge of #106356 - aDotInTheVoid:del-ctor-kind, r=jyn514

clean: Remove `ctor_kind` from `VariantStruct`.

It's always `None`.

r? `@ghost`

17 months agoRollup merge of #106005 - LeSeulArtichaut:if-let-guard-borrowck-test, r=Nilstrieb
Matthias Krüger [Tue, 3 Jan 2023 16:12:11 +0000 (17:12 +0100)]
Rollup merge of #106005 - LeSeulArtichaut:if-let-guard-borrowck-test, r=Nilstrieb

Test the borrowck behavior of if-let guards

Add some tests to make sure that if-let guards behave the same as if guards with respect to borrow-checking. Most of them are a naive adaptation, replacing an `if` guard with `if let Some(())`.
This includes regression tests for notable issues that arose for if guards (#24535, #27282, #29723, #31287) as suggested in https://github.com/rust-lang/rust/issues/51114#issuecomment-900470419.

cc `@pnkfelix` are there any other tests that you would want to see?
cc tracking issue #51114

17 months agoRollup merge of #105681 - tshepang:doc-mir-visit, r=Nilstrieb
Matthias Krüger [Tue, 3 Jan 2023 16:12:10 +0000 (17:12 +0100)]
Rollup merge of #105681 - tshepang:doc-mir-visit, r=Nilstrieb

some fixes/improvements to mir::visit module

17 months agoRollup merge of #104552 - DebugSteven:warn-newer-x, r=jyn514
Matthias Krüger [Tue, 3 Jan 2023 16:12:10 +0000 (17:12 +0100)]
Rollup merge of #104552 - DebugSteven:warn-newer-x, r=jyn514

warn newer available version of the x tool

This PR adds a check to `tidy` to assert that the installed version of `x` is equal to the version in `src/tools/x/Cargo.toml`. It adds a `--wrapper-version` argument to `x` to determine the version at runtime, .

It does not warn if `x` has not yet been installed, on the assumption that the user isn't interested in using it.