Esteban Küber
73fe905f3c
Detect inherent method behind deref being shadowed by trait method
...
```
error[E0277]: the trait bound `Rc<RefCell<S>>: Borrow<S>` is not satisfied
--> $DIR/shadowed-intrinsic-method-deref.rs:16:22
|
LL | let sb : &S = &s.borrow();
| ^^^^^^ the trait `Borrow<S>` is not implemented for `Rc<RefCell<S>>`
|
help: the trait `Borrow<S>` is not implemented for `Rc<RefCell<S>>`
but trait `Borrow<RefCell<S>>` is implemented for it
--> $SRC_DIR/alloc/src/rc.rs:LL:COL
= help: for that trait implementation, expected `RefCell<S>`, found `S`
= note: there's an inherent method on `RefCell<S>` of the same name, which can be auto-dereferenced from `&RefCell<T>`
help: to access the inherent method on `RefCell<S>`, use the fully-qualified path
|
LL - let sb : &S = &s.borrow();
LL + let sb : &S = &RefCell::borrow(&s);
|
```
In the example above, method `borrow` is available both on `<RefCell<S> as Borrow<S>>` *and* on `RefCell<S>`. Adding the import `use std::borrow::Borrow;` causes `s.borrow()` to find the former instead of the latter. We now point out that the other exists, and provide a suggestion on how to call it.
2026-03-10 23:24:27 +00:00
..
2025-08-04 17:20:07 +00:00
2026-03-04 08:06:45 +08:00
2025-11-21 21:29:56 +08:00
2025-11-21 21:29:56 +08:00
2024-02-08 08:10:43 +00:00
2025-04-08 23:06:31 +03:00
2025-01-03 19:39:39 +00:00
2026-02-16 19:36:09 +00:00
2026-02-16 19:36:09 +00:00
2024-12-11 11:59:12 +00:00
2026-02-16 19:36:09 +00:00
2026-02-16 19:36:09 +00:00
2025-04-29 12:46:26 +02:00
2025-04-29 12:46:26 +02:00
2025-04-08 23:06:31 +03:00
2025-02-10 20:21:39 +00:00
2023-10-17 17:33:55 +00:00
2025-05-05 14:27:09 +00:00
2023-10-17 17:33:55 +00:00
2025-05-05 14:27:09 +00:00
2023-10-17 17:33:55 +00:00
2025-05-05 14:27:09 +00:00
2023-10-17 17:33:55 +00:00
2025-05-05 14:27:09 +00:00
2024-07-26 13:18:35 -04:00
2025-06-24 18:59:42 +00:00
2024-09-29 11:57:18 -04:00
2024-09-29 11:57:18 -04:00
2025-12-10 14:47:49 +00:00
2025-12-10 14:47:49 +00:00
2024-04-21 20:10:12 -04:00
2025-03-03 23:53:42 +00:00
2025-03-03 23:53:42 +00:00
2025-08-07 21:18:00 +00:00
2025-08-22 17:55:15 +00:00
2025-07-24 17:01:44 -04:00
2025-06-11 20:51:49 +05:00
2023-08-28 17:47:37 -03:00
2025-11-21 20:34:35 +08:00
2024-03-03 16:30:48 -03:00
2024-03-03 16:30:48 -03:00
2024-03-03 16:30:48 -03:00
2025-05-24 23:31:07 +02:00
2024-04-21 20:10:12 -04:00
2025-02-10 20:21:39 +00:00
2024-02-16 20:02:50 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2023-11-12 19:59:13 +00:00
2025-02-10 20:21:39 +00:00
2024-02-16 20:02:50 +00:00
2025-02-21 00:41:17 +00:00
2024-07-22 22:51:53 +00:00
2024-02-16 20:02:50 +00:00
2025-08-26 15:15:17 -06:00
2024-05-30 22:52:33 +02:00
2024-05-30 22:52:33 +02:00
2025-06-13 01:16:36 +02:00
2025-07-17 19:26:39 +08:00
2024-11-26 02:50:48 +08:00
2024-05-09 14:47:09 +10:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2026-02-17 08:45:08 +00:00
2025-02-10 20:21:39 +00:00
2025-08-07 21:18:00 +00:00
2026-01-18 06:23:47 +01:00
2026-01-18 06:23:47 +01:00
2024-02-16 20:02:50 +00:00
2025-02-14 00:44:10 -08:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-11-26 02:50:48 +08:00
2025-08-19 21:27:10 +02:00
2023-11-24 19:15:52 +01:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2023-07-10 20:09:26 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-09-13 14:10:56 +03:00
2024-09-13 14:10:56 +03:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2025-08-19 21:27:10 +02:00
2024-11-26 02:50:48 +08:00
2025-08-19 21:27:10 +02:00
2025-06-28 16:24:17 +05:00
2025-06-28 16:24:17 +05:00
2024-02-16 20:02:50 +00:00
2025-11-27 14:13:58 -05:00
2025-11-27 14:13:58 -05:00
2025-03-11 12:05:02 +00:00
2025-09-23 08:02:54 +02:00
2025-08-07 21:18:00 +00:00
2025-08-07 21:18:00 +00:00
2024-05-13 23:38:31 -04:00
2024-05-13 23:38:31 -04:00
2024-04-01 21:41:45 -04:00
2024-09-16 10:55:07 -04:00
2025-05-24 23:31:07 +02:00
2025-11-27 11:19:00 -05:00
2025-11-27 11:19:00 -05:00
2025-08-24 20:30:52 +00:00
2025-08-24 20:30:52 +00:00
2025-08-24 20:30:52 +00:00
2025-08-24 20:30:52 +00:00
2025-08-24 20:30:52 +00:00
2024-04-21 20:10:12 -04:00
2026-03-10 23:24:27 +00:00
2026-03-10 23:24:27 +00:00
2026-03-10 23:24:27 +00:00
2024-04-10 18:51:09 +02:00
2025-06-22 10:58:25 +02:00
2024-05-23 19:42:10 -04:00
2024-05-23 19:42:10 -04:00
2023-07-27 16:50:28 +00:00
2023-11-24 19:15:52 +01:00
2025-08-27 15:06:05 -04:00
2025-08-27 15:06:05 -04:00
2025-08-04 16:43:53 -04:00
2025-08-04 16:43:53 -04:00
2025-08-22 20:42:25 +00:00
2025-08-22 20:42:25 +00:00
2025-05-24 23:31:07 +02:00
2025-08-07 21:18:00 +00:00
2025-05-31 19:49:19 +05:00
2025-05-31 19:49:19 +05:00
2025-07-17 19:26:39 +08:00
2025-07-17 19:26:39 +08:00