Skip to content

Commit 660480a

Browse files
committed
Avoid suggesting inside macro call
Specifically avoid non-sense suggestion when calling `panic!` with something `!Send`.
1 parent ae5a239 commit 660480a

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,6 +1537,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
15371537
let generics = self.tcx.generics_of(*def_id);
15381538
if generics.params.iter().any(|p| p.name != kw::SelfUpper)
15391539
&& !snippet.ends_with('>')
1540+
&& !span.from_expansion()
15401541
{
15411542
// FIXME: To avoid spurious suggestions in functions where type arguments
15421543
// where already supplied, we check the snippet to make sure it doesn't

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,6 @@ LL | pub fn begin_panic<M: Any + Send>(msg: M) -> ! {
1111
|
1212
= note: cannot satisfy `_: Send`
1313
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
14-
help: consider specifying the type argument in the function call
15-
|
16-
LL | ($msg:expr) => ({ $crate::rt::begin_panic::<IoSlice<'a>>($msg) });
17-
| ^^^^^^^^^^^^^^^
18-
LL | ($msg:expr) => ({ $crate::rt::begin_panic::<IoSliceMut<'a>>($msg) });
19-
| ^^^^^^^^^^^^^^^^^^
20-
LL | ($msg:expr) => ({ $crate::rt::begin_panic::<ResumeTy>($msg) });
21-
| ^^^^^^^^^^^^
22-
LL | ($msg:expr) => ({ $crate::rt::begin_panic::<Waker>($msg) });
23-
| ^^^^^^^^^
24-
and 13 other candidates
2514

2615
error: aborting due to previous error
2716

0 commit comments

Comments
 (0)