Commit graph

214004 commits

Author SHA1 Message Date
Takayuki Maeda 804dea9ca6 use smaller spans for missing lifetime/generic args
fix rustdoc ui test
2023-01-06 21:55:23 +09:00
bors 1146560e1a Auto merge of #106529 - Dylan-DPC:rollup-mvncmrk, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #106400 (Point at expressions where inference refines an unexpected type)
 - #106491 (Fix error-index redirect to work with the back button.)
 - #106494 (Add regression test for #58355)
 - #106499 (fix [type error] for error E0029 and E0277)
 - #106502 (rustdoc: remove legacy user-select CSS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-06 09:17:14 +00:00
Dylan DPC dd97619b1f
Rollup merge of #106502 - notriddle:notriddle/user-select, r=GuillaumeGomez
rustdoc: remove legacy user-select CSS

According to [caniuse], the only supported browser that requires the vendor prefix, as defined in [RFC 1985], is Safari.

* The last version of Chrome that required a vendor prefix was version 53. The current version is 108.
* Firefox 68 is the last version that required a vendor prefix. The [current Firefox ESR] is version 102.
* The current version of Safari for Mac and iOS still requires a prefix.
* The last version of Edge that required a vendor frefix was 18. The current version of Edge is 108.
* UCAndroid support is unknown, but if it still requires a vendor prefix, it's more likely to be `-webkit-` than `-moz-` or `-ms-`, since they would want to emulate iOS for compatibility.

[caniuse]: https://caniuse.com/?search=user-select
[RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html
[current Firefox ESR]: https://wiki.mozilla.org/Releases
2023-01-06 11:38:58 +05:30
Dylan DPC a8f7ec2c48
Rollup merge of #106499 - lyming2007:issue-105946-fix, r=estebank
fix [type error] for error E0029 and E0277

check explicitly for the type references error
if ty.references_error() is true change the error to be err.delay_as_bug() and prevent the error E0029 and E0277 from emitting out this fix #105946
2023-01-06 11:38:57 +05:30
Dylan DPC 4b094c5933
Rollup merge of #106494 - JohnTitor:issue-58355, r=compiler-errors
Add regression test for #58355

Closes #58355
r? `@compiler-errors`
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-01-06 11:38:57 +05:30
Dylan DPC 2b6e38cb71
Rollup merge of #106491 - ehuss:error-index-redirect, r=GuillaumeGomez,notriddle
Fix error-index redirect to work with the back button.

This fixes the redirect page at https://doc.rust-lang.org/error-index.html so that it works with the browser's back-button. The solution is to use `window.location.replace()`, which avoids adding the page to the browser history stack.

This also cleans up the code a little bit, since it looks like it was written with different assumptions (maybe before f5857d5c5e).  I don't think there is a need to have a redirect at https://doc.rust-lang.org/error_codes/error-index.html since I don't think fragment-based links were ever used there.

I have tested with Firefox, Chrome, and Safari. Going to `/error-index.html` redirects without adding to the stack, and can use the back button. Additionally, `/error-index.html#E0005` redirects correctly to the error page.

Finally, there is an unrelated commit to remove the 404 hack. There is an official way of avoiding the generation of the 404 page with setting input-404 to an empty value.

Fixes #106485
2023-01-06 11:38:56 +05:30
Dylan DPC 6ae0f08c19
Rollup merge of #106400 - estebank:type-errs, r=compiler-errors
Point at expressions where inference refines an unexpected type

Fix #106355. Fix #14007. (!)

```
error[E0308]: mismatched types
  --> src/test/ui/type/type-check/point-at-inference.rs:12:9
   |
9  |         foo.push(i);
   |                  - this is of type `&{integer}`, which makes `foo` to be inferred as `Vec<&{integer}>`
...
12 |     bar(foo);
   |     --- ^^^ expected `i32`, found `&{integer}`
   |     |
   |     arguments to this function are incorrect
   |
   = note: expected struct `Vec<i32>`
              found struct `Vec<&{integer}>`
note: function defined here
  --> src/test/ui/type/type-check/point-at-inference.rs:2:4
   |
2  | fn bar(_: Vec<i32>) {}
   |    ^^^ -----------
help: consider dereferencing the borrow
   |
9  |         foo.push(*i);
   |                  +
```
2023-01-06 11:38:56 +05:30
bors ce8fbe7901 Auto merge of #106429 - djkoloski:add_vendor_to_fuchsia_target_triple, r=nagisa
Add vendor to Fuchsia's target triple

Historically, Rust's Fuchsia targets have been labeled x86_64-fuchsia and aarch64-fuchsia. However, they should technically contain vendor information. This CL changes Fuchsia's target triples to include the "unknown" vendor since Clang now does normalization and handles all triple spellings.

This was previously attempted in #90510, which was closed due to inactivity.
2023-01-06 06:05:40 +00:00
Yiming Lei 10dbcf0630 fix [type error] for error E0029 and E0277
check explicitly for the type references error
if ty.references_error() is true change the error to be err.delay_as_bug()
and prevent the error E0029 and E0277 from emitting out
this fix #105946
2023-01-05 21:21:13 -08:00
bors 0853d9677c Auto merge of #105890 - Nilstrieb:inline-fmt-part-1, r=jackh726
Fix `uninlined_format_args` in compiler crates with the diagnostic migration completed

Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).

