rust/tests/rustdoc-ui/issues
Michael Goulet f41ad1bc9c
Rollup merge of #119148 - estebank:bare-traits, r=davidtwco
Tweak suggestions for bare trait used as a type

```
error[E0782]: trait objects must include the `dyn` keyword
  --> $DIR/not-on-bare-trait-2021.rs:11:11
   |
LL | fn bar(x: Foo) -> Foo {
   |           ^^^
   |
help: use a generic type parameter, constrained by the trait `Foo`
   |
LL | fn bar<T: Foo>(x: T) -> Foo {
   |       ++++++++    ~
help: you can also use `impl Foo`, but users won't be able to specify the type paramer when calling the `fn`, having to rely exclusively on type inference
   |
LL | fn bar(x: impl Foo) -> Foo {
   |           ++++
help: alternatively, use a trait object to accept any type that implements `Foo`, accessing its methods at runtime using dynamic dispatch
   |
LL | fn bar(x: &dyn Foo) -> Foo {
   |           ++++

error[E0782]: trait objects must include the `dyn` keyword
  --> $DIR/not-on-bare-trait-2021.rs:11:19
   |
LL | fn bar(x: Foo) -> Foo {
   |                   ^^^
   |
help: use `impl Foo` to return an opaque type, as long as you return a single underlying type
   |
LL | fn bar(x: Foo) -> impl Foo {
   |                   ++++
help: alternatively, you can return an owned trait object
   |
LL | fn bar(x: Foo) -> Box<dyn Foo> {
   |                   +++++++    +
```

Fix #119525:

```

error[E0038]: the trait `Ord` cannot be made into an object
  --> $DIR/bare-trait-dont-suggest-dyn.rs:3:33
   |
LL | fn ord_prefer_dot(s: String) -> Ord {
   |                                 ^^^ `Ord` cannot be made into an object
   |
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
  --> $SRC_DIR/core/src/cmp.rs:LL:COL
   |
   = note: the trait cannot be made into an object because it uses `Self` as a type parameter
  ::: $SRC_DIR/core/src/cmp.rs:LL:COL
   |
   = note: the trait cannot be made into an object because it uses `Self` as a type parameter
help: consider using an opaque type instead
   |
LL | fn ord_prefer_dot(s: String) -> impl Ord {
   |                                 ++++
```
2024-01-05 10:57:20 -05:00
..
auxiliary
issue-58473-2.rs
issue-58473.rs
issue-61592-2.rs
issue-61592-2.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
issue-61592.rs
issue-61592.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
issue-61732.rs
issue-61732.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
issue-74134.private.stderr
issue-74134.public.stderr
issue-74134.rs
issue-79465.rs
issue-79465.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
issue-79467.rs
issue-79467.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
issue-79494.rs
issue-79494.stderr Manual find replace updates 2023-11-24 21:04:51 +01:00
issue-80992.rs
issue-80992.stdout
issue-81662-shortness.rs Switch from using //~ERROR annotations with --error-format to error-pattern 2023-12-21 16:45:29 +05:30
issue-81662-shortness.stdout Switch from using //~ERROR annotations with --error-format to error-pattern 2023-12-21 16:45:29 +05:30
issue-83883-describe-lints.rs
issue-83883-describe-lints.stdout Remove support for compiler plugins. 2023-11-04 08:50:46 +11:00
issue-91134.rs
issue-91134.stdout
issue-91713.rs
issue-91713.stderr
issue-91713.stdout Add tests for custom_code_classes_in_docs feature 2023-09-15 21:32:28 +02:00
issue-96287.rs
issue-96287.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
issue-98690.rs
issue-98690.stderr
issue-101076.rs
issue-102986.rs
issue-102986.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
issue-103997.rs
issue-103997.stderr
issue-105334.rs
issue-105334.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
issue-105737.rs
issue-105737.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
issue-105742.rs Accept less invalid Rust in rustdoc 2023-10-31 13:58:03 +00:00
issue-105742.stderr Silence redundant warning when E0038 will be emitted 2024-01-04 00:46:33 +00:00
issue-106213.rs
issue-106213.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
issue-106226.rs
issue-106226.stderr Bless rustdoc-ui tests 2023-11-24 19:15:52 +01:00
issue-107918.rs Mark Rustdoc test as Linux-only 2023-11-08 08:53:58 -05:00
issue-109282-import-inline-merge.rs
issue-110900.rs