rust/tests/ui/rfcs
Georg Semmler 9b45cfdbdd
Actually use the #[do_not_recommend] attribute if present
This change tweaks the error message generation to actually use the
`#[do_not_recommend]` attribute if present by just skipping the marked
trait impl in favour of the parent impl. It also adds a compile test for
this behaviour. Without this change the test would output the following
error:

```
error[E0277]: the trait bound `&str: Expression` is not satisfied
  --> /home/weiznich/Documents/rust/rust/tests/ui/diagnostic_namespace/do_not_recommend.rs:53:15
   |
LL |     SelectInt.check("bar");
   |               ^^^^^ the trait `Expression` is not implemented for `&str`, which is required by `&str: AsExpression<Integer>`
   |
   = help: the following other types implement trait `Expression`:
             Bound<T>
             SelectInt
note: required for `&str` to implement `AsExpression<Integer>`
  --> /home/weiznich/Documents/rust/rust/tests/ui/diagnostic_namespace/do_not_recommend.rs:26:13
   |
LL | impl<T, ST> AsExpression<ST> for T
   |             ^^^^^^^^^^^^^^^^     ^
LL | where
LL |     T: Expression<SqlType = ST>,
   |        ------------------------ unsatisfied trait bound introduced here
```

Note how that mentions `&str: Expression` before and now mentions `&str:
AsExpression<Integer>` instead which is much more helpful for users.

Open points for further changes before stabilization:

* We likely want to move the attribute to the `#[diagnostic]` namespace
to relax the guarantees given?
* How does it interact with the new trait solver?
2024-05-19 08:29:27 +02:00
..
impl-trait Remove some annotations that just specify the default 2024-02-22 16:56:26 +00:00
rfc-0000-never_patterns Lower never patterns to Unreachable in mir 2024-05-04 16:30:01 +02:00
rfc-0107-bind-by-move-pattern-guards Suggest .clone() in some move errors 2024-04-11 16:41:41 +00:00
rfc-1014-stdout-existential-crisis Remove libc from more tests 2024-04-17 08:36:49 -04:00
rfc-1445-restrict-constants-in-patterns Stabilize exclusive_range 2024-05-02 19:42:31 -04:00
rfc-1623-static properly fill a promoted's required_consts 2024-04-23 23:02:54 +02:00
rfc-1717-dllimport Update test directives for wasm32-wasip1 2024-03-11 09:36:35 -07:00
rfc-1789-as-cell [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rfc-1857-stabilize-drop-order [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rfc-1937-termination-trait Remove some unnecessary allow(incomplete_features) 2024-03-11 19:42:04 +00:00
rfc-2005-default-binding-mode [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rfc-2008-non-exhaustive Rollup merge of #120742 - Nadrieril:use-min_exh_pats, r=compiler-errors 2024-02-23 17:02:03 +01:00
rfc-2027-object-safe-for-dispatch Ignore tests w/ current/next revisions from compare-mode=next-solver 2024-03-10 21:18:41 -04:00
rfc-2091-track-caller Error on using yield without also using #[coroutine] on the closure 2024-04-24 08:05:29 +00:00
rfc-2093-infer-outlives [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rfc-2126-crate-paths Show number in error message even for one error 2023-11-24 19:15:52 +01:00
rfc-2126-extern-absolute-paths [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rfc-2151-raw-identifiers [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rfc-2175-or-if-while-let [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rfc-2294-if-let-guard [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rfc-2302-self-struct-ctor [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rfc-2306-convert-id [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rfc-2361-dbg-macro [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rfc-2396-target_feature-11 Add inline comments why we're forcing the target cpu 2024-05-01 16:54:20 -07:00
rfc-2397-do-not-recommend Actually use the #[do_not_recommend] attribute if present 2024-05-19 08:29:27 +02:00
rfc-2421-unreserve-pure-offsetof-sizeof-alignof [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rfc-2457-non-ascii-idents [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rfc-2497-if-let-chains [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rfc-2528-type-changing-struct-update Remove some unnecessary allow(incomplete_features) 2024-03-11 19:42:04 +00:00
rfc-2565-param-attrs compiletest: add enable-by-default check-cfg 2024-05-04 11:30:38 +02:00
rfc-2627-raw-dylib Refactor dlltool searching code into separate function 2024-04-24 19:24:45 +02:00
rfc-2632-const-trait-impl Further cleanup cfgs in the UI test suite 2024-04-09 23:58:18 +02:00
rfc-3348-c-string-literals [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
type-alias-impl-trait Remove some annotations that just specify the default 2024-02-22 16:56:26 +00:00