Jonathan Brouwer
1ca55fb5e2
Rollup merge of #160428 - xyz-harshal:fix-dyn-compat-diagnostic-159492, r=khyperia
...
Add more context to dyn-compatibility diagnostic for receiver-less associated functions
Fixes rust-lang/rust#159492
Expands the two suggestion messages for the "no `self` parameter"
dyn-compatibility violation to explain *why* each fix works, per the issue.
Before:
help: consider turning `create` into a method by giving it a `&self` argument
help: alternatively, consider constraining `create` so it does not apply to trait objects
After:
help: consider turning `create` into a method by giving it a `&self` argument, so that it is accessible through the trait object's vtable
help: alternatively, consider constraining `create` so it is explicitly marked as not applying to trait objects
Only the two strings in `DynCompatibilityViolationSolution::add_to`
(rustc_middle/src/traits/mod.rs) changed — no logic, applicability, or span changes.
Added a regression test using the issue's exact example
(tests/ui/dyn-compatibility/static-constructor-prevents-dyn-no-api-guidance.rs).
Verified against a locally-built rustc; full `tests/ui` suite passes
(21643 passed, 0 failed). Note: `next-solver` compare-mode has pre-existing,
unrelated failures on 3 tests in this directory, confirmed present on `main`
without this diff.
2026-08-24 08:06:14 +02:00
..
2025-05-09 02:35:18 +00:00
2026-06-04 16:10:12 +00:00
2026-07-29 17:52:50 +02:00
2026-06-08 12:34:45 +02:00
2025-10-31 20:44:01 +00:00
2026-08-13 11:44:34 +08:00
2026-07-19 20:55:47 +00:00
2025-10-13 15:26:22 +01:00
2026-07-27 21:12:22 +03:30
2026-05-02 21:07:23 +08:00
2026-08-17 12:49:31 +03:30
2026-07-02 15:53:50 +07:00
2025-08-22 20:10:27 +00:00
2026-04-07 16:06:24 +08:00
2026-02-18 18:33:35 +00:00
2025-10-12 08:24:39 +09:00
2025-08-25 14:20:18 +02:00
2026-08-12 19:19:11 +06:00
2025-08-25 14:20:18 +02:00
2026-08-12 19:19:11 +06:00
2026-06-01 14:13:08 +02:00
2026-06-01 14:13:08 +02:00
2025-06-30 11:50:19 +05:00
2025-09-26 16:33:15 +02:00
2025-11-27 11:19:00 -05:00
2025-11-27 11:19:00 -05:00
2025-11-27 11:19:00 -05:00
2025-09-26 16:33:15 +02:00
2025-09-26 16:33:15 +02:00
2025-09-26 16:33:15 +02:00
2025-09-26 16:33:15 +02:00
2025-09-26 16:33:15 +02:00
2025-08-26 15:15:17 -06:00
2026-03-02 19:31:15 +01:00
2026-08-20 01:21:53 +07:00
2026-08-20 01:21:53 +07:00
2026-08-12 19:19:11 +06:00
2025-03-25 16:44:59 +00:00
2025-03-25 16:44:59 +00:00
2025-03-25 16:44:59 +00:00
2025-08-20 11:04:38 +02:00
2025-05-27 08:18:11 +00:00
2026-08-22 17:49:34 +05:30
2026-04-26 17:43:40 +05:30
2025-06-25 17:02:26 +00:00
2025-06-25 17:02:26 +00:00
2025-06-25 17:02:26 +00:00
2026-03-21 20:10:07 +00:00
2026-03-21 20:10:07 +00:00
2026-03-21 20:10:07 +00:00
2026-03-21 20:10:07 +00:00
2026-04-20 13:59:39 +05:30
2026-04-10 12:14:07 +02:00
2026-07-06 18:30:20 -06:00
2025-08-19 21:27:10 +02:00
2025-06-14 13:44:43 +08:00
2025-06-14 13:44:43 +08:00
2025-06-14 13:44:43 +08:00
2026-04-20 16:46:57 +06:00
2025-08-19 21:27:10 +02:00
2025-11-27 14:13:58 -05:00
2025-11-27 14:13:58 -05:00
2025-11-27 14:13:58 -05:00
2025-10-07 09:51:16 +01:00
2025-10-07 09:51:16 +01:00
2025-10-12 16:51:28 +09:00
2025-10-12 16:51:28 +09:00
2025-10-12 16:51:28 +09:00
2025-11-21 21:42:40 +09:00
2025-11-21 21:42:40 +09:00
2025-04-11 11:03:08 +10:00
2026-06-14 04:02:35 +09:00
2026-06-14 04:02:35 +09:00
2025-03-28 18:15:23 +01:00
2025-03-28 18:15:23 +01:00
2025-06-25 17:02:26 +00:00
2025-06-25 17:02:26 +00:00
2025-06-25 17:02:26 +00:00
2025-06-04 10:40:04 -04:00
2025-10-12 16:51:28 +09:00
2025-10-12 16:51:28 +09:00
2025-06-25 17:02:26 +00:00
2025-06-25 17:02:26 +00:00
2025-06-25 17:02:26 +00:00
2025-04-07 19:13:31 +03:00
2025-08-26 15:15:17 -06:00
2026-01-22 19:50:00 +01:00
2026-01-22 19:50:00 +01:00
2025-04-15 10:08:49 +02:00
2025-04-15 10:08:49 +02:00
2026-03-02 19:31:15 +01:00
2025-06-03 15:16:51 +00:00
2025-03-28 18:15:23 +01:00
2025-10-07 23:02:23 +01:00
2026-08-03 21:50:32 +01:00
2026-08-03 21:50:32 +01:00
2026-08-03 21:50:32 +01:00
2026-07-15 16:37:18 +00:00
2025-06-25 15:42:11 +00:00
2025-06-25 15:42:11 +00:00
2025-04-08 23:06:31 +03:00
2026-07-01 05:42:16 +00:00
2026-07-19 20:55:47 +00:00
2025-10-13 15:26:22 +01:00
2025-12-10 06:52:27 +00:00
2026-08-19 02:42:06 +03:30
2026-08-19 02:42:06 +03:30
2025-08-20 11:04:38 +02:00
2025-11-27 11:19:00 -05:00
2025-11-27 11:19:00 -05:00
2025-06-26 13:46:45 +00:00
2025-07-08 14:36:43 +00:00
2026-08-12 14:04:31 +06:00
2025-12-02 18:25:13 +00:00
2025-07-18 12:13:30 +02:00
2025-07-18 12:13:30 +02:00
2026-04-26 17:43:40 +05:30
2026-07-29 17:52:50 +02:00
2025-09-26 16:33:15 +02:00
2025-09-26 16:33:15 +02:00
2025-04-03 11:13:10 +02:00
2026-06-04 15:10:14 +02:00
2026-06-04 15:10:14 +02:00
2025-08-25 14:20:18 +02:00
2026-05-02 21:07:23 +08:00
2026-05-02 21:07:23 +08:00
2026-07-12 19:18:50 +00:00
2025-10-31 20:44:01 +00:00
2026-07-05 19:53:22 +06:00
2026-07-05 19:53:22 +06:00
2025-07-14 09:52:58 -04:00
2025-08-23 22:11:43 +00:00
2026-02-17 16:51:44 +00:00
2026-02-17 16:51:44 +00:00
2026-07-15 16:37:18 +00:00
2025-06-25 15:42:11 +00:00
2026-02-28 05:29:28 +00:00
2025-04-03 11:13:10 +02:00
2026-05-02 21:07:23 +08:00
2025-09-18 12:58:39 +02:00
2025-08-19 21:27:10 +02:00
2026-07-21 01:03:16 +03:00
2026-07-21 01:03:16 +03:00
2026-05-29 06:15:29 +00:00
2026-08-17 21:40:39 -07:00
2026-05-02 21:07:23 +08:00
2026-05-02 21:07:23 +08:00
2026-05-02 21:07:23 +08:00
2026-07-04 02:20:13 +02:00
2026-03-02 19:31:15 +01:00
2026-08-14 17:54:28 +02:00
2026-08-14 17:54:28 +02:00
2026-08-14 17:54:28 +02:00
2025-11-27 14:13:58 -05:00
2026-03-16 17:58:49 +00:00
2025-11-27 14:13:58 -05:00
2026-08-12 14:04:31 +06:00