Skip to content

Commit 6327553

Browse files
committed
Fix borrow and deref
1 parent 6361f90 commit 6327553

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

core/src/borrow.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
/// [`HashMap<K, V>`]: ../../std/collections/struct.HashMap.html
154154
/// [`String`]: ../../std/string/struct.String.html
155155
#[stable(feature = "rust1", since = "1.0.0")]
156+
#[rustc_diagnostic_item = "Borrow"]
156157
pub trait Borrow<Borrowed: ?Sized> {
157158
/// Immutably borrows from an owned value.
158159
///
@@ -205,6 +206,7 @@ pub trait BorrowMut<Borrowed: ?Sized>: Borrow<Borrowed> {
205206

206207
#[stable(feature = "rust1", since = "1.0.0")]
207208
impl<T: ?Sized> Borrow<T> for T {
209+
#[rustc_diagnostic_item = "noop_method_borrow"]
208210
fn borrow(&self) -> &T {
209211
self
210212
}

core/src/ops/deref.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#[doc(alias = "*")]
6161
#[doc(alias = "&*")]
6262
#[stable(feature = "rust1", since = "1.0.0")]
63+
#[rustc_diagnostic_item = "Deref"]
6364
pub trait Deref {
6465
/// The resulting type after dereferencing.
6566
#[stable(feature = "rust1", since = "1.0.0")]
@@ -78,6 +79,7 @@ pub trait Deref {
7879
impl<T: ?Sized> Deref for &T {
7980
type Target = T;
8081

82+
#[rustc_diagnostic_item = "noop_method_deref"]
8183
fn deref(&self) -> &T {
8284
*self
8385
}

core/tests/clone.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![cfg_attr(not(bootstrap), allow(noop_method_call))]
2-
31
#[test]
42
fn test_borrowed_clone() {
53
let x = 5;

0 commit comments

Comments
 (0)