about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-05-10Auto merge of #96904 - JohnTitor:rollup-f1sz5x0, r=JohnTitorbors-15/+152
Rollup of 6 pull requests Successful merges: - #96717 (Handle mismatched generic param kinds in trait impls betterly) - #96725 (Expose process windows_process_extensions_main_thread_handle on Windows) - #96849 (Move some tests to more reasonable places) - #96861 (Use Rust 2021 prelude in std itself.) - #96879 (rustdoc: search result ranking fix) - #96882 (Don't subst an AdtDef with its own substs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-05-11Rollup merge of #96849 - c410-f3r:z-errors, r=petrochenkovYuki Okushi-0/+0
Move some tests to more reasonable places cc https://github.com/rust-lang/rust/issues/73494 r? `@petrochenkov`
2022-05-11Rollup merge of #96717 - BoxyUwU:gats_const_param_types_mismatch_err, r=lcnrYuki Okushi-15/+152
Handle mismatched generic param kinds in trait impls betterly - Check that generic params on a generic associated type are the same as in the trait definition - Check that const generics are not used in place of type generics (and the other way round too) r? `@lcnr`
2022-05-10Auto merge of #96736 - oli-obk:tait_missing_wf_check, r=davidtwcobors-137/+229
Check hidden types for well formedness at the definition site instead of only at the opaque type itself work towards #90409 . We'll need to look into closure and generator bodies of closures and generators nested inside the hidden type in order to fix that. In hindsight this PR is not necessary for that, but it may be a bit easier with it and we'll get better diagnostics from it on its own.
2022-05-10Check hidden types for well formedness at the definition site instead of ↵Oli Scherer-137/+229
only at the opaque type itself
2022-05-10Rollup merge of #96872 - RalfJung:layout-sanity, r=eddybDylan DPC-21/+109
make sure ScalarPair enums have ScalarPair variants; add some layout sanity checks `@eddyb` suggested that it might be reasonable for `ScalarPair` enums to simply adjust the ABI of their variants accordingly, such that the layout invariant Miri expects actually holds. This PR implements that. I should note though that I don't know much about this layout computation code and what non-Miri consumers expect from it, so tread with caution! I also added a function to sanity-check that computed layouts are internally consistent. This helped a lot in figuring out the final shape of this PR, though I am also not 100% sure that these sanity checks are the right ones. Cc `@oli-obk` Fixes https://github.com/rust-lang/rust/issues/96221
2022-05-10Rollup merge of #96812 - cjgillot:no-lint-outllives-macro, r=petrochenkovDylan DPC-0/+48
Do not lint on explicit outlives requirements from external macros. The current implementation of the list rightfully skipped where predicates from external macros. However, if the where predicate came from the current macro but the bounds were from an external macro, the lint still fired. Closes https://github.com/rust-lang/rust/issues/96640
2022-05-10Auto merge of #96715 - cjgillot:trait-alias-loop, r=compiler-errorsbors-11/+45
Fortify handing of where bounds on trait & trait alias definitions Closes https://github.com/rust-lang/rust/issues/96664 Closes https://github.com/rust-lang/rust/issues/96665 Since https://github.com/rust-lang/rust/pull/93803, when listing all bounds and predicates we now need to account for the possible presence of predicates on any of the generic parameters. Both bugs were hidden by the special handling of bounds at the generic parameter declaration position. Trait alias expansion used to confuse predicates on `Self` and where predicates. Exiting too late when listing all the bounds caused a cycle error.
2022-05-09Point to the empty trait alias.Camille GILLOT-0/+9
2022-05-09Rollup merge of #96844 - Badel2:actually-fix-96583, r=compiler-errorsMatthias Krüger-2/+17
Actually fix ICE from #96583 PR #96746 fixed a very similar bug, so the same logic is used in a different place. I originally concluded that the two issues (#96583 and #96738) were identical by comparing the backtrace, but I didn't look close enough.
2022-05-09Rollup merge of #96008 - ↵Matthias Krüger-0/+151
fmease:warn-on-useless-doc-hidden-on-assoc-impl-items, r=lcnr Warn on unused `#[doc(hidden)]` attributes on trait impl items [Zulip conversation](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.E2.9C.94.20Validy.20checks.20for.20.60.23.5Bdoc.28hidden.29.5D.60). Whether an associated item in a trait impl is shown or hidden in the documentation entirely depends on the corresponding item in the trait declaration. Rustdoc completely ignores `#[doc(hidden)]` attributes on impl items. No error or warning is emitted: ```rust pub trait Tr { fn f(); } pub struct Ty; impl Tr for Ty { #[doc(hidden)] fn f() {} } // ^^^^^^^^^^^^^^ ignored by rustdoc and currently // no error or warning issued ``` This may lead users to the wrong belief that the attribute has an effect. In fact, several such cases are found in the standard library (I've removed all of them in this PR). There does not seem to exist any incentive to allow this in the future either: Impl'ing a trait for a type means the type *fully* conforms to its API. Users can add `#[doc(hidden)]` to the whole impl if they want to hide the implementation or add the attribute to the corresponding associated item in the trait declaration to hide the specific item. Hiding an implementation of an associated item does not make much sense: The associated item can still be found on the trait page. This PR emits the warn-by-default lint `unused_attribute` for this case with a future-incompat warning. `@rustbot` label T-compiler T-rustdoc A-lint
2022-05-09make sure ScalarPair enums have ScalarPair variants; add some layout sanity ↵Ralf Jung-21/+109
checks
2022-05-09Auto merge of #95960 - jhpratt:remove-rustc_deprecated, r=compiler-errorsbors-23/+65
Remove `#[rustc_deprecated]` This removes `#[rustc_deprecated]` and introduces diagnostics to help users to the right direction (that being `#[deprecated]`). All uses of `#[rustc_deprecated]` have been converted. CI is expected to fail initially; this requires #95958, which includes converting `stdarch`. I plan on following up in a short while (maybe a bootstrap cycle?) removing the diagnostics, as they're only intended to be short-term.
2022-05-09Auto merge of #95542 - xFrednet:rfc-2383-expect-query, r=wesleywiserbors-0/+207
Support tool lints with the `#[expect]` attribute (RFC 2383) This PR fixes the ICE https://github.com/rust-lang/rust/issues/94953 by making the assert for converted expectation IDs conditional. Additionally, it moves the lint expectation check into a separate query to support rustdoc and other tools. On the way, I've also added some tests to ensure that the attribute works for Clippy and rustdoc lints. The number of changes comes from the long test file. This may look like a monster PR, this may smell like a monster PR and this may be a monster PR, but it's a harmless monster. :sauropod: --- Closes: https://github.com/rust-lang/rust/issues/94953 cc: https://github.com/rust-lang/rust/issues/85549 r? `@wesleywiser` cc: `@rust-lang/rustdoc`
2022-05-08Auto merge of #96846 - matthiaskrgr:rollup-yxu9ot9, r=matthiaskrgrbors-1/+101
Rollup of 5 pull requests Successful merges: - #96617 (Fix incorrect syntax suggestion with `pub async fn`) - #96828 (Further elaborate the lack of guarantees from `Hasher`) - #96829 (Fix the `x.py clippy` command) - #96830 (Add and tweak const-generics tests) - #96835 (Add more eslint rules) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-05-08Warn on unused doc(hidden) on trait impl itemsLeón Orell Valerian Liehr-0/+151
2022-05-08Move some tests to more reasonable placesCaio-0/+0
2022-05-08Rollup merge of #96830 - JohnTitor:issue-96654, r=compiler-errorsMatthias Krüger-1/+16
Add and tweak const-generics tests Closes #96654 Also correct the src/test/ui/const-generics/issues/issue-77357.rs test's issue number.
2022-05-08Rollup merge of #96617 - ↵Matthias Krüger-0/+85
ken-matsui:fix-incorrect-syntax-suggestion-with-pub-async-fn, r=cjgillot Fix incorrect syntax suggestion with `pub async fn` This PR closes: https://github.com/rust-lang/rust/issues/96555
2022-05-08Auto merge of #96302 - Serial-ATA:more-diagnostic-items, r=manishearthbors-40/+0
Add more diagnostic items This just adds a handful diagnostic items I noticed were missing. Would it be worth doing this for all of the remaining types? I'm willing to do it if it'd be helpful.
2022-05-08Actually fix ICE from #96583Badel2-2/+17
PR #96746 fixed a very similar bug, so the same logic is used in a different place.
2022-05-08Test `expect` attribute for tool lints, rustc edition (RFC 2383)xFrednet-0/+171
2022-05-08Only assert for unstable expectation ids after conversion (RFC 2383)xFrednet-0/+36
This ICE was reported by `@matthiaskrgr`. A big THANK YOU to him. See `rust#94953`
2022-05-08Auto merge of #96155 - jackh726:param-heuristics-followup, r=estebankbors-225/+192
Followups for method call error change Each commit is self-contained. Fixes most of the followup reviews from that PR. r? `@estebank`
2022-05-08Correct the issue number of a testYuki Okushi-1/+1
2022-05-08Add regression test for #96654Yuki Okushi-0/+15
2022-05-08Fix incorrect syntax suggestion with `pub async fn`Ken Matsui-0/+85
2022-05-07Rollup merge of #96777 - JohnTitor:do-not-run-pass-save-analysis, ↵Matthias Krüger-1/+1
r=Mark-Simulacrum Make the test `check-pass` not to produce a JSON file `run-pass` produces a JSON file when enabling save analysis. The original ICE happened on `cargo check`, moreover **without** the `generic_const_exprs` feature, so `check-pass` should be enough.
2022-05-07Rollup merge of #96726 - oli-obk:no_cross_inference, r=Mark-SimulacrumMatthias Krüger-0/+103
Add regression and bug tests this tracks the behaviour from https://github.com/rust-lang/rust/issues/96572 in our test suite
2022-05-07Rollup merge of #96667 - oli-obk:collect_hidden_types, r=Mark-SimulacrumMatthias Krüger-0/+43
Add regression test fixes #69785 This issue seems to have been fixed in the meantime.
2022-05-07Rollup merge of #96581 - RalfJung:debug-size-align, r=oli-obkGuillaume Gomez-521/+190
make Size and Align debug-printing a bit more compact In particular in `{:#?}`-mode, these take up a lot of space, so I think this is the better alternative (even though it is a bit longer in `{:?}` mode, I think it is still more readable). We could make it even smaller by deviating further from what the actual code looks like, e.g. via something like `Size(4 bytes)`. Not sure what people would think about that? Cc `````@oli-obk`````
2022-05-07Add test.Camille GILLOT-0/+48
2022-05-07Auto merge of #96804 - compiler-errors:rollup-1mc6aw3, r=compiler-errorsbors-0/+21
Rollup of 8 pull requests Successful merges: - #96660 ([bootstrap] Give a better error when trying to run a path with no registered step) - #96701 (update `jemallocator` example to use 2018 edition import syntax) - #96746 (Fix an ICE on #96738) - #96758 (bootstrap: bsd platform flags for split debuginfo) - #96778 (Remove closures on `expect_local` to apply `#[track_caller]`) - #96781 (Fix an incorrect link in The Unstable Book) - #96783 (Link to correct issue in issue-95034 known-bug) - #96801 (Add regression test for #96319) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-05-06Rollup merge of #96783 - aliemjay:typo-issue-95034, r=compiler-errorsMichael Goulet-0/+2
Link to correct issue in issue-95034 known-bug fix a typo is issue number: 94034 -> 95034
2022-05-06Rollup merge of #96746 - JohnTitor:issue-96738, r=petrochenkovMichael Goulet-0/+19
Fix an ICE on #96738 In the block we don't know if the method actually exists thus `expect_local` panics. Fixes #96738 Fixes #96583
2022-05-06Resolve vars before emitting coerce suggestions tooJack Huey-0/+16
2022-05-06Resolve vars in note_type_errJack Huey-129/+134
2022-05-07Auto merge of #96531 - kckeiks:remove-item-like-visitor-from-rustc-typeck, ↵bors-2/+2
r=cjgillot Remove ItemLikeVisitor impls from rustc_typeck Issue #95004 cc `@cjgillot`
2022-05-06Point at closure args tooJack Huey-3/+42
2022-05-06Remove previously deleted test filesJack Huey-93/+0
2022-05-06Rollup merge of #96772 - ↵Guillaume Gomez-0/+85
TaKO8Ki:suggest-fully-qualified-path-with-appropriate-params, r=compiler-errors Suggest fully qualified path with appropriate params closes #96291
2022-05-06Rollup merge of #96752 - scottmcm:error-sorting, r=compiler-errorsGuillaume Gomez-3/+3
Put the incompatible_closure_captures lint messages in alphabetical order Looks like they were in hash order before, which was causing me trouble in #94598, so this PR sorts the errors by trait name.
2022-05-06Rollup merge of #96557 - nbdd0121:const, r=oli-obkGuillaume Gomez-5/+83
Allow inline consts to reference generic params Tracking issue: #76001 The RFC says that inline consts cannot reference to generic parameters (for now), same as array length expressions. And expresses that it's desirable for it to reference in-scope generics, when array length expressions gain that feature as well. However it is possible to implement this for inline consts before doing this for all anon consts, because inline consts are only used as values and they won't be used in the type system. So we can have: ```rust fn foo<T>() { let x = [4i32; std::mem::size_of::<T>()]; // NOT ALLOWED (for now) let x = const { std::mem::size_of::<T>() }; // ALLOWED with this PR! let x = [4i32; const { std::mem::size_of::<T>() }]; // NOT ALLOWED (for now) } ``` This would make inline consts super useful for compile-time checks and assertions: ```rust fn assert_zst<T>() { const { assert!(std::mem::size_of::<T>() == 0) }; } ``` This would create an error during monomorphization when `assert_zst` is instantiated with non-ZST `T`s. A error during mono might sound scary, but this is exactly what a "desugared" inline const would do: ```rust fn assert_zst<T>() { struct F<T>(T); impl<T> F<T> { const V: () = assert!(std::mem::size_of::<T>() == 0); } let _ = F::<T>::V; } ``` It should also be noted that the current inline const implementation can already reference the type params via type inference, so this resolver-level restriction is not any useful either: ```rust fn foo<T>() -> usize { let (_, size): (PhantomData<T>, usize) = const { const fn my_size_of<T>() -> (PhantomData<T>, usize) { (PhantomData, std::mem::size_of::<T>()) } my_size_of() }; size } ``` ```@rustbot``` label: F-inline_const
2022-05-06Link to correct issue in issue-95034 testAli MJ Al-Nasrawy-0/+2
2022-05-06remove ItemLikeVisitor impl for InherentCollectMiguel Guarniz-2/+2
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-07Make the test `check-pass` not to produce a JSON fileYuki Okushi-1/+1
`run-pass` produces a JSON file when enabling save analysis.
2022-05-07Also suggest calling constructors for external DefIdsYuki Okushi-1/+6
2022-05-06suggest fully qualified path with appropriate paramsTakayuki Maeda-0/+85
2022-05-06Auto merge of #96268 - ↵bors-276/+76
jackh726:remove-mutable_borrow_reservation_conflict-lint, r=nikomatsakis Remove mutable_borrow_reservation_conflict lint and allow the code pattern This was the only breaking issue with the NLL stabilization PR. Lang team decided to go ahead and allow this. r? `@nikomatsakis` Closes #59159 Closes #56254
2022-05-06wording tweaksEllen-18/+18