about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-01-19Add testMichael Goulet-0/+26
2023-01-19Encode whether foreign opaques are TAITs or notMichael Goulet-2/+23
2023-01-19Auto merge of #107064 - GuillaumeGomez:rollup-pbgu6r3, r=GuillaumeGomezbors-100/+716
Rollup of 5 pull requests Successful merges: - #105977 (Transform async `ResumeTy` in generator transform) - #106927 (make `CastError::NeedsDeref` create a `MachineApplicable` suggestion) - #106931 (document + UI test `E0208` and make its output more user-friendly) - #107027 (Remove extra removal from test path) - #107037 (Fix Dominators::rank_partial_cmp to match documentation) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-19Rollup merge of #107037 - tmiasko:rank, r=oli-obkGuillaume Gomez-6/+6
Fix Dominators::rank_partial_cmp to match documentation The only use site is also updated accordingly and there is no change in end-to-end behaviour.
2023-01-19Rollup merge of #107027 - GuillaumeGomez:rm-extra-removal, r=tmiaskoGuillaume Gomez-1/+1
Remove extra removal from test path I don't know how to describe it shortly so better show what it's doing instead. Currently, there is one extra "rust/" before the test folder when running tests: ``` failures: ---- [rustdoc] rust/tests/rustdoc/redirect.rs stdout ---- ``` This is a bit annoying when copying the test path. This is due to the moving of the `tests` folder one level up, meaning we were trimming too much of the `root_path`. Now it is again displaying the correct path: ``` failures: ---- [rustdoc] tests/rustdoc/redirect.rs stdout ---- ```
2023-01-19Rollup merge of #106931 - Ezrashaw:docs-e0208, r=compiler-errorsGuillaume Gomez-46/+96
document + UI test `E0208` and make its output more user-friendly Cleans up `E0208`'s output a lot. It could actually be useful for someone learning about variance now. I also added a UI test for it in `tests/ui/error-codes/` and wrote some docs for it. r? `@GuillaumeGomez` another error code, can't be bothered to find the issue :P. Obviously there's some compiler stuff, so you'll have to hand it off. Part of https://github.com/rust-lang/rust/issues/61137.
2023-01-19Rollup merge of #106927 - Ezrashaw:e0606-make-machine-applicable, r=estebankGuillaume Gomez-33/+64
make `CastError::NeedsDeref` create a `MachineApplicable` suggestion Fixes #106903 Simple impl for the linked issue. I also made some other small changes: - `CastError::ErrorGuaranteed` now owns an actual `ErrorGuaranteed`. This better enforces the static guarantees of `ErrorGuaranteed`. - `CastError::NeedDeref` code simplified a bit, we now just suggest the `*`, instead of the whole expression as well.
2023-01-19Rollup merge of #105977 - Swatinem:async-mir-context, r=oli-obkGuillaume Gomez-14/+549
Transform async `ResumeTy` in generator transform - Eliminates all the `get_context` calls that async lowering created. - Replace all `Local` `ResumeTy` types with `&mut Context<'_>`. The `Local`s that have their types replaced are: - The `resume` argument itself. - The argument to `get_context`. - The yielded value of a `yield`. The `ResumeTy` hides a `&mut Context<'_>` behind an unsafe raw pointer, and the `get_context` function is being used to convert that back to a `&mut Context<'_>`. Ideally the async lowering would not use the `ResumeTy`/`get_context` indirection, but rather directly use `&mut Context<'_>`, however that would currently lead to higher-kinded lifetime errors. See <https://github.com/rust-lang/rust/issues/105501>. The async lowering step and the type / lifetime inference / checking are still using the `ResumeTy` indirection for the time being, and that indirection is removed here. After this transform, the generator body only knows about `&mut Context<'_>`. --- Fixes https://github.com/bjorn3/rustc_codegen_cranelift/issues/1330 CC `@bjorn3` r? `@compiler-errors`
2023-01-19Auto merge of #106989 - clubby789:is-zero-num, r=scottmcmbors-1/+37
Implement `alloc::vec::IsZero` for `Option<$NUM>` types Fixes #106911 Mirrors the `NonZero$NUM` implementations with an additional `assert_zero_valid`. `None::<i32>` doesn't stricly satisfy `IsZero` but for the purpose of allocating we can produce more efficient codegen.
2023-01-19Transform async ResumeTy in generator transformArpad Borsos-14/+549
- Eliminates all the `get_context` calls that async lowering created. - Replace all `Local` `ResumeTy` types with `&mut Context<'_>`. The `Local`s that have their types replaced are: - The `resume` argument itself. - The argument to `get_context`. - The yielded value of a `yield`. The `ResumeTy` hides a `&mut Context<'_>` behind an unsafe raw pointer, and the `get_context` function is being used to convert that back to a `&mut Context<'_>`. Ideally the async lowering would not use the `ResumeTy`/`get_context` indirection, but rather directly use `&mut Context<'_>`, however that would currently lead to higher-kinded lifetime errors. See <https://github.com/rust-lang/rust/issues/105501>. The async lowering step and the type / lifetime inference / checking are still using the `ResumeTy` indirection for the time being, and that indirection is removed here. After this transform, the generator body only knows about `&mut Context<'_>`.
2023-01-19Auto merge of #106810 - oli-obk:resolver_reverse_plumbing, r=petrochenkovbors-300/+203
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.
2023-01-19Auto merge of #107052 - compiler-errors:rollup-vxr22g5, r=compiler-errorsbors-239/+736
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
2023-01-18Rollup merge of #107045 - notriddle:notriddle/settings-css-setting-line, ↵Michael Goulet-5/+8
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.
2023-01-18Rollup merge of #107042 - notriddle:notriddle/rustdoc-js-question, ↵Michael Goulet-1/+24
r=GuillaumeGomez rustdoc: fix corner cases with "?" JS keyboard command
2023-01-18Rollup merge of #107030 - albertlarsan68:patch-3, r=lcnrMichael Goulet-1/+1
Correct typo https://github.com/rust-lang/rust/pull/106718#discussion_r1073508490
2023-01-18Rollup merge of #107023 - scottmcm:stop-shouting, r=NilstriebMichael Goulet-113/+111
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.
2023-01-18Rollup merge of #107004 - compiler-errors:new-solver-new-candidates-2, r=lcnrMichael Goulet-47/+442
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``
2023-01-18Rollup merge of #106917 - compiler-errors:const-closure-foreign, r=tmiaskoMichael Goulet-11/+18
Encode const mir for closures if they're const Fixes #106913
2023-01-18Rollup merge of #106753 - compiler-errors:rpitit-not-suggestable, r=spastorinoMichael Goulet-5/+62
Make sure that RPITITs are not considered suggestable Makes no sense to suggest `where impl Future<Output = ()>: Send`, for example.
2023-01-18Rollup merge of #105796 - ↵Michael Goulet-56/+70
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
2023-01-18Auto merge of #107041 - ↵bors-56/+32
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
2023-01-18Auto merge of #105716 - chriswailes:ndk-update-redux, r=pietroalbinibors-44/+31
Ndk update redux Blocked on https://github.com/rust-lang/blog.rust-lang.org/pull/1055
2023-01-18rustdoc: add test case for setting-line margin on settings.htmlMichael Howell-0/+7
2023-01-18rustdoc: remove redundant rule `#settings .setting-line`Michael Howell-5/+1
Since the current version of settings.js always nests things below a div with ID `settings`, this rule always overrode the one above.
2023-01-18Revert "Improve heuristics whether `format_args` string is a source literal"Nilstrieb-56/+32
This reverts commit e6c02aad9345925cfed74f86b414c4d0715d381b. Keeps the code improvements from the PR and the test (as a known-bug).
2023-01-18rustdoc: fix "?" keyboard command when radio button is focusedMichael Howell-1/+12
This extends the special case with checkbox settings to also cover radios.
2023-01-18rustdoc: put focus on the help link when opening it from keyboardMichael Howell-0/+12
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.
2023-01-18Also remove `#![feature(control_flow_enum)]` where possibleScott McMurray-7/+1
2023-01-18Auto merge of #106503 - cjgillot:remap-nofilter, r=oli-obkbors-28/+41
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
2023-01-18Fix Dominators::rank_partial_cmp to match documentationTomasz Miąsko-6/+6
The only use site is also updated accordingly and there is no change in end-to-end behaviour.
2023-01-18Update `IsZero` documentationclubby789-1/+2
2023-01-18Implement `alloc::vec::IsZero` for `Option<$NUM>` typesclubby789-0/+35
2023-01-18Handle structural traits more gracefullyMichael Goulet-215/+212
2023-01-18no subtyping in the new trait solverMichael Goulet-34/+23
2023-01-18Sized, Copy/CloneMichael Goulet-3/+151
2023-01-18Auto and alias traitsMichael Goulet-21/+169
2023-01-18Assemble object bound candidatesMichael Goulet-0/+52
2023-01-18implement consider_assumptionMichael Goulet-10/+70
2023-01-18Canonicalize trait solver response inside probeMichael Goulet-24/+25
2023-01-18Correct typoAlbert Larsan-1/+1
2023-01-18Remove extra removal from test pathGuillaume Gomez-1/+1
2023-01-18Auto merge of #107026 - Dylan-DPC:rollup-4fonvdc, r=Dylan-DPCbors-706/+952
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
2023-01-18Rollup merge of #107014 - notriddle:notriddle/js-cleanup, r=GuillaumeGomezDylan DPC-9/+4
rustdoc: remove deprecated / unused code from main.js
2023-01-18Rollup merge of #106950 - the8472:fix-splice-miri, r=cuviperDylan DPC-3/+15
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
2023-01-18Rollup merge of #106718 - lcnr:solver-cycles, r=compiler-errorsDylan DPC-644/+916
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`
2023-01-18Rollup merge of #106441 - mllken:abstract-socket-noref, r=joshtriplettDylan DPC-2/+2
relax reference requirement on SocketAddrExt::from_abstract_name Reference: https://github.com/rust-lang/rust/issues/85410#issuecomment-1369544671
2023-01-18Rollup merge of #103702 - ↵Dylan DPC-48/+15
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
2023-01-18remove error code from `#[rustc_variance]` and document its remainsEzra Shaw-46/+96
2023-01-17Stop using `BREAK` & `CONTINUE` in compilerScott McMurray-106/+110
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.
2023-01-18add commentlcnr-0/+1