error: missing `fn`, `type`, or `const` for impl-item declaration --> $DIR/issue-40006.rs:1:13 | LL | impl dyn X { | _____________^ LL | | LL | | Y | |____^ missing `fn`, `type`, or `const` error: missing `fn`, `type`, or `const` for trait-item declaration --> $DIR/issue-40006.rs:8:10 | LL | trait X { | __________^ LL | | X() {} | |____^ missing `fn`, `type`, or `const` error: expected `[`, found `#` --> $DIR/issue-40006.rs:10:17 | LL | fn xxx() { ### } | ^ expected `[` error: missing `fn`, `type`, or `const` for trait-item declaration --> $DIR/issue-40006.rs:10:21 | LL | fn xxx() { ### } | _____________________^ LL | | LL | | L = M; | |____^ missing `fn`, `type`, or `const` error: missing `fn`, `type`, or `const` for trait-item declaration --> $DIR/issue-40006.rs:12:11 | LL | L = M; | ___________^ LL | | Z = { 2 + 3 }; | |____^ missing `fn`, `type`, or `const` error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;` --> $DIR/issue-40006.rs:13:18 | LL | Z = { 2 + 3 }; | ^ expected one of 7 possible tokens here error: expected one of `!` or `::`, found `(` --> $DIR/issue-40006.rs:14:9 | LL | ::Y (); | ^ expected one of `!` or `::` here error: missing `fn`, `type`, or `const` for impl-item declaration --> $DIR/issue-40006.rs:18:8 | LL | pub hello_method(&self) { | ^ missing `fn`, `type`, or `const` error[E0038]: the trait `X` cannot be made into an object --> $DIR/issue-40006.rs:1:6 | LL | impl dyn X { | ^^^^^ the trait `X` cannot be made into an object ... LL | fn xxx() { ### } | --- associated function `xxx` has no `self` parameter error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0038`.