aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2024-11-04 15:05:03 -0500
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-21 12:32:56 +0100
commitc92c217c86cc2023146d6f14c8eb7732b560c175 (patch)
tree0c2edbfca490ad775a8c3568e0c9d0aeb1aed15b /gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
parent6a65fb23a9b6e541460ebbfe4044b1ae062c37c9 (diff)
downloadgcc-c92c217c86cc2023146d6f14c8eb7732b560c175.zip
gcc-c92c217c86cc2023146d6f14c8eb7732b560c175.tar.gz
gcc-c92c217c86cc2023146d6f14c8eb7732b560c175.tar.bz2
gccrs: Improve handling of implicit Self parameter in AST
gcc/rust/ChangeLog: * ast/rust-item.h (Trait::self_param): Add. (Trait::Trait): Initialize self_param. (Trait::operator=): Copy self_param. (Trait::insert_implicit_self): Remove. (Trait::get_implicit_self): Add. * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Make sure implicit self is still lowered to HIR. * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Adjust handling of implicit self. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Add commit to Trait visitor mentioning that implicit self is not visited. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Remove call to Trait::insert_implicit_self. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. * rust/link/generic_function_0.rs: No longer expect failure. * rust/link/trait_import_0.rs: Likewise. * rust/link/trait_import_1.rs (trait Sized): Add. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc')
-rw-r--r--gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc17
1 files changed, 0 insertions, 17 deletions
diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
index fff3769..ef7a727 100644
--- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
@@ -103,23 +103,6 @@ TopLevel::visit (AST::Module &module)
void
TopLevel::visit (AST::Trait &trait)
{
- // FIXME: This Self injection is dodgy. It even lead to issues with metadata
- // export in the past (#2349). We cannot tell appart injected parameters from
- // regular ones. Dumping generic parameters highlights this Self in metadata,
- // during debug or proc macro collection. This is clearly a hack.
- //
- // For now I'll keep it here in the new name resolver even if it should
- // probably not be there. We need to find another way to solve this.
- // Maybe an additional attribute to Trait ?
- //
- // From old resolver:
- //// we need to inject an implicit self TypeParam here
- //// FIXME: which location should be used for Rust::Identifier `Self`?
- AST::TypeParam *implicit_self
- = new AST::TypeParam ({"Self"}, trait.get_locus ());
- trait.insert_implict_self (
- std::unique_ptr<AST::GenericParam> (implicit_self));
-
insert_or_error_out (trait.get_identifier ().as_string (), trait,
Namespace::Types);