From cb145d4a45aaf42a5ab687acdd06ee1dcba1c6f2 Mon Sep 17 00:00:00 2001 From: Ijtihed Kilani Date: Sat, 13 Jun 2026 13:35:44 +0300 Subject: [PATCH 1/5] Fix ICE \Unexpected node Synthetic\ in diagnostic_hir_wf_check --- .../rustc_hir_analysis/src/hir_wf_check.rs | 3 + ...ssue-148630-unexpected-node-synthetic-2.rs | 21 +++++ ...-148630-unexpected-node-synthetic-2.stderr | 65 ++++++++++++++ .../issue-148630-unexpected-node-synthetic.rs | 23 +++++ ...ue-148630-unexpected-node-synthetic.stderr | 89 +++++++++++++++++++ 5 files changed, 201 insertions(+) create mode 100644 tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic-2.rs create mode 100644 tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic-2.stderr create mode 100644 tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic.rs create mode 100644 tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic.stderr diff --git a/compiler/rustc_hir_analysis/src/hir_wf_check.rs b/compiler/rustc_hir_analysis/src/hir_wf_check.rs index f2c25c8716783..a56ed668bfdf4 100644 --- a/compiler/rustc_hir_analysis/src/hir_wf_check.rs +++ b/compiler/rustc_hir_analysis/src/hir_wf_check.rs @@ -189,6 +189,9 @@ pub(super) fn diagnostic_hir_wf_check<'tcx>( vec![] } } + // Synthetic nodes are created by query feeding for items like RPITIT + // opaque types that have no corresponding HIR type to walk. + hir::Node::Synthetic => vec![], ref node => bug!("Unexpected node {:?}", node), }, WellFormedLoc::Param { function: _, param_idx } => { diff --git a/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic-2.rs b/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic-2.rs new file mode 100644 index 0000000000000..8e490d26a4db9 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic-2.rs @@ -0,0 +1,21 @@ +// Regression test for #148630 (simpler reproduction). + +#![feature(unboxed_closures)] + +trait Tr {} +trait Foo { + fn foo() -> impl Sized + //~^ ERROR expected a `FnOnce<&'a i32>` closure, found `()` + //~| ERROR expected a `FnOnce<&'a i32>` closure, found `()` + //~| ERROR expected a `FnOnce<&'a i32>` closure, found `()` + //~| ERROR expected a `FnOnce<&'a i32>` closure, found `()` + //~| ERROR expected a `FnOnce<&'a i32>` closure, found `()` + //~| ERROR expected a `FnOnce<&'a i32>` closure, found `()` + //~| ERROR expected a `FnOnce<&'a i32>` closure, found `()` + where + for<'a> <() as FnOnce<&'a i32>>::Output: Tr, + { + } +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic-2.stderr b/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic-2.stderr new file mode 100644 index 0000000000000..1e6c08798b121 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic-2.stderr @@ -0,0 +1,65 @@ +error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` + --> $DIR/issue-148630-unexpected-node-synthetic-2.rs:7:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` + | + = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` + +error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` + --> $DIR/issue-148630-unexpected-node-synthetic-2.rs:7:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` + | + = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` + --> $DIR/issue-148630-unexpected-node-synthetic-2.rs:7:5 + | +LL | / fn foo() -> impl Sized +... | +LL | | where +LL | | for<'a> <() as FnOnce<&'a i32>>::Output: Tr, + | |____________________________________________________^ expected an `FnOnce<&'a i32>` closure, found `()` + | + = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` + +error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` + --> $DIR/issue-148630-unexpected-node-synthetic-2.rs:7:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` + | + = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` + +error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` + --> $DIR/issue-148630-unexpected-node-synthetic-2.rs:7:22 + | +LL | fn foo() -> impl Sized + | ^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` + | + = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` + +error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` + --> $DIR/issue-148630-unexpected-node-synthetic-2.rs:7:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` + | + = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` + --> $DIR/issue-148630-unexpected-node-synthetic-2.rs:7:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` + | + = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic.rs b/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic.rs new file mode 100644 index 0000000000000..5f8151d54d823 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic.rs @@ -0,0 +1,23 @@ +// Regression test for #148630. + +#![feature(unboxed_closures)] + +use std::future::Future; + +trait Foo { + fn foo() -> impl Sized + //~^ ERROR expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + //~| ERROR expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + //~| ERROR expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + //~| ERROR expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + //~| ERROR expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + //~| ERROR expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + //~| ERROR expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + where + for<'a> >::Output: Future + 'a, + //~^ ERROR the trait `Foo` is not dyn compatible [E0038] + { + } +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic.stderr b/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic.stderr new file mode 100644 index 0000000000000..2b32669a4bdfb --- /dev/null +++ b/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic.stderr @@ -0,0 +1,89 @@ +error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + | + = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `(dyn Foo + 'static)` + +error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + | + = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `(dyn Foo + 'static)` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:5 + | +LL | / fn foo() -> impl Sized +... | +LL | | where +LL | | for<'a> >::Output: Future + 'a, + | |______________________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + | + = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `(dyn Foo + 'static)` + +error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + | + = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `(dyn Foo + 'static)` + +error[E0038]: the trait `Foo` is not dyn compatible + --> $DIR/issue-148630-unexpected-node-synthetic.rs:17:84 + | +LL | for<'a> >::Output: Future + 'a, + | ^^ `Foo` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit + --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:8 + | +LL | trait Foo { + | --- this trait is not dyn compatible... +LL | fn foo() -> impl Sized + | ^^^ ...because associated function `foo` has no `self` parameter +help: consider turning `foo` into a method by giving it a `&self` argument + | +LL | fn foo(&self) -> impl Sized + | +++++ +help: alternatively, consider constraining `foo` so it does not apply to trait objects + | +LL | for<'a> >::Output: Future + 'a, Self: Sized + | +++++++++++ + +error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:22 + | +LL | fn foo() -> impl Sized + | ^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + | + = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `(dyn Foo + 'static)` + +error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + | + = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `(dyn Foo + 'static)` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` + | + = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `(dyn Foo + 'static)` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 8 previous errors + +Some errors have detailed explanations: E0038, E0277. +For more information about an error, try `rustc --explain E0038`. From 26a8a201c35ad86526b915b4886ea3653cd6d605 Mon Sep 17 00:00:00 2001 From: Ijtihed Kilani Date: Sat, 13 Jun 2026 14:32:40 +0300 Subject: [PATCH 2/5] Rename test files to satisfy tidy naming convention --- ...nexpected-node-synthetic-issue-148630-2.rs} | 0 ...ected-node-synthetic-issue-148630-2.stderr} | 14 +++++++------- ... unexpected-node-synthetic-issue-148630.rs} | 0 ...xpected-node-synthetic-issue-148630.stderr} | 18 +++++++++--------- 4 files changed, 16 insertions(+), 16 deletions(-) rename tests/ui/impl-trait/in-trait/{issue-148630-unexpected-node-synthetic-2.rs => unexpected-node-synthetic-issue-148630-2.rs} (100%) rename tests/ui/impl-trait/in-trait/{issue-148630-unexpected-node-synthetic-2.stderr => unexpected-node-synthetic-issue-148630-2.stderr} (84%) rename tests/ui/impl-trait/in-trait/{issue-148630-unexpected-node-synthetic.rs => unexpected-node-synthetic-issue-148630.rs} (100%) rename tests/ui/impl-trait/in-trait/{issue-148630-unexpected-node-synthetic.stderr => unexpected-node-synthetic-issue-148630.stderr} (88%) diff --git a/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic-2.rs b/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-issue-148630-2.rs similarity index 100% rename from tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic-2.rs rename to tests/ui/impl-trait/in-trait/unexpected-node-synthetic-issue-148630-2.rs diff --git a/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic-2.stderr b/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-issue-148630-2.stderr similarity index 84% rename from tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic-2.stderr rename to tests/ui/impl-trait/in-trait/unexpected-node-synthetic-issue-148630-2.stderr index 1e6c08798b121..df7202d197bd6 100644 --- a/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic-2.stderr +++ b/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-issue-148630-2.stderr @@ -1,5 +1,5 @@ error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` - --> $DIR/issue-148630-unexpected-node-synthetic-2.rs:7:17 + --> $DIR/unexpected-node-synthetic-issue-148630-2.rs:7:17 | LL | fn foo() -> impl Sized | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` @@ -7,7 +7,7 @@ LL | fn foo() -> impl Sized = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` - --> $DIR/issue-148630-unexpected-node-synthetic-2.rs:7:17 + --> $DIR/unexpected-node-synthetic-issue-148630-2.rs:7:17 | LL | fn foo() -> impl Sized | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` @@ -16,7 +16,7 @@ LL | fn foo() -> impl Sized = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` - --> $DIR/issue-148630-unexpected-node-synthetic-2.rs:7:5 + --> $DIR/unexpected-node-synthetic-issue-148630-2.rs:7:5 | LL | / fn foo() -> impl Sized ... | @@ -27,7 +27,7 @@ LL | | for<'a> <() as FnOnce<&'a i32>>::Output: Tr, = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` - --> $DIR/issue-148630-unexpected-node-synthetic-2.rs:7:17 + --> $DIR/unexpected-node-synthetic-issue-148630-2.rs:7:17 | LL | fn foo() -> impl Sized | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` @@ -35,7 +35,7 @@ LL | fn foo() -> impl Sized = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` - --> $DIR/issue-148630-unexpected-node-synthetic-2.rs:7:22 + --> $DIR/unexpected-node-synthetic-issue-148630-2.rs:7:22 | LL | fn foo() -> impl Sized | ^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` @@ -43,7 +43,7 @@ LL | fn foo() -> impl Sized = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` - --> $DIR/issue-148630-unexpected-node-synthetic-2.rs:7:17 + --> $DIR/unexpected-node-synthetic-issue-148630-2.rs:7:17 | LL | fn foo() -> impl Sized | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` @@ -52,7 +52,7 @@ LL | fn foo() -> impl Sized = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` - --> $DIR/issue-148630-unexpected-node-synthetic-2.rs:7:17 + --> $DIR/unexpected-node-synthetic-issue-148630-2.rs:7:17 | LL | fn foo() -> impl Sized | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` diff --git a/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic.rs b/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-issue-148630.rs similarity index 100% rename from tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic.rs rename to tests/ui/impl-trait/in-trait/unexpected-node-synthetic-issue-148630.rs diff --git a/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic.stderr b/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-issue-148630.stderr similarity index 88% rename from tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic.stderr rename to tests/ui/impl-trait/in-trait/unexpected-node-synthetic-issue-148630.stderr index 2b32669a4bdfb..cb63cbbff3368 100644 --- a/tests/ui/impl-trait/in-trait/issue-148630-unexpected-node-synthetic.stderr +++ b/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-issue-148630.stderr @@ -1,5 +1,5 @@ error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` - --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:17 + --> $DIR/unexpected-node-synthetic-issue-148630.rs:8:17 | LL | fn foo() -> impl Sized | ^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` @@ -7,7 +7,7 @@ LL | fn foo() -> impl Sized = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `(dyn Foo + 'static)` error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` - --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:17 + --> $DIR/unexpected-node-synthetic-issue-148630.rs:8:17 | LL | fn foo() -> impl Sized | ^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` @@ -16,7 +16,7 @@ LL | fn foo() -> impl Sized = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` - --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:5 + --> $DIR/unexpected-node-synthetic-issue-148630.rs:8:5 | LL | / fn foo() -> impl Sized ... | @@ -27,7 +27,7 @@ LL | | for<'a> >::Output: Future FnOnce(&'a mut i32)` is not implemented for `(dyn Foo + 'static)` error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` - --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:17 + --> $DIR/unexpected-node-synthetic-issue-148630.rs:8:17 | LL | fn foo() -> impl Sized | ^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` @@ -35,14 +35,14 @@ LL | fn foo() -> impl Sized = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `(dyn Foo + 'static)` error[E0038]: the trait `Foo` is not dyn compatible - --> $DIR/issue-148630-unexpected-node-synthetic.rs:17:84 + --> $DIR/unexpected-node-synthetic-issue-148630.rs:17:84 | LL | for<'a> >::Output: Future + 'a, | ^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit - --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:8 + --> $DIR/unexpected-node-synthetic-issue-148630.rs:8:8 | LL | trait Foo { | --- this trait is not dyn compatible... @@ -58,7 +58,7 @@ LL | for<'a> >::Output: Future $DIR/issue-148630-unexpected-node-synthetic.rs:8:22 + --> $DIR/unexpected-node-synthetic-issue-148630.rs:8:22 | LL | fn foo() -> impl Sized | ^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` @@ -66,7 +66,7 @@ LL | fn foo() -> impl Sized = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `(dyn Foo + 'static)` error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` - --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:17 + --> $DIR/unexpected-node-synthetic-issue-148630.rs:8:17 | LL | fn foo() -> impl Sized | ^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` @@ -75,7 +75,7 @@ LL | fn foo() -> impl Sized = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` - --> $DIR/issue-148630-unexpected-node-synthetic.rs:8:17 + --> $DIR/unexpected-node-synthetic-issue-148630.rs:8:17 | LL | fn foo() -> impl Sized | ^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `(dyn Foo + 'static)` From 6399187b3d08df8dd033c941f1091a9c2a553dfd Mon Sep 17 00:00:00 2001 From: Ijtihed Kilani Date: Sun, 14 Jun 2026 12:54:18 +0300 Subject: [PATCH 3/5] rename issue-148630 test files to match tidy naming convention --- ...ue-148630-2.rs => unexpected-node-synthetic-2-issue-148630.rs} | 0 ...0-2.stderr => unexpected-node-synthetic-2-issue-148630.stderr} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename tests/ui/impl-trait/in-trait/{unexpected-node-synthetic-issue-148630-2.rs => unexpected-node-synthetic-2-issue-148630.rs} (100%) rename tests/ui/impl-trait/in-trait/{unexpected-node-synthetic-issue-148630-2.stderr => unexpected-node-synthetic-2-issue-148630.stderr} (100%) diff --git a/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-issue-148630-2.rs b/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-2-issue-148630.rs similarity index 100% rename from tests/ui/impl-trait/in-trait/unexpected-node-synthetic-issue-148630-2.rs rename to tests/ui/impl-trait/in-trait/unexpected-node-synthetic-2-issue-148630.rs diff --git a/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-issue-148630-2.stderr b/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-2-issue-148630.stderr similarity index 100% rename from tests/ui/impl-trait/in-trait/unexpected-node-synthetic-issue-148630-2.stderr rename to tests/ui/impl-trait/in-trait/unexpected-node-synthetic-2-issue-148630.stderr From fb5042fc90581aea2dd4c5aa4c3e3f7bd414d263 Mon Sep 17 00:00:00 2001 From: Ijtihed Kilani Date: Sun, 14 Jun 2026 13:51:40 +0300 Subject: [PATCH 4/5] fix: update stderr baseline filename reference --- ...ected-node-synthetic-2-issue-148630.stderr | 65 ------------------- 1 file changed, 65 deletions(-) diff --git a/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-2-issue-148630.stderr b/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-2-issue-148630.stderr index df7202d197bd6..e69de29bb2d1d 100644 --- a/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-2-issue-148630.stderr +++ b/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-2-issue-148630.stderr @@ -1,65 +0,0 @@ -error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` - --> $DIR/unexpected-node-synthetic-issue-148630-2.rs:7:17 - | -LL | fn foo() -> impl Sized - | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` - | - = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` - -error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` - --> $DIR/unexpected-node-synthetic-issue-148630-2.rs:7:17 - | -LL | fn foo() -> impl Sized - | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` - | - = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` - --> $DIR/unexpected-node-synthetic-issue-148630-2.rs:7:5 - | -LL | / fn foo() -> impl Sized -... | -LL | | where -LL | | for<'a> <() as FnOnce<&'a i32>>::Output: Tr, - | |____________________________________________________^ expected an `FnOnce<&'a i32>` closure, found `()` - | - = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` - -error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` - --> $DIR/unexpected-node-synthetic-issue-148630-2.rs:7:17 - | -LL | fn foo() -> impl Sized - | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` - | - = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` - -error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` - --> $DIR/unexpected-node-synthetic-issue-148630-2.rs:7:22 - | -LL | fn foo() -> impl Sized - | ^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` - | - = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` - -error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` - --> $DIR/unexpected-node-synthetic-issue-148630-2.rs:7:17 - | -LL | fn foo() -> impl Sized - | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` - | - = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` - --> $DIR/unexpected-node-synthetic-issue-148630-2.rs:7:17 - | -LL | fn foo() -> impl Sized - | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` - | - = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 7 previous errors - -For more information about this error, try `rustc --explain E0277`. From dd2ec31390761d97627eb7d7a93590fadf6c9129 Mon Sep 17 00:00:00 2001 From: Ijtihed Kilani Date: Sun, 14 Jun 2026 13:56:13 +0300 Subject: [PATCH 5/5] fix: update stderr baseline filename reference --- ...ected-node-synthetic-2-issue-148630.stderr | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-2-issue-148630.stderr b/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-2-issue-148630.stderr index e69de29bb2d1d..5b3b4abf791ef 100644 --- a/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-2-issue-148630.stderr +++ b/tests/ui/impl-trait/in-trait/unexpected-node-synthetic-2-issue-148630.stderr @@ -0,0 +1,65 @@ +error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` + --> $DIR/unexpected-node-synthetic-2-issue-148630.rs:7:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` + | + = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` + +error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` + --> $DIR/unexpected-node-synthetic-2-issue-148630.rs:7:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` + | + = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` + --> $DIR/unexpected-node-synthetic-2-issue-148630.rs:7:5 + | +LL | / fn foo() -> impl Sized +... | +LL | | where +LL | | for<'a> <() as FnOnce<&'a i32>>::Output: Tr, + | |____________________________________________________^ expected an `FnOnce<&'a i32>` closure, found `()` + | + = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` + +error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` + --> $DIR/unexpected-node-synthetic-2-issue-148630.rs:7:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` + | + = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` + +error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` + --> $DIR/unexpected-node-synthetic-2-issue-148630.rs:7:22 + | +LL | fn foo() -> impl Sized + | ^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` + | + = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` + +error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` + --> $DIR/unexpected-node-synthetic-2-issue-148630.rs:7:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` + | + = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0277]: expected a `FnOnce<&'a i32>` closure, found `()` + --> $DIR/unexpected-node-synthetic-2-issue-148630.rs:7:17 + | +LL | fn foo() -> impl Sized + | ^^^^^^^^^^ expected an `FnOnce<&'a i32>` closure, found `()` + | + = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0277`.