-
Notifications
You must be signed in to change notification settings - Fork 157
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
Resolve type path error #2375
Comments
Same error from
|
This is missing the sized trait definition in gccrs we don't compile libcore yet so the test case is missing:
when this is added we still get an issue:
|
philberty
modified the milestones:
HIR Pipeline for libcore 1.49 Complete,
GCC 14 Stage 3
Jul 29, 2023
philberty
added a commit
that referenced
this issue
Jul 29, 2023
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of #2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: #2375 Addresses: #2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (tokenstream_from_string): update Lexer constructor * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
philberty
added a commit
that referenced
this issue
Jul 29, 2023
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of #2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: #2375 Addresses: #2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
philberty
added a commit
that referenced
this issue
Jul 29, 2023
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of #2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: #2375 Addresses: #2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
github-merge-queue bot
pushed a commit
that referenced
this issue
Jul 30, 2023
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of #2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: #2375 Addresses: #2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Nov 15, 2023
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Nov 21, 2023
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Nov 21, 2023
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 5, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 8, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 9, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 11, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 12, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 16, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 16, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur
pushed a commit
to CohenArthur/gccrs
that referenced
this issue
Jan 17, 2024
…ized Sized is implicitly applied to every generic type parameter apart from the implicit Self type parameter on traits, as that would cause a recursive bound and would make Traits unable to be appied to unsized types. In order to keep everything happy this means we also need to support the anti trait bound '?' so that Sized can be removed properly. The full Sized rules are not completely implemented here. Slice's and Str's are currently marked as Sized but there is a small regression here that looks like a more general bug which should be fixed on its own as part of Rust-GCC#2443. There is a big testsuite update here to pull in the Sized lang item. Note this lays the bound's ground work so we can start supporting Drop trait properly which needs tackled very soon. Fixes: Rust-GCC#2375 Addresses: Rust-GCC#2443 gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise gcc/testsuite/ChangeLog: * rust/compile/bounds1.rs: Apply sized trait * rust/compile/canonical_paths1.rs: likewise * rust/compile/cast_generics.rs: likewise * rust/compile/closure_no_type_anno.rs: likewise * rust/compile/complex_qualified_path_in_expr.rs: likewise * rust/compile/const-issue1440.rs: likewise * rust/compile/const_generics_1.rs: likewise * rust/compile/const_generics_8.rs: likewise * rust/compile/derive_macro1.rs: likewise * rust/compile/derive_macro3.rs: likewise * rust/compile/derive_macro4.rs: likewise * rust/compile/derive_macro6.rs: likewise * rust/compile/expected_type_args2.rs: likewise * rust/compile/expected_type_args3.rs: likewise * rust/compile/generics1.rs: likewise * rust/compile/generics11.rs: likewise * rust/compile/generics12.rs: likewise * rust/compile/generics2.rs: likewise * rust/compile/generics3.rs: likewise * rust/compile/generics4.rs: likewise * rust/compile/generics6.rs: likewise * rust/compile/generics7.rs: likewise * rust/compile/generics8.rs: likewise * rust/compile/if_let_expr.rs: likewise * rust/compile/issue-1005.rs: likewise * rust/compile/issue-1019.rs: likewise * rust/compile/issue-1031.rs: likewise * rust/compile/issue-1034.rs: likewise * rust/compile/issue-1128.rs: likewise * rust/compile/issue-1129-2.rs: likewise * rust/compile/issue-1130.rs: likewise * rust/compile/issue-1131.rs: likewise * rust/compile/issue-1165.rs: likewise * rust/compile/issue-1173.rs: likewise * rust/compile/issue-1235.rs: likewise * rust/compile/issue-1237.rs: likewise * rust/compile/issue-1289.rs: likewise * rust/compile/issue-1383.rs: likewise * rust/compile/issue-1447.rs: likewise * rust/compile/issue-1589.rs: likewise * rust/compile/issue-1725-1.rs: likewise * rust/compile/issue-1725-2.rs: likewise * rust/compile/issue-1773.rs: likewise * rust/compile/issue-1786.rs: likewise * rust/compile/issue-1893.rs: likewise * rust/compile/issue-1901.rs: likewise * rust/compile/issue-1930.rs: likewise * rust/compile/issue-1981.rs: likewise * rust/compile/issue-2019-1.rs: likewise * rust/compile/issue-2019-2.rs: likewise * rust/compile/issue-2019-3.rs: likewise * rust/compile/issue-2036.rs: likewise * rust/compile/issue-2037.rs: likewise * rust/compile/issue-2070.rs: likewise * rust/compile/issue-2105.rs: likewise * rust/compile/issue-2106.rs: likewise * rust/compile/issue-2135.rs: likewise * rust/compile/issue-2136-1.rs: likewise * rust/compile/issue-2136-2.rs: likewise * rust/compile/issue-2139.rs: likewise * rust/compile/issue-2142.rs: likewise * rust/compile/issue-2165.rs: likewise * rust/compile/issue-2166.rs: likewise * rust/compile/issue-2190-1.rs: likewise * rust/compile/issue-2190-2.rs: likewise * rust/compile/issue-2195.rs: likewise * rust/compile/issue-2238.rs: likewise * rust/compile/issue-2304.rs: likewise * rust/compile/issue-850.rs: likewise * rust/compile/issue-855.rs: likewise * rust/compile/issue-925.rs: likewise * rust/compile/macro-issue1400.rs: likewise * rust/compile/macro20.rs: likewise * rust/compile/macro23.rs: likewise * rust/compile/macro40.rs: likewise * rust/compile/macro54.rs: likewise * rust/compile/name_resolution2.rs: likewise * rust/compile/name_resolution4.rs: likewise * rust/compile/nested_generic.rs: likewise * rust/compile/parse_associated_type_as_generic_arg.rs: likewise * rust/compile/parse_associated_type_as_generic_arg2.rs: likewise * rust/compile/parse_associated_type_as_generic_arg3.rs: likewise * rust/compile/parse_complex_generic_application.rs: likewise * rust/compile/parse_complex_generic_application2.rs: likewise * rust/compile/path_as_generic_arg.rs: likewise * rust/compile/privacy4.rs: likewise * rust/compile/privacy6.rs: likewise * rust/compile/sizeof-stray-infer-var-bug.rs: likewise * rust/compile/stmt_with_block_dot.rs: likewise * rust/compile/torture/associated_types1.rs: likewise * rust/compile/torture/forward_decl_5.rs: likewise * rust/compile/torture/generics1.rs: likewise * rust/compile/torture/generics10.rs: likewise * rust/compile/torture/generics11.rs: likewise * rust/compile/torture/generics12.rs: likewise * rust/compile/torture/generics13.rs: likewise * rust/compile/torture/generics14.rs: likewise * rust/compile/torture/generics15.rs: likewise * rust/compile/torture/generics16.rs: likewise * rust/compile/torture/generics17.rs: likewise * rust/compile/torture/generics18.rs: likewise * rust/compile/torture/generics19.rs: likewise * rust/compile/torture/generics2.rs: likewise * rust/compile/torture/generics20.rs: likewise * rust/compile/torture/generics21.rs: likewise * rust/compile/torture/generics22.rs: likewise * rust/compile/torture/generics23.rs: likewise * rust/compile/torture/generics24.rs: likewise * rust/compile/torture/generics25.rs: likewise * rust/compile/torture/generics26.rs: likewise * rust/compile/torture/generics27.rs: likewise * rust/compile/torture/generics28.rs: likewise * rust/compile/torture/generics29.rs: likewise * rust/compile/torture/generics3.rs: likewise * rust/compile/torture/generics30.rs: likewise * rust/compile/torture/generics31.rs: likewise * rust/compile/torture/generics32.rs: likewise * rust/compile/torture/generics4.rs: likewise * rust/compile/torture/generics5.rs: likewise * rust/compile/torture/generics6.rs: likewise * rust/compile/torture/generics7.rs: likewise * rust/compile/torture/generics8.rs: likewise * rust/compile/torture/generics9.rs: likewise * rust/compile/torture/intrinsics-2.rs: likewise * rust/compile/torture/intrinsics-6.rs: likewise * rust/compile/torture/intrinsics-7.rs: likewise * rust/compile/torture/intrinsics-8.rs: likewise * rust/compile/torture/issue-1024.rs: likewise * rust/compile/torture/issue-1075.rs: likewise * rust/compile/torture/issue-1432.rs: likewise * rust/compile/torture/issue-1555.rs: likewise * rust/compile/torture/issue-368.rs: likewise * rust/compile/torture/issue-808.rs: likewise * rust/compile/torture/issue-862.rs: likewise * rust/compile/torture/issue-893-2.rs: likewise * rust/compile/torture/issue-893.rs: likewise * rust/compile/torture/must_use2.rs: likewise * rust/compile/torture/nested_fn2.rs: likewise * rust/compile/torture/phantom_data.rs: likewise * rust/compile/torture/range-lang-item1.rs: likewise * rust/compile/torture/traits1.rs: likewise * rust/compile/torture/traits11.rs: likewise * rust/compile/torture/traits12.rs: likewise * rust/compile/torture/traits13.rs: likewise * rust/compile/torture/traits14.rs: likewise * rust/compile/torture/traits15.rs: likewise * rust/compile/torture/traits16.rs: likewise * rust/compile/torture/traits17.rs: likewise * rust/compile/torture/traits18.rs: likewise * rust/compile/torture/traits19.rs: likewise * rust/compile/torture/traits2.rs: likewise * rust/compile/torture/traits3.rs: likewise * rust/compile/torture/traits4.rs: likewise * rust/compile/torture/traits5.rs: likewise * rust/compile/torture/traits6.rs: likewise * rust/compile/torture/traits7.rs: likewise * rust/compile/torture/traits8.rs: likewise * rust/compile/torture/traits9.rs: likewise * rust/compile/torture/transmute-size-check-1.rs: likewise * rust/compile/torture/transmute1.rs: likewise * rust/compile/torture/uninit-intrinsic-1.rs: likewise * rust/compile/torture/utf8_identifiers.rs: likewise * rust/compile/traits1.rs: likewise * rust/compile/traits10.rs: likewise * rust/compile/traits11.rs: likewise * rust/compile/traits12.rs: likewise * rust/compile/traits2.rs: likewise * rust/compile/traits3.rs: likewise * rust/compile/traits4.rs: likewise * rust/compile/traits5.rs: likewise * rust/compile/traits6.rs: likewise * rust/compile/traits7.rs: likewise * rust/compile/traits8.rs: likewise * rust/compile/traits9.rs: likewise * rust/compile/type-bindings1.rs: likewise * rust/compile/unconstrained_type_param.rs: likewise * rust/compile/unsafe10.rs: likewise * rust/execute/torture/closure1.rs: likewise * rust/execute/torture/closure2.rs: likewise * rust/execute/torture/closure3.rs: likewise * rust/execute/torture/closure4.rs: likewise * rust/execute/torture/coercion1.rs: likewise * rust/execute/torture/coercion2.rs: likewise * rust/execute/torture/coercion3.rs: likewise * rust/execute/torture/copy_nonoverlapping1.rs: likewise * rust/execute/torture/derive_macro1.rs: likewise * rust/execute/torture/derive_macro3.rs: likewise * rust/execute/torture/derive_macro4.rs: likewise * rust/execute/torture/index1.rs: likewise * rust/execute/torture/issue-1120.rs: likewise * rust/execute/torture/issue-1133.rs: likewise * rust/execute/torture/issue-1198.rs: likewise * rust/execute/torture/issue-1232.rs: likewise * rust/execute/torture/issue-1249.rs: likewise * rust/execute/torture/issue-1436.rs: likewise * rust/execute/torture/issue-1496.rs: likewise * rust/execute/torture/issue-1720-2.rs: likewise * rust/execute/torture/issue-1720.rs: likewise * rust/execute/torture/issue-2052.rs: likewise * rust/execute/torture/issue-2179.rs: likewise * rust/execute/torture/issue-2180.rs: likewise * rust/execute/torture/issue-2236.rs: likewise * rust/execute/torture/issue-647.rs: likewise * rust/execute/torture/issue-845.rs: likewise * rust/execute/torture/issue-851.rs: likewise * rust/execute/torture/issue-858.rs: likewise * rust/execute/torture/macros23.rs: likewise * rust/execute/torture/macros28.rs: likewise * rust/execute/torture/method2.rs: likewise * rust/execute/torture/method3.rs: likewise * rust/execute/torture/method4.rs: likewise * rust/execute/torture/operator_overload_1.rs: likewise * rust/execute/torture/operator_overload_10.rs: likewise * rust/execute/torture/operator_overload_11.rs: likewise * rust/execute/torture/operator_overload_12.rs: likewise * rust/execute/torture/operator_overload_2.rs: likewise * rust/execute/torture/operator_overload_3.rs: likewise * rust/execute/torture/operator_overload_4.rs: likewise * rust/execute/torture/operator_overload_5.rs: likewise * rust/execute/torture/operator_overload_6.rs: likewise * rust/execute/torture/operator_overload_7.rs: likewise * rust/execute/torture/operator_overload_8.rs: likewise * rust/execute/torture/operator_overload_9.rs: likewise * rust/execute/torture/prefetch_data.rs: likewise * rust/execute/torture/ref-pattern2.rs: likewise * rust/execute/torture/slice-magic.rs: likewise * rust/execute/torture/slice-magic2.rs: likewise * rust/execute/torture/slice1.rs: likewise * rust/execute/torture/str-layout1.rs: likewise * rust/execute/torture/trait1.rs: likewise * rust/execute/torture/trait10.rs: likewise * rust/execute/torture/trait11.rs: likewise * rust/execute/torture/trait12.rs: likewise * rust/execute/torture/trait13.rs: likewise * rust/execute/torture/trait2.rs: likewise * rust/execute/torture/trait3.rs: likewise * rust/execute/torture/trait4.rs: likewise * rust/execute/torture/trait5.rs: likewise * rust/execute/torture/trait6.rs: likewise * rust/execute/torture/trait7.rs: likewise * rust/execute/torture/trait8.rs: likewise * rust/execute/torture/trait9.rs: likewise * rust/execute/torture/transmute1.rs: likewise * rust/execute/torture/wrapping_op1.rs: likewise * rust/execute/torture/wrapping_op2.rs: likewise * rust/link/generic_function_0.rs: likewise * rust/link/generic_function_1.rs: likewise * rust/compile/issue-2375.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried this code:
I expected to see this happen:
Instead, this happened: explanation
Meta
The text was updated successfully, but these errors were encountered: