]> git.lizzy.rs Git - rust.git/log
rust.git
17 months agoAuto merge of #106810 - oli-obk:resolver_reverse_plumbing, r=petrochenkov
bors [Thu, 19 Jan 2023 05:23:40 +0000 (05:23 +0000)]
Auto merge of #106810 - oli-obk:resolver_reverse_plumbing, r=petrochenkov

Various cleanups around pre-TyCtxt queries and functions

part of #105462

based on https://github.com/rust-lang/rust/pull/106776 (everything starting at [0e2b39f](https://github.com/rust-lang/rust/pull/106810/commits/0e2b39fd1ffde51b50d45ccbe41de52b85136b8b) is new in this PR)

r? `@petrochenkov`

I think this should be most of the uncontroversial part of #105462.

17 months agoAuto merge of #107052 - compiler-errors:rollup-vxr22g5, r=compiler-errors
bors [Thu, 19 Jan 2023 02:09:45 +0000 (02:09 +0000)]
Auto merge of #107052 - compiler-errors:rollup-vxr22g5, r=compiler-errors

Rollup of 8 pull requests

Successful merges:

 - #105796 (rustdoc: simplify JS search routine by not messing with lev distance)
 - #106753 (Make sure that RPITITs are not considered suggestable)
 - #106917 (Encode const mir for closures if they're const)
 - #107004 (Implement some candidates for the new solver (redux))
 - #107023 (Stop using `BREAK` & `CONTINUE` in compiler)
 - #107030 (Correct typo)
 - #107042 (rustdoc: fix corner cases with "?" JS keyboard command)
 - #107045 (rustdoc: remove redundant CSS rule `#settings .setting-line`)

Failed merges:

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

17 months agoRollup merge of #107045 - notriddle:notriddle/settings-css-setting-line, r=GuillaumeGomez
Michael Goulet [Wed, 18 Jan 2023 23:00:31 +0000 (18:00 -0500)]
Rollup merge of #107045 - notriddle:notriddle/settings-css-setting-line, r=GuillaumeGomez

rustdoc: remove redundant CSS rule `#settings .setting-line`

Since the current version of settings.js always nests things below a div with ID `settings`, this rule always overrode the one above.

17 months agoRollup merge of #107042 - notriddle:notriddle/rustdoc-js-question, r=GuillaumeGomez
Michael Goulet [Wed, 18 Jan 2023 23:00:31 +0000 (18:00 -0500)]
Rollup merge of #107042 - notriddle:notriddle/rustdoc-js-question, r=GuillaumeGomez

rustdoc: fix corner cases with "?" JS keyboard command

17 months agoRollup merge of #107030 - albertlarsan68:patch-3, r=lcnr
Michael Goulet [Wed, 18 Jan 2023 23:00:30 +0000 (18:00 -0500)]
Rollup merge of #107030 - albertlarsan68:patch-3, r=lcnr

Correct typo

https://github.com/rust-lang/rust/pull/106718#discussion_r1073508490

17 months agoRollup merge of #107023 - scottmcm:stop-shouting, r=Nilstrieb
Michael Goulet [Wed, 18 Jan 2023 23:00:30 +0000 (18:00 -0500)]
Rollup merge of #107023 - scottmcm:stop-shouting, r=Nilstrieb

Stop using `BREAK` & `CONTINUE` in compiler

Switching them to `Break(())` and `Continue(())` instead.

Entirely search-and-replace, though there's one spot where rustfmt insisted on a reformatting too.

