Commit Graph

216265 Commits

Author SHA1 Message Date
Michael Goulet
64f5293956 Don't cause a cycle when formatting query description that references a FnDef 2023-02-02 05:49:07 +00:00
Michael Goulet
e63ec2e140 Revert "switch to the macos-12-xl builder"
This reverts commit fcbae989ae.
2023-02-01 21:31:05 +00:00
bors
dc1d9d50fb Auto merge of #107297 - Mark-Simulacrum:bump-bootstrap, r=pietroalbini
Bump bootstrap compiler to 1.68

This also changes our stage0.json to include the rustc component for the rustfmt pinned nightly toolchain, which is currently necessary due to rustfmt dynamically linking to that toolchain's librustc_driver and libstd.

r? `@pietroalbini`
2023-01-31 19:24:29 +00:00
Mark Rousskov
652f79e835 Download rustc component for rustfmt toolchain as well 2023-01-31 10:29:33 -05:00
bors
f361413cbf Auto merge of #106399 - estebank:type-err-span-label, r=nagisa
Modify primary span label for E0308

Looking at the reactions to https://hachyderm.io/`@ekuber/109622160673605438,` a lot of people seem to have trouble understanding the current output, where the primary span label on type errors talks about the specific types that diverged, but these can be deeply nested type parameters. Because of that we could see "expected i32, found u32" in the label while the note said "expected Vec<i32>, found Vec<u32>". This understandably confuses people. I believe that once people learn to read these errors it starts to make more sense, but this PR changes the output to be more in line with what people might expect, without sacrificing terseness.

Fix #68220.
2023-01-31 13:53:40 +00:00
bors
a64ef7d07d Auto merge of #100754 - davidtwco:translation-incremental, r=compiler-errors
incremental: migrate diagnostics

- Apply the diagnostic migration lints to more functions on `Session`, namely: `span_warn`, `span_warn_with_code`, `warn` `note_without_error`, `span_note_without_error`, `struct_note_without_error`.
- Add impls of `IntoDiagnosticArg` for `std::io::Error`, `std::path::Path` and `std::path::PathBuf`.
- Migrate the `rustc_incremental` crate's diagnostics to translatable diagnostic structs.

r? `@compiler-errors`
cc #100717
2023-01-31 10:20:58 +00:00
bors
7c4a9a971c Auto merge of #107498 - JohnTitor:rollup-2i6g4uk, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #107245 (Implement unsizing in the new trait solver)
 - #107445 (Remove `GenFuture` from core)
 - #107473 (Update books)
 - #107476 (rustdoc: remove unnecessary wrapper `div.item-decl` from HTML)
 - #107477 (Migrate last part of CSS themes to CSS variables)
 - #107479 (Use `ObligationCtxt::new_in_snapshot` in `satisfied_from_param_env`)
 - #107482 (rustdoc: remove meta keywords from HTML)
 - #107494 (fix link in std::path::Path::display())

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-31 06:25:30 +00:00
Yuki Okushi
150340bafd
Rollup merge of #107494 - lebensterben:patch-1, r=JohnTitor
fix link in std::path::Path::display()

The link `Debug` points to should be the trait `Debug`, not the macro `Debug`.
2023-01-31 11:46:26 +09:00
Yuki Okushi
e776a63956
Rollup merge of #107482 - notriddle:notriddle/keywords, r=jsha
rustdoc: remove meta keywords from HTML

Discussed in <https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.60.3Cmeta.20name.3D.22keywords.22.3E.60>
2023-01-31 11:46:26 +09:00
Yuki Okushi
f95f835470
Rollup merge of #107479 - compiler-errors:probe-can-call-ocx, r=BoxyUwU
Use `ObligationCtxt::new_in_snapshot` in `satisfied_from_param_env`

We can evaluate nested `ConstEvaluatable` obligations in an evaluation probe, which will ICE if we use `ObligationCtxt::new`.

Fixes #107474
Fixes #106666

r? `@BoxyUwU` but feel free to reassign
cc `@JulianKnodt` who i think added this assertion code

Not sure if the rustdoc test is needed, but can't hurt. They're the same root cause, though.
2023-01-31 11:46:25 +09:00
Yuki Okushi
fbcaf046cc
Rollup merge of #107477 - GuillaumeGomez:css-var, r=notriddle
Migrate last part of CSS themes to CSS variables

No changes in the output. This is already tested in `tests/rustdoc-gui/search-tab.goml` so no need to add a GUI test.

r? `@notriddle`
2023-01-31 11:46:25 +09:00
Yuki Okushi
b10e60170c
Rollup merge of #107476 - notriddle:notriddle/item-decl-3, r=GuillaumeGomez
rustdoc: remove unnecessary wrapper `div.item-decl` from HTML
2023-01-31 11:46:24 +09:00
Yuki Okushi
401564d96d
Rollup merge of #107473 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/book

