Skip to content

Commit dea8a16

Browse files
committed
Avoid describing a method as 'not found' when bounds are unsatisfied
Fixes #76267 When there is a single applicable method candidate, but its trait bounds are not satisfied, we avoid saying that the method is "not found". Insted, we update the error message to directly mention which bounds are not satisfied, rather than mentioning them in a note.
1 parent 78e2206 commit dea8a16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+144
-128
lines changed

compiler/rustc_errors/src/diagnostic_builder.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,18 @@ macro_rules! forward {
7474
});
7575
};
7676

77-
// Forward pattern for &mut self -> &mut Self, with S: Into<MultiSpan>
78-
// type parameter. No obvious way to make this more generic.
77+
// Forward pattern for &mut self -> &mut Self, with generic parameters.
7978
(
8079
$(#[$attrs:meta])*
81-
pub fn $n:ident<S: Into<MultiSpan>>(
80+
pub fn $n:ident<$($generic:ident: $bound:path),*>(
8281
&mut self,
8382
$($name:ident: $ty:ty),*
8483
$(,)?
8584
) -> &mut Self
8685
) => {
8786
$(#[$attrs])*
8887
forward_inner_docs!(concat!("See [`Diagnostic::", stringify!($n), "()`].") =>
89-
pub fn $n<S: Into<MultiSpan>>(&mut self, $($name: $ty),*) -> &mut Self {
88+
pub fn $n<$($generic: $bound),*>(&mut self, $($name: $ty),*) -> &mut Self {
9089
self.0.diagnostic.$n($($name),*);
9190
self
9291
});
@@ -398,6 +397,7 @@ impl<'a> DiagnosticBuilder<'a> {
398397
self
399398
}
400399

400+
forward!(pub fn set_primary_message<M: Into<String>>(&mut self, msg: M) -> &mut Self);
401401
forward!(pub fn set_span<S: Into<MultiSpan>>(&mut self, sp: S) -> &mut Self);
402402
forward!(pub fn code(&mut self, s: DiagnosticId) -> &mut Self);
403403

compiler/rustc_typeck/src/check/method/suggest.rs

+34-19
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
446446
}
447447
}
448448

449+
let mut label_span_not_found = || {
450+
if unsatisfied_predicates.is_empty() {
451+
err.span_label(span, format!("{item_kind} not found in `{ty_str}`"));
452+
} else {
453+
err.span_label(span, format!("{item_kind} cannot be called on `{ty_str}` due to unsatisfied trait bounds"));
454+
}
455+
self.tcx.sess.trait_methods_not_found.borrow_mut().insert(orig_span);
456+
};
457+
449458
// If the method name is the name of a field with a function or closure type,
450459
// give a helping note that it has to be called as `(x.f)(...)`.
451460
if let SelfSource::MethodCall(expr) = source {
@@ -501,12 +510,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
501510
let field_kind = if is_accessible { "field" } else { "private field" };
502511
err.span_label(item_name.span, format!("{}, not a method", field_kind));
503512
} else if lev_candidate.is_none() && static_sources.is_empty() {
504-
err.span_label(span, format!("{} not found in `{}`", item_kind, ty_str));
505-
self.tcx.sess.trait_methods_not_found.borrow_mut().insert(orig_span);
513+
label_span_not_found();
506514
}
507515
} else {
508-
err.span_label(span, format!("{} not found in `{}`", item_kind, ty_str));
509-
self.tcx.sess.trait_methods_not_found.borrow_mut().insert(orig_span);
516+
label_span_not_found();
510517
}
511518

512519
if self.is_fn_ty(&rcvr_ty, span) {
@@ -721,10 +728,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
721728
.map(|(_, path)| path)
722729
.collect::<Vec<_>>()
723730
.join("\n");
731+
let actual_prefix = actual.prefix_string();
732+
err.set_primary_message(&format!(
733+
"the {item_kind} `{item_name}` exists for {actual_prefix} `{ty_str}`, but its trait bounds were not satisfied"
734+
));
724735
err.note(&format!(
725-
"the method `{}` exists but the following trait bounds were not \
726-
satisfied:\n{}",
727-
item_name, bound_list
736+
"the following trait bounds were not satisfied:\n{bound_list}"
728737
));
729738
}
730739
}
@@ -742,7 +751,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
742751
);
743752
}
744753