libs-api would like to remove these constants (https://github.com/rust-lang/rust/pull/102697#issuecomment-1385705202), so stop using them in compiler to make the removal PR later smaller.

17 months agoRollup merge of #107004 - compiler-errors:new-solver-new-candidates-2, r=lcnr
Michael Goulet [Wed, 18 Jan 2023 23:00:29 +0000 (18:00 -0500)]
Rollup merge of #107004 - compiler-errors:new-solver-new-candidates-2, r=lcnr

Implement some candidates for the new solver (redux)

Based on #106718, so the diff is hard to read without it. See [here](https://github.com/rust-lang/rust/compare/98700cf481bce946bff316b56836cfffd885127b...compiler-errors:rust:new-solver-new-candidates-2) for an easier view until that one lands.

Of note:
44af916020fb43c12070125c45b6dee4ec303bbc fixes a bug where we need to make the query response *inside* of a probe, or else we make no inference progress (I think)
50daad5acd2f163d03e7ffab942534f09bc36e2e implements `consider_assumption` for traits and predicates. I'm not sure if using `sup` here is necessary or if `eq` is fine.
* We decided that all of the `instantiate_constituent_tys_for_*` functions are verbose but ok, since they need to be exhaustive and the logic between each of them is not similar enough, right?

r? ``@lcnr``

17 months agoRollup merge of #106917 - compiler-errors:const-closure-foreign, r=tmiasko
Michael Goulet [Wed, 18 Jan 2023 23:00:29 +0000 (18:00 -0500)]
Rollup merge of #106917 - compiler-errors:const-closure-foreign, r=tmiasko

Encode const mir for closures if they're const

Fixes #106913

17 months agoRollup merge of #106753 - compiler-errors:rpitit-not-suggestable, r=spastorino
Michael Goulet [Wed, 18 Jan 2023 23:00:28 +0000 (18:00 -0500)]
Rollup merge of #106753 - compiler-errors:rpitit-not-suggestable, r=spastorino

Make sure that RPITITs are not considered suggestable

Makes no sense to suggest `where impl Future<Output = ()>: Send`, for example.

17 months agoRollup merge of #105796 - notriddle:notriddle/rustdoc-search-stop-doing-demerits...
Michael Goulet [Wed, 18 Jan 2023 23:00:28 +0000 (18:00 -0500)]
Rollup merge of #105796 - notriddle:notriddle/rustdoc-search-stop-doing-demerits, r=GuillaumeGomez

rustdoc: simplify JS search routine by not messing with lev distance

Since the sorting function accounts for an `index` field, there's not much reason to also be applying changes to the levenshtein distance. Instead, we can just not treat `lev` as a filter if there's already a non-sentinel value for `index`.

<details>

This change gives slightly more weight to the index and path part, as search criteria, than it used to. This changes some of the test cases, but not in any obviously-"worse" way, and, in particular, substring matches are a bigger deal than levenshtein distances (we're assuming that a typo is less likely than someone just not typing the entire name).

The biggest change is the addition of a `path_lev` field to result items. It's always zero if the search query has no parent path part and for type queries, making the check in the `sortResults` function a no-op. When it's present, it is used to implement different precedence for the parent path and the tail.

Consider the query `hashset::insert`, a test case [that already exists and can be found here](https://github.com/rust-lang/rust/blob/5c6a1681a9a7b815febdd9de2f840da338984e68/src/test/rustdoc-js-std/path-ordering.js). We want the ordering shown in the test case:

```
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' },
        { 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' },
```

We do not want this ordering, which is the ordering that would occur if substring position took priority over `path_lev`:

```
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' },
        { 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' }, // BAD
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' },
```

We also do not want `HashSet::iter` to appear before `HashMap::insert`, which is what would happen if `path_lev` took priority over the appearance of any substring match. This is why the `sortResults` function has `path_lev` sandwiched between a `index < 0` check and a `index` comparison check:

```
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' },
        { 'path': 'std::collections::hash_set::HashSet', 'name': 'iter' }, // BAD
        { 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' },
```

The old code implemented a similar feature by manipulating the `lev` member based on whether a substring match was found and averaging in the path distance (`item.lev = name_lev + path_lev / 10`), so the path lev wound up acting like a tie breaker, but it gives slightly different results for `Vec::new`, [changing the test case](https://github.com/rust-lang/rust/pull/105796/files#diff-b346e2ef72a407915f438063c8c2c04f7a621df98923d441b41c0312211a5b21) because of the slight changes to ordering priority.

</details>

Based on https://github.com/rust-lang/rust/pull/103710#issuecomment-1296894296

Previews:

* https://notriddle.com/notriddle-rustdoc-demos/rustdoc-search-stop-doing-demerits/std/index.html
* https://notriddle.com/notriddle-rustdoc-demos/rustdoc-search-stop-doing-demerits-compiler/index.html

17 months agoAuto merge of #107041 - Nilstrieb:back-to-being-clueless-whether-it-really-is-a-liter...
bors [Wed, 18 Jan 2023 22:58:30 +0000 (22:58 +0000)]
Auto merge of #107041 - Nilstrieb:back-to-being-clueless-whether-it-really-is-a-literal, r=compiler-errors

Revert "Improve heuristics whether `format_args` string is a source literal"

This reverts commit e6c02aad9345925cfed74f86b414c4d0715d381b (from #106195).

Keeps the code improvements from the PR and the test (as a known-bug).

Works around #106408 while a proper fix is discussed more thoroughly in #106505, as proposed by `@tmandry.`

Reopens #106191

r? compiler-errors

17 months agoAuto merge of #105716 - chriswailes:ndk-update-redux, r=pietroalbini
bors [Wed, 18 Jan 2023 19:49:02 +0000 (19:49 +0000)]
Auto merge of #105716 - chriswailes:ndk-update-redux, r=pietroalbini

Ndk update redux

Blocked on https://github.com/rust-lang/blog.rust-lang.org/pull/1055

17 months agorustdoc: add test case for setting-line margin on settings.html
Michael Howell [Wed, 18 Jan 2023 19:48:24 +0000 (12:48 -0700)]
rustdoc: add test case for setting-line margin on settings.html

17 months agorustdoc: remove redundant rule `#settings .setting-line`
Michael Howell [Wed, 18 Jan 2023 19:39:13 +0000 (12:39 -0700)]
rustdoc: remove redundant rule `#settings .setting-line`

Since the current version of settings.js always nests things below
a div with ID `settings`, this rule always overrode the one above.

17 months agoRevert "Improve heuristics whether `format_args` string is a source literal"
Nilstrieb [Wed, 18 Jan 2023 18:47:22 +0000 (19:47 +0100)]
Revert "Improve heuristics whether `format_args` string is a source literal"

This reverts commit e6c02aad9345925cfed74f86b414c4d0715d381b.

Keeps the code improvements from the PR and the test (as a known-bug).

17 months agorustdoc: fix "?" keyboard command when radio button is focused
Michael Howell [Wed, 18 Jan 2023 18:52:31 +0000 (11:52 -0700)]
rustdoc: fix "?" keyboard command when radio button is focused

This extends the special case with checkbox settings to also cover radios.

17 months agorustdoc: put focus on the help link when opening it from keyboard
Michael Howell [Wed, 18 Jan 2023 18:41:34 +0000 (11:41 -0700)]
rustdoc: put focus on the help link when opening it from keyboard

This prevents some strange blur-event-related bugs with the "?" command
by ensuring that the focus remains in the same spot when the settings
area closes.

17 months agoAlso remove `#![feature(control_flow_enum)]` where possible
Scott McMurray [Wed, 18 Jan 2023 18:22:21 +0000 (10:22 -0800)]
Also remove `#![feature(control_flow_enum)]` where possible

17 months agoAuto merge of #106503 - cjgillot:remap-nofilter, r=oli-obk
bors [Wed, 18 Jan 2023 16:37:33 +0000 (16:37 +0000)]
Auto merge of #106503 - cjgillot:remap-nofilter, r=oli-obk

Do not filter substs in `remap_generic_params_to_declaration_params`.

The relevant filtering should have been performed by borrowck.

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

r? types

17 months agoHandle structural traits more gracefully
Michael Goulet [Wed, 18 Jan 2023 14:56:44 +0000 (14:56 +0000)]
Handle structural traits more gracefully

17 months agono subtyping in the new trait solver
Michael Goulet [Wed, 18 Jan 2023 14:40:16 +0000 (14:40 +0000)]
no subtyping in the new trait solver

17 months agoSized, Copy/Clone
Michael Goulet [Tue, 17 Jan 2023 20:24:58 +0000 (20:24 +0000)]
Sized, Copy/Clone

17 months agoAuto and alias traits
Michael Goulet [Tue, 17 Jan 2023 20:16:30 +0000 (20:16 +0000)]
Auto and alias traits

17 months agoAssemble object bound candidates
Michael Goulet [Tue, 17 Jan 2023 18:19:11 +0000 (18:19 +0000)]
Assemble object bound candidates

17 months agoimplement consider_assumption
Michael Goulet [Tue, 17 Jan 2023 19:50:50 +0000 (19:50 +0000)]
implement consider_assumption

17 months agoCanonicalize trait solver response inside probe
Michael Goulet [Tue, 17 Jan 2023 19:29:52 +0000 (19:29 +0000)]
Canonicalize trait solver response inside probe

17 months agoCorrect typo
Albert Larsan [Wed, 18 Jan 2023 13:08:41 +0000 (14:08 +0100)]
Correct typo

17 months agoAuto merge of #107026 - Dylan-DPC:rollup-4fonvdc, r=Dylan-DPC
bors [Wed, 18 Jan 2023 10:26:12 +0000 (10:26 +0000)]
Auto merge of #107026 - Dylan-DPC:rollup-4fonvdc, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #103702 (Lift `T: Sized` bounds from some `strict_provenance` pointer methods)
 - #106441 (relax reference requirement on SocketAddrExt::from_abstract_name)
 - #106718 (finish trait solver skeleton work)
 - #106950 (Don't do pointer arithmetic on pointers to deallocated memory)
 - #107014 (rustdoc: remove deprecated / unused code from main.js)

Failed merges:

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

17 months agoRollup merge of #107014 - notriddle:notriddle/js-cleanup, r=GuillaumeGomez
Dylan DPC [Wed, 18 Jan 2023 10:25:39 +0000 (15:55 +0530)]
Rollup merge of #107014 - notriddle:notriddle/js-cleanup, r=GuillaumeGomez

rustdoc: remove deprecated / unused code from main.js

17 months agoRollup merge of #106950 - the8472:fix-splice-miri, r=cuviper
Dylan DPC [Wed, 18 Jan 2023 10:25:38 +0000 (15:55 +0530)]
Rollup merge of #106950 - the8472:fix-splice-miri, r=cuviper

Don't do pointer arithmetic on pointers to deallocated memory

vec::Splice can invalidate the slice::Iter inside vec::Drain. So we replace them with dangling pointers which, unlike ones to deallocated memory, are allowed.

Fixes miri test failures.
Fixes https://github.com/rust-lang/miri/issues/2759

17 months agoRollup merge of #106718 - lcnr:solver-cycles, r=compiler-errors
Dylan DPC [Wed, 18 Jan 2023 10:25:38 +0000 (15:55 +0530)]
Rollup merge of #106718 - lcnr:solver-cycles, r=compiler-errors

finish trait solver skeleton work

### 648d661b4e0fcf55f7082894f577377eb451db4b

The previous implementation didn't remove provisional entries which depended on the current goal if we're forced to rerun in case the provisional result of that entry is different from the new result. For reference, see https://rust-lang.github.io/chalk/book/recursive/search_graph.html.

We should also treat inductive cycles as overflow, not ordinary ambiguity.

### 219a5de2517cebfe20a2c3417bd302f7c12db70c 6a1912be539dd5a3b3c10be669787c4bf0c1868a

These two commits move canonicalization to the start of the queries which simplifies a bunch of stuff. I originally intended to keep stuff canonicalized for a while because I expected us to add a additional caches the trait solver, either for candidate assembly or for projections. We ended up not adding (and expect to not need) any of them so this just ends up being easier to understand.

### d78d5ad0979e965afde6500bccfa119b47063506

adds a special `eq` for the solver which doesn't care about obligations or spans

### 18704e6a78b7703e1bbb3856f015cb76c0a07a06

implements https://rust-lang.zulipchat.com/#narrow/stream/364551-t-types.2Ftrait-system-refactor/topic/projection.20cache

r? `@compiler-errors`

17 months agoRollup merge of #106441 - mllken:abstract-socket-noref, r=joshtriplett
Dylan DPC [Wed, 18 Jan 2023 10:25:37 +0000 (15:55 +0530)]
Rollup merge of #106441 - mllken:abstract-socket-noref, r=joshtriplett

relax reference requirement on SocketAddrExt::from_abstract_name

Reference: https://github.com/rust-lang/rust/issues/85410#issuecomment-1369544671

17 months agoRollup merge of #103702 - WaffleLapkin:lift-sized-bounds-from-pointer-methods-where...
Dylan DPC [Wed, 18 Jan 2023 10:25:36 +0000 (15:55 +0530)]
Rollup merge of #103702 - WaffleLapkin:lift-sized-bounds-from-pointer-methods-where-applicable, r=m-ou-se

Lift `T: Sized` bounds from some `strict_provenance` pointer methods

This PR removes requirement for `T` (pointee type) to be `Sized` to call `pointer::{addr, expose_addr, with_addr, map_addr}`. These functions don't use `T`'s size, so there is no reason for them to require this. Updated public API:

cc ``@Gankra,`` #95228
r? libs-api

17 months agoStop using `BREAK` & `CONTINUE` in compiler
Scott McMurray [Wed, 18 Jan 2023 07:17:13 +0000 (23:17 -0800)]
Stop using `BREAK` & `CONTINUE` in compiler

Switching them to `Break(())` and `Continue(())` instead.

libs-api would like to remove these constants, so stop using them in compiler to make the removal PR later smaller.

17 months agoadd comment
lcnr [Wed, 18 Jan 2023 07:08:58 +0000 (08:08 +0100)]
add comment

17 months agoadd note about indirect cycles
lcnr [Tue, 17 Jan 2023 15:00:00 +0000 (16:00 +0100)]
add note about indirect cycles

17 months agoupdate project to emulate a projection cache
lcnr [Tue, 17 Jan 2023 12:41:12 +0000 (13:41 +0100)]
update project to emulate a projection cache

17 months agoadd `eq` to `InferCtxtExt`
lcnr [Tue, 17 Jan 2023 11:26:28 +0000 (12:26 +0100)]
add `eq` to `InferCtxtExt`

17 months agoremove assembly context and impl a bit more
lcnr [Tue, 17 Jan 2023 10:47:47 +0000 (11:47 +0100)]
remove assembly context and impl a bit more

17 months agoinstantiate canonical vars eagerly
lcnr [Tue, 17 Jan 2023 09:21:30 +0000 (10:21 +0100)]
instantiate canonical vars eagerly

17 months agoupdate cache
lcnr [Wed, 11 Jan 2023 12:39:02 +0000 (13:39 +0100)]
update cache

17 months agoAuto merge of #107021 - matthiaskrgr:rollup-0dzxfyi, r=matthiaskrgr
bors [Wed, 18 Jan 2023 07:08:20 +0000 (07:08 +0000)]
Auto merge of #107021 - matthiaskrgr:rollup-0dzxfyi, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #106244 (Improve Markdown styling in README)
 - #106747 (Add 'static lifetime suggestion when GAT implied 'static requirement from HRTB)
 - #106873 (dont randomly use `_` to print out const generic arguments)
 - #106992 (Remove unused `#![feature(box_syntax)]` in `alloc`)
 - #106995 (bump failing assembly & codegen tests from LLVM 14 to LLVM 15)
 - #106996 (rustdoc: instead of `.setting-name { width: 100% }`, use default div CSS)
 - #106997 (Add heapsort fallback in `select_nth_unstable`)

Failed merges:

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

17 months agoRollup merge of #106997 - Sp00ph:introselect, r=scottmcm
Matthias Krüger [Wed, 18 Jan 2023 05:59:22 +0000 (06:59 +0100)]
Rollup merge of #106997 - Sp00ph:introselect, r=scottmcm

Add heapsort fallback in `select_nth_unstable`

Addresses #102451 and #106933.

`slice::select_nth_unstable` uses a quick select implementation based on the same pattern defeating quicksort algorithm that `slice::sort_unstable` uses. `slice::sort_unstable` uses a recursion limit and falls back to heapsort if there were too many bad pivot choices, to ensure O(n log n) worst case running time (known as introsort). However, `slice::select_nth_unstable` does not have such a fallback strategy, which leads to it having a worst case running time of O(n²) instead. #102451 links to a playground which generates pathological inputs that show this quadratic behavior. On my machine, a randomly generated slice of length `1 << 19` takes ~200µs to calculate its median, whereas a pathological input of the same length takes over 2.5s. This PR adds an iteration limit to `select_nth_unstable`, falling back to heapsort, which ensures an O(n log n) worst case running time (introselect). With this change, there was no noticable slowdown for the random input, but the same pathological input now takes only ~1.2ms. In the future it might be worth implementing something like Median of Medians or Fast Deterministic Selection instead, which guarantee O(n) running time for all possible inputs. I've left this as a `FIXME` for now and only implemented the heapsort fallback to minimize the needed code changes.

I still think we should clarify in the `select_nth_unstable` docs that the worst case running time isn't currently O(n) (the original reason that #102451 was opened), but I think it's a lot better to be able to guarantee O(n log n) instead of O(n²) for the worst case.

17 months agoRollup merge of #106996 - notriddle:notriddle/settings-line-div, r=GuillaumeGomez
Matthias Krüger [Wed, 18 Jan 2023 05:59:22 +0000 (06:59 +0100)]
Rollup merge of #106996 - notriddle:notriddle/settings-line-div, r=GuillaumeGomez

rustdoc: instead of `.setting-name { width: 100% }`, use default div CSS

This has no discernible change in appearance.

17 months agoRollup merge of #106995 - lukas-code:align_offset_assembly_test, r=cuviper
Matthias Krüger [Wed, 18 Jan 2023 05:59:21 +0000 (06:59 +0100)]
Rollup merge of #106995 - lukas-code:align_offset_assembly_test, r=cuviper

bump failing assembly & codegen tests from LLVM 14 to LLVM 15

These tests need LLVM 15.

Found by ```@Robert-Cunningham``` in https://github.com/rust-lang/rust/pull/100601#issuecomment-1385400008

Passed tests at 006506e93fc80318ebfd7939fe1fd4dc19ecd8cb in https://github.com/rust-lang/rust/actions/runs/3942442730/jobs/6746104740.

17 months agoRollup merge of #106992 - joboet:alloc_remove_box_syntax, r=thomcc
Matthias Krüger [Wed, 18 Jan 2023 05:59:21 +0000 (06:59 +0100)]
Rollup merge of #106992 - joboet:alloc_remove_box_syntax, r=thomcc

Remove unused `#![feature(box_syntax)]` in `alloc`

17 months agoRollup merge of #106873 - BoxyUwU:ty_const_formatting, r=compiler-errors
Matthias Krüger [Wed, 18 Jan 2023 05:59:20 +0000 (06:59 +0100)]
Rollup merge of #106873 - BoxyUwU:ty_const_formatting, r=compiler-errors

dont randomly use `_` to print out const generic arguments

const generics seem to get printed out as `_` for no reason a lot of the time, as someone who spends a lot of time with const generics this has gotten :sparkles: very annoying :sparkles:. Latest example would be #106423 where the ICE messaged formatted a `ty::Const` containing no infer vars, as `_`.

For some reason printing of the const argument on arrays was custom instead of using the existing logic for printing `ty::Const`. Additionally the existing logic for printing `ty::Const` would print out `_` for anon consts that are in a separate crate leading to weird diagnostics (see second commit). There ought to be less cases of consts randomly getting printed as `_` hiding valuable info now.

17 months agoRollup merge of #106747 - yanchen4791:issue-105507-fix, r=estebank
Matthias Krüger [Wed, 18 Jan 2023 05:59:20 +0000 (06:59 +0100)]
Rollup merge of #106747 - yanchen4791:issue-105507-fix, r=estebank

Add 'static lifetime suggestion when GAT implied 'static requirement from HRTB

Fix for issue #105507

The problem:
When generic associated types (GATs) are from higher-ranked trait bounds (HRTB), they are implied 'static requirement (see
[Implied 'static requirement from higher-ranked trait bounds](https://blog.rust-lang.org/2022/10/28/gats-stabilization.html#implied-static-requirement-from-higher-ranked-trait-bounds) for more details). If the user did not explicitly specify the `'static` lifetime when using the GAT, the current error message will only point out the type `does not live long enough` where the type is used, but not where the GAT is specified and how to fix the problem.

The solution:
Add notes at the span where the problematic GATs are specified and suggestions of how to fix the problem by adding `'static` lifetime at the right spans.

17 months agoRollup merge of #106244 - atouchet:readme3, r=workingjubilee
Matthias Krüger [Wed, 18 Jan 2023 05:59:19 +0000 (06:59 +0100)]
Rollup merge of #106244 - atouchet:readme3, r=workingjubilee

Improve Markdown styling in README

Update Readme to use consistent line lengths. Also update some formatting and links. (Followup to https://github.com/rust-lang/rust/pull/105553).

r? ``@workingjubilee``

17 months agoi am free
Boxy [Wed, 18 Jan 2023 04:45:35 +0000 (04:45 +0000)]
i am free

17 months agoactually print out non local anon consts
Boxy [Sat, 14 Jan 2023 19:03:50 +0000 (19:03 +0000)]
actually print out non local anon consts

17 months agotest for non local anon const printing
Boxy [Sat, 14 Jan 2023 19:01:31 +0000 (19:01 +0000)]
test for non local anon const printing

17 months agodefer array len printing to const arg printing
Boxy [Sat, 14 Jan 2023 18:32:17 +0000 (18:32 +0000)]
defer array len printing to const arg printing

17 months agoAuto merge of #106952 - petrochenkov:docglob, r=notriddle,GuillaumeGomez
bors [Wed, 18 Jan 2023 03:54:04 +0000 (03:54 +0000)]
Auto merge of #106952 - petrochenkov:docglob, r=notriddle,GuillaumeGomez

rustdoc: Fix glob import inlining

Filter away names that are not actually imported by the glob, e.g. because they are shadowed by something else.

Fixes the issue found in https://github.com/rust-lang/rust/pull/94857#issuecomment-1382912356.

17 months agorustdoc: stop using deprecated `window.event` when there's an `ev` param
Michael Howell [Wed, 18 Jan 2023 00:54:58 +0000 (17:54 -0700)]
rustdoc: stop using deprecated `window.event` when there's an `ev` param

17 months agoAuto merge of #107010 - weihanglo:update-cargo, r=weihanglo
bors [Wed, 18 Jan 2023 00:23:49 +0000 (00:23 +0000)]
Auto merge of #107010 - weihanglo:update-cargo, r=weihanglo

Update cargo

9 commits in 1cd6d3803dfb0b342272862a8590f5dfc9f72573..a5d47a72595dd6fbe7d4e4f6ec20dc5fe724edd1 2023-01-12 18:40:36 +0000 to 2023-01-16 18:51:50 +0000

- Add network container tests (rust-lang/cargo#11583)
- Show progress of crates.io index update even `net.git-fetch-with-cli` option enabled (rust-lang/cargo#11579)
- `cargo metadata` supports artifact dependencies (rust-lang/cargo#11550)
- fix(docs): add required "inherits" option to example profile (rust-lang/cargo#11504)
- add documentation that SSH markers aren't supported (rust-lang/cargo#11586)
- Fix typo (rust-lang/cargo#11585)
- Enable source_config_env test on Windows (rust-lang/cargo#11582)
- Support `codegen-backend` and `rustflags` in profiles in config file (rust-lang/cargo#11562)
- ci: reflect to clap updates (rust-lang/cargo#11578)

r? `@ghost`

17 months agorustdoc: remove function `handleClick` that's only used once
Michael Howell [Wed, 18 Jan 2023 00:22:05 +0000 (17:22 -0700)]
rustdoc: remove function `handleClick` that's only used once

17 months agoUpdate cargo
Weihang Lo [Tue, 17 Jan 2023 22:25:17 +0000 (22:25 +0000)]
Update cargo

9 commits in 1cd6d3803dfb0b342272862a8590f5dfc9f72573..a5d47a72595dd6fbe7d4e4f6ec20dc5fe724edd1
2023-01-12 18:40:36 +0000 to 2023-01-16 18:51:50 +0000

- Add network container tests (rust-lang/cargo#11583)
- Show progress of crates.io index update even `net.git-fetch-with-cli` option enabled (rust-lang/cargo#11579)
- `cargo metadata` supports artifact dependencies (rust-lang/cargo#11550)
- fix(docs): add required "inherits" option to example profile (rust-lang/cargo#11504)
- add documentation that SSH markers aren't supported (rust-lang/cargo#11586)
- Fix typo (rust-lang/cargo#11585)
- Enable source_config_env test on Windows (rust-lang/cargo#11582)
- Support `codegen-backend` and `rustflags` in profiles in config file (rust-lang/cargo#11562)
- ci: reflect to clap updates (rust-lang/cargo#11578)

17 months agoadd miri regression test
The 8472 [Tue, 17 Jan 2023 19:30:47 +0000 (20:30 +0100)]
add miri regression test

17 months agoDon't do pointer arithmetic on pointers to deallocated memory
The 8472 [Mon, 16 Jan 2023 20:39:36 +0000 (21:39 +0100)]
Don't do pointer arithmetic on pointers to deallocated memory

vec::Splice can invalidate the slice::Iter inside vec::Drain.
So we replace them with dangling pointers which, unlike ones to
deallocated memory, are allowed.

17 months agoAuto merge of #106998 - matthiaskrgr:rollup-hmfisji, r=matthiaskrgr
bors [Tue, 17 Jan 2023 20:53:05 +0000 (20:53 +0000)]
Auto merge of #106998 - matthiaskrgr:rollup-hmfisji, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #104505 (Remove double spaces after dots in comments)
 - #106784 (prevent E0512 from emitting [type error] by checking the references_error)
 - #106834 (new trait solver: only consider goal changed if response is not identity)
 - #106889 (Mention the lack of `windows_mut` in `windows`)
 - #106963 (Use `scope_expr_id` from `ProbeCtxt`)
 - #106970 (Switch to `EarlyBinder` for `item_bounds` query)
 - #106980 (Hide `_use_mk_alias_ty_instead` in `<AliasTy as Debug>::fmt`)

Failed merges:

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

17 months agoAdd 'static lifetime suggestion when GAT implied 'static requirement from HRTB
yanchen4791 [Wed, 11 Jan 2023 08:19:40 +0000 (00:19 -0800)]
Add 'static lifetime suggestion when GAT implied 'static requirement from HRTB

17 months agoRollup merge of #106980 - Nilstrieb:_use_mk_manual_debug_impl_instead, r=lcnr
Matthias Krüger [Tue, 17 Jan 2023 19:21:28 +0000 (20:21 +0100)]
Rollup merge of #106980 - Nilstrieb:_use_mk_manual_debug_impl_instead, r=lcnr

Hide `_use_mk_alias_ty_instead` in `<AliasTy as Debug>::fmt`

17 months agoRollup merge of #106970 - kylematsuda:earlybinder-item-bounds, r=lcnr
Matthias Krüger [Tue, 17 Jan 2023 19:21:28 +0000 (20:21 +0100)]
Rollup merge of #106970 - kylematsuda:earlybinder-item-bounds, r=lcnr

Switch to `EarlyBinder` for `item_bounds` query

Part of the work to finish #105779 (also see https://github.com/rust-lang/types-team/issues/78).

Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `item_bounds` query and removes `bound_item_bounds`.

r? `@lcnr`

17 months agoRollup merge of #106963 - compiler-errors:scope-expr-dupe, r=michaelwoerister
Matthias Krüger [Tue, 17 Jan 2023 19:21:27 +0000 (20:21 +0100)]
Rollup merge of #106963 - compiler-errors:scope-expr-dupe, r=michaelwoerister

Use `scope_expr_id` from `ProbeCtxt`

We already store it in the `ProbeCtxt`, so just retrieve it from there.

17 months agoRollup merge of #106889 - scottmcm:windows-mut, r=cuviper
Matthias Krüger [Tue, 17 Jan 2023 19:21:27 +0000 (20:21 +0100)]
Rollup merge of #106889 - scottmcm:windows-mut, r=cuviper

Mention the lack of `windows_mut` in `windows`

This is a common request, going back to at least 2015 (#23783), so mention in the docs that it can't be done and offer a workaround using <https://doc.rust-lang.org/std/cell/struct.Cell.html#method.as_slice_of_cells>.

(See also URLO threads like <https://internals.rust-lang.org/t/a-windows-mut-method-on-slice/16941/10?u=scottmcm>.)

17 months agoRollup merge of #106834 - compiler-errors:new-solver-did-changed, r=lcnr
Matthias Krüger [Tue, 17 Jan 2023 19:21:26 +0000 (20:21 +0100)]
Rollup merge of #106834 - compiler-errors:new-solver-did-changed, r=lcnr

new trait solver: only consider goal changed if response is not identity

I think this is the right way of implementing it..

r? `@lcnr`

17 months agoRollup merge of #106784 - lyming2007:issue-106695-fix, r=WaffleLapkin
Matthias Krüger [Tue, 17 Jan 2023 19:21:26 +0000 (20:21 +0100)]
Rollup merge of #106784 - lyming2007:issue-106695-fix, r=WaffleLapkin

prevent E0512 from emitting [type error] by checking the references_error

but still emit E0512
this will fix #106695

17 months agoRollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726
Matthias Krüger [Tue, 17 Jan 2023 19:21:25 +0000 (20:21 +0100)]
Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726

Remove double spaces after dots in comments

Most of the comments do not have double spaces, so I assume these are typos.

17 months agorustdoc: add test cases for settings radio button layout
Michael Howell [Tue, 17 Jan 2023 19:09:38 +0000 (12:09 -0700)]
rustdoc: add test cases for settings radio button layout

17 months agobump failing assembly & codegen tests from LLVM 14 to LLVM 15
Lukas Markeffsky [Tue, 17 Jan 2023 18:35:19 +0000 (19:35 +0100)]
bump failing assembly & codegen tests from LLVM 14 to LLVM 15

17 months agorustdoc: instead of `.setting-name { width: 100% }`, use default div CSS
Michael Howell [Tue, 17 Jan 2023 18:49:36 +0000 (11:49 -0700)]
rustdoc: instead of `.setting-name { width: 100% }`, use default div CSS

17 months agoAdd heapsort fallback in `select_nth_unstable`
Markus Everling [Tue, 17 Jan 2023 18:38:37 +0000 (19:38 +0100)]
Add heapsort fallback in `select_nth_unstable`

17 months agorefactor[alloc]: remove unused box syntax feature
joboet [Tue, 17 Jan 2023 17:55:44 +0000 (18:55 +0100)]
refactor[alloc]: remove unused box syntax feature

17 months agonew trait solver: only consider goal changed if response is not identity
Michael Goulet [Sat, 14 Jan 2023 04:46:23 +0000 (04:46 +0000)]
new trait solver: only consider goal changed if response is not identity

17 months agoAuto merge of #106294 - Nilstrieb:noundef-everything, r=nikic
bors [Tue, 17 Jan 2023 17:39:48 +0000 (17:39 +0000)]
Auto merge of #106294 - Nilstrieb:noundef-everything, r=nikic

Put `noundef` on all scalars that don't allow uninit

Previously, it was only put on scalars with range validity invariants like bool, was uninit was obviously invalid for those.

Since then, we have normatively declared all uninit primitives to be undefined behavior and can therefore put `noundef` on them.

The remaining concern was the `mem::uninitialized` function, which cause quite a lot of UB in the older parts of the ecosystem. After #99182, this function now doesn't return uninit values anymore, making users of it safe from this change.

The only real sources of UB where people could encounter uninit primitives are `MaybeUninit::uninit().assume_init()`, which has always be clear in the docs about being UB and from heap allocations (like reading from the spare capacity of a vec). This is hopefully rare enough to not break anything.

cc `@nagisa` `@scottmcm` `@nikic`

17 months agodelay E0512 as a bug by checking the references_error
Yiming Lei [Thu, 12 Jan 2023 20:28:07 +0000 (12:28 -0800)]
delay E0512 as a bug by checking the references_error
fix #106695

17 months agofix missing subst in clippy utils
Kyle Matsuda [Tue, 17 Jan 2023 15:54:07 +0000 (08:54 -0700)]
fix missing subst in clippy utils

17 months agochange item_bounds query to return EarlyBinder; remove bound_item_bounds query
Kyle Matsuda [Mon, 16 Jan 2023 22:07:23 +0000 (15:07 -0700)]
change item_bounds query to return EarlyBinder; remove bound_item_bounds query

17 months agochange usages of item_bounds query to bound_item_bounds
Kyle Matsuda [Mon, 16 Jan 2023 21:50:11 +0000 (14:50 -0700)]
change usages of item_bounds query to bound_item_bounds

17 months agoAdd more codegen tests
Nilstrieb [Fri, 30 Dec 2022 20:11:30 +0000 (21:11 +0100)]
Add more codegen tests

17 months agoAuto merge of #106984 - Dylan-DPC:rollup-xce8263, r=Dylan-DPC
bors [Tue, 17 Jan 2023 15:09:12 +0000 (15:09 +0000)]
Auto merge of #106984 - Dylan-DPC:rollup-xce8263, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #101698 (Constify `TypeId` ordering impls)
 - #106148 (Fix unused_parens issue for higher ranked function pointers)
 - #106922 (Avoid unsafe code in `to_ascii_[lower/upper]case()`)
 - #106951 (Remove ineffective run of SimplifyConstCondition)
 - #106962 (Fix use suggestion span)

Failed merges:

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

17 months agoRollup merge of #106962 - compiler-errors:use-sugg-span, r=oli-obk
Dylan DPC [Tue, 17 Jan 2023 15:03:05 +0000 (20:33 +0530)]
Rollup merge of #106962 - compiler-errors:use-sugg-span, r=oli-obk

Fix use suggestion span

Fixes #106954

17 months agoRollup merge of #106951 - tmiasko:rm-simplify-initial, r=oli-obk
Dylan DPC [Tue, 17 Jan 2023 15:03:05 +0000 (20:33 +0530)]
Rollup merge of #106951 - tmiasko:rm-simplify-initial, r=oli-obk

Remove ineffective run of SimplifyConstCondition

There are no constant conditions at this stage.

17 months agoRollup merge of #106922 - ChayimFriedman2:patch-5, r=workingjubilee
Dylan DPC [Tue, 17 Jan 2023 15:03:04 +0000 (20:33 +0530)]
Rollup merge of #106922 - ChayimFriedman2:patch-5, r=workingjubilee

Avoid unsafe code in `to_ascii_[lower/upper]case()`

17 months agoRollup merge of #106148 - chenyukang:yukang/fix-105061-unused, r=lcnr
Dylan DPC [Tue, 17 Jan 2023 15:03:03 +0000 (20:33 +0530)]
Rollup merge of #106148 - chenyukang:yukang/fix-105061-unused, r=lcnr

Fix unused_parens issue for higher ranked function pointers

fixes #105061

r? `@lcnr`

17 months agoRollup merge of #101698 - raldone01:feat/const_cmp_typeid, r=scottmcm
Dylan DPC [Tue, 17 Jan 2023 15:03:03 +0000 (20:33 +0530)]
Rollup merge of #101698 - raldone01:feat/const_cmp_typeid, r=scottmcm

Constify `TypeId` ordering impls

Tracking issue: #101871

Adding const ordering to `TypeId` allows rtti crates to optimize some casting scenarios (without transmuting to `u64`). This would also prevent these crates from breaking if the underlying type is changed from `u64` to something different.

Feature gate: `#![feature(const_cmp_type_id)]`

17 months agoHide `_use_mk_alias_ty_instead` in `<AliasTy as Debug>::fmt`
nils [Tue, 17 Jan 2023 13:06:12 +0000 (14:06 +0100)]
Hide `_use_mk_alias_ty_instead` in `<AliasTy as Debug>::fmt`

17 months agoAuto merge of #106612 - JakobDegen:cleanup-wf, r=tmiasko
bors [Tue, 17 Jan 2023 11:34:35 +0000 (11:34 +0000)]
Auto merge of #106612 - JakobDegen:cleanup-wf, r=tmiasko

Document wf constraints on control flow in cleanup blocks

Was recently made aware of [this code](https://github.com/rust-lang/rust/blob/a377893da2cd7124e5a18c7116cbb70e16dd5541/compiler/rustc_codegen_ssa/src/mir/analyze.rs#L247-L368), which has this potential ICE: https://github.com/rust-lang/rust/blob/a377893da2cd7124e5a18c7116cbb70e16dd5541/compiler/rustc_codegen_ssa/src/mir/analyze.rs#L308-L314

Roughly speaking, the code there is attempting to partition the cleanup blocks into funclets that satisfy a "unique successor" property, and the ICE is set off if that's not possible. This PR documents the well-formedness constraints that MIR must satisfy to avoid setting off that ICE.

The constraints documented are slightly stronger than the cases in which the ICE would have been set off in that code. This is necessary though, since whether or not that ICE gets set off can depend on iteration order in some graphs.

This sort of constraint is kind of ugly, but I don't know a better alternative at the moment. It's worth knowing that two important optimizations are still correct:
 - Removing edges in the cfg: Fewer edges => fewer paths => stronger dominance relations => more contractions, and more contractions can't turn a forest into not-a-forest.
 - Contracting an edge u -> v when u only has one successor and v only has one predecessor: u already dominated v, so this contraction was going to happen anyway.

There is definitely a MIR opt somewhere that can run afoul of this, but I don't know where it is. `@saethlin` was able to set it off though, so maybe he'll be able to shed some light on it.

r? `@RalfJung` I suppose, and cc `@tmiasko` who might have insight/opinions on this

17 months agoSkip tidy style checks for `rustc_apfloat`
Maybe Waffle [Thu, 12 Jan 2023 20:01:36 +0000 (20:01 +0000)]
Skip tidy style checks for `rustc_apfloat`

17 months agoAdd a tidy check to check for ". \w"
Maybe Waffle [Tue, 17 Jan 2023 08:09:51 +0000 (08:09 +0000)]
Add a tidy check to check for ". \w"

17 months agoRemove double spaces after dots in comments
Maybe Waffle [Wed, 16 Nov 2022 20:34:16 +0000 (20:34 +0000)]
Remove double spaces after dots in comments

17 months agoAuto merge of #106627 - Ezrashaw:no-e0711-without-staged-api, r=Mark-Simulacrum
bors [Tue, 17 Jan 2023 07:20:32 +0000 (07:20 +0000)]
Auto merge of #106627 - Ezrashaw:no-e0711-without-staged-api, r=Mark-Simulacrum

fix: don't emit `E0711` if `staged_api` not enabled

Fixes #106589

Simple fix, added UI test.

As an aside, it seems a lot of features are susceptible to this, `E0711` stands out to me because it's perma-unstable and we are effectively exposing an implementation detail.

17 months agoImprove comments
Nilstrieb [Fri, 30 Dec 2022 20:11:17 +0000 (21:11 +0100)]
Improve comments

17 months agoPut `noundef` on all scalars that don't allow uninit
Nilstrieb [Fri, 30 Dec 2022 14:55:05 +0000 (15:55 +0100)]
Put `noundef` on all scalars that don't allow uninit

Previously, it was only put on scalars with range validity invariants
like bool, was uninit was obviously invalid for those.

Since then, we have normatively declared all uninit primitives to be
undefined behavior and can therefore put `noundef` on them.

The remaining concern was the `mem::uninitialized` function, which cause
quite a lot of UB in the older parts of the ecosystem. This function now
doesn't return uninit values anymore, making users of it safe from this
change.

The only real sources of UB where people could encounter uninit
primitives are `MaybeUninit::uninit().assume_init()`, which has always
be clear in the docs about being UB and from heap allocations (like
reading from the spare capacity of a vec. This is hopefully rare enough
to not break anything.

17 months agoAuto merge of #106966 - matthiaskrgr:rollup-e34pevi, r=matthiaskrgr
bors [Tue, 17 Jan 2023 04:25:53 +0000 (04:25 +0000)]
Auto merge of #106966 - matthiaskrgr:rollup-e34pevi, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #106591 (suggestion for attempted integer identifier in patterns)
 - #106712 (make error emitted on `impl &Trait` nicer)
 - #106829 (Unify `Opaque`/`Projection` handling in region outlives code)
 - #106869 (rustdoc: remove redundant item kind class from `.item-decl > pre`)
 - #106949 (ConstBlocks are poly if their substs are poly)
 - #106953 (Document `EarlyBinder::subst_identity` and `skip_binder`)
 - #106958 (Don't add A-bootstrap to PRs modifying Cargo.lock)

Failed merges:

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

17 months agoRollup merge of #106958 - jyn514:labels, r=m-ou-se
Matthias Krüger [Tue, 17 Jan 2023 04:25:23 +0000 (05:25 +0100)]
Rollup merge of #106958 - jyn514:labels, r=m-ou-se

Don't add A-bootstrap to PRs modifying Cargo.lock

Changing Cargo.lock is common even when adding dependencies between existing rustc crates.

cc https://github.com/rust-lang/rust/pull/103204#discussion_r1070268737, `@m-ou-se`

17 months agoRollup merge of #106953 - kylematsuda:early-binder-docs, r=jackh726
Matthias Krüger [Tue, 17 Jan 2023 04:25:23 +0000 (05:25 +0100)]
Rollup merge of #106953 - kylematsuda:early-binder-docs, r=jackh726

Document `EarlyBinder::subst_identity` and `skip_binder`

Finishing implementing #105779 will change several commonly used queries to return `EarlyBinder` by default. This PR adds documentation for two of the methods used to access data inside the `EarlyBinder`. I tried to summarize some of the [discussion from the issue](https://github.com/rust-lang/rust/issues/105779#issuecomment-1375512647) in writing this.

r? `@lcnr`

17 months agoRollup merge of #106949 - compiler-errors:is-poly, r=BoxyUwU
Matthias Krüger [Tue, 17 Jan 2023 04:25:23 +0000 (05:25 +0100)]
Rollup merge of #106949 - compiler-errors:is-poly, r=BoxyUwU

ConstBlocks are poly if their substs are poly

r? `@BoxyUwU`

fixes #106926

17 months agoRollup merge of #106869 - notriddle:notriddle/item-decl-pre-rust, r=GuillaumeGomez
Matthias Krüger [Tue, 17 Jan 2023 04:25:22 +0000 (05:25 +0100)]
Rollup merge of #106869 - notriddle:notriddle/item-decl-pre-rust, r=GuillaumeGomez

rustdoc: remove redundant item kind class from `.item-decl > pre`

This class originated in the very first commit of `rustdoc_ng`, and was used to add a color border around the item decl based on its kind.

https://github.com/rust-lang/rust/blob/4fd061c426902b0904c65e64a3780b21f9ab3afb/src/rustdoc_ng/html/static/main.css#L102-L106

The item decl no longer has a border, and there aren't any kind-specific styles in modern rustdoc's rendering of this UI item.

Most of this PR is updating test cases so that they use `item-decl` to find the `<pre>` tag instead of relying on the fact that the class name had `rust {kind}` in it while other `<pre>` tags only had class `rust`.