Forbid const generics on abis #7483
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR forbids "const generics" on
abis. The reason is that to correctly support it, we will need to introduce changes to the ABI json.This will be reserved to the future.
Checklist
Breaking*orNew Featurelabels where relevant.Note
Disallows const generics in ABI method parameters/returns (including nested forms), adjusts type substitution to ignore const params, and adds failing tests to validate.
has_const_generics(..)to detect const generics inTypeInfo(including arrays/strings, nested structs/enums/tuples).TyAbiDecl::forbid_const_generics(..)emittingCompileError::ConstGenericNotSupportedHerefor ABI interfacefnparams/returns and implementation items.ty::TyAbiDeclinsway-core/src/semantic_analysis/ast_node/declaration/abi.rs.TypeSubstMap::from_superset_and_subsetforEnum/Struct, usefilter_map(|x| x.as_type_parameter())so only type parameters participate in substitution (ignores const params).should_fail/unsupported_const_genericswith ABIs using const generics directly and via nested types; update snapshots and project files to expect errors.Written by Cursor Bugbot for commit 1bf3210. This will update automatically on new commits. Configure here.