summary refs log tree commit diff
path: root/src/test/ui/traits
AgeCommit message (Collapse)AuthorLines
2022-12-08Rollup merge of #104922 - estebank:fur-elize, r=oli-obkMatthias Krüger-1/+1
Detect long types in E0308 and write them to disk On type error with long types, print an abridged type and write the full type to disk. Print the widest possible short type while still fitting in the terminal.
2022-12-05Tweak "the following other types implement trait"Esteban Küber-4/+1
When *any* of the suggested impls is an exact match, *only* show the exact matches. This is particularly relevant for integer types. fix fmt
2022-11-30Add a regression test for #104322Georg Semmler-0/+80
2022-11-28Detect long types in E0308 and write them to diskEsteban Küber-1/+1
On type error with long types, print an abridged type and write the full type to disk. Print the widest possible short type while still fitting in the terminal.
2022-11-26Revert "Do not need to account for overflow in predicate_can_apply"Michael Goulet-27/+0
This reverts commit cbe932801892da06688b53638622be1c8a1c8974.
2022-11-24Rollup merge of #104742 - WaffleLapkin:forbidden-SUPER-deref, r=compiler-errorsMatthias Krüger-6/+11
Make `deref_into_dyn_supertrait` lint the impl and not the usage Proposed by ``@compiler-errors`` in https://github.com/rust-lang/rust/issues/89460#issuecomment-1320806785 r? ``@crlf0710``
2022-11-23Use nicer spans for `deref_into_dyn_supertrait`Maybe Waffle-10/+7
2022-11-23Make `deref_into_dyn_supertrait` lint the impl and not the usageMaybe Waffle-6/+14
2022-11-23Rollup merge of #104269 - compiler-errors:hang-in-where-clause-sugg, r=lcnrDylan DPC-0/+27
Fix hang in where-clause suggestion with `predicate_can_apply` Using `predicate_may_hold` during error reporting causes an evaluation overflow, which (because we use `evaluate_obligation_no_overflow`) then causes the predicate to need to be re-evaluated locally, which results in a hang. ... but since the "add a where clause" suggestion is best-effort, just throw any overflow errors. No need for 100% accuracy. r? `@lcnr` who has been thinking about overflows... Let me know if you want more context about this issue, and as always, feel free to reassign. Fixes #104225
2022-11-23Do not need to account for overflow in predicate_can_applyMichael Goulet-0/+27
2022-11-22Rollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnrManish Goregaokar-14/+1
Allow opaque types in trait impl headers and rely on coherence to reject unsound cases r? ````@lcnr```` fixes #99840
2022-11-22Rollup merge of #104597 - ↵Matthias Krüger-2/+2
compiler-errors:need_migrate_deref_output_trait_object-msg, r=eholk Probe + better error messsage for `need_migrate_deref_output_trait_object` 1. Use `InferCtxt::probe` in `need_migrate_deref_output_trait_object` -- that normalization *could* technically do type inference as a side-effect, and this is a lint, so it should have no side-effects. 2. Return the trait-ref so we format the error message correctly. See the UI test change -- `(dyn A + 'static)` is not a trait.
2022-11-21Allow opaque types in trait impl headers and rely on coherence to reject ↵Oli Scherer-14/+1
unsound cases
2022-11-19Probe + better error messsage for need_migrate_deref_output_trait_objectMichael Goulet-2/+2
2022-11-18Only use `...` instead of `_` for type elisionEsteban Küber-1/+1
`_` might confuse people into believing that the type isn't known, while `...` is not used anywhere else for types and is not valid syntax, making it more likely to convey the right understanding.
2022-11-18On overflow errors, do not print out long typesEsteban Küber-2/+4
2022-11-17Auto merge of #104170 - cjgillot:hir-def-id, r=fee1-deadbors-31/+4
Record `LocalDefId` in HIR nodes instead of a side table This is part of an attempt to remove the `HirId -> LocalDefId` table from HIR. This attempt is a prerequisite to creation of `LocalDefId` after HIR lowering (https://github.com/rust-lang/rust/pull/96840), by controlling how `def_id` information is accessed. This first part adds the information to HIR nodes themselves instead of a table. The second part is https://github.com/rust-lang/rust/pull/103902 The third part will be to make `hir::Visitor::visit_fn` take a `LocalDefId` as last parameter. The fourth part will be to completely remove the side table.
2022-11-16Rollup merge of #104348 - fmease:iat-vis-stab, r=cjgillotMatthias Krüger-1/+4
Respect visibility & stability of inherent associated types As discussed in #103621, this probably won't be the final location of the code that resolves inherent associated types. Still, I think it's valuable to push correctness fixes for this feature (in regards to visibility and stability). Let me know if I should write a translatable diagnostic instead and if I should move the tests to `privacy/` and `stability-attribute/` respectively. Fixes #104243. ````@rustbot```` label A-visibility F-inherent_associated_types r? ````@cjgillot```` (since you reviewed #103621, feel free to reroll though)
2022-11-14respect visibility & stability of inherent associated typesLeón Orell Valerian Liehr-1/+4
2022-11-14Rollup merge of #104229 - compiler-errors:overlap-full-path, r=davidtwcoMatthias Krüger-34/+34
Don't print full paths in overlap errors We don't print the full path in other diagnostics -- I don't think it particularly helps with the error message. I also delayed the printing until actually needing to render the error message. r? diagnostics
2022-11-13Rollup merge of #104181 - jackh726:known-bug-tests, r=Mark-SimulacrumManish Goregaokar-0/+58
Add a few known-bug tests The labels of these tests should be changed from `S-bug-has-mcve` to `S-bug-has-test` once this is merged. cc: #101518 #99492 #90950 #89196 #104034 #101350 #103705 #103899 I couldn't reproduce the failures in #101962 and #100772 (so either these have started passing, or I didn't repro properly), so leaving those out for now. #102065 was a bit more complicated, since it uses `rustc_private` and I didn't want to mess with that.
2022-11-13Add a few known-bug testsJack Huey-0/+58
2022-11-13Ensure codegen_fn_attrs during collection.Camille GILLOT-31/+4
2022-11-13Rollup merge of #104318 - c410-f3r:moar-errors, r=petrochenkovYuki Okushi-0/+44
Move tests r? `@petrochenkov` https://github.com/rust-lang/rust/pull/46521 -> enum-discriminant
2022-11-12Rollup merge of #104117 - crlf0710:update_feature_gate, r=jackh726Guillaume Gomez-79/+80
Mark `trait_upcasting` feature no longer incomplete. This marks the `trait_upcasting` feature no longer incomplete since #101336 has been settled for a little while. r? ``````@jackh726``````
2022-11-12Move testsCaio-0/+44
2022-11-11Auto merge of #104293 - Manishearth:rollup-xj92d0k, r=Manishearthbors-16/+3
Rollup of 8 pull requests Successful merges: - #95292 (Allow specialized const trait impls.) - #100386 (Make `Sized` coinductive, again) - #102215 (Implement the `+whole-archive` modifier for `wasm-ld`) - #103468 (Fix unused lint and parser caring about spaces to won't produce invalid code) - #103531 (Suggest calling the instance method of the same name when method not found) - #103960 (piece of diagnostic migrate) - #104051 (update Miri) - #104129 (rustdoc: use javascript to layout notable traits popups) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-10bless testsMichael Goulet-16/+3
2022-11-11Mark `trait_upcasting` feature no longer incomplete.Charles Lew-79/+80
2022-11-10Don't print full paths in overlap errorsMichael Goulet-34/+34
2022-11-09Don't ICE on operator trait methods with generic methodsNilstrieb-0/+31
Emit a fatal error instead.
2022-11-08selection failure: recompute applicable implslcnr-6/+1
2022-11-04Fix ICE when negative impl is collected during eager monoGary Guo-0/+12
2022-10-28Rollup merge of #103283 - nbarrios1337:unsafe-impl-suggestions, r=cjgillotMatthias Krüger-0/+18
Add suggestions for unsafe impl error codes Adds suggestions for users to add `unsafe` to trait impls that should be `unsafe`, and remove `unsafe` from trait impls that do not require `unsafe` With the folllowing code: ```rust struct Foo {} struct Bar {} trait Safe {} unsafe trait Unsafe {} impl Safe for Foo {} // ok impl Unsafe for Foo {} // E0200 unsafe impl Safe for Bar {} // E0199 unsafe impl Unsafe for Bar {} // ok // omitted empty main fn ``` The current rustc output is: ``` error[E0199]: implementing the trait `Safe` is not unsafe --> e0200.rs:13:1 | 13 | unsafe impl Safe for Bar {} // E0199 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0200]: the trait `Unsafe` requires an `unsafe impl` declaration --> e0200.rs:11:1 | 11 | impl Unsafe for Foo {} // E0200 | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors Some errors have detailed explanations: E0199, E0200. For more information about an error, try `rustc --explain E0199`. ``` With this PR, the future rustc output would be: ``` error[E0199]: implementing the trait `Safe` is not unsafe --> ../../temp/e0200.rs:13:1 | 13 | unsafe impl Safe for Bar {} // E0199 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove `unsafe` from this trait implementation | 13 - unsafe impl Safe for Bar {} // E0199 13 + impl Safe for Bar {} // E0199 | error[E0200]: the trait `Unsafe` requires an `unsafe impl` declaration --> ../../temp/e0200.rs:11:1 | 11 | impl Unsafe for Foo {} // E0200 | ^^^^^^^^^^^^^^^^^^^^^^ | = note: the trait `Unsafe` enforces invariants that the compiler can't check. Review the trait documentation and make sure this implementation upholds those invariants before adding the `unsafe` keyword help: add `unsafe` to this trait implementation | 11 | unsafe impl Unsafe for Foo {} // E0200 | ++++++ error: aborting due to 2 previous errors Some errors have detailed explanations: E0199, E0200. For more information about an error, try `rustc --explain E0199`. ``` ``@rustbot`` label +T-compiler +A-diagnostics +A-suggestion-diagnostics
2022-10-22Rollup merge of #103339 - Rageking8:fix-some-typos, r=fee1-deadMatthias Krüger-1/+1
Fix some typos
2022-10-21fix some typosRageking8-1/+1
2022-10-20Add fix suggestions for E0199, E0200, and E0569Nicolas Barrios-0/+18
2022-10-17`order_dependent_trait_objects` to `ReportNow`lcnr-0/+70
2022-10-15remove no_core featureTakayuki Maeda-28/+12
2022-10-14normalize stderrTakayuki Maeda-9/+10
2022-10-14check if the self type is `ty::Float` before getting second substsTakayuki Maeda-0/+90
2022-10-11Rollup merge of #100387 - cjgillot:hygiene-trait-impl, r=petrochenkovMatthias Krüger-2/+5
Check uniqueness of impl items by trait item when applicable. When checking uniqueness of item names in impl blocks, we currently use the same definition of hygiene as for toplevel items. This means that a plain item and one generated by a macro 2.0 do not collide. This hygiene rule does not match with how impl items resolve to associated trait items. As a consequence, we misdiagnose the trait impls. This PR proposes to consider that trait impl items are uses of the corresponding trait items during resolution, instead of checking for duplicates later. An error is emitted when a trait impl item is used twice. There should be no stable breakage, since macros 2.0 are still unstable. r? ``@petrochenkov`` cc ``@RalfJung`` Fixes https://github.com/rust-lang/rust/issues/71614.
2022-10-11Report duplicate definitions in trait impls during resolution.Camille GILLOT-2/+5
2022-10-10Rollup merge of #102055 - c410-f3r:moar-errors, r=petrochenkovDylan DPC-0/+29
Move some tests to more reasonable directories r? ``@petrochenkov``
2022-10-04follow-up fix about 101866 to print the self type.Yiming Lei-2/+2
modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs modified: src/test/ui/error-codes/E0283.stderr modified: src/test/ui/error-codes/E0790.stderr modified: src/test/ui/traits/static-method-generic-inference.stderr modified: src/test/ui/type/issue-101866.stderr
2022-10-01bless ui testsMaybe Waffle-12/+12
2022-09-26Rollup merge of #101996 - b-naber:binder-print, r=lcnrMatthias Krüger-1/+1
Don't duplicate region names for late-bound regions in print of Binder Fixes https://github.com/rust-lang/rust/issues/101280
2022-09-26address reviewb-naber-1/+1
2022-09-23Allow more !Copy implsLeón Orell Valerian Liehr-2/+2
2022-09-20Move some tests to more reasonable directoriesCaio-0/+29