Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[E0380] Use of auto trait with method or associated item #2527

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gcc/rust/parse/rust-parse-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4922,8 +4922,8 @@ Parser<ManagedTokenSource>::parse_trait (AST::Visibility vis,

if (is_auto_trait && !trait_items.empty ())
{
add_error (
Error (locus, "associated items are forbidden within auto traits"));
add_error (Error (locus, ErrorCode::E0380,
"auto traits cannot have associated items"));

// FIXME: unsure if this should be done at parsing time or not
for (const auto &item : trait_items)
Expand Down
2 changes: 1 addition & 1 deletion gcc/testsuite/rust/compile/auto_trait_invalid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#![feature(optin_builtin_traits)]

unsafe auto trait Invalid { // { dg-error "associated items are forbidden within auto traits" }
unsafe auto trait Invalid { // { dg-error "auto traits cannot have associated items" }
fn foo(); // { dg-message "remove this item" }

fn bar() {} // { dg-message "remove this item" }
Expand Down