2 commits in 2cd1b5593d26dc6a03c20f8619187ad4b2485552..f2a78f64b668f63f581203c6bac509903f7c00ee
2023-01-23 18:19:32 UTC to 2023-01-23 15:15:22 UTC

- Change CamelCase to UpperCamelCase
- Fix broken link to the No Starch Press version (rust-lang/book#3513)

## rust-embedded/book

3 commits in 19f798d448835a4888e3b3eae7fe69f1d61d8681..f1a4614aa41cc544b91b79760a709e113f3451d7
2023-01-26 15:21:58 UTC to 2023-01-18 07:51:06 UTC

- Fix typo in the registers.md (rust-embedded/book#343)
- Macports install instructions (rust-embedded/book#342)
- remove extern crate statements (rust-embedded/book#340)

## rust-lang/nomicon

2 commits in 960d610e7f33889a2577f5f17c26f0d5c82b30df..bd1829d235296952bf72ca55635e360584b8805e
2023-01-18 03:14:58 UTC to 2023-01-17 20:05:07 UTC

- Copyedits to FFI and unwinding section (rust-lang/nomicon#396)
- Fix typo in dropck documentation (rust-lang/nomicon#397)

## rust-lang/reference

2 commits in 2cb0ed9ba56360949f492f9866afe8c293f9f9da..22882fb3f7b4d69fdc0d1731e8b9cfcb6910537d
2023-01-23 13:21:28 UTC to 2023-01-20 18:38:44 UTC

- Fix typo “assigment” (…and more) (rust-lang/reference#1322)
- Syntax correction for trait-bounds.md (rust-lang/reference#1319)

## rust-lang/rust-by-example

1 commits in a9fb7d13eadfcc5f457962731f105b97f9a7474a..134376872e8c387ef369507e0ee9b5a0e3272718
2023-01-25 11:56:37 UTC to 2023-01-25 11:56:37 UTC

- update std_misc/file/create.md: fixed grammar (rust-lang/rust-by-example#1668)

## rust-lang/rustc-dev-guide

12 commits in 7352353ae91c48b136d2ca7d03822e1448165e1e..e359ee27fc3da3356d71a732128c0a1abe02e53a
2023-01-30 15:08:16 UTC to 2023-01-17 12:44:19 UTC

- New infcx usage (rust-lang/rustc-dev-guide#1571)
- Create a chapter for AST validation (rust-lang/rustc-dev-guide#1524)
- Use ephemeral PAT for linkcheck (rust-lang/rustc-dev-guide#1569)
- add section for the new trait solver (rust-lang/rustc-dev-guide#1551)
- version 5 is now not supported (rust-lang/rustc-dev-guide#1568)
- there are still no locale bundles (rust-lang/rustc-dev-guide#1567)
- bumpt date-check examples to current month (rust-lang/rustc-dev-guide#1566)
- Update hir.md (rust-lang/rustc-dev-guide#1565)
- rustc_typeck exists no more (rust-lang/rustc-dev-guide#1559)
- Correct tests misplacement (rust-lang/rustc-dev-guide#1564)
- Update resolution.md (rust-lang/rustc-dev-guide#1561)
- Update asm.md  (rust-lang/rustc-dev-guide#1560)
2023-01-31 11:46:24 +09:00
Yuki Okushi
39d2639f81
Rollup merge of #107445 - Swatinem:rm-genfuture, r=cuviper
Remove `GenFuture` from core

The handling of async constructs in the compiler does not rely on `GenFuture` anymore since `1.67`, so this code can now be removed from `core`.
2023-01-31 11:46:23 +09:00
Yuki Okushi
6eeb981a58
Rollup merge of #107245 - compiler-errors:new-solver-unsizing, r=lcnr
Implement unsizing in the new trait solver

This makes hello world compile! Ignore the first commit, that's just #107146 which is waiting on merge.

I'll leave some comments inline about design choices that might be debatable.

r? `@lcnr` (until we have a new trait solver reviewer group...)
2023-01-31 11:46:22 +09:00
bors
dc3e59cb3f Auto merge of #107443 - cjgillot:generator-less-query, r=compiler-errors
Test drop_tracking_mir before querying generator.

r? `@ghost`
2023-01-31 02:46:11 +00:00
Lucius Hu
3c408d82a3
fix link in std::path::Path::display()
The link `Debug` points to should be the trait `Debug`, not the macro `Debug`.
2023-01-31 00:20:27 +00:00
bors
487e83b711 Auto merge of #105650 - cassaundra:float-literal-suggestion, r=pnkfelix
Fix invalid float literal suggestions when recovering an integer

Only suggest adding a zero to integers with a preceding dot when the change will result in a valid floating point literal.

For example, `.0x0` should not be turned into `0.0x0`.

r? nnethercote
2023-01-31 00:03:08 +00:00
Esteban Küber
449dfc64f0 Fix unquoted projection types in label 2023-01-30 22:02:30 +00:00
Esteban Küber
d86835769c Make structured suggestion for fn casting verbose 2023-01-30 21:55:25 +00:00
Esteban Küber
6c2c8edac3 Tweak E0271 wording 2023-01-30 21:51:35 +00:00
Esteban Küber
5ae8e23816 Mention fn coercion rules (needs to be expanded) 2023-01-30 21:51:33 +00:00
Cassaundra Smith
80fcd7c40e
Fix invalid float literal suggestions when recovering an integer
Only suggest adding a zero to integers with a preceding dot when the change will
result in a valid floating point literal.

For example, `.0x0` should not be turned into `0.0x0`.
2023-01-30 13:39:25 -08:00
Esteban Küber
153ed09fb3 Tweak use of trimmed paths 2023-01-30 20:12:21 +00:00
Esteban Küber
ab8dc9a0ad Hide lifetimes of impl Trait in force trimmed paths 2023-01-30 20:12:21 +00:00
Esteban Küber
252c43b42b Do not mention lifetime names in force trimmed paths 2023-01-30 20:12:21 +00:00
Esteban Küber
81973a39e0 Don't show for<'lt> in force trimmed paths 2023-01-30 20:12:21 +00:00
Esteban Küber
3fa95b847b review comments 2023-01-30 20:12:21 +00:00
Esteban Küber
62ba3e70a1 Modify primary span label for E0308
The previous output was unintuitive to users.
2023-01-30 20:12:19 +00:00
bors
001a77fac3 Auto merge of #107197 - aliemjay:patch-2, r=jackh726
assume MIR types are fully normalized in ascribe_user_type

This FIXME was introduced in c6a17bf8bc but it should've been restricted to `ascribe_user_type_skip_wf`.
2023-01-30 19:42:49 +00:00
Michael Howell
f5bac0c4c8 rustdoc: remove meta keywords from HTML
Discussed in
<https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.60.3Cmeta.20name.3D.22keywords.22.3E.60>
2023-01-30 12:20:06 -07:00
Michael Goulet
f7fc0b7121 nits 2023-01-30 19:19:07 +00:00
Michael Goulet
c24844048f Trait upcasting support in new solver 2023-01-30 19:11:01 +00:00
Michael Goulet
085a48e798 Implement unsizing in the new trait solver 2023-01-30 19:11:01 +00:00
Michael Goulet
343a359109 Use ObligationCtxt::new_in_snapshot in satisfied_from_param_env 2023-01-30 19:04:59 +00:00
Guillaume Gomez
e9f5630067 Migrate last part of CSS themes to CSS variables 2023-01-30 19:28:47 +01:00
Mark Rousskov
5b08c9f397 stage-step cfgs 2023-01-30 13:09:09 -05:00
Michael Howell
7080f80e8b rustdoc: remove unnecessary wrapper div.item-decl from HTML 2023-01-30 11:06:18 -07:00
David Wood
2ff46641a9 incremental: migrate diagnostics
Migrate the `rustc_incremental` crate's diagnostics to translatable
diagnostic structs.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30 17:11:35 +00:00
David Wood
2575b1abc9 session: diagnostic migration lint on more fns
Apply the diagnostic migration lint to more functions on `Session`.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30 17:11:35 +00:00
David Wood
d45004806d session: impl IntoDiagnosticArg for CrateType
Forward the `Display` implementation for `CrateType` to
`IntoDiagnosticArg` so that it can be used in diagnostic structs.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30 17:11:34 +00:00
David Wood
f7b42102e6 errors: implement IntoDiagnosticArg for &T
Implement `IntoDiagnosticArg` for `&'a T` when `T` implements
`IntoDiagnosticArg` and `Clone`. Makes it easier to write diagnostic
structs that borrow something which implements `IntoDiagnosticArg`.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30 17:11:34 +00:00
David Wood
59cc5e5d59 errors: add emit_note/create_note on Handler
Support for emission of notes was added in f8ebc72 but `emit_note` and
`create_note` functions weren't added to `Handler`.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30 17:11:34 +00:00
bors
a322848c6b Auto merge of #107472 - matthiaskrgr:rollup-s9gn4n7, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #107125 (Add and use expect methods to hir.)
 - #107172 (Reimplement NormalizeArrayLen based on SsaLocals)
 - #107177 (Keep all theme-updating logic together)
 - #107424 (Make Vec::clone_from and slice::clone_into share the same code)
 - #107455 (use a more descriptive name)
 - #107465 (`has_allow_dead_code_or_lang_attr` micro refactor)
 - #107469 (Change turbofish context link to an archive link)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-30 17:01:29 +00:00
rustbot
3e5e387318 Update books 2023-01-30 12:01:05 -05:00
Matthias Krüger
d79a40d4d3
Rollup merge of #107469 - LLBlumire:master, r=jyn514
Change turbofish context link to an archive link

The original tweet in the chain linked to (via quote tweet), and thus the through line of links back to Anna's tweet where she named the turbofish (https://web.archive.org/web/20210911061514/https://twitter.com/whoisaldeka/status/914914008225816576) are lost as the user whoisaldeka has deleted their twitter account.

Switching to an archive link preserves this through line, allowing someone to browse back to see the point at which Anna created the turbofish, as was the original intent of including this context.

I was sharing this test with some friends as I often do, and noticed the changes (I had only seen the version from before her death previously). Looking for context myself, I realized the deleted twitter account was breaking an important link in the chain for the context of who Anna was to begin with, and the exact moment the turbofish was so named.

As an alternative to using an archive, we could link to both the tweet where Anna names the turbofish, and the tweet where she refers to herself as its guardian, as two separate links - not requiring the quote tweet to connect them.
2023-01-30 17:50:12 +01:00
Matthias Krüger
3c155dc7b6
Rollup merge of #107465 - WaffleLapkin:has_allow_dead_code_or_lang_attr, r=Nilstrieb
`has_allow_dead_code_or_lang_attr` micro refactor

r? `@Nilstrieb`
2023-01-30 17:50:11 +01:00
Matthias Krüger
c3b1f5428b
Rollup merge of #107455 - tshepang:better-name, r=wesleywiser
use a more descriptive name

I found it hard to distinguish between the two method names.

Also, the comment just repeats the `expect` string.
2023-01-30 17:50:11 +01:00
Matthias Krüger
b3b9383f8d
Rollup merge of #107424 - bpeel:clone-into-from-share-code, r=scottmcm
Make Vec::clone_from and slice::clone_into share the same code

In the past, `Vec::clone_from` was implemented using `slice::clone_into`. The code from `clone_into` was later duplicated into `clone_from` in 8725e4c337, which is the commit that adds custom allocator support to Vec. Presumably this was done because the `slice::clone_into` method only works for vecs with the default allocator so it would have the wrong type to clone into `Vec<T, A>`.

Later on in 361398009b the code for the two methods diverged because the `Vec::clone_from` version gained a specialization to optimize the case when T is Copy. In order to reduce code duplication and make them both be able to take advantage of this specialization, this PR moves the specialization into the slice module and makes vec use it again.
2023-01-30 17:50:10 +01:00
Matthias Krüger
d1320a542f
Rollup merge of #107177 - thanatos:fix-doc-errant-light-theme, r=notriddle
Keep all theme-updating logic together

Prior to this PR, if the page is restored from the browser bfcache¹, we call `switchToSavedTheme`. But `switchToSavedTheme` never looks at the `use-system-theme` preference. Further, if it can't find a saved theme, it will fall back to the default of "light".

For a user with cookies disabled² whose preferred color scheme is dark, this means the theme will wobble back and forth between dark and light. The sequence that occurs is,

1. The page is loaded. During a page load, we consult `use-system-theme`: as cookies are disabled, this preference is unset. The default is true.

   Because the default is true, we look at the preferred color scheme: for our example user, that's "dark". **The page theme is set to dark.** We'll attempt to store these preferences in localStorage, but fail due to cookies being disabled.

2. The user navigates through the docs. Subsequent page loads happen, and the same process in step 1 recurs. Previous pages are (potentially) put into the bfcache.

3. The user navigates backwards/forwards, causing a page in bfcache to be pulled out of cache. The `pageShow` event handler is triggered. However, this calls `switchToSavedTheme`: this doesn't consider the system theme, as noted above. Instead, it only looks for a saved theme. However, with cookies disabled, there is none. It defaults to light. **The page theme is set to light!** The user wonders why the dark theme is lost.

There are effectively two functions trying to determine and apply the correct theme: `updateSystemTheme` and `switchToSavedTheme`. Thus, we merge them into just one: `updateTheme`. This function contains all the logic for determining the correct theme, and is called in all circumstances where we need to set the theme:

* The initial page load
* If the browser preferred color scheme (i.e., light/dark mode) is changed
* If the page is restored from bfcache
* If the user updates the theme preferences (i.e., in `settings.js`)

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

¹bfcache: https://web.dev/bfcache/ The bfcache is used to sleep a page, if the user navigates away from it, and to restore it from cache if the user returns to it.

²Note that the browser preference that enables/disables cookies really controls many forms of storage. The same preference thus also affects localStorage. (This is so a normal browser user doesn't need to understand the distinction between "cookies" and "localStorage".)
2023-01-30 17:50:09 +01:00