about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-01-20diagnostics: add `};` only if `{` was added tooMichael Howell-0/+55
2023-01-20diagnostics: suggest changing `s@self::{macro}@::macro` for exportedMichael Howell-0/+49
Fixes #99695
2023-01-20Auto merge of #107106 - matthiaskrgr:rollup-g7r1ep0, r=matthiaskrgrbors-76/+177
Rollup of 6 pull requests Successful merges: - #106699 ([drop tracking] Visit break expressions ) - #106738 (Fix known-bug annotations) - #106891 (Tweak "borrow closure argument" suggestion) - #106928 (add raw identifier for keyword in suggestion) - #107065 (Clippy: Make sure to include in beta: Move `unchecked_duration_subtraction` to pedantic) - #107068 (autoderive Subdiagnostic for AddtoExternBlockSuggestion) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-20Rollup merge of #106928 - bvanjoi:print-keyword-raw-identifier, r=petrochenkovMatthias Krüger-5/+36
add raw identifier for keyword in suggestion fix https://github.com/rust-lang/rust/issues/106841
2023-01-20Rollup merge of #106891 - estebank:issue-45727, r=petrochenkovMatthias Krüger-39/+101
Tweak "borrow closure argument" suggestion Fix #45727.
2023-01-20Rollup merge of #106738 - compiler-errors:known-bugs-oops, r=jackh726Matthias Krüger-32/+19
Fix known-bug annotations r? ``@Nilstrieb``
2023-01-20Rollup merge of #106699 - eholk:await-chains-drop-tracking, r=wesleywiserMatthias Krüger-0/+21
[drop tracking] Visit break expressions This fixes https://github.com/rust-lang/rust/issues/102383 by remembering to visit the expression in `break expr` when building the drop tracking CFG. Missing this step was causing an off-by-one error which meant after a number of awaits we'd be looking for dropped values at the wrong point in the code. Additionally, this changes the order of traversal for assignment expressions to visit the rhs and then the lhs. This matches what is done elsewhere. Finally, this improves some of the debugging output (for example, the CFG visualizer) to make it easier to figure out these sorts of issues.
2023-01-20Rollup merge of #107076 - megakorre:106419_add_test_case, r=compiler-errorsMatthias Krüger-0/+12
Added const-generic ui test case for issue #106419 This PR adds a test case for #106419 which has been fixed in master by #105292 I also ran the test on f769d34291e489db19d3c972348ddb24b6b32481 (the commit before #105292 was merged) and it did fail there with the following output. ``` --- stderr ------------------------------- error[E0308]: mismatched types --> /home/patrikk/src/rust/src/test/ui/const-generics/issue-106419-struct-with-multiple-const-params.rs:5:10 | LL | #[derive(Clone)] | ^^^^^ | | | expected `A`, found `B` | expected `Bar<A, B>` because of return type | = note: expected struct `Bar<A, _>` found struct `Bar<B, _>` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. ------------------------------------------ ```
2023-01-20Rollup merge of #107067 - tmiasko:custom-mir-storage-statements, r=oli-obkMatthias Krüger-5/+9
Custom MIR: Support storage statements r? `@oli-obk` `@JakobDegen`
2023-01-20Rollup merge of #107058 - clubby789:eqeq-homoglyph, r=wesleywiserMatthias Krüger-1/+15
Recognise double-equals homoglyph Recognise `⩵` as a homoglyph for `==`. The first commit switches `char` to `&str`, as all previous homoglyphs corresponded to a single ASCII character, while the second implements the fix. `@rustbot` label +A-diagnostics +A-parser
2023-01-20Rollup merge of #106973 - oli-obk:tait_ice_closure_in_impl_header, r=lcnrMatthias Krüger-2/+38
Don't treat closures from other crates as local fixes #104817 r? `@lcnr` Specialization can prefer an impl for an opaque type over a blanket impls that also matches. If the blanket impl only applies if an auto-trait applies, we look at the hidden type of the opaque type to see if that implements the auto trait. The hidden type can be a closure or generator, and thus we will end up seeing these types in coherence and have to handle them properly.
2023-01-20Rollup merge of #106783 - WaffleLapkin:break-my-ident, r=wesleywiserMatthias Krüger-0/+39
Recover labels written as identifiers This adds recovery for `break label expr` and `continue label`, as well as a test for `break label`.
2023-01-20Auto merge of #107083 - GuillaumeGomez:revert-104889, r=notriddlebors-77/+7
rustdoc: Revert #104889 Reverts #104889. I don't think I'll be able to finish https://github.com/rust-lang/rust/pull/107000 on time unfortunately so to prevent https://github.com/rust-lang/rust/issues/106373, better to revert it and to make it into the next release. r? `@notriddle`
2023-01-19Fix known-bug, silence ICE stderrMichael Goulet-32/+19
2023-01-19Tweak "borrow closure argument" suggestionEsteban Küber-39/+101
Fix #45727.
2023-01-19Revert "Add regression test for impl blocks in const expr"Guillaume Gomez-43/+0
This reverts commit 9cce0bc583ee2cff88935ce0e08d8ec1eb1239a8.
2023-01-19Revert "Update newly failing UI tests"Guillaume Gomez-34/+7
This reverts commit 9c46173895430c63066731440e00faf0ab2195dd.
2023-01-19Auto merge of #107038 - compiler-errors:dont-wfcheck-non-local-rpit, r=oli-obkbors-0/+26
Don't wf-check non-local RPITs We were using `ty::is_impl_trait_defn(..).is_none()` to check if we need to add WF obligations for an opaque type. This is *supposed* to be checking if the type is a TAIT, since RPITs' wfness is implied by wf checking its parent item, but since `is_impl_trait_defn` returns `None` for non-local RPIT and async futures, we unnecessarily consider wf predicates for an RPIT if it is coming from a foreign crate. Fixes #107036 r? `@oli-obk` but feel free to reassign
2023-01-20add raw identifier for keyword in suggestionbohan-5/+36
2023-01-19Add testMichael Goulet-0/+26
2023-01-19Added UI test case for issue #106419Patrik Kårlin-0/+12
2023-01-19Auto merge of #106910 - aliemjay:alias-ty-in-regionck, r=oli-obkbors-0/+18
even more unify Projection/Opaque handling in region outlives code edit: This continues ate the same pace as #106829. New changes are described in https://github.com/rust-lang/rust/pull/106910#issuecomment-1383251254. ~This touches `OutlivesBound`, `Component`, `GenericKind` enums.~ r? `@oli-obk` (because of overlap with #95474)
2023-01-19add test for ICE fixAli MJ Al-Nasrawy-0/+18
2023-01-19Don't treat closures from other crates as localOli Scherer-2/+38
2023-01-19Auto merge of #107064 - GuillaumeGomez:rollup-pbgu6r3, r=GuillaumeGomezbors-57/+478
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-19Custom MIR: Support storage statementsTomasz Miąsko-5/+9
2023-01-19Rollup merge of #106931 - Ezrashaw:docs-e0208, r=compiler-errorsGuillaume Gomez-41/+48
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-16/+35
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-0/+395
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-0/+17
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-0/+395
- 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-6/+3
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-19Add double-equals homoglyphclubby789-1/+15
2023-01-19Auto merge of #107052 - compiler-errors:rollup-vxr22g5, r=compiler-errorsbors-6/+98
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-0/+7
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-0/+19
r=GuillaumeGomez rustdoc: fix corner cases with "?" JS keyboard command
2023-01-18Rollup merge of #106917 - compiler-errors:const-closure-foreign, r=tmiaskoMichael Goulet-0/+16
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-0/+50
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-6/+6
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-21/+30
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-18rustdoc: add test case for setting-line margin on settings.htmlMichael Howell-0/+7
2023-01-18Revert "Improve heuristics whether `format_args` string is a source literal"Nilstrieb-21/+30
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-0/+10
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/+9
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-18Auto merge of #106503 - cjgillot:remap-nofilter, r=oli-obkbors-0/+39
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-18Implement `alloc::vec::IsZero` for `Option<$NUM>` typesclubby789-0/+17
2023-01-18remove error code from `#[rustc_variance]` and document its remainsEzra Shaw-41/+48
2023-01-18Auto merge of #107021 - matthiaskrgr:rollup-0dzxfyi, r=matthiaskrgrbors-53/+255
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
2023-01-18Rollup merge of #106996 - notriddle:notriddle/settings-line-div, ↵Matthias Krüger-0/+27
r=GuillaumeGomez rustdoc: instead of `.setting-name { width: 100% }`, use default div CSS This has no discernible change in appearance.
2023-01-18Rollup merge of #106995 - lukas-code:align_offset_assembly_test, r=cuviperMatthias Krüger-2/+2
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.