Some of them have been reviewed by myself and they were all correct (though I still recommend going over all of them again for review).
2023-01-06 02:58:40 +00:00
bors b85f57d652 Auto merge of #106416 - Nilstrieb:better-failure, r=compiler-errors
Shrink `ParseResult` in the hot path.

#105570 increased the size, which caused regressions. This uses the existing generic infrastructure to differentiate between the hot path and the diagnostics path.
2023-01-05 23:27:51 +00:00
Nilstrieb 5112f0281d Shrink ParseResult in the hot path.
A recent PR increased the size, which caused regressions. This uses the
existing generic infrastructure to differentiate between the hot path
and the diagnostics path.
2023-01-05 20:42:26 +01:00
Eric Huss 72c3082aab error-index: Don't generate 404 instead of removing it. 2023-01-05 11:07:35 -08:00
Eric Huss f2ad85a930 Fix error-index redirect to work with back button. 2023-01-05 11:07:11 -08:00
Michael Howell 0de182a581 rustdoc: remove legacy user-select CSS
According to [caniuse], the only supported browser that requires the vendor prefix,
as defined in [RFC 1985], is Safari.

* The last version of Chrome that required a vendor prefix was version 53.
  The current version is 108.
* Firefox 68 is the last version that required a vendor prefix. The
  [current Firefox ESR] is version 102.
* The current version of Safari for Mac and iOS still requires a prefix.
* The last version of Edge that required a vendor frefix was 18. The current
  version of Edge is 108.
* UCAndroid support is unknown, but if it still requires a vendor prefix,
  it's more likely to be `-webkit-` than `-moz-` or `-ms-`, since they
  would want to emulate iOS for compatibility.

