-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gccrs: add discriminant value intrinsic
This is pretty nasty piece of rust in my opinion the return type of this intrinsic results into a lang item associated type: <T as DiscriminantKind>::Discriminant This is a special case which needs to support mapping onto the repr type of the associated ADT that is passed in, but defaults to iszie otherwise. This patch assumes we only come accross this case in a HIR::CALL_EXPR, so and makes assumutions that its always of this function signiture. I will do some checking in libcore to verify that assumption. More work is needed to parse the repr type on enums but the code is there to support this when its in to change the types etc. Addresses #3348 gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (discriminant_value_handler): new handler * typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item): track the defid * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::parse_repr_options): default isize * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): special case CallExpr * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): parse repr options enum * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): remove bad diagnostic * typecheck/rust-tyty.cc (PlaceholderType::PlaceholderType): track defid (PlaceholderType::clone): likewise (PlaceholderType::get_def_id): likeiwse * typecheck/rust-tyty.h: placeholder track defid * util/rust-lang-item.cc: add new lang items * util/rust-lang-item.h: likewise gcc/testsuite/ChangeLog: * rust/execute/torture/enum_intrinsics1.rs: New test. Signed-off-by: Philip Herron <[email protected]>
- Loading branch information
Showing
11 changed files
with
235 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.