diff options
| author | bors <bors@rust-lang.org> | 2021-01-28 12:09:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-01-28 12:09:50 +0000 |
| commit | 643a79af3d5a31fa87c8a4c9d7f8bc4ebe2add4b (patch) | |
| tree | f0f8524b6fcb838e1d6729926c48d7b37502c787 /compiler/rustc_errors/src | |
| parent | 0e190206e2ff0c13d64701d9b4145bf89a2d0cab (diff) | |
| parent | dea8a16af55e319a41e9451959c68d7a24fcdc5a (diff) | |
| download | rust-643a79af3d5a31fa87c8a4c9d7f8bc4ebe2add4b.tar.gz rust-643a79af3d5a31fa87c8a4c9d7f8bc4ebe2add4b.zip | |
Auto merge of #81149 - Aaron1011:feature/better-no-method-found-err, r=estebank
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.
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic_builder.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index f165a60336a..37902dddff4 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -74,11 +74,10 @@ macro_rules! forward { }); }; - // Forward pattern for &mut self -> &mut Self, with S: Into<MultiSpan> - // type parameter. No obvious way to make this more generic. + // Forward pattern for &mut self -> &mut Self, with generic parameters. ( $(#[$attrs:meta])* - pub fn $n:ident<S: Into<MultiSpan>>( + pub fn $n:ident<$($generic:ident: $bound:path),*>( &mut self, $($name:ident: $ty:ty),* $(,)? @@ -86,7 +85,7 @@ macro_rules! forward { ) => { $(#[$attrs])* forward_inner_docs!(concat!("See [`Diagnostic::", stringify!($n), "()`].") => - pub fn $n<S: Into<MultiSpan>>(&mut self, $($name: $ty),*) -> &mut Self { + pub fn $n<$($generic: $bound),*>(&mut self, $($name: $ty),*) -> &mut Self { self.0.diagnostic.$n($($name),*); self }); @@ -398,6 +397,7 @@ impl<'a> DiagnosticBuilder<'a> { self } + forward!(pub fn set_primary_message<M: Into<String>>(&mut self, msg: M) -> &mut Self); forward!(pub fn set_span<S: Into<MultiSpan>>(&mut self, sp: S) -> &mut Self); forward!(pub fn code(&mut self, s: DiagnosticId) -> &mut Self); |