[caniuse]: https://caniuse.com/?search=user-select
[RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html
[current Firefox ESR]: https://wiki.mozilla.org/Releases
2023-01-05 11:25:06 -07:00
nils fd7a159710 Fix uninlined_format_args for some compiler crates
Convert all the crates that have had their diagnostic migration
completed (except save_analysis because that will be deleted soon and
apfloat because of the licensing problem).
2023-01-05 19:01:12 +01:00
Esteban Küber f98f2fcb5e fix rebase 2023-01-05 17:09:41 +00:00
Esteban Küber b182259d39 review comments: reword 2023-01-05 16:51:17 +00:00
Esteban Küber 98f3936aa7 review comment: potentially produce more suggestions for arg type mismatch 2023-01-05 16:51:17 +00:00
Esteban Küber f571862d17 Suggest changing argument on type error 2023-01-05 16:51:17 +00:00
Esteban Küber c905f5e1b0 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
```
2023-01-05 16:51:17 +00:00
Esteban Küber ad82eedfa1 Use BottomUpFolder 2023-01-05 16:51:16 +00:00
Esteban Küber 4ac7d1c3ab Formatting 2023-01-05 16:51:16 +00:00
Esteban Küber 9cc8d86190 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.
2023-01-05 16:51:16 +00:00
Esteban Küber 6b0cce4b50 review comments: do not always point at init expr 2023-01-05 16:51:16 +00:00
Esteban Küber 48094a4a6f More eagerly resolve expr tys before writing them
This allows the expressions to have more accurate types
when showing inference steps.
2023-01-05 16:51:16 +00:00
Esteban Küber 05c30b0ca5 Skip macros to avoid talking about bindings the user can't see 2023-01-05 16:51:16 +00:00
Esteban Küber ea43eb3721 Point at expressions where inference refines an unexpected type
Address #106355.
2023-01-05 16:51:16 +00:00
bors 388538fc96 Auto merge of #106487 - GuillaumeGomez:fix-kbd-var, r=notriddle
Fix --kbd-color variable name in rustdoc.css

Interestingly enough, it only impacted the dark theme.

Before:

![Screenshot from 2023-01-05 11-03-17](https://user-images.githubusercontent.com/3050060/210754145-c3bb0f50-d35f-4543-bf73-010a4524a803.png)

After:

![Screenshot from 2023-01-05 11-03-05](https://user-images.githubusercontent.com/3050060/210754190-85c2f146-a774-4463-9cd3-9495b7c91bd7.png)

r? `@notriddle`
2023-01-05 15:47:39 +00:00
Yuki Okushi b83fa06c56
Add regression test for #58355
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-01-06 00:24:42 +09:00
David Koloski f6ef039775 Add vendor to Fuchsia's target triple
Historically, Rust's Fuchsia targets have been labeled x86_64-fuchsia
and aarch64-fuchsia. However, they should technically contain vendor
information. This CL changes Fuchsia's target triples to include the
"unknown" vendor since Clang now does normalization and handles all
triple spellings.

This was previously attempted in #90510, which was closed due to
inactivity.
2023-01-05 09:34:22 -05:00
bors 1d284af117 Auto merge of #106406 - nikic:update-llvm-11, r=cuviper
Update LLVM submodule

Fixes #104099.
2023-01-05 12:45:43 +00:00
Guillaume Gomez 112723b4e3 Update kbd GUI test 2023-01-05 11:03:45 +01:00
Guillaume Gomez 407e72e0ce Fix --kbd-color variable name in rustdoc.css 2023-01-05 11:03:35 +01:00
bors e94fab69d0 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.
2023-01-05 09:50:05 +00:00
bors 1429899700 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
2023-01-05 06:47:02 +00:00
Michael Goulet e048ee2ac1
Rollup merge of #106478 - estebank:tweak-fn-mismatch, r=compiler-errors
Tweak wording of fn call with wrong number of args
2023-01-04 20:36:29 -08:00
Michael Goulet 27292f5cbb
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`
2023-01-04 20:36:28 -08:00
Michael Goulet 6132993144
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.
2023-01-04 20:36:28 -08:00
Michael Goulet 5ce6311f34
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.
2023-01-04 20:36:28 -08:00
Michael Goulet 13bb8a8b15
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
2023-01-04 20:36:27 -08:00
Michael Goulet f9ccbf084f
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
2023-01-04 20:36:27 -08:00
bors 03b9e1d154 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
2023-01-05 03:59:31 +00:00
Esteban Küber 5393c6bbd1 Tweak wording of fn call with wrong number of args 2023-01-05 03:02:10 +00:00
bors d26242d35f 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
2023-01-05 01:06:05 +00:00
Matthias Krüger 06b2df4706
Rollup merge of #106461 - notriddle:notriddle/window-searchstate-focus, r=GuillaumeGomez
docs: fix broken link "search bar"

Regression introduced by #84150
2023-01-04 23:39:52 +01:00
Matthias Krüger 3df7cd9553
Rollup merge of #106460 - c410-f3r:moar-errors, r=compiler-errors
Move tests

r? `@petrochenkov`
2023-01-04 23:39:51 +01:00
Matthias Krüger 6feb1fedbc
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.
2023-01-04 23:39:51 +01:00
Matthias Krüger 836321effb
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".
2023-01-04 23:39:50 +01:00
Matthias Krüger d214402128
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`
2023-01-04 23:39:50 +01:00