745-
if actual.is_enum() {
754+
// Don't emit a suggestion if we found an actual method
755+
// that had unsatisfied trait bounds
756+
if unsatisfied_predicates.is_empty() && actual.is_enum() {
746757
let adt_def = actual.ty_adt_def().expect("enum is not an ADT");
747758
if let Some(suggestion) = lev_distance::find_best_match_for_name(
748759
&adt_def.variants.iter().map(|s| s.ident.name).collect::<Vec<_>>(),
@@ -778,17 +789,21 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
778789
err.span_label(span, msg);
779790
}
780791
} else if let Some(lev_candidate) = lev_candidate {
781-
let def_kind = lev_candidate.kind.as_def_kind();
782-
err.span_suggestion(
783-
span,
784-
&format!(
785-
"there is {} {} with a similar name",
786-
def_kind.article(),
787-
def_kind.descr(lev_candidate.def_id),
788-
),
789-
lev_candidate.ident.to_string(),
790-
Applicability::MaybeIncorrect,
791-
);
792+
// Don't emit a suggestion if we found an actual method
793+
// that had unsatisfied trait bounds
794+
if unsatisfied_predicates.is_empty() {
795+
let def_kind = lev_candidate.kind.as_def_kind();
796+
err.span_suggestion(
797+
span,
798+
&format!(
799+
"there is {} {} with a similar name",
800+
def_kind.article(),
801+
def_kind.descr(lev_candidate.def_id),
802+
),
803+
lev_candidate.ident.to_string(),
804+
Applicability::MaybeIncorrect,
805+
);
806+
}
792807
}
793808

794809
return Some(err);

compiler/rustc_typeck/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ This API is completely unstable and subject to change.
6060
#![feature(bool_to_option)]
6161
#![feature(box_syntax)]
6262
#![feature(crate_visibility_modifier)]
63+
#![feature(format_args_capture)]
6364
#![feature(in_band_lifetimes)]
6465
#![feature(is_sorted)]
6566
#![feature(nll)]

src/test/ui/associated-types/hr-associated-type-bound-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ where
1717

1818
fn main() {
1919
1u32.f("abc");
20-
//~^ ERROR no method named `f` found for type `u32` in the current scope
20+
//~^ ERROR the method
2121
}

src/test/ui/associated-types/hr-associated-type-bound-2.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0599]: no method named `f` found for type `u32` in the current scope
1+
error[E0599]: the method `f` exists for type `u32`, but its trait bounds were not satisfied
22
--> $DIR/hr-associated-type-bound-2.rs:19:10
33
|
44
LL | 1u32.f("abc");
5-
| ^ method not found in `u32`
5+
| ^ method cannot be called on `u32` due to unsatisfied trait bounds
66
|
7-
= note: the method `f` exists but the following trait bounds were not satisfied:
7+
= note: the following trait bounds were not satisfied:
88
`<u32 as X<'b>>::U: Clone`
99
which is required by `u32: X`
1010

src/test/ui/derives/derive-assoc-type-not-impl.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0599]: no method named `clone` found for struct `Bar<NotClone>` in the current scope
1+
error[E0599]: the method `clone` exists for struct `Bar<NotClone>`, but its trait bounds were not satisfied
22
--> $DIR/derive-assoc-type-not-impl.rs:18:30
33
|
44
LL | struct Bar<T: Foo> {
@@ -11,7 +11,7 @@ LL | struct NotClone;
1111
| ---------------- doesn't satisfy `NotClone: Clone`
1212
...
1313
LL | Bar::<NotClone> { x: 1 }.clone();
14-
| ^^^^^ method not found in `Bar<NotClone>`
14+
| ^^^^^ method cannot be called on `Bar<NotClone>` due to unsatisfied trait bounds
1515
|
1616
::: $SRC_DIR/core/src/clone.rs:LL:COL
1717
|
@@ -21,7 +21,7 @@ LL | fn clone(&self) -> Self;
2121
| the method is available for `Arc<Bar<NotClone>>` here
2222
| the method is available for `Rc<Bar<NotClone>>` here
2323
|
24-
= note: the method `clone` exists but the following trait bounds were not satisfied:
24+
= note: the following trait bounds were not satisfied:
2525
`NotClone: Clone`
2626
which is required by `Bar<NotClone>: Clone`
2727
= help: items from traits can only be used if the trait is implemented and in scope

src/test/ui/hrtb/issue-30786.migrate.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0599]: no method named `filterx` found for struct `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>` in the current scope
1+
error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>`, but its trait bounds were not satisfied
22
--> $DIR/issue-30786.rs:128:22
33
|
44
LL | pub struct Map<S, F> {
@@ -8,17 +8,17 @@ LL | pub struct Map<S, F> {
88
| doesn't satisfy `_: StreamExt`
99
...
1010
LL | let filter = map.filterx(|x: &_| true);
11-
| ^^^^^^^ method not found in `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>`
11+
| ^^^^^^^ method cannot be called on `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>` due to unsatisfied trait bounds
1212
|
13-
= note: the method `filterx` exists but the following trait bounds were not satisfied:
13+
= note: the following trait bounds were not satisfied:
1414
`&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
1515
which is required by `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: StreamExt`
1616
`&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
1717
which is required by `&Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: StreamExt`
1818
`&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
1919
which is required by `&mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: StreamExt`
2020

21-
error[E0599]: no method named `countx` found for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>` in the current scope
21+
error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>`, but its trait bounds were not satisfied
2222
--> $DIR/issue-30786.rs:141:24
2323
|
2424
LL | pub struct Filter<S, F> {
@@ -28,9 +28,9 @@ LL | pub struct Filter<S, F> {
2828
| doesn't satisfy `_: StreamExt`
2929
...
3030
LL | let count = filter.countx();
31-
| ^^^^^^ method not found in `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>`
31+
| ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>` due to unsatisfied trait bounds
3232
|
33-
= note: the method `countx` exists but the following trait bounds were not satisfied:
33+
= note: the following trait bounds were not satisfied:
3434
`&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`
3535
which is required by `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: StreamExt`
3636
`&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`

src/test/ui/hrtb/issue-30786.nll.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0599]: no method named `filterx` found for struct `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>` in the current scope
1+
error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>`, but its trait bounds were not satisfied
22
--> $DIR/issue-30786.rs:128:22
33
|
44
LL | pub struct Map<S, F> {
@@ -8,17 +8,17 @@ LL | pub struct Map<S, F> {
88
| doesn't satisfy `_: StreamExt`
99
...
1010
LL | let filter = map.filterx(|x: &_| true);
11-
| ^^^^^^^ method not found in `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>`
11+
| ^^^^^^^ method cannot be called on `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>` due to unsatisfied trait bounds
1212
|
13-
= note: the method `filterx` exists but the following trait bounds were not satisfied:
13+
= note: the following trait bounds were not satisfied:
1414
`&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
1515
which is required by `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: StreamExt`
1616
`&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
1717
which is required by `&Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: StreamExt`
1818
`&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
1919
which is required by `&mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: StreamExt`
2020

21-
error[E0599]: no method named `countx` found for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>` in the current scope
21+
error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>`, but its trait bounds were not satisfied
2222
--> $DIR/issue-30786.rs:141:24
2323
|
2424
LL | pub struct Filter<S, F> {
@@ -28,9 +28,9 @@ LL | pub struct Filter<S, F> {
2828
| doesn't satisfy `_: StreamExt`
2929
...
3030
LL | let count = filter.countx();
31-
| ^^^^^^ method not found in `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>`
31+
| ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>` due to unsatisfied trait bounds
3232
|
33-
= note: the method `countx` exists but the following trait bounds were not satisfied:
33+
= note: the following trait bounds were not satisfied:
3434
`&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`
3535
which is required by `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: StreamExt`
3636
`&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`

src/test/ui/hrtb/issue-30786.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ fn variant1() {
126126
// guess.
127127
let map = source.mapx(|x: &_| x);
128128
let filter = map.filterx(|x: &_| true);
129-
//[migrate]~^ ERROR no method named `filterx`
130-
//[nll]~^^ ERROR no method named `filterx`
129+
//[migrate]~^ ERROR the method
130+
//[nll]~^^ ERROR the method
131131
}
132132

133133
fn variant2() {
@@ -139,8 +139,8 @@ fn variant2() {
139139
let map = source.mapx(identity);
140140
let filter = map.filterx(|x: &_| true);
141141
let count = filter.countx();
142-
//[migrate]~^ ERROR no method named `countx`
143-
//[nll]~^^ ERROR no method named `countx`
142+
//[migrate]~^ ERROR the method
143+
//[nll]~^^ ERROR the method
144144
}
145145

146146
fn main() {}

src/test/ui/issues/issue-21596.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
error[E0599]: no method named `to_string` found for raw pointer `*const u8` in the current scope
1+
error[E0599]: the method `to_string` exists for raw pointer `*const u8`, but its trait bounds were not satisfied
22
--> $DIR/issue-21596.rs:4:22
33
|
44
LL | println!("{}", z.to_string());
5-
| ^^^^^^^^^ method not found in `*const u8`
5+
| ^^^^^^^^^ method cannot be called on `*const u8` due to unsatisfied trait bounds
66
|
77
= note: try using `<*const T>::as_ref()` to get a reference to the type behind the pointer: https://doc.rust-lang.org/std/primitive.pointer.html#method.as_ref
88
= note: using `<*const T>::as_ref()` on a pointer which is unaligned or points to invalid or uninitialized memory is undefined behavior
9-
= note: the method `to_string` exists but the following trait bounds were not satisfied:
9+
= note: the following trait bounds were not satisfied:
1010
`*const u8: std::fmt::Display`
1111
which is required by `*const u8: ToString`
1212

src/test/ui/issues/issue-31173.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn get_tok(it: &mut IntoIter<u8>) {
1111
//~^ ERROR type mismatch resolving
1212
//~| expected type `u8`
1313
//~| found reference `&_`
14-
.collect(); //~ ERROR no method named `collect`
14+
.collect(); //~ ERROR the method
1515
}
1616

1717
fn main() {}

src/test/ui/issues/issue-31173.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ LL | .cloned()
77
= note: expected type `u8`
88
found reference `&_`
99

10-
error[E0599]: no method named `collect` found for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>` in the current scope
10+
error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>`, but its trait bounds were not satisfied
1111
--> $DIR/issue-31173.rs:14:10
1212
|
1313
LL | .collect();
14-
| ^^^^^^^ method not found in `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>`
14+
| ^^^^^^^ method cannot be called on `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>` due to unsatisfied trait bounds
1515
|
1616
::: $SRC_DIR/core/src/iter/adapters/cloned.rs:LL:COL
1717
|
@@ -23,7 +23,7 @@ LL | pub struct Cloned<I> {
2323
LL | pub struct TakeWhile<I, P> {
2424
| -------------------------- doesn't satisfy `<_ as Iterator>::Item = &_`
2525
|
26-
= note: the method `collect` exists but the following trait bounds were not satisfied:
26+
= note: the following trait bounds were not satisfied:
2727
`<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]> as Iterator>::Item = &_`
2828
which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>: Iterator`
2929
`Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>: Iterator`

src/test/ui/issues/issue-35677.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::collections::HashSet;
22

33
fn is_subset<T>(this: &HashSet<T>, other: &HashSet<T>) -> bool {
44
this.is_subset(other)
5-
//~^ ERROR no method named
5+
//~^ ERROR the method
66
}
77

88
fn main() {}

src/test/ui/issues/issue-35677.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0599]: no method named `is_subset` found for reference `&HashSet<T>` in the current scope
1+
error[E0599]: the method `is_subset` exists for reference `&HashSet<T>`, but its trait bounds were not satisfied
22
--> $DIR/issue-35677.rs:4:10
33
|
44
LL | this.is_subset(other)
5-
| ^^^^^^^^^ method not found in `&HashSet<T>`
5+
| ^^^^^^^^^ method cannot be called on `&HashSet<T>` due to unsatisfied trait bounds
66
|
7-
= note: the method `is_subset` exists but the following trait bounds were not satisfied:
7+
= note: the following trait bounds were not satisfied:
88
`T: Eq`
99
`T: Hash`
1010

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
fn main() {
22
let _result = &Some(42).as_deref();
3-
//~^ ERROR no method named `as_deref` found for enum `Option<{integer}>`
3+
//~^ ERROR the method
44
}

src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0599]: no method named `as_deref` found for enum `Option<{integer}>` in the current scope
1+
error[E0599]: the method `as_deref` exists for enum `Option<{integer}>`, but its trait bounds were not satisfied
22
--> $DIR/option-as_deref.rs:2:29
33
|
44
LL | let _result = &Some(42).as_deref();
5-
| ^^^^^^^^ help: there is an associated function with a similar name: `as_ref`
5+
| ^^^^^^^^
66
|
7-
= note: the method `as_deref` exists but the following trait bounds were not satisfied:
7+
= note: the following trait bounds were not satisfied:
88
`{integer}: Deref`
99
`<{integer} as Deref>::Target = _`
1010

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
fn main() {
22
let _result = &mut Some(42).as_deref_mut();
3-
//~^ ERROR no method named `as_deref_mut` found for enum `Option<{integer}>`
3+
//~^ ERROR the method
44
}

0 commit comments

Comments
 (0)