From f806230fb1af13e0d7187b77b11c60dfa1ff2ccd Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Tue, 18 Jul 2023 17:46:08 +0100 Subject: [PATCH] gccrs: Begin enforcing Sized properly and support anti traits like ?Sized 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 --- gcc/rust/expand/rust-proc-macro.cc | 4 +- gcc/rust/lex/rust-lex.cc | 4 +- gcc/rust/lex/rust-lex.h | 2 +- gcc/rust/parse/rust-cfg-parser.cc | 2 +- gcc/rust/rust-session-manager.cc | 2 +- gcc/rust/typecheck/rust-hir-trait-resolve.cc | 20 ++++-- .../typecheck/rust-hir-type-check-base.cc | 17 +++++ gcc/rust/typecheck/rust-hir-type-check-base.h | 8 ++- .../typecheck/rust-hir-type-check-type.cc | 69 +++++++++++++++++-- gcc/rust/typecheck/rust-hir-type-check-type.h | 8 ++- gcc/rust/typecheck/rust-typecheck-context.cc | 3 - gcc/rust/typecheck/rust-tyty-bounds.cc | 48 ++++++++----- gcc/rust/util/rust-hir-map.cc | 21 ++++-- gcc/rust/util/rust-hir-map.h | 6 +- gcc/rust/util/rust-token-converter.cc | 4 +- gcc/testsuite/rust/compile/bounds1.rs | 3 + .../rust/compile/canonical_paths1.rs | 3 + gcc/testsuite/rust/compile/cast_generics.rs | 3 + .../rust/compile/closure_no_type_anno.rs | 3 + .../compile/complex_qualified_path_in_expr.rs | 5 +- gcc/testsuite/rust/compile/const-issue1440.rs | 3 + .../rust/compile/const_generics_1.rs | 3 + .../rust/compile/const_generics_8.rs | 3 + gcc/testsuite/rust/compile/derive_macro1.rs | 3 + gcc/testsuite/rust/compile/derive_macro3.rs | 3 + gcc/testsuite/rust/compile/derive_macro4.rs | 3 + gcc/testsuite/rust/compile/derive_macro6.rs | 3 + .../rust/compile/expected_type_args2.rs | 3 + .../rust/compile/expected_type_args3.rs | 3 + gcc/testsuite/rust/compile/generics1.rs | 3 + gcc/testsuite/rust/compile/generics11.rs | 3 + gcc/testsuite/rust/compile/generics12.rs | 3 + gcc/testsuite/rust/compile/generics2.rs | 3 + gcc/testsuite/rust/compile/generics3.rs | 3 + gcc/testsuite/rust/compile/generics4.rs | 3 + gcc/testsuite/rust/compile/generics6.rs | 3 + gcc/testsuite/rust/compile/generics7.rs | 3 + gcc/testsuite/rust/compile/generics8.rs | 3 + gcc/testsuite/rust/compile/if_let_expr.rs | 3 + gcc/testsuite/rust/compile/issue-1005.rs | 3 + gcc/testsuite/rust/compile/issue-1019.rs | 3 + gcc/testsuite/rust/compile/issue-1031.rs | 3 + gcc/testsuite/rust/compile/issue-1034.rs | 3 + gcc/testsuite/rust/compile/issue-1128.rs | 3 + gcc/testsuite/rust/compile/issue-1129-2.rs | 3 + gcc/testsuite/rust/compile/issue-1130.rs | 3 + gcc/testsuite/rust/compile/issue-1131.rs | 3 + gcc/testsuite/rust/compile/issue-1165.rs | 3 + gcc/testsuite/rust/compile/issue-1173.rs | 3 + gcc/testsuite/rust/compile/issue-1235.rs | 3 + gcc/testsuite/rust/compile/issue-1237.rs | 3 + gcc/testsuite/rust/compile/issue-1289.rs | 3 + gcc/testsuite/rust/compile/issue-1383.rs | 3 + gcc/testsuite/rust/compile/issue-1447.rs | 3 + gcc/testsuite/rust/compile/issue-1589.rs | 3 + gcc/testsuite/rust/compile/issue-1725-1.rs | 3 + gcc/testsuite/rust/compile/issue-1725-2.rs | 3 + gcc/testsuite/rust/compile/issue-1773.rs | 3 + gcc/testsuite/rust/compile/issue-1786.rs | 3 + gcc/testsuite/rust/compile/issue-1893.rs | 3 + gcc/testsuite/rust/compile/issue-1901.rs | 3 + gcc/testsuite/rust/compile/issue-1930.rs | 3 + gcc/testsuite/rust/compile/issue-1981.rs | 3 + gcc/testsuite/rust/compile/issue-2019-1.rs | 3 + gcc/testsuite/rust/compile/issue-2019-2.rs | 3 + gcc/testsuite/rust/compile/issue-2019-3.rs | 3 + gcc/testsuite/rust/compile/issue-2036.rs | 3 + gcc/testsuite/rust/compile/issue-2037.rs | 3 + gcc/testsuite/rust/compile/issue-2070.rs | 3 + gcc/testsuite/rust/compile/issue-2105.rs | 3 + gcc/testsuite/rust/compile/issue-2106.rs | 3 + gcc/testsuite/rust/compile/issue-2135.rs | 3 + gcc/testsuite/rust/compile/issue-2136-1.rs | 3 + gcc/testsuite/rust/compile/issue-2136-2.rs | 3 + gcc/testsuite/rust/compile/issue-2139.rs | 3 + gcc/testsuite/rust/compile/issue-2142.rs | 3 + gcc/testsuite/rust/compile/issue-2165.rs | 3 + gcc/testsuite/rust/compile/issue-2166.rs | 3 + gcc/testsuite/rust/compile/issue-2190-1.rs | 3 + gcc/testsuite/rust/compile/issue-2190-2.rs | 3 + gcc/testsuite/rust/compile/issue-2195.rs | 3 + gcc/testsuite/rust/compile/issue-2238.rs | 3 + gcc/testsuite/rust/compile/issue-2304.rs | 3 + gcc/testsuite/rust/compile/issue-2375.rs | 14 ++++ gcc/testsuite/rust/compile/issue-850.rs | 3 + gcc/testsuite/rust/compile/issue-855.rs | 3 + gcc/testsuite/rust/compile/issue-925.rs | 3 + gcc/testsuite/rust/compile/macro-issue1400.rs | 3 + gcc/testsuite/rust/compile/macro20.rs | 3 + gcc/testsuite/rust/compile/macro23.rs | 3 + gcc/testsuite/rust/compile/macro40.rs | 3 + gcc/testsuite/rust/compile/macro54.rs | 3 + .../rust/compile/name_resolution2.rs | 3 + .../rust/compile/name_resolution4.rs | 3 + gcc/testsuite/rust/compile/nested_generic.rs | 3 + .../parse_associated_type_as_generic_arg.rs | 3 + .../parse_associated_type_as_generic_arg2.rs | 3 + .../parse_associated_type_as_generic_arg3.rs | 3 + .../parse_complex_generic_application.rs | 3 + .../parse_complex_generic_application2.rs | 3 + .../rust/compile/path_as_generic_arg.rs | 3 + gcc/testsuite/rust/compile/privacy4.rs | 3 + gcc/testsuite/rust/compile/privacy6.rs | 3 + .../compile/sizeof-stray-infer-var-bug.rs | 3 + .../rust/compile/stmt_with_block_dot.rs | 3 + .../rust/compile/torture/associated_types1.rs | 3 + .../rust/compile/torture/forward_decl_5.rs | 3 + .../rust/compile/torture/generics1.rs | 3 + .../rust/compile/torture/generics10.rs | 3 + .../rust/compile/torture/generics11.rs | 3 + .../rust/compile/torture/generics12.rs | 3 + .../rust/compile/torture/generics13.rs | 3 + .../rust/compile/torture/generics14.rs | 3 + .../rust/compile/torture/generics15.rs | 3 + .../rust/compile/torture/generics16.rs | 3 + .../rust/compile/torture/generics17.rs | 3 + .../rust/compile/torture/generics18.rs | 3 + .../rust/compile/torture/generics19.rs | 3 + .../rust/compile/torture/generics2.rs | 3 + .../rust/compile/torture/generics20.rs | 3 + .../rust/compile/torture/generics21.rs | 3 + .../rust/compile/torture/generics22.rs | 3 + .../rust/compile/torture/generics23.rs | 3 + .../rust/compile/torture/generics24.rs | 3 + .../rust/compile/torture/generics25.rs | 3 + .../rust/compile/torture/generics26.rs | 3 + .../rust/compile/torture/generics27.rs | 3 + .../rust/compile/torture/generics28.rs | 3 + .../rust/compile/torture/generics29.rs | 3 + .../rust/compile/torture/generics3.rs | 3 + .../rust/compile/torture/generics30.rs | 3 + .../rust/compile/torture/generics31.rs | 3 + .../rust/compile/torture/generics32.rs | 3 + .../rust/compile/torture/generics4.rs | 3 + .../rust/compile/torture/generics5.rs | 3 + .../rust/compile/torture/generics6.rs | 3 + .../rust/compile/torture/generics7.rs | 3 + .../rust/compile/torture/generics8.rs | 3 + .../rust/compile/torture/generics9.rs | 3 + .../rust/compile/torture/intrinsics-2.rs | 3 + .../rust/compile/torture/intrinsics-6.rs | 3 + .../rust/compile/torture/intrinsics-7.rs | 3 + .../rust/compile/torture/intrinsics-8.rs | 3 + .../rust/compile/torture/issue-1024.rs | 3 + .../rust/compile/torture/issue-1075.rs | 3 + .../rust/compile/torture/issue-1432.rs | 4 ++ .../rust/compile/torture/issue-1555.rs | 3 + .../rust/compile/torture/issue-368.rs | 3 + .../rust/compile/torture/issue-808.rs | 3 + .../rust/compile/torture/issue-862.rs | 4 ++ .../rust/compile/torture/issue-893-2.rs | 3 + .../rust/compile/torture/issue-893.rs | 3 + .../rust/compile/torture/must_use2.rs | 3 + .../rust/compile/torture/nested_fn2.rs | 3 + .../rust/compile/torture/phantom_data.rs | 3 + .../rust/compile/torture/range-lang-item1.rs | 3 + gcc/testsuite/rust/compile/torture/traits1.rs | 3 + .../rust/compile/torture/traits11.rs | 3 + .../rust/compile/torture/traits12.rs | 3 + .../rust/compile/torture/traits13.rs | 3 + .../rust/compile/torture/traits14.rs | 3 + .../rust/compile/torture/traits15.rs | 3 + .../rust/compile/torture/traits16.rs | 3 + .../rust/compile/torture/traits17.rs | 3 + .../rust/compile/torture/traits18.rs | 3 + .../rust/compile/torture/traits19.rs | 3 + gcc/testsuite/rust/compile/torture/traits2.rs | 3 + gcc/testsuite/rust/compile/torture/traits3.rs | 3 + gcc/testsuite/rust/compile/torture/traits4.rs | 3 + gcc/testsuite/rust/compile/torture/traits5.rs | 3 + gcc/testsuite/rust/compile/torture/traits6.rs | 3 + gcc/testsuite/rust/compile/torture/traits7.rs | 3 + gcc/testsuite/rust/compile/torture/traits8.rs | 3 + gcc/testsuite/rust/compile/torture/traits9.rs | 3 + .../compile/torture/transmute-size-check-1.rs | 3 + .../rust/compile/torture/transmute1.rs | 3 + .../compile/torture/uninit-intrinsic-1.rs | 3 + .../rust/compile/torture/utf8_identifiers.rs | 3 + gcc/testsuite/rust/compile/traits1.rs | 3 + gcc/testsuite/rust/compile/traits10.rs | 3 + gcc/testsuite/rust/compile/traits11.rs | 3 + gcc/testsuite/rust/compile/traits12.rs | 3 + gcc/testsuite/rust/compile/traits2.rs | 3 + gcc/testsuite/rust/compile/traits3.rs | 3 + gcc/testsuite/rust/compile/traits4.rs | 3 + gcc/testsuite/rust/compile/traits5.rs | 3 + gcc/testsuite/rust/compile/traits6.rs | 3 + gcc/testsuite/rust/compile/traits7.rs | 3 + gcc/testsuite/rust/compile/traits8.rs | 3 + gcc/testsuite/rust/compile/traits9.rs | 3 + gcc/testsuite/rust/compile/type-bindings1.rs | 3 + .../rust/compile/unconstrained_type_param.rs | 3 + gcc/testsuite/rust/compile/unsafe10.rs | 3 + .../rust/execute/torture/closure1.rs | 3 + .../rust/execute/torture/closure2.rs | 3 + .../rust/execute/torture/closure3.rs | 3 + .../rust/execute/torture/closure4.rs | 3 + .../rust/execute/torture/coercion1.rs | 3 + .../rust/execute/torture/coercion2.rs | 3 + .../rust/execute/torture/coercion3.rs | 3 + .../execute/torture/copy_nonoverlapping1.rs | 4 +- .../rust/execute/torture/derive_macro1.rs | 3 + .../rust/execute/torture/derive_macro3.rs | 3 + .../rust/execute/torture/derive_macro4.rs | 5 +- gcc/testsuite/rust/execute/torture/index1.rs | 3 + .../rust/execute/torture/issue-1120.rs | 3 + .../rust/execute/torture/issue-1133.rs | 3 + .../rust/execute/torture/issue-1198.rs | 3 + .../rust/execute/torture/issue-1232.rs | 3 + .../rust/execute/torture/issue-1249.rs | 3 + .../rust/execute/torture/issue-1436.rs | 3 + .../rust/execute/torture/issue-1496.rs | 3 + .../rust/execute/torture/issue-1720-2.rs | 3 + .../rust/execute/torture/issue-1720.rs | 3 + .../rust/execute/torture/issue-2052.rs | 3 + .../rust/execute/torture/issue-2179.rs | 3 + .../rust/execute/torture/issue-2180.rs | 3 + .../rust/execute/torture/issue-2236.rs | 3 + .../rust/execute/torture/issue-647.rs | 3 + .../rust/execute/torture/issue-845.rs | 3 + .../rust/execute/torture/issue-851.rs | 3 + .../rust/execute/torture/issue-858.rs | 3 + .../rust/execute/torture/macros23.rs | 3 + .../rust/execute/torture/macros28.rs | 3 + gcc/testsuite/rust/execute/torture/method2.rs | 3 + gcc/testsuite/rust/execute/torture/method3.rs | 3 + gcc/testsuite/rust/execute/torture/method4.rs | 3 + .../execute/torture/operator_overload_1.rs | 3 + .../execute/torture/operator_overload_10.rs | 3 + .../execute/torture/operator_overload_11.rs | 3 + .../execute/torture/operator_overload_12.rs | 3 + .../execute/torture/operator_overload_2.rs | 3 + .../execute/torture/operator_overload_3.rs | 3 + .../execute/torture/operator_overload_4.rs | 3 + .../execute/torture/operator_overload_5.rs | 3 + .../execute/torture/operator_overload_6.rs | 3 + .../execute/torture/operator_overload_7.rs | 3 + .../execute/torture/operator_overload_8.rs | 3 + .../execute/torture/operator_overload_9.rs | 3 + .../rust/execute/torture/prefetch_data.rs | 3 + .../rust/execute/torture/ref-pattern2.rs | 3 + .../rust/execute/torture/slice-magic.rs | 3 + .../rust/execute/torture/slice-magic2.rs | 3 + gcc/testsuite/rust/execute/torture/slice1.rs | 3 + .../rust/execute/torture/str-layout1.rs | 3 + gcc/testsuite/rust/execute/torture/trait1.rs | 3 + gcc/testsuite/rust/execute/torture/trait10.rs | 3 + gcc/testsuite/rust/execute/torture/trait11.rs | 3 + gcc/testsuite/rust/execute/torture/trait12.rs | 3 + gcc/testsuite/rust/execute/torture/trait13.rs | 3 + gcc/testsuite/rust/execute/torture/trait2.rs | 3 + gcc/testsuite/rust/execute/torture/trait3.rs | 3 + gcc/testsuite/rust/execute/torture/trait4.rs | 3 + gcc/testsuite/rust/execute/torture/trait5.rs | 3 + gcc/testsuite/rust/execute/torture/trait6.rs | 3 + gcc/testsuite/rust/execute/torture/trait7.rs | 3 + gcc/testsuite/rust/execute/torture/trait8.rs | 3 + gcc/testsuite/rust/execute/torture/trait9.rs | 3 + .../rust/execute/torture/transmute1.rs | 3 + .../rust/execute/torture/wrapping_op1.rs | 3 + .../rust/execute/torture/wrapping_op2.rs | 3 + gcc/testsuite/rust/link/generic_function_0.rs | 3 + gcc/testsuite/rust/link/generic_function_1.rs | 3 + 263 files changed, 925 insertions(+), 55 deletions(-) create mode 100644 gcc/testsuite/rust/compile/issue-2375.rs diff --git a/gcc/rust/expand/rust-proc-macro.cc b/gcc/rust/expand/rust-proc-macro.cc index e9e79181646b..541a0100ea82 100644 --- a/gcc/rust/expand/rust-proc-macro.cc +++ b/gcc/rust/expand/rust-proc-macro.cc @@ -31,7 +31,7 @@ namespace { ProcMacro::Literal literal_from_string (const std::string &data, bool &error) { - Lexer lex (data); + Lexer lex (data, nullptr); const_TokenPtr output = lex.build_token (); if (output == nullptr || !output->is_literal ()) { @@ -48,7 +48,7 @@ ProcMacro::TokenStream tokenstream_from_string (std::string &data, bool &lex_error) { // FIXME: Insert location pointing to call site in tokens - Lexer lex (data); + Lexer lex (data, nullptr); std::vector tokens; TokenPtr ptr; diff --git a/gcc/rust/lex/rust-lex.cc b/gcc/rust/lex/rust-lex.cc index a59440f902dd..c40e70021aef 100644 --- a/gcc/rust/lex/rust-lex.cc +++ b/gcc/rust/lex/rust-lex.cc @@ -136,9 +136,9 @@ is_identifier_continue (uint32_t codepoint) return check_xid_property (codepoint) & XID_CONTINUE; } -Lexer::Lexer (const std::string &input) +Lexer::Lexer (const std::string &input, Linemap *linemap) : input (RAIIFile::create_error ()), current_line (1), current_column (1), - line_map (nullptr), dump_lex_out ({}), + line_map (linemap), dump_lex_out ({}), raw_input_source (new BufferInputSource (input, 0)), input_queue{*raw_input_source}, token_queue (TokenSource (this)) {} diff --git a/gcc/rust/lex/rust-lex.h b/gcc/rust/lex/rust-lex.h index 3f271feaff16..bb342912b3e8 100644 --- a/gcc/rust/lex/rust-lex.h +++ b/gcc/rust/lex/rust-lex.h @@ -161,7 +161,7 @@ class Lexer tl::optional dump_lex_opt = tl::nullopt); // Lex the contents of a string instead of a file - Lexer (const std::string &input); + Lexer (const std::string &input, Linemap *linemap); // dtor ~Lexer (); diff --git a/gcc/rust/parse/rust-cfg-parser.cc b/gcc/rust/parse/rust-cfg-parser.cc index 0a62dd11ede9..f8593998527f 100644 --- a/gcc/rust/parse/rust-cfg-parser.cc +++ b/gcc/rust/parse/rust-cfg-parser.cc @@ -27,7 +27,7 @@ parse_cfg_option (std::string &input, std::string &key, std::string &value) key.clear (); value.clear (); - auto lexer = Lexer (input); + auto lexer = Lexer (input, nullptr); auto parser = Parser (lexer); auto token = parser.peek_current_token (); diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc index b9d8cbc84390..98c7e662201c 100644 --- a/gcc/rust/rust-session-manager.cc +++ b/gcc/rust/rust-session-manager.cc @@ -1021,7 +1021,7 @@ Session::load_extern_crate (const std::string &crate_name, location_t locus) mappings->set_current_crate (crate_num); // then lets parse this as a 2nd crate - Lexer lex (extern_crate.get_metadata ()); + Lexer lex (extern_crate.get_metadata (), linemap); Parser parser (lex); std::unique_ptr metadata_crate = parser.parse_crate (); diff --git a/gcc/rust/typecheck/rust-hir-trait-resolve.cc b/gcc/rust/typecheck/rust-hir-trait-resolve.cc index fed1de2869bd..1d0fee7909fc 100644 --- a/gcc/rust/typecheck/rust-hir-trait-resolve.cc +++ b/gcc/rust/typecheck/rust-hir-trait-resolve.cc @@ -164,8 +164,8 @@ TraitResolver::resolve_trait (HIR::Trait *trait_reference) TyTy::BaseType *self = nullptr; std::vector substitutions; - // FIXME - // this should use the resolve_generic_params like everywhere else + // this needs to be special cased for the sized trait to not auto implemented + // Sized on Self for (auto &generic_param : trait_reference->get_generic_params ()) { switch (generic_param.get ()->get_kind ()) @@ -177,16 +177,22 @@ TraitResolver::resolve_trait (HIR::Trait *trait_reference) break; case HIR::GenericParam::GenericKind::TYPE: { + auto &typaram = static_cast (*generic_param); + bool is_self + = typaram.get_type_representation ().as_string ().compare ("Self") + == 0; + + // https://doc.rust-lang.org/std/marker/trait.Sized.html + // The one exception is the implicit Self type of a trait + bool apply_sized = !is_self; auto param_type - = TypeResolveGenericParam::Resolve (generic_param.get ()); + = TypeResolveGenericParam::Resolve (generic_param.get (), + apply_sized); context->insert_type (generic_param->get_mappings (), param_type); - - auto &typaram = static_cast (*generic_param); substitutions.push_back ( TyTy::SubstitutionParamMapping (typaram, param_type)); - if (typaram.get_type_representation ().as_string ().compare ("Self") - == 0) + if (is_self) { rust_assert (param_type->get_kind () == TyTy::TypeKind::PARAM); TyTy::ParamType *p diff --git a/gcc/rust/typecheck/rust-hir-type-check-base.cc b/gcc/rust/typecheck/rust-hir-type-check-base.cc index 16653adab3b1..902ce9ebfda8 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-base.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-base.cc @@ -19,6 +19,7 @@ #include "rust-hir-type-check-base.h" #include "rust-hir-type-check-expr.h" #include "rust-hir-type-check-type.h" +#include "rust-hir-trait-resolve.h" #include "rust-type-util.h" namespace Rust { @@ -399,5 +400,21 @@ TypeCheckBase::resolve_generic_params ( } } +TyTy::TypeBoundPredicate +TypeCheckBase::get_marker_predicate (Analysis::RustLangItem::ItemType item_type, + location_t locus) +{ + DefId item_id = mappings->get_lang_item (item_type, locus); + HIR::Item *item = mappings->lookup_defid (item_id); + rust_assert (item != nullptr); + rust_assert (item->get_item_kind () == HIR::Item::ItemKind::Trait); + + HIR::Trait &trait = *static_cast (item); + TraitReference *ref = TraitResolver::Resolve (trait); + rust_assert (ref != nullptr); + + return TyTy::TypeBoundPredicate (*ref, BoundPolarity::RegularBound, locus); +} + } // namespace Resolver } // namespace Rust diff --git a/gcc/rust/typecheck/rust-hir-type-check-base.h b/gcc/rust/typecheck/rust-hir-type-check-base.h index 7cea1013eaf8..351356503cdb 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-base.h +++ b/gcc/rust/typecheck/rust-hir-type-check-base.h @@ -38,7 +38,9 @@ class TypeCheckBase TraitReference *resolve_trait_path (HIR::TypePath &); TyTy::TypeBoundPredicate - get_predicate_from_bound (HIR::TypePath &path, HIR::Type *associated_self); + get_predicate_from_bound (HIR::TypePath &path, HIR::Type *associated_self, + BoundPolarity polarity + = BoundPolarity::RegularBound); bool check_for_unconstrained ( const std::vector ¶ms_to_constrain, @@ -56,6 +58,10 @@ class TypeCheckBase const std::vector > &generic_params, std::vector &substitutions); + TyTy::TypeBoundPredicate + get_marker_predicate (Analysis::RustLangItem::ItemType item_type, + location_t locus); + Analysis::Mappings *mappings; Resolver *resolver; TypeCheckContext *context; diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.cc b/gcc/rust/typecheck/rust-hir-type-check-type.cc index d684068b91b4..b4c62b57dfd8 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-type.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-type.cc @@ -673,9 +673,9 @@ TypeCheckType::visit (HIR::NeverType &type) } TyTy::ParamType * -TypeResolveGenericParam::Resolve (HIR::GenericParam *param) +TypeResolveGenericParam::Resolve (HIR::GenericParam *param, bool apply_sized) { - TypeResolveGenericParam resolver; + TypeResolveGenericParam resolver (apply_sized); switch (param->get_kind ()) { case HIR::GenericParam::GenericKind::TYPE: @@ -733,8 +733,26 @@ TypeResolveGenericParam::visit (HIR::TypeParam ¶m) = new HIR::TypePath (mappings, {}, BUILTINS_LOCATION, false); } + std::map> predicates; + + // https://doc.rust-lang.org/std/marker/trait.Sized.html + // All type parameters have an implicit bound of Sized. The special syntax + // ?Sized can be used to remove this bound if it’s not appropriate. + // + // We can only do this when we are not resolving the implicit Self for Sized + // itself + rust_debug_loc (param.get_locus (), "apply_sized: %s", + apply_sized ? "true" : "false"); + if (apply_sized) + { + TyTy::TypeBoundPredicate sized_predicate + = get_marker_predicate (Analysis::RustLangItem::ItemType::SIZED, + param.get_locus ()); + + predicates[sized_predicate.get_id ()] = {sized_predicate}; + } + // resolve the bounds - std::vector specified_bounds; if (param.has_type_param_bounds ()) { for (auto &bound : param.get_type_param_bounds ()) @@ -747,9 +765,40 @@ TypeResolveGenericParam::visit (HIR::TypeParam ¶m) TyTy::TypeBoundPredicate predicate = get_predicate_from_bound (b->get_path (), - implicit_self_bound); + implicit_self_bound, + b->get_polarity ()); if (!predicate.is_error ()) - specified_bounds.push_back (std::move (predicate)); + { + switch (predicate.get_polarity ()) + { + case BoundPolarity::AntiBound: { + bool found = predicates.find (predicate.get_id ()) + != predicates.end (); + if (found) + predicates.erase (predicate.get_id ()); + else + { + // emit error message + rich_location r (line_table, b->get_locus ()); + r.add_range (predicate.get ()->get_locus ()); + rust_error_at ( + r, "antibound for %s is not applied here", + predicate.get ()->get_name ().c_str ()); + } + } + break; + + default: { + if (predicates.find (predicate.get_id ()) + == predicates.end ()) + { + predicates[predicate.get_id ()] = {}; + } + predicates[predicate.get_id ()].push_back (predicate); + } + break; + } + } } break; @@ -759,6 +808,16 @@ TypeResolveGenericParam::visit (HIR::TypeParam ¶m) } } + // now to flat map the specified_bounds into the raw specified predicates + std::vector specified_bounds; + for (auto it = predicates.begin (); it != predicates.end (); it++) + { + for (const auto &predicate : it->second) + { + specified_bounds.push_back (predicate); + } + } + resolved = new TyTy::ParamType (param.get_type_representation ().as_string (), param.get_locus (), param.get_mappings ().get_hirid (), param, diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.h b/gcc/rust/typecheck/rust-hir-type-check-type.h index 83d54b626b6b..9d6d4b43633c 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-type.h +++ b/gcc/rust/typecheck/rust-hir-type-check-type.h @@ -96,7 +96,8 @@ class TypeCheckType : public TypeCheckBase, public HIR::HIRTypeVisitor class TypeResolveGenericParam : public TypeCheckBase { public: - static TyTy::ParamType *Resolve (HIR::GenericParam *param); + static TyTy::ParamType *Resolve (HIR::GenericParam *param, + bool apply_sized = true); protected: void visit (HIR::TypeParam ¶m); @@ -104,9 +105,12 @@ class TypeResolveGenericParam : public TypeCheckBase void visit (HIR::ConstGenericParam ¶m); private: - TypeResolveGenericParam () : TypeCheckBase (), resolved (nullptr) {} + TypeResolveGenericParam (bool apply_sized) + : TypeCheckBase (), resolved (nullptr), apply_sized (apply_sized) + {} TyTy::ParamType *resolved; + bool apply_sized; }; class ResolveWhereClauseItem : public TypeCheckBase diff --git a/gcc/rust/typecheck/rust-typecheck-context.cc b/gcc/rust/typecheck/rust-typecheck-context.cc index 606f97c06513..d65a679d7162 100644 --- a/gcc/rust/typecheck/rust-typecheck-context.cc +++ b/gcc/rust/typecheck/rust-typecheck-context.cc @@ -345,7 +345,6 @@ void TypeCheckContext::insert_autoderef_mappings ( HirId id, std::vector &&adjustments) { - rust_assert (autoderef_mappings.find (id) == autoderef_mappings.end ()); autoderef_mappings.emplace (id, std::move (adjustments)); } @@ -365,8 +364,6 @@ void TypeCheckContext::insert_cast_autoderef_mappings ( HirId id, std::vector &&adjustments) { - rust_assert (cast_autoderef_mappings.find (id) - == cast_autoderef_mappings.end ()); cast_autoderef_mappings.emplace (id, std::move (adjustments)); } diff --git a/gcc/rust/typecheck/rust-tyty-bounds.cc b/gcc/rust/typecheck/rust-tyty-bounds.cc index 6a910e2cc881..791740dc534a 100644 --- a/gcc/rust/typecheck/rust-tyty-bounds.cc +++ b/gcc/rust/typecheck/rust-tyty-bounds.cc @@ -103,18 +103,22 @@ TypeBoundsProbe::assemble_sized_builtin () { const TyTy::BaseType *raw = receiver->destructure (); - // does this thing actually implement sized? + // https://runrust.miraheze.org/wiki/Dynamically_Sized_Type + // everything is sized except for: + // + // 1. dyn traits + // 2. slices + // 3. str + // 4. ADT's which contain any of the above + // t. tuples which contain any of the above switch (raw->get_kind ()) { - case TyTy::ADT: - case TyTy::STR: + case TyTy::ARRAY: case TyTy::REF: case TyTy::POINTER: case TyTy::PARAM: - case TyTy::SLICE: case TyTy::FNDEF: case TyTy::FNPTR: - case TyTy::TUPLE: case TyTy::BOOL: case TyTy::CHAR: case TyTy::INT: @@ -124,13 +128,21 @@ TypeBoundsProbe::assemble_sized_builtin () case TyTy::ISIZE: case TyTy::CLOSURE: case TyTy::INFER: - assemble_builtin_candidate (Analysis::RustLangItem::SIZED); - break; - - case TyTy::ARRAY: case TyTy::NEVER: case TyTy::PLACEHOLDER: case TyTy::PROJECTION: + assemble_builtin_candidate (Analysis::RustLangItem::SIZED); + break; + + // FIXME str and slice need to be moved and test cases updated + case TyTy::SLICE: + case TyTy::STR: + case TyTy::ADT: + case TyTy::TUPLE: + // FIXME add extra checks + assemble_builtin_candidate (Analysis::RustLangItem::SIZED); + break; + case TyTy::DYNAMIC: case TyTy::ERROR: break; @@ -171,7 +183,8 @@ TypeCheckBase::resolve_trait_path (HIR::TypePath &path) TyTy::TypeBoundPredicate TypeCheckBase::get_predicate_from_bound (HIR::TypePath &type_path, - HIR::Type *associated_self) + HIR::Type *associated_self, + BoundPolarity polarity) { TyTy::TypeBoundPredicate lookup = TyTy::TypeBoundPredicate::error (); bool already_resolved @@ -184,8 +197,7 @@ TypeCheckBase::get_predicate_from_bound (HIR::TypePath &type_path, if (trait->is_error ()) return TyTy::TypeBoundPredicate::error (); - TyTy::TypeBoundPredicate predicate (*trait, BoundPolarity::RegularBound, - type_path.get_locus ()); + TyTy::TypeBoundPredicate predicate (*trait, polarity, type_path.get_locus ()); HIR::GenericArgs args = HIR::GenericArgs::create_empty (type_path.get_locus ()); @@ -234,7 +246,8 @@ TypeCheckBase::get_predicate_from_bound (HIR::TypePath &type_path, TypeCheckType::Resolve (fn.get_return_type ().get ()); HIR::TraitItem *trait_item = mappings->lookup_trait_item_lang_item ( - Analysis::RustLangItem::ItemType::FN_ONCE_OUTPUT); + Analysis::RustLangItem::ItemType::FN_ONCE_OUTPUT, + final_seg->get_locus ()); std::vector bindings; location_t output_locus = fn.get_return_type ()->get_locus (); @@ -609,10 +622,11 @@ TypeBoundPredicate::handle_substitions ( TyTy::BaseType *type = it.second; TypeBoundPredicateItem item = lookup_associated_item (identifier); - rust_assert (!item.is_error ()); - - const auto item_ref = item.get_raw_item (); - item_ref->associated_type_set (type); + if (!item.is_error ()) + { + const auto item_ref = item.get_raw_item (); + item_ref->associated_type_set (type); + } } // FIXME more error handling at some point diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc index ce9571cae8e1..cf907e935674 100644 --- a/gcc/rust/util/rust-hir-map.cc +++ b/gcc/rust/util/rust-hir-map.cc @@ -1266,16 +1266,23 @@ Mappings::lookup_builtin_marker () return builtinMarker; } -HIR::TraitItem * -Mappings::lookup_trait_item_lang_item (Analysis::RustLangItem::ItemType item) +DefId +Mappings::get_lang_item (RustLangItem::ItemType item_type, location_t locus) { - DefId trait_item_id = UNKNOWN_DEFID; - bool trait_item_lang_item_defined = lookup_lang_item (item, &trait_item_id); + DefId item = UNKNOWN_DEFID; + bool ok = lookup_lang_item (item_type, &item); + if (!ok) + rust_fatal_error (locus, "failed to find lang item %s", + RustLangItem::ToString (item_type).c_str ()); - // FIXME - // make this an error? what does rustc do when a lang item is not defined? - rust_assert (trait_item_lang_item_defined); + return item; +} +HIR::TraitItem * +Mappings::lookup_trait_item_lang_item (Analysis::RustLangItem::ItemType item, + location_t locus) +{ + DefId trait_item_id = get_lang_item (item, locus); return lookup_trait_item_defid (trait_item_id); } diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h index e1f610674e48..bf3ed90dc1a5 100644 --- a/gcc/rust/util/rust-hir-map.h +++ b/gcc/rust/util/rust-hir-map.h @@ -271,6 +271,9 @@ class Mappings return true; } + // This will fatal_error when this lang item does not exist + DefId get_lang_item (RustLangItem::ItemType item_type, location_t locus); + void insert_macro_def (AST::MacroRulesDefinition *macro); bool lookup_macro_def (NodeId id, AST::MacroRulesDefinition **def); @@ -342,7 +345,8 @@ class Mappings HIR::ImplBlock *lookup_builtin_marker (); HIR::TraitItem * - lookup_trait_item_lang_item (Analysis::RustLangItem::ItemType item); + lookup_trait_item_lang_item (Analysis::RustLangItem::ItemType item, + location_t locus); private: Mappings (); diff --git a/gcc/rust/util/rust-token-converter.cc b/gcc/rust/util/rust-token-converter.cc index d9fb85caa83e..67d073d5e153 100644 --- a/gcc/rust/util/rust-token-converter.cc +++ b/gcc/rust/util/rust-token-converter.cc @@ -279,7 +279,7 @@ from_ident (const ProcMacro::Ident &ident, std::vector &result) if (ident.is_raw) value = "r#" + value; - Lexer lexer (value); + Lexer lexer (value, nullptr); auto token = lexer.build_token (); token->set_locus (convert (ident.span)); result.push_back (token); @@ -349,7 +349,7 @@ from_punct (const ProcMacro::Punct &punct, std::vector &acc, { // TODO: UTF-8 string std::string whole (acc.begin (), acc.end ()); - auto lexer = Lexer (whole); + auto lexer = Lexer (whole, nullptr); auto token = lexer.build_token (); token->set_locus (convert (punct.span)); result.push_back (token); diff --git a/gcc/testsuite/rust/compile/bounds1.rs b/gcc/testsuite/rust/compile/bounds1.rs index 1ace9fbbf305..a02e6f63eb97 100644 --- a/gcc/testsuite/rust/compile/bounds1.rs +++ b/gcc/testsuite/rust/compile/bounds1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + mod core { mod ops { #[lang = "add"] diff --git a/gcc/testsuite/rust/compile/canonical_paths1.rs b/gcc/testsuite/rust/compile/canonical_paths1.rs index 193e7b5b6980..bd6f3b27547c 100644 --- a/gcc/testsuite/rust/compile/canonical_paths1.rs +++ b/gcc/testsuite/rust/compile/canonical_paths1.rs @@ -1,4 +1,7 @@ // { dg-additional-options "-w -fdump-tree-gimple -frust-crate=example" } +#[lang = "sized"] +pub trait Sized {} + struct Foo(i32); trait TR { diff --git a/gcc/testsuite/rust/compile/cast_generics.rs b/gcc/testsuite/rust/compile/cast_generics.rs index 7d185964e50a..469fa942ea0c 100644 --- a/gcc/testsuite/rust/compile/cast_generics.rs +++ b/gcc/testsuite/rust/compile/cast_generics.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + fn test(a: T) -> T { a } diff --git a/gcc/testsuite/rust/compile/closure_no_type_anno.rs b/gcc/testsuite/rust/compile/closure_no_type_anno.rs index ff2c8b88a8ab..b647da7b5957 100644 --- a/gcc/testsuite/rust/compile/closure_no_type_anno.rs +++ b/gcc/testsuite/rust/compile/closure_no_type_anno.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + #[lang = "fn_once"] trait FnOnce { type Output; diff --git a/gcc/testsuite/rust/compile/complex_qualified_path_in_expr.rs b/gcc/testsuite/rust/compile/complex_qualified_path_in_expr.rs index 6244a6bf1009..5036410aca58 100644 --- a/gcc/testsuite/rust/compile/complex_qualified_path_in_expr.rs +++ b/gcc/testsuite/rust/compile/complex_qualified_path_in_expr.rs @@ -1,4 +1,7 @@ -struct S; // { dg-warning "struct is never constructed" "" { target *-*-* } .-1 } +#[lang = "sized"] +pub trait Sized {} + +struct S; // { dg-warning "struct is never constructed" } impl S { fn f() -> i32 { return 0; } // { dg-warning "associated function is never used" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/const-issue1440.rs b/gcc/testsuite/rust/compile/const-issue1440.rs index 2529a1c0fa84..3a2989cc8d02 100644 --- a/gcc/testsuite/rust/compile/const-issue1440.rs +++ b/gcc/testsuite/rust/compile/const-issue1440.rs @@ -1,6 +1,9 @@ // { dg-additional-options "-w" } #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + mod intrinsics { extern "rust-intrinsic" { pub fn wrapping_add(a: T, b: T) -> T; diff --git a/gcc/testsuite/rust/compile/const_generics_1.rs b/gcc/testsuite/rust/compile/const_generics_1.rs index bcad8ee6a197..5d4ca64c81d8 100644 --- a/gcc/testsuite/rust/compile/const_generics_1.rs +++ b/gcc/testsuite/rust/compile/const_generics_1.rs @@ -3,6 +3,9 @@ // There are errors about unused generic parameters, but we can't handle that yet. // Still, this code is invalid Rust. +#[lang = "sized"] +pub trait Sized {} + mod sain { struct Foo; struct Bar; diff --git a/gcc/testsuite/rust/compile/const_generics_8.rs b/gcc/testsuite/rust/compile/const_generics_8.rs index b0bb2624a2c3..c7810830f466 100644 --- a/gcc/testsuite/rust/compile/const_generics_8.rs +++ b/gcc/testsuite/rust/compile/const_generics_8.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Bidule {} enum Bidoule {} diff --git a/gcc/testsuite/rust/compile/derive_macro1.rs b/gcc/testsuite/rust/compile/derive_macro1.rs index 131822820b0e..779aad78e11d 100644 --- a/gcc/testsuite/rust/compile/derive_macro1.rs +++ b/gcc/testsuite/rust/compile/derive_macro1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Clone { fn clone(&self) -> Self; } diff --git a/gcc/testsuite/rust/compile/derive_macro3.rs b/gcc/testsuite/rust/compile/derive_macro3.rs index 35284d8fa3b7..1c7d4737bfe9 100644 --- a/gcc/testsuite/rust/compile/derive_macro3.rs +++ b/gcc/testsuite/rust/compile/derive_macro3.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Clone { fn clone(&self) -> Self; } diff --git a/gcc/testsuite/rust/compile/derive_macro4.rs b/gcc/testsuite/rust/compile/derive_macro4.rs index 564555f896f2..7802e8fd8000 100644 --- a/gcc/testsuite/rust/compile/derive_macro4.rs +++ b/gcc/testsuite/rust/compile/derive_macro4.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Copy {} pub trait Clone { fn clone(&self) -> Self; diff --git a/gcc/testsuite/rust/compile/derive_macro6.rs b/gcc/testsuite/rust/compile/derive_macro6.rs index 0254754f7aec..b7bf7a78acd1 100644 --- a/gcc/testsuite/rust/compile/derive_macro6.rs +++ b/gcc/testsuite/rust/compile/derive_macro6.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Copy {} pub trait Clone { fn clone(&self) -> Self; diff --git a/gcc/testsuite/rust/compile/expected_type_args2.rs b/gcc/testsuite/rust/compile/expected_type_args2.rs index 79454202aadf..11a70bec6d46 100644 --- a/gcc/testsuite/rust/compile/expected_type_args2.rs +++ b/gcc/testsuite/rust/compile/expected_type_args2.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(A); fn main() { diff --git a/gcc/testsuite/rust/compile/expected_type_args3.rs b/gcc/testsuite/rust/compile/expected_type_args3.rs index ba07239207a6..7003f7abcf70 100644 --- a/gcc/testsuite/rust/compile/expected_type_args3.rs +++ b/gcc/testsuite/rust/compile/expected_type_args3.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(A); impl Foo { diff --git a/gcc/testsuite/rust/compile/generics1.rs b/gcc/testsuite/rust/compile/generics1.rs index de1bbf5dafb1..e9bdb3a28457 100644 --- a/gcc/testsuite/rust/compile/generics1.rs +++ b/gcc/testsuite/rust/compile/generics1.rs @@ -1,5 +1,8 @@ // { dg-error "expected .i32. got .i8." "" { target *-*-* } 0 } +#[lang = "sized"] +pub trait Sized {} + struct GenericStruct(T, usize); fn main() { diff --git a/gcc/testsuite/rust/compile/generics11.rs b/gcc/testsuite/rust/compile/generics11.rs index 4d3b9e1777c1..10b5880d5bcb 100644 --- a/gcc/testsuite/rust/compile/generics11.rs +++ b/gcc/testsuite/rust/compile/generics11.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(T, bool); impl Foo { diff --git a/gcc/testsuite/rust/compile/generics12.rs b/gcc/testsuite/rust/compile/generics12.rs index f1ac8b0314b4..b32f56679caf 100644 --- a/gcc/testsuite/rust/compile/generics12.rs +++ b/gcc/testsuite/rust/compile/generics12.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + fn main() { bar(); // { dg-error "type annotations needed" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/generics2.rs b/gcc/testsuite/rust/compile/generics2.rs index 5812b1330388..fc203abc4510 100644 --- a/gcc/testsuite/rust/compile/generics2.rs +++ b/gcc/testsuite/rust/compile/generics2.rs @@ -1,5 +1,8 @@ // { dg-error "expected .i32. got .i8." "" { target *-*-* } 0 } +#[lang = "sized"] +pub trait Sized {} + struct GenericStruct(T, usize); fn main() { diff --git a/gcc/testsuite/rust/compile/generics3.rs b/gcc/testsuite/rust/compile/generics3.rs index 2d4210588fb5..e28953c14f8c 100644 --- a/gcc/testsuite/rust/compile/generics3.rs +++ b/gcc/testsuite/rust/compile/generics3.rs @@ -1,4 +1,7 @@ // { dg-error "expected .i32. got .i8." "" { target *-*-* } 0 } +#[lang = "sized"] +pub trait Sized {} + struct GenericStruct(T, usize); fn main() { diff --git a/gcc/testsuite/rust/compile/generics4.rs b/gcc/testsuite/rust/compile/generics4.rs index e8fe23cd2688..31b681abb10e 100644 --- a/gcc/testsuite/rust/compile/generics4.rs +++ b/gcc/testsuite/rust/compile/generics4.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct GenericStruct(T, usize); fn main() { diff --git a/gcc/testsuite/rust/compile/generics6.rs b/gcc/testsuite/rust/compile/generics6.rs index ad5b682d0ba7..00b93c33ebee 100644 --- a/gcc/testsuite/rust/compile/generics6.rs +++ b/gcc/testsuite/rust/compile/generics6.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo { a: A, } diff --git a/gcc/testsuite/rust/compile/generics7.rs b/gcc/testsuite/rust/compile/generics7.rs index aeb91a6fb419..f2cd607a330c 100644 --- a/gcc/testsuite/rust/compile/generics7.rs +++ b/gcc/testsuite/rust/compile/generics7.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo { a: A, } diff --git a/gcc/testsuite/rust/compile/generics8.rs b/gcc/testsuite/rust/compile/generics8.rs index ceefc5d2c6a3..99df0c9b58cc 100644 --- a/gcc/testsuite/rust/compile/generics8.rs +++ b/gcc/testsuite/rust/compile/generics8.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(A, B); impl Foo { diff --git a/gcc/testsuite/rust/compile/if_let_expr.rs b/gcc/testsuite/rust/compile/if_let_expr.rs index ffa367b69c34..7bab19a1ef03 100644 --- a/gcc/testsuite/rust/compile/if_let_expr.rs +++ b/gcc/testsuite/rust/compile/if_let_expr.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub enum Option { None, Some(T), diff --git a/gcc/testsuite/rust/compile/issue-1005.rs b/gcc/testsuite/rust/compile/issue-1005.rs index 46c85eea91e8..15d4bef08c2a 100644 --- a/gcc/testsuite/rust/compile/issue-1005.rs +++ b/gcc/testsuite/rust/compile/issue-1005.rs @@ -1,4 +1,7 @@ // { dg-additional-options "-w" } +#[lang = "sized"] +pub trait Sized {} + impl *const T { fn test(self) {} } diff --git a/gcc/testsuite/rust/compile/issue-1019.rs b/gcc/testsuite/rust/compile/issue-1019.rs index aea86a821c77..1f77ba9d31d6 100644 --- a/gcc/testsuite/rust/compile/issue-1019.rs +++ b/gcc/testsuite/rust/compile/issue-1019.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait A { type Output; diff --git a/gcc/testsuite/rust/compile/issue-1031.rs b/gcc/testsuite/rust/compile/issue-1031.rs index a9049de96fba..cd1da47362aa 100644 --- a/gcc/testsuite/rust/compile/issue-1031.rs +++ b/gcc/testsuite/rust/compile/issue-1031.rs @@ -1,5 +1,8 @@ #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] pub fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/compile/issue-1034.rs b/gcc/testsuite/rust/compile/issue-1034.rs index 23d770054524..d40005ec5d97 100644 --- a/gcc/testsuite/rust/compile/issue-1034.rs +++ b/gcc/testsuite/rust/compile/issue-1034.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { type Output; diff --git a/gcc/testsuite/rust/compile/issue-1128.rs b/gcc/testsuite/rust/compile/issue-1128.rs index 462426b679da..8960ebbea63d 100644 --- a/gcc/testsuite/rust/compile/issue-1128.rs +++ b/gcc/testsuite/rust/compile/issue-1128.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Hasher { fn write(&mut self, bytes: &[u8]); fn write_u8(&mut self, i: u8) { diff --git a/gcc/testsuite/rust/compile/issue-1129-2.rs b/gcc/testsuite/rust/compile/issue-1129-2.rs index 25d30faf4aa9..cfe01b5b4db5 100644 --- a/gcc/testsuite/rust/compile/issue-1129-2.rs +++ b/gcc/testsuite/rust/compile/issue-1129-2.rs @@ -1,4 +1,7 @@ // { dg-additional-options "-w" } +#[lang = "sized"] +pub trait Sized {} + pub trait Hasher { fn finish(&self) -> u64; fn write(&mut self, bytes: &[u8]); diff --git a/gcc/testsuite/rust/compile/issue-1130.rs b/gcc/testsuite/rust/compile/issue-1130.rs index 6d265cb6044a..115e6aad2f15 100644 --- a/gcc/testsuite/rust/compile/issue-1130.rs +++ b/gcc/testsuite/rust/compile/issue-1130.rs @@ -1,6 +1,9 @@ // { dg-additional-options "-w" } #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + mod mem { extern "rust-intrinsic" { fn size_of() -> usize; diff --git a/gcc/testsuite/rust/compile/issue-1131.rs b/gcc/testsuite/rust/compile/issue-1131.rs index 5cb9caf81f0a..86eeb98453ac 100644 --- a/gcc/testsuite/rust/compile/issue-1131.rs +++ b/gcc/testsuite/rust/compile/issue-1131.rs @@ -1,5 +1,8 @@ #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { fn size_of() -> usize; fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/compile/issue-1165.rs b/gcc/testsuite/rust/compile/issue-1165.rs index f5889698d70e..a6378239519e 100644 --- a/gcc/testsuite/rust/compile/issue-1165.rs +++ b/gcc/testsuite/rust/compile/issue-1165.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(T); fn main() { diff --git a/gcc/testsuite/rust/compile/issue-1173.rs b/gcc/testsuite/rust/compile/issue-1173.rs index 5c2a9173241d..a8fd93eea1b1 100644 --- a/gcc/testsuite/rust/compile/issue-1173.rs +++ b/gcc/testsuite/rust/compile/issue-1173.rs @@ -2,6 +2,9 @@ #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + mod mem { extern "rust-intrinsic" { pub fn transmute(_: U) -> V; diff --git a/gcc/testsuite/rust/compile/issue-1235.rs b/gcc/testsuite/rust/compile/issue-1235.rs index 098b337455fe..7c85ac4a6b00 100644 --- a/gcc/testsuite/rust/compile/issue-1235.rs +++ b/gcc/testsuite/rust/compile/issue-1235.rs @@ -1,4 +1,7 @@ // { dg-additional-options "-w" } +#[lang = "sized"] +pub trait Sized {} + struct FatPtr { data: *const T, len: usize, diff --git a/gcc/testsuite/rust/compile/issue-1237.rs b/gcc/testsuite/rust/compile/issue-1237.rs index 54a51df156fb..79b60b07b522 100644 --- a/gcc/testsuite/rust/compile/issue-1237.rs +++ b/gcc/testsuite/rust/compile/issue-1237.rs @@ -1,6 +1,9 @@ // { dg-additional-options "-w" } #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + mod intrinsics { extern "rust-intrinsic" { pub fn offset(ptr: *const T, count: isize) -> *const T; diff --git a/gcc/testsuite/rust/compile/issue-1289.rs b/gcc/testsuite/rust/compile/issue-1289.rs index 3d7716a1d8ca..9251d79290bb 100644 --- a/gcc/testsuite/rust/compile/issue-1289.rs +++ b/gcc/testsuite/rust/compile/issue-1289.rs @@ -1,5 +1,8 @@ #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "C" { fn printf(s: *const i8, ...); } diff --git a/gcc/testsuite/rust/compile/issue-1383.rs b/gcc/testsuite/rust/compile/issue-1383.rs index cca12e8fc714..dac4b2a12552 100644 --- a/gcc/testsuite/rust/compile/issue-1383.rs +++ b/gcc/testsuite/rust/compile/issue-1383.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub fn generic_function(a: X) -> X { a } diff --git a/gcc/testsuite/rust/compile/issue-1447.rs b/gcc/testsuite/rust/compile/issue-1447.rs index e0543e6247c4..6d58f7a6eea3 100644 --- a/gcc/testsuite/rust/compile/issue-1447.rs +++ b/gcc/testsuite/rust/compile/issue-1447.rs @@ -1,4 +1,7 @@ // { dg-options "-w" } +#[lang = "sized"] +pub trait Sized {} + struct PhantomData; struct Hasher { diff --git a/gcc/testsuite/rust/compile/issue-1589.rs b/gcc/testsuite/rust/compile/issue-1589.rs index 79a5866e4aff..45f2415a8131 100644 --- a/gcc/testsuite/rust/compile/issue-1589.rs +++ b/gcc/testsuite/rust/compile/issue-1589.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait A: B {} // { dg-error "trait cycle detected" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/issue-1725-1.rs b/gcc/testsuite/rust/compile/issue-1725-1.rs index 1ace9fbbf305..a02e6f63eb97 100644 --- a/gcc/testsuite/rust/compile/issue-1725-1.rs +++ b/gcc/testsuite/rust/compile/issue-1725-1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + mod core { mod ops { #[lang = "add"] diff --git a/gcc/testsuite/rust/compile/issue-1725-2.rs b/gcc/testsuite/rust/compile/issue-1725-2.rs index 8bfd0bbd9246..01ed287f545e 100644 --- a/gcc/testsuite/rust/compile/issue-1725-2.rs +++ b/gcc/testsuite/rust/compile/issue-1725-2.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + mod core { mod ops { #[lang = "add"] diff --git a/gcc/testsuite/rust/compile/issue-1773.rs b/gcc/testsuite/rust/compile/issue-1773.rs index c627ac09cecb..a4542aea00b0 100644 --- a/gcc/testsuite/rust/compile/issue-1773.rs +++ b/gcc/testsuite/rust/compile/issue-1773.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { type A; diff --git a/gcc/testsuite/rust/compile/issue-1786.rs b/gcc/testsuite/rust/compile/issue-1786.rs index f73b63d0cb67..1c46fee6a870 100644 --- a/gcc/testsuite/rust/compile/issue-1786.rs +++ b/gcc/testsuite/rust/compile/issue-1786.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + #[lang = "clone"] trait Clone { fn clone(&self) -> Self; diff --git a/gcc/testsuite/rust/compile/issue-1893.rs b/gcc/testsuite/rust/compile/issue-1893.rs index 6be1d6d6f294..46c53e9ce7ae 100644 --- a/gcc/testsuite/rust/compile/issue-1893.rs +++ b/gcc/testsuite/rust/compile/issue-1893.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub enum Option { None, Some(T), diff --git a/gcc/testsuite/rust/compile/issue-1901.rs b/gcc/testsuite/rust/compile/issue-1901.rs index b2a70805e758..dd41ff89346d 100644 --- a/gcc/testsuite/rust/compile/issue-1901.rs +++ b/gcc/testsuite/rust/compile/issue-1901.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + mod intrinsics { extern "rust-intrinsic" { pub fn offset(ptr: *const T, count: isize) -> *const T; diff --git a/gcc/testsuite/rust/compile/issue-1930.rs b/gcc/testsuite/rust/compile/issue-1930.rs index ab30ccc7da43..071b3dae21c3 100644 --- a/gcc/testsuite/rust/compile/issue-1930.rs +++ b/gcc/testsuite/rust/compile/issue-1930.rs @@ -1,4 +1,7 @@ // { dg-options "-w" } +#[lang = "sized"] +pub trait Sized {} + fn test(x: *mut T) { let x = x as *mut u8; } diff --git a/gcc/testsuite/rust/compile/issue-1981.rs b/gcc/testsuite/rust/compile/issue-1981.rs index 9ad2a55404f7..b1637ac02602 100644 --- a/gcc/testsuite/rust/compile/issue-1981.rs +++ b/gcc/testsuite/rust/compile/issue-1981.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + mod intrinsics { extern "rust-intrinsic" { pub fn offset(ptr: *const T, count: isize) -> *const T; diff --git a/gcc/testsuite/rust/compile/issue-2019-1.rs b/gcc/testsuite/rust/compile/issue-2019-1.rs index f359ea4fb15d..e91e347b2ea6 100644 --- a/gcc/testsuite/rust/compile/issue-2019-1.rs +++ b/gcc/testsuite/rust/compile/issue-2019-1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + #[lang = "add"] pub trait Add { type Output; diff --git a/gcc/testsuite/rust/compile/issue-2019-2.rs b/gcc/testsuite/rust/compile/issue-2019-2.rs index 37c8e30b1060..9f7c0c01bbe5 100644 --- a/gcc/testsuite/rust/compile/issue-2019-2.rs +++ b/gcc/testsuite/rust/compile/issue-2019-2.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + #[lang = "add"] pub trait Add { type Output; diff --git a/gcc/testsuite/rust/compile/issue-2019-3.rs b/gcc/testsuite/rust/compile/issue-2019-3.rs index 67890388be31..c95ce43083ab 100644 --- a/gcc/testsuite/rust/compile/issue-2019-3.rs +++ b/gcc/testsuite/rust/compile/issue-2019-3.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + macro_rules! forward_ref_binop { (impl $imp:ident, $method:ident for $t:ty, $u:ty) => { forward_ref_binop!(impl $imp, $method for $t, $u, diff --git a/gcc/testsuite/rust/compile/issue-2036.rs b/gcc/testsuite/rust/compile/issue-2036.rs index d1459752ea51..8701b204fd32 100644 --- a/gcc/testsuite/rust/compile/issue-2036.rs +++ b/gcc/testsuite/rust/compile/issue-2036.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Hash { fn hash2(&self, hasher: &H) -> u64; } diff --git a/gcc/testsuite/rust/compile/issue-2037.rs b/gcc/testsuite/rust/compile/issue-2037.rs index ec27a0d10dcf..8adcb9751098 100644 --- a/gcc/testsuite/rust/compile/issue-2037.rs +++ b/gcc/testsuite/rust/compile/issue-2037.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { fn bar(&mut self, other: &mut Foo); } diff --git a/gcc/testsuite/rust/compile/issue-2070.rs b/gcc/testsuite/rust/compile/issue-2070.rs index 46f35209f4dd..981e59926fbb 100644 --- a/gcc/testsuite/rust/compile/issue-2070.rs +++ b/gcc/testsuite/rust/compile/issue-2070.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { fn get(self) -> i32; } diff --git a/gcc/testsuite/rust/compile/issue-2105.rs b/gcc/testsuite/rust/compile/issue-2105.rs index 7d1c9a10c270..28f170e51cf1 100644 --- a/gcc/testsuite/rust/compile/issue-2105.rs +++ b/gcc/testsuite/rust/compile/issue-2105.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub enum Option { Some(T), None, diff --git a/gcc/testsuite/rust/compile/issue-2106.rs b/gcc/testsuite/rust/compile/issue-2106.rs index a4f235c14dd3..4af57c866525 100644 --- a/gcc/testsuite/rust/compile/issue-2106.rs +++ b/gcc/testsuite/rust/compile/issue-2106.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(u32); // { dg-warning "struct is never constructed" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/issue-2135.rs b/gcc/testsuite/rust/compile/issue-2135.rs index 563345efee36..9f4d3e1b6c18 100644 --- a/gcc/testsuite/rust/compile/issue-2135.rs +++ b/gcc/testsuite/rust/compile/issue-2135.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Foo { fn foo(self, _: A) -> u16; } diff --git a/gcc/testsuite/rust/compile/issue-2136-1.rs b/gcc/testsuite/rust/compile/issue-2136-1.rs index fcf1efcd171c..f0af551f87ea 100644 --- a/gcc/testsuite/rust/compile/issue-2136-1.rs +++ b/gcc/testsuite/rust/compile/issue-2136-1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Foo { fn foo(); } diff --git a/gcc/testsuite/rust/compile/issue-2136-2.rs b/gcc/testsuite/rust/compile/issue-2136-2.rs index 7317f3f5151b..b25820dadfb5 100644 --- a/gcc/testsuite/rust/compile/issue-2136-2.rs +++ b/gcc/testsuite/rust/compile/issue-2136-2.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct S; impl S { diff --git a/gcc/testsuite/rust/compile/issue-2139.rs b/gcc/testsuite/rust/compile/issue-2139.rs index 77bf78d13a7f..3b9ad9546796 100644 --- a/gcc/testsuite/rust/compile/issue-2139.rs +++ b/gcc/testsuite/rust/compile/issue-2139.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Foo { fn foo(); } diff --git a/gcc/testsuite/rust/compile/issue-2142.rs b/gcc/testsuite/rust/compile/issue-2142.rs index 7a8bb2aca502..a3ec228c0e12 100644 --- a/gcc/testsuite/rust/compile/issue-2142.rs +++ b/gcc/testsuite/rust/compile/issue-2142.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + #[lang = "fn_once"] pub trait FnOnce { #[lang = "fn_once_output"] diff --git a/gcc/testsuite/rust/compile/issue-2165.rs b/gcc/testsuite/rust/compile/issue-2165.rs index 199bc13aa686..5bbde65928b4 100644 --- a/gcc/testsuite/rust/compile/issue-2165.rs +++ b/gcc/testsuite/rust/compile/issue-2165.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Alpha { type Beta; } diff --git a/gcc/testsuite/rust/compile/issue-2166.rs b/gcc/testsuite/rust/compile/issue-2166.rs index f333888879a4..318f0a61b7ec 100644 --- a/gcc/testsuite/rust/compile/issue-2166.rs +++ b/gcc/testsuite/rust/compile/issue-2166.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Add { type Output; diff --git a/gcc/testsuite/rust/compile/issue-2190-1.rs b/gcc/testsuite/rust/compile/issue-2190-1.rs index 3e43e5410497..057d7c71633e 100644 --- a/gcc/testsuite/rust/compile/issue-2190-1.rs +++ b/gcc/testsuite/rust/compile/issue-2190-1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + #[lang = "deref"] trait Deref { type Target; diff --git a/gcc/testsuite/rust/compile/issue-2190-2.rs b/gcc/testsuite/rust/compile/issue-2190-2.rs index 48ab72b92001..1c933386aa46 100644 --- a/gcc/testsuite/rust/compile/issue-2190-2.rs +++ b/gcc/testsuite/rust/compile/issue-2190-2.rs @@ -1,4 +1,7 @@ // { dg-options "-w" } +#[lang = "sized"] +pub trait Sized {} + #[lang = "deref"] trait Deref { type Target; diff --git a/gcc/testsuite/rust/compile/issue-2195.rs b/gcc/testsuite/rust/compile/issue-2195.rs index c955df4f1c6b..fc158c39bb4b 100644 --- a/gcc/testsuite/rust/compile/issue-2195.rs +++ b/gcc/testsuite/rust/compile/issue-2195.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct A { // { dg-warning "struct is never constructed" "" { target *-*-* } .-1 } f: *const T, diff --git a/gcc/testsuite/rust/compile/issue-2238.rs b/gcc/testsuite/rust/compile/issue-2238.rs index b0c7e36ea445..38871b337c12 100644 --- a/gcc/testsuite/rust/compile/issue-2238.rs +++ b/gcc/testsuite/rust/compile/issue-2238.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + fn main() { struct Foo; diff --git a/gcc/testsuite/rust/compile/issue-2304.rs b/gcc/testsuite/rust/compile/issue-2304.rs index 243cf100539a..83130336ebec 100644 --- a/gcc/testsuite/rust/compile/issue-2304.rs +++ b/gcc/testsuite/rust/compile/issue-2304.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + #[lang = "add"] pub trait Add { type Output; diff --git a/gcc/testsuite/rust/compile/issue-2375.rs b/gcc/testsuite/rust/compile/issue-2375.rs new file mode 100644 index 000000000000..a61fef8b618c --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-2375.rs @@ -0,0 +1,14 @@ +#[lang = "sized"] +pub trait Sized {} + +pub trait Trait { + fn foo(&self) -> Self + where + Self: Sized; +} + +pub fn static_foo(_b: &T) {} + +pub fn dynamic_bar(a: &dyn Trait) { + static_foo(a) +} diff --git a/gcc/testsuite/rust/compile/issue-850.rs b/gcc/testsuite/rust/compile/issue-850.rs index 531cbf4f6633..e42b5573d1d1 100644 --- a/gcc/testsuite/rust/compile/issue-850.rs +++ b/gcc/testsuite/rust/compile/issue-850.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + extern "C" { fn printf(s: *const i8, ...); } diff --git a/gcc/testsuite/rust/compile/issue-855.rs b/gcc/testsuite/rust/compile/issue-855.rs index f48e3a1bfe0a..9e450ddda3ae 100644 --- a/gcc/testsuite/rust/compile/issue-855.rs +++ b/gcc/testsuite/rust/compile/issue-855.rs @@ -1,5 +1,8 @@ pub use result::Result::{self, Err, Ok}; +#[lang = "sized"] +pub trait Sized {} + extern "C" { fn printf(s: *const i8, ...); } diff --git a/gcc/testsuite/rust/compile/issue-925.rs b/gcc/testsuite/rust/compile/issue-925.rs index 930b192c3d30..2d536a547252 100644 --- a/gcc/testsuite/rust/compile/issue-925.rs +++ b/gcc/testsuite/rust/compile/issue-925.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct S; trait A { fn foo(&self); diff --git a/gcc/testsuite/rust/compile/macro-issue1400.rs b/gcc/testsuite/rust/compile/macro-issue1400.rs index 971bd778054e..5c51b78065c1 100644 --- a/gcc/testsuite/rust/compile/macro-issue1400.rs +++ b/gcc/testsuite/rust/compile/macro-issue1400.rs @@ -1,5 +1,8 @@ // { dg-additional-options "-w" } +#[lang = "sized"] +pub trait Sized {} + macro_rules! foo { ( ( $( $Trait: ident ),+ ) for $Ty: ident ) => { $( diff --git a/gcc/testsuite/rust/compile/macro20.rs b/gcc/testsuite/rust/compile/macro20.rs index 9f3cbca012ce..e03455b1b01f 100644 --- a/gcc/testsuite/rust/compile/macro20.rs +++ b/gcc/testsuite/rust/compile/macro20.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + macro_rules! define_trait { ($assoc:ident, $i:item) => { type $assoc; diff --git a/gcc/testsuite/rust/compile/macro23.rs b/gcc/testsuite/rust/compile/macro23.rs index afaca9bc96b1..a6a2afdad076 100644 --- a/gcc/testsuite/rust/compile/macro23.rs +++ b/gcc/testsuite/rust/compile/macro23.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + macro_rules! maybe_impl { ($left:ident, $right:ident, $l_fn:ident, $r_fn:ident) => { fn $l_fn(value: T) -> Maybe { diff --git a/gcc/testsuite/rust/compile/macro40.rs b/gcc/testsuite/rust/compile/macro40.rs index 7151f3a83bce..f9d048e8ab1d 100644 --- a/gcc/testsuite/rust/compile/macro40.rs +++ b/gcc/testsuite/rust/compile/macro40.rs @@ -1,5 +1,8 @@ // { dg-additional-options "-w" } +#[lang = "sized"] +pub trait Sized {} + macro_rules! t { () => { i32 diff --git a/gcc/testsuite/rust/compile/macro54.rs b/gcc/testsuite/rust/compile/macro54.rs index afb20263566c..d3b3f806a6a0 100644 --- a/gcc/testsuite/rust/compile/macro54.rs +++ b/gcc/testsuite/rust/compile/macro54.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + macro_rules! foo { () => {"foo"}; (number) => { 12 }; diff --git a/gcc/testsuite/rust/compile/name_resolution2.rs b/gcc/testsuite/rust/compile/name_resolution2.rs index 343f6282a887..7e4f5a14da5d 100644 --- a/gcc/testsuite/rust/compile/name_resolution2.rs +++ b/gcc/testsuite/rust/compile/name_resolution2.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Bar; trait Foo { diff --git a/gcc/testsuite/rust/compile/name_resolution4.rs b/gcc/testsuite/rust/compile/name_resolution4.rs index 1c138e837b24..b2eadbe2c54c 100644 --- a/gcc/testsuite/rust/compile/name_resolution4.rs +++ b/gcc/testsuite/rust/compile/name_resolution4.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { fn foo(&self) {} // { dg-warning "unused name" } } diff --git a/gcc/testsuite/rust/compile/nested_generic.rs b/gcc/testsuite/rust/compile/nested_generic.rs index 6c3109957f90..322b3c50afb4 100644 --- a/gcc/testsuite/rust/compile/nested_generic.rs +++ b/gcc/testsuite/rust/compile/nested_generic.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub struct A(T); pub struct B(T); diff --git a/gcc/testsuite/rust/compile/parse_associated_type_as_generic_arg.rs b/gcc/testsuite/rust/compile/parse_associated_type_as_generic_arg.rs index fbe79f00bde0..ba1042a9bbe8 100644 --- a/gcc/testsuite/rust/compile/parse_associated_type_as_generic_arg.rs +++ b/gcc/testsuite/rust/compile/parse_associated_type_as_generic_arg.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { type A; diff --git a/gcc/testsuite/rust/compile/parse_associated_type_as_generic_arg2.rs b/gcc/testsuite/rust/compile/parse_associated_type_as_generic_arg2.rs index ba5d9a3936c9..a2662c25e218 100644 --- a/gcc/testsuite/rust/compile/parse_associated_type_as_generic_arg2.rs +++ b/gcc/testsuite/rust/compile/parse_associated_type_as_generic_arg2.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { type A; diff --git a/gcc/testsuite/rust/compile/parse_associated_type_as_generic_arg3.rs b/gcc/testsuite/rust/compile/parse_associated_type_as_generic_arg3.rs index 72c1b95c09a5..b4342e8c4cba 100644 --- a/gcc/testsuite/rust/compile/parse_associated_type_as_generic_arg3.rs +++ b/gcc/testsuite/rust/compile/parse_associated_type_as_generic_arg3.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Bar { type B; diff --git a/gcc/testsuite/rust/compile/parse_complex_generic_application.rs b/gcc/testsuite/rust/compile/parse_complex_generic_application.rs index d5c7bf488b7d..02877dd727ed 100644 --- a/gcc/testsuite/rust/compile/parse_complex_generic_application.rs +++ b/gcc/testsuite/rust/compile/parse_complex_generic_application.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub enum Either { Left(T), Right(E), diff --git a/gcc/testsuite/rust/compile/parse_complex_generic_application2.rs b/gcc/testsuite/rust/compile/parse_complex_generic_application2.rs index 0361931c50c0..5ebc94f1f989 100644 --- a/gcc/testsuite/rust/compile/parse_complex_generic_application2.rs +++ b/gcc/testsuite/rust/compile/parse_complex_generic_application2.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub enum Either { Left(L), Right(R), diff --git a/gcc/testsuite/rust/compile/path_as_generic_arg.rs b/gcc/testsuite/rust/compile/path_as_generic_arg.rs index 35b3160e9a85..21baf8000e71 100644 --- a/gcc/testsuite/rust/compile/path_as_generic_arg.rs +++ b/gcc/testsuite/rust/compile/path_as_generic_arg.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub enum Result { Ok(T), Err(E), diff --git a/gcc/testsuite/rust/compile/privacy4.rs b/gcc/testsuite/rust/compile/privacy4.rs index d1ce0afd6543..648b7b9adb76 100644 --- a/gcc/testsuite/rust/compile/privacy4.rs +++ b/gcc/testsuite/rust/compile/privacy4.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + mod orange { mod green { fn bean(value: T) -> T { diff --git a/gcc/testsuite/rust/compile/privacy6.rs b/gcc/testsuite/rust/compile/privacy6.rs index 487ed0242090..1680c2481441 100644 --- a/gcc/testsuite/rust/compile/privacy6.rs +++ b/gcc/testsuite/rust/compile/privacy6.rs @@ -1,5 +1,8 @@ // { dg-additional-options "-w" } +#[lang = "sized"] +pub trait Sized {} + struct Adt; enum EAdt { V0, diff --git a/gcc/testsuite/rust/compile/sizeof-stray-infer-var-bug.rs b/gcc/testsuite/rust/compile/sizeof-stray-infer-var-bug.rs index 310da661fca8..a5f0c2b78fb4 100644 --- a/gcc/testsuite/rust/compile/sizeof-stray-infer-var-bug.rs +++ b/gcc/testsuite/rust/compile/sizeof-stray-infer-var-bug.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + mod mem { extern "rust-intrinsic" { pub fn size_of() -> usize; diff --git a/gcc/testsuite/rust/compile/stmt_with_block_dot.rs b/gcc/testsuite/rust/compile/stmt_with_block_dot.rs index ae623c345579..c7037af8cd4e 100644 --- a/gcc/testsuite/rust/compile/stmt_with_block_dot.rs +++ b/gcc/testsuite/rust/compile/stmt_with_block_dot.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub struct A(i32, i32); trait Clone { diff --git a/gcc/testsuite/rust/compile/torture/associated_types1.rs b/gcc/testsuite/rust/compile/torture/associated_types1.rs index bf181df7045e..2be703722c2e 100644 --- a/gcc/testsuite/rust/compile/torture/associated_types1.rs +++ b/gcc/testsuite/rust/compile/torture/associated_types1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Foo { type A; diff --git a/gcc/testsuite/rust/compile/torture/forward_decl_5.rs b/gcc/testsuite/rust/compile/torture/forward_decl_5.rs index 73a47fe061bb..670ab0a799fb 100644 --- a/gcc/testsuite/rust/compile/torture/forward_decl_5.rs +++ b/gcc/testsuite/rust/compile/torture/forward_decl_5.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub fn main() { let a; a = foo { a: 123, b: 456f32 }; diff --git a/gcc/testsuite/rust/compile/torture/generics1.rs b/gcc/testsuite/rust/compile/torture/generics1.rs index 87bcdc8f305d..b32eddd6c482 100644 --- a/gcc/testsuite/rust/compile/torture/generics1.rs +++ b/gcc/testsuite/rust/compile/torture/generics1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo { a: f32, b: bool, diff --git a/gcc/testsuite/rust/compile/torture/generics10.rs b/gcc/testsuite/rust/compile/torture/generics10.rs index 8473d49587ba..1a17e842a0dc 100644 --- a/gcc/testsuite/rust/compile/torture/generics10.rs +++ b/gcc/testsuite/rust/compile/torture/generics10.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(T); struct Bar { diff --git a/gcc/testsuite/rust/compile/torture/generics11.rs b/gcc/testsuite/rust/compile/torture/generics11.rs index 3c8f5ba0058d..9d5e719d774f 100644 --- a/gcc/testsuite/rust/compile/torture/generics11.rs +++ b/gcc/testsuite/rust/compile/torture/generics11.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(T, u32); type TypeAlias = Foo; diff --git a/gcc/testsuite/rust/compile/torture/generics12.rs b/gcc/testsuite/rust/compile/torture/generics12.rs index f31be584e09b..9347b24d2d41 100644 --- a/gcc/testsuite/rust/compile/torture/generics12.rs +++ b/gcc/testsuite/rust/compile/torture/generics12.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct GenericStruct(T, usize); impl GenericStruct { diff --git a/gcc/testsuite/rust/compile/torture/generics13.rs b/gcc/testsuite/rust/compile/torture/generics13.rs index 9eb598f02a84..00b26ec0968c 100644 --- a/gcc/testsuite/rust/compile/torture/generics13.rs +++ b/gcc/testsuite/rust/compile/torture/generics13.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo { a: A, // { dg-warning "field is never read" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/torture/generics14.rs b/gcc/testsuite/rust/compile/torture/generics14.rs index e51a4079e30e..5be39ebff91c 100644 --- a/gcc/testsuite/rust/compile/torture/generics14.rs +++ b/gcc/testsuite/rust/compile/torture/generics14.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo { a: A, // { dg-warning "field is never read" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/torture/generics15.rs b/gcc/testsuite/rust/compile/torture/generics15.rs index c16a67c4dd55..2b1f31c0217e 100644 --- a/gcc/testsuite/rust/compile/torture/generics15.rs +++ b/gcc/testsuite/rust/compile/torture/generics15.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(T, bool); impl Foo { diff --git a/gcc/testsuite/rust/compile/torture/generics16.rs b/gcc/testsuite/rust/compile/torture/generics16.rs index 15b9d7b55e73..a9fa2ebdf0bc 100644 --- a/gcc/testsuite/rust/compile/torture/generics16.rs +++ b/gcc/testsuite/rust/compile/torture/generics16.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(T, bool); impl Foo { diff --git a/gcc/testsuite/rust/compile/torture/generics17.rs b/gcc/testsuite/rust/compile/torture/generics17.rs index d52314999b97..9a04158e4c95 100644 --- a/gcc/testsuite/rust/compile/torture/generics17.rs +++ b/gcc/testsuite/rust/compile/torture/generics17.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(T); impl Foo { diff --git a/gcc/testsuite/rust/compile/torture/generics18.rs b/gcc/testsuite/rust/compile/torture/generics18.rs index 4c98b86a1b93..cb7b1fa7404d 100644 --- a/gcc/testsuite/rust/compile/torture/generics18.rs +++ b/gcc/testsuite/rust/compile/torture/generics18.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(T); impl Foo { diff --git a/gcc/testsuite/rust/compile/torture/generics19.rs b/gcc/testsuite/rust/compile/torture/generics19.rs index 9a5b4cb48dc8..c98599fffdac 100644 --- a/gcc/testsuite/rust/compile/torture/generics19.rs +++ b/gcc/testsuite/rust/compile/torture/generics19.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(X, Y); impl Foo { diff --git a/gcc/testsuite/rust/compile/torture/generics2.rs b/gcc/testsuite/rust/compile/torture/generics2.rs index da0ab992243f..e720b4221497 100644 --- a/gcc/testsuite/rust/compile/torture/generics2.rs +++ b/gcc/testsuite/rust/compile/torture/generics2.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(f32, bool); struct GenericStruct(T, usize); diff --git a/gcc/testsuite/rust/compile/torture/generics20.rs b/gcc/testsuite/rust/compile/torture/generics20.rs index 8fe1cffdf7da..92b022e3746f 100644 --- a/gcc/testsuite/rust/compile/torture/generics20.rs +++ b/gcc/testsuite/rust/compile/torture/generics20.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(A, B); impl Foo { diff --git a/gcc/testsuite/rust/compile/torture/generics21.rs b/gcc/testsuite/rust/compile/torture/generics21.rs index dc4e935cac77..1c74ea429991 100644 --- a/gcc/testsuite/rust/compile/torture/generics21.rs +++ b/gcc/testsuite/rust/compile/torture/generics21.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + fn callee(t: &T) -> i32 { // { dg-warning "unused name" "" { target *-*-* } .-1 } 32 diff --git a/gcc/testsuite/rust/compile/torture/generics22.rs b/gcc/testsuite/rust/compile/torture/generics22.rs index 465ebb0f5e14..b838e6e8262c 100644 --- a/gcc/testsuite/rust/compile/torture/generics22.rs +++ b/gcc/testsuite/rust/compile/torture/generics22.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + fn callee(t: (T, bool)) -> i32 { // { dg-warning "unused name" "" { target *-*-* } .-1 } 32 diff --git a/gcc/testsuite/rust/compile/torture/generics23.rs b/gcc/testsuite/rust/compile/torture/generics23.rs index 2169e3649c61..bf4dfb59f6bb 100644 --- a/gcc/testsuite/rust/compile/torture/generics23.rs +++ b/gcc/testsuite/rust/compile/torture/generics23.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(A); fn main() { diff --git a/gcc/testsuite/rust/compile/torture/generics24.rs b/gcc/testsuite/rust/compile/torture/generics24.rs index 0de45a8c404b..ce782c0e9876 100644 --- a/gcc/testsuite/rust/compile/torture/generics24.rs +++ b/gcc/testsuite/rust/compile/torture/generics24.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo { a: A, } diff --git a/gcc/testsuite/rust/compile/torture/generics25.rs b/gcc/testsuite/rust/compile/torture/generics25.rs index e7792e3efb31..4fe952a5da17 100644 --- a/gcc/testsuite/rust/compile/torture/generics25.rs +++ b/gcc/testsuite/rust/compile/torture/generics25.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(A, B); fn main() { diff --git a/gcc/testsuite/rust/compile/torture/generics26.rs b/gcc/testsuite/rust/compile/torture/generics26.rs index 522e16f32f7e..0111add4138a 100644 --- a/gcc/testsuite/rust/compile/torture/generics26.rs +++ b/gcc/testsuite/rust/compile/torture/generics26.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + // github issue #415 fn test(a: A, b: B) -> (A, B) { (a, b) diff --git a/gcc/testsuite/rust/compile/torture/generics27.rs b/gcc/testsuite/rust/compile/torture/generics27.rs index 9871638dd9fe..c4ca4db81e01 100644 --- a/gcc/testsuite/rust/compile/torture/generics27.rs +++ b/gcc/testsuite/rust/compile/torture/generics27.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + // github issue #415 fn test(a: &A) -> &A { a diff --git a/gcc/testsuite/rust/compile/torture/generics28.rs b/gcc/testsuite/rust/compile/torture/generics28.rs index 8cee8b00fb20..c1ffd9c245fb 100644 --- a/gcc/testsuite/rust/compile/torture/generics28.rs +++ b/gcc/testsuite/rust/compile/torture/generics28.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(A, B); impl Foo { diff --git a/gcc/testsuite/rust/compile/torture/generics29.rs b/gcc/testsuite/rust/compile/torture/generics29.rs index e09a1044574f..e9c693e6db76 100644 --- a/gcc/testsuite/rust/compile/torture/generics29.rs +++ b/gcc/testsuite/rust/compile/torture/generics29.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(A, B); impl Foo { diff --git a/gcc/testsuite/rust/compile/torture/generics3.rs b/gcc/testsuite/rust/compile/torture/generics3.rs index ceec8f7d9c64..4c5dabcbd8bc 100644 --- a/gcc/testsuite/rust/compile/torture/generics3.rs +++ b/gcc/testsuite/rust/compile/torture/generics3.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + fn test(a: T) -> T { a } diff --git a/gcc/testsuite/rust/compile/torture/generics30.rs b/gcc/testsuite/rust/compile/torture/generics30.rs index 229f6d1254b7..24ae58f08602 100644 --- a/gcc/testsuite/rust/compile/torture/generics30.rs +++ b/gcc/testsuite/rust/compile/torture/generics30.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(A, B); impl Foo { diff --git a/gcc/testsuite/rust/compile/torture/generics31.rs b/gcc/testsuite/rust/compile/torture/generics31.rs index 68ad4bf9a96f..f8e2f36ef734 100644 --- a/gcc/testsuite/rust/compile/torture/generics31.rs +++ b/gcc/testsuite/rust/compile/torture/generics31.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(A, B); impl Foo { diff --git a/gcc/testsuite/rust/compile/torture/generics32.rs b/gcc/testsuite/rust/compile/torture/generics32.rs index 21b9cae74096..49c4539d91d7 100644 --- a/gcc/testsuite/rust/compile/torture/generics32.rs +++ b/gcc/testsuite/rust/compile/torture/generics32.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(A, B); impl Foo { diff --git a/gcc/testsuite/rust/compile/torture/generics4.rs b/gcc/testsuite/rust/compile/torture/generics4.rs index 915cc49c68b8..54bdf56b63fa 100644 --- a/gcc/testsuite/rust/compile/torture/generics4.rs +++ b/gcc/testsuite/rust/compile/torture/generics4.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo { a: T, // { dg-warning "field is never read" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/torture/generics5.rs b/gcc/testsuite/rust/compile/torture/generics5.rs index b7f430289926..df27fdd8f6eb 100644 --- a/gcc/testsuite/rust/compile/torture/generics5.rs +++ b/gcc/testsuite/rust/compile/torture/generics5.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + fn test(a: T) -> T { a } diff --git a/gcc/testsuite/rust/compile/torture/generics6.rs b/gcc/testsuite/rust/compile/torture/generics6.rs index 5456b6dcb970..16b85fbcb189 100644 --- a/gcc/testsuite/rust/compile/torture/generics6.rs +++ b/gcc/testsuite/rust/compile/torture/generics6.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(T); struct Bar { diff --git a/gcc/testsuite/rust/compile/torture/generics7.rs b/gcc/testsuite/rust/compile/torture/generics7.rs index e8e5ca69c3d6..66454d6166dc 100644 --- a/gcc/testsuite/rust/compile/torture/generics7.rs +++ b/gcc/testsuite/rust/compile/torture/generics7.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(T); struct Bar { diff --git a/gcc/testsuite/rust/compile/torture/generics8.rs b/gcc/testsuite/rust/compile/torture/generics8.rs index 036d85568f0c..bc6d09b9919c 100644 --- a/gcc/testsuite/rust/compile/torture/generics8.rs +++ b/gcc/testsuite/rust/compile/torture/generics8.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct GenericStruct(T, usize); impl GenericStruct { diff --git a/gcc/testsuite/rust/compile/torture/generics9.rs b/gcc/testsuite/rust/compile/torture/generics9.rs index 307c34f3e9b1..3d9d748ef98c 100644 --- a/gcc/testsuite/rust/compile/torture/generics9.rs +++ b/gcc/testsuite/rust/compile/torture/generics9.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct GenericStruct(T, usize); impl GenericStruct { diff --git a/gcc/testsuite/rust/compile/torture/intrinsics-2.rs b/gcc/testsuite/rust/compile/torture/intrinsics-2.rs index 6b2339f38f3d..a6cd8f8553f4 100644 --- a/gcc/testsuite/rust/compile/torture/intrinsics-2.rs +++ b/gcc/testsuite/rust/compile/torture/intrinsics-2.rs @@ -2,6 +2,9 @@ #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { pub fn size_of() -> usize; } diff --git a/gcc/testsuite/rust/compile/torture/intrinsics-6.rs b/gcc/testsuite/rust/compile/torture/intrinsics-6.rs index 4e510e110877..0e2634592379 100644 --- a/gcc/testsuite/rust/compile/torture/intrinsics-6.rs +++ b/gcc/testsuite/rust/compile/torture/intrinsics-6.rs @@ -1,5 +1,8 @@ #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { pub fn unchecked_add(x: T, y: T) -> T; pub fn unchecked_sub(x: T, y: T) -> T; diff --git a/gcc/testsuite/rust/compile/torture/intrinsics-7.rs b/gcc/testsuite/rust/compile/torture/intrinsics-7.rs index da85fff5cd68..754aacb3449e 100644 --- a/gcc/testsuite/rust/compile/torture/intrinsics-7.rs +++ b/gcc/testsuite/rust/compile/torture/intrinsics-7.rs @@ -1,5 +1,8 @@ #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { pub fn unchecked_add(x: T, y: T) -> T; // { dg-error "unchecked operation intrinsics can only be used with basic integer types .got .NotAdd.." "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/torture/intrinsics-8.rs b/gcc/testsuite/rust/compile/torture/intrinsics-8.rs index 8788da5c7fca..deb19bd431cd 100644 --- a/gcc/testsuite/rust/compile/torture/intrinsics-8.rs +++ b/gcc/testsuite/rust/compile/torture/intrinsics-8.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + mod intrinsics { extern "rust-intrinsic" { pub fn add_with_overflow(x: T, y: T) -> (T, bool); diff --git a/gcc/testsuite/rust/compile/torture/issue-1024.rs b/gcc/testsuite/rust/compile/torture/issue-1024.rs index a8503cebf533..819e329058c5 100644 --- a/gcc/testsuite/rust/compile/torture/issue-1024.rs +++ b/gcc/testsuite/rust/compile/torture/issue-1024.rs @@ -1,5 +1,8 @@ #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { pub fn size_of() -> usize; } diff --git a/gcc/testsuite/rust/compile/torture/issue-1075.rs b/gcc/testsuite/rust/compile/torture/issue-1075.rs index 201a241d45d9..d23774b2c0bb 100644 --- a/gcc/testsuite/rust/compile/torture/issue-1075.rs +++ b/gcc/testsuite/rust/compile/torture/issue-1075.rs @@ -1,6 +1,9 @@ // { dg-additional-options "-w" } #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] pub fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/compile/torture/issue-1432.rs b/gcc/testsuite/rust/compile/torture/issue-1432.rs index 0269823fb6d5..5b526fdd52db 100644 --- a/gcc/testsuite/rust/compile/torture/issue-1432.rs +++ b/gcc/testsuite/rust/compile/torture/issue-1432.rs @@ -1,5 +1,9 @@ // { dg-additional-options "-w" } #![feature(intrinsics)] + +#[lang = "sized"] +pub trait Sized {} + mod intrinsics { extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_int_wrapping", since = "1.40.0")] diff --git a/gcc/testsuite/rust/compile/torture/issue-1555.rs b/gcc/testsuite/rust/compile/torture/issue-1555.rs index adb489116488..bee8952f3683 100644 --- a/gcc/testsuite/rust/compile/torture/issue-1555.rs +++ b/gcc/testsuite/rust/compile/torture/issue-1555.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + extern "C" { fn printf(s: *const i8, ...); } diff --git a/gcc/testsuite/rust/compile/torture/issue-368.rs b/gcc/testsuite/rust/compile/torture/issue-368.rs index 18bc9bdc62ec..775e70d9d23e 100644 --- a/gcc/testsuite/rust/compile/torture/issue-368.rs +++ b/gcc/testsuite/rust/compile/torture/issue-368.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct S; fn foo(s: S) -> S { diff --git a/gcc/testsuite/rust/compile/torture/issue-808.rs b/gcc/testsuite/rust/compile/torture/issue-808.rs index 2e5a81fe516b..4186d54f4bc1 100644 --- a/gcc/testsuite/rust/compile/torture/issue-808.rs +++ b/gcc/testsuite/rust/compile/torture/issue-808.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Foo { type Target; diff --git a/gcc/testsuite/rust/compile/torture/issue-862.rs b/gcc/testsuite/rust/compile/torture/issue-862.rs index c1a4609ba866..d9ac91246018 100644 --- a/gcc/testsuite/rust/compile/torture/issue-862.rs +++ b/gcc/testsuite/rust/compile/torture/issue-862.rs @@ -1,4 +1,8 @@ // { dg-additional-options "-w" } + +#[lang = "sized"] +pub trait Sized {} + extern "C" { fn printf(s: *const i8, ...); } diff --git a/gcc/testsuite/rust/compile/torture/issue-893-2.rs b/gcc/testsuite/rust/compile/torture/issue-893-2.rs index 88a865d66dcf..3df27b8335ef 100644 --- a/gcc/testsuite/rust/compile/torture/issue-893-2.rs +++ b/gcc/testsuite/rust/compile/torture/issue-893-2.rs @@ -1,4 +1,7 @@ // { dg-additional-options "-w" } +#[lang = "sized"] +pub trait Sized {} + struct Foo(T); impl Foo { fn new(a: T, b: Y) -> Self { diff --git a/gcc/testsuite/rust/compile/torture/issue-893.rs b/gcc/testsuite/rust/compile/torture/issue-893.rs index d8245f3e0d85..f96b5c346432 100644 --- a/gcc/testsuite/rust/compile/torture/issue-893.rs +++ b/gcc/testsuite/rust/compile/torture/issue-893.rs @@ -1,4 +1,7 @@ // { dg-additional-options "-w" } +#[lang = "sized"] +pub trait Sized {} + struct Foo(T); impl Foo { fn new(a: T, b: Y) -> Self { diff --git a/gcc/testsuite/rust/compile/torture/must_use2.rs b/gcc/testsuite/rust/compile/torture/must_use2.rs index 466f7ee7a147..cf6643eec25d 100644 --- a/gcc/testsuite/rust/compile/torture/must_use2.rs +++ b/gcc/testsuite/rust/compile/torture/must_use2.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait A { #[must_use] fn test() -> i32; diff --git a/gcc/testsuite/rust/compile/torture/nested_fn2.rs b/gcc/testsuite/rust/compile/torture/nested_fn2.rs index 7040c862e75e..ad7a10b0a82e 100644 --- a/gcc/testsuite/rust/compile/torture/nested_fn2.rs +++ b/gcc/testsuite/rust/compile/torture/nested_fn2.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub fn main() { fn test(x: T) -> T { x diff --git a/gcc/testsuite/rust/compile/torture/phantom_data.rs b/gcc/testsuite/rust/compile/torture/phantom_data.rs index 89e76aeb5eb6..d6c5adcf89a2 100644 --- a/gcc/testsuite/rust/compile/torture/phantom_data.rs +++ b/gcc/testsuite/rust/compile/torture/phantom_data.rs @@ -1,4 +1,7 @@ // { dg-options "-w" } +#[lang = "sized"] +pub trait Sized {} + #[lang = "phantom_data"] struct PhantomData; diff --git a/gcc/testsuite/rust/compile/torture/range-lang-item1.rs b/gcc/testsuite/rust/compile/torture/range-lang-item1.rs index 869461622765..604fee8e3285 100644 --- a/gcc/testsuite/rust/compile/torture/range-lang-item1.rs +++ b/gcc/testsuite/rust/compile/torture/range-lang-item1.rs @@ -1,4 +1,7 @@ // { dg-additional-options "-w" } +#[lang = "sized"] +pub trait Sized {} + #[lang = "RangeFull"] pub struct RangeFull; diff --git a/gcc/testsuite/rust/compile/torture/traits1.rs b/gcc/testsuite/rust/compile/torture/traits1.rs index 90357738a81d..8929501de6f5 100644 --- a/gcc/testsuite/rust/compile/torture/traits1.rs +++ b/gcc/testsuite/rust/compile/torture/traits1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { fn bar() -> i32; } diff --git a/gcc/testsuite/rust/compile/torture/traits11.rs b/gcc/testsuite/rust/compile/torture/traits11.rs index 41c82f01b6dd..02383a5610aa 100644 --- a/gcc/testsuite/rust/compile/torture/traits11.rs +++ b/gcc/testsuite/rust/compile/torture/traits11.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { type A; diff --git a/gcc/testsuite/rust/compile/torture/traits12.rs b/gcc/testsuite/rust/compile/torture/traits12.rs index a55b965baf0b..8648022b8fe3 100644 --- a/gcc/testsuite/rust/compile/torture/traits12.rs +++ b/gcc/testsuite/rust/compile/torture/traits12.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { type A; diff --git a/gcc/testsuite/rust/compile/torture/traits13.rs b/gcc/testsuite/rust/compile/torture/traits13.rs index 326f03907567..5d9c81943d9c 100644 --- a/gcc/testsuite/rust/compile/torture/traits13.rs +++ b/gcc/testsuite/rust/compile/torture/traits13.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Trait { const FOO: usize; type Target; diff --git a/gcc/testsuite/rust/compile/torture/traits14.rs b/gcc/testsuite/rust/compile/torture/traits14.rs index 8bca0d5c1f6c..ab546a88fae7 100644 --- a/gcc/testsuite/rust/compile/torture/traits14.rs +++ b/gcc/testsuite/rust/compile/torture/traits14.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { type A; diff --git a/gcc/testsuite/rust/compile/torture/traits15.rs b/gcc/testsuite/rust/compile/torture/traits15.rs index c8c40b78b45e..c1863a8a2f9b 100644 --- a/gcc/testsuite/rust/compile/torture/traits15.rs +++ b/gcc/testsuite/rust/compile/torture/traits15.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { type A; diff --git a/gcc/testsuite/rust/compile/torture/traits16.rs b/gcc/testsuite/rust/compile/torture/traits16.rs index afc4a86de6d5..8c8e682e6c16 100644 --- a/gcc/testsuite/rust/compile/torture/traits16.rs +++ b/gcc/testsuite/rust/compile/torture/traits16.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait A { fn a() -> i32 { 123 diff --git a/gcc/testsuite/rust/compile/torture/traits17.rs b/gcc/testsuite/rust/compile/torture/traits17.rs index 6da8bcb0082d..268c2bd50c55 100644 --- a/gcc/testsuite/rust/compile/torture/traits17.rs +++ b/gcc/testsuite/rust/compile/torture/traits17.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait A { fn a() -> i32 { 123 diff --git a/gcc/testsuite/rust/compile/torture/traits18.rs b/gcc/testsuite/rust/compile/torture/traits18.rs index 63319dd2daa7..512152e9fdf3 100644 --- a/gcc/testsuite/rust/compile/torture/traits18.rs +++ b/gcc/testsuite/rust/compile/torture/traits18.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo<'a> {} trait Bar { diff --git a/gcc/testsuite/rust/compile/torture/traits19.rs b/gcc/testsuite/rust/compile/torture/traits19.rs index 4412656f5351..4be898d40240 100644 --- a/gcc/testsuite/rust/compile/torture/traits19.rs +++ b/gcc/testsuite/rust/compile/torture/traits19.rs @@ -1,4 +1,7 @@ // { dg-additional-options "-w" } +#[lang = "sized"] +pub trait Sized {} + trait Get { type Value; fn get(&self) -> &::Value; diff --git a/gcc/testsuite/rust/compile/torture/traits2.rs b/gcc/testsuite/rust/compile/torture/traits2.rs index fc6eb6002e0e..a9dca948d1b4 100644 --- a/gcc/testsuite/rust/compile/torture/traits2.rs +++ b/gcc/testsuite/rust/compile/torture/traits2.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { fn bar() -> i32; } diff --git a/gcc/testsuite/rust/compile/torture/traits3.rs b/gcc/testsuite/rust/compile/torture/traits3.rs index deeb81e0946c..d805da5d2d4d 100644 --- a/gcc/testsuite/rust/compile/torture/traits3.rs +++ b/gcc/testsuite/rust/compile/torture/traits3.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Foo { fn Bar(self) -> i32; } diff --git a/gcc/testsuite/rust/compile/torture/traits4.rs b/gcc/testsuite/rust/compile/torture/traits4.rs index 67b012c11f58..49c4db2d34a6 100644 --- a/gcc/testsuite/rust/compile/torture/traits4.rs +++ b/gcc/testsuite/rust/compile/torture/traits4.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { type A; type B; diff --git a/gcc/testsuite/rust/compile/torture/traits5.rs b/gcc/testsuite/rust/compile/torture/traits5.rs index 445b0658f5c2..c60a2597418b 100644 --- a/gcc/testsuite/rust/compile/torture/traits5.rs +++ b/gcc/testsuite/rust/compile/torture/traits5.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { type A; type B; diff --git a/gcc/testsuite/rust/compile/torture/traits6.rs b/gcc/testsuite/rust/compile/torture/traits6.rs index 260dde3f465d..f11735324f2f 100644 --- a/gcc/testsuite/rust/compile/torture/traits6.rs +++ b/gcc/testsuite/rust/compile/torture/traits6.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { type A; diff --git a/gcc/testsuite/rust/compile/torture/traits7.rs b/gcc/testsuite/rust/compile/torture/traits7.rs index 7bc3384ab412..8e4472d529ae 100644 --- a/gcc/testsuite/rust/compile/torture/traits7.rs +++ b/gcc/testsuite/rust/compile/torture/traits7.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { const A: i32; diff --git a/gcc/testsuite/rust/compile/torture/traits8.rs b/gcc/testsuite/rust/compile/torture/traits8.rs index 459032fb4a2d..cc0875bd0757 100644 --- a/gcc/testsuite/rust/compile/torture/traits8.rs +++ b/gcc/testsuite/rust/compile/torture/traits8.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { fn default() -> i32; } diff --git a/gcc/testsuite/rust/compile/torture/traits9.rs b/gcc/testsuite/rust/compile/torture/traits9.rs index 89e4bf19b0cd..3a7c37fcbb60 100644 --- a/gcc/testsuite/rust/compile/torture/traits9.rs +++ b/gcc/testsuite/rust/compile/torture/traits9.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { fn default() -> i32; fn get(self) -> i32; diff --git a/gcc/testsuite/rust/compile/torture/transmute-size-check-1.rs b/gcc/testsuite/rust/compile/torture/transmute-size-check-1.rs index 461a35de8efd..6d34fb1b0245 100644 --- a/gcc/testsuite/rust/compile/torture/transmute-size-check-1.rs +++ b/gcc/testsuite/rust/compile/torture/transmute-size-check-1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + mod mem { extern "rust-intrinsic" { fn size_of() -> usize; diff --git a/gcc/testsuite/rust/compile/torture/transmute1.rs b/gcc/testsuite/rust/compile/torture/transmute1.rs index af9a55d1b978..b2a0d07a3d7c 100644 --- a/gcc/testsuite/rust/compile/torture/transmute1.rs +++ b/gcc/testsuite/rust/compile/torture/transmute1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + mod mem { extern "rust-intrinsic" { fn size_of() -> usize; diff --git a/gcc/testsuite/rust/compile/torture/uninit-intrinsic-1.rs b/gcc/testsuite/rust/compile/torture/uninit-intrinsic-1.rs index 0c6772b5f383..cbb92feb4954 100644 --- a/gcc/testsuite/rust/compile/torture/uninit-intrinsic-1.rs +++ b/gcc/testsuite/rust/compile/torture/uninit-intrinsic-1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + mod intrinsics { extern "rust-intrinsic" { pub fn uninit() -> T; diff --git a/gcc/testsuite/rust/compile/torture/utf8_identifiers.rs b/gcc/testsuite/rust/compile/torture/utf8_identifiers.rs index 7fb86eb5ff08..eeee01c95cf1 100644 --- a/gcc/testsuite/rust/compile/torture/utf8_identifiers.rs +++ b/gcc/testsuite/rust/compile/torture/utf8_identifiers.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub fn f() { let crab = (); diff --git a/gcc/testsuite/rust/compile/traits1.rs b/gcc/testsuite/rust/compile/traits1.rs index 355064eec1a9..68f5abb5aa01 100644 --- a/gcc/testsuite/rust/compile/traits1.rs +++ b/gcc/testsuite/rust/compile/traits1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { fn Bar() -> i32 {} // { dg-error "expected .i32. got .()." "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/traits10.rs b/gcc/testsuite/rust/compile/traits10.rs index f8f551ba86d7..da6c15553049 100644 --- a/gcc/testsuite/rust/compile/traits10.rs +++ b/gcc/testsuite/rust/compile/traits10.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(i32); trait Bar { diff --git a/gcc/testsuite/rust/compile/traits11.rs b/gcc/testsuite/rust/compile/traits11.rs index d06e47d7e16f..ac8ccdf5886b 100644 --- a/gcc/testsuite/rust/compile/traits11.rs +++ b/gcc/testsuite/rust/compile/traits11.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(i32); trait A { diff --git a/gcc/testsuite/rust/compile/traits12.rs b/gcc/testsuite/rust/compile/traits12.rs index b170692f265c..b194e073a911 100644 --- a/gcc/testsuite/rust/compile/traits12.rs +++ b/gcc/testsuite/rust/compile/traits12.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait A { type Output; diff --git a/gcc/testsuite/rust/compile/traits2.rs b/gcc/testsuite/rust/compile/traits2.rs index 376b3c9cc7f6..3631a092e562 100644 --- a/gcc/testsuite/rust/compile/traits2.rs +++ b/gcc/testsuite/rust/compile/traits2.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { fn Bar() -> i32 {} // { dg-error "expected .i32. got .()." "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/traits3.rs b/gcc/testsuite/rust/compile/traits3.rs index d6d081487b96..119132f80e88 100644 --- a/gcc/testsuite/rust/compile/traits3.rs +++ b/gcc/testsuite/rust/compile/traits3.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { type A; diff --git a/gcc/testsuite/rust/compile/traits4.rs b/gcc/testsuite/rust/compile/traits4.rs index 486301d61369..4388b5e1cb5f 100644 --- a/gcc/testsuite/rust/compile/traits4.rs +++ b/gcc/testsuite/rust/compile/traits4.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { const A: i32; diff --git a/gcc/testsuite/rust/compile/traits5.rs b/gcc/testsuite/rust/compile/traits5.rs index 8b2fb9bc10d4..4e9dcc167b7b 100644 --- a/gcc/testsuite/rust/compile/traits5.rs +++ b/gcc/testsuite/rust/compile/traits5.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { const A: i32; diff --git a/gcc/testsuite/rust/compile/traits6.rs b/gcc/testsuite/rust/compile/traits6.rs index 3579b5a0842c..d081dd11e10d 100644 --- a/gcc/testsuite/rust/compile/traits6.rs +++ b/gcc/testsuite/rust/compile/traits6.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { fn default() -> i32; } diff --git a/gcc/testsuite/rust/compile/traits7.rs b/gcc/testsuite/rust/compile/traits7.rs index 825553ce4966..68f3f38f97bd 100644 --- a/gcc/testsuite/rust/compile/traits7.rs +++ b/gcc/testsuite/rust/compile/traits7.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Foo { fn default() -> i32; } diff --git a/gcc/testsuite/rust/compile/traits8.rs b/gcc/testsuite/rust/compile/traits8.rs index b22590a52bbb..ccba9fad5dbe 100644 --- a/gcc/testsuite/rust/compile/traits8.rs +++ b/gcc/testsuite/rust/compile/traits8.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait A { fn get(self) -> f64; } diff --git a/gcc/testsuite/rust/compile/traits9.rs b/gcc/testsuite/rust/compile/traits9.rs index e1aef5397fc9..bb3034d0f21c 100644 --- a/gcc/testsuite/rust/compile/traits9.rs +++ b/gcc/testsuite/rust/compile/traits9.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(i32); trait Bar { fn baz(&self); diff --git a/gcc/testsuite/rust/compile/type-bindings1.rs b/gcc/testsuite/rust/compile/type-bindings1.rs index dc0e274fdd5f..358035bbc171 100644 --- a/gcc/testsuite/rust/compile/type-bindings1.rs +++ b/gcc/testsuite/rust/compile/type-bindings1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(A, B); fn main() { diff --git a/gcc/testsuite/rust/compile/unconstrained_type_param.rs b/gcc/testsuite/rust/compile/unconstrained_type_param.rs index a510332f167c..1cef0b983b0a 100644 --- a/gcc/testsuite/rust/compile/unconstrained_type_param.rs +++ b/gcc/testsuite/rust/compile/unconstrained_type_param.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + struct Foo(T, bool); impl Foo { diff --git a/gcc/testsuite/rust/compile/unsafe10.rs b/gcc/testsuite/rust/compile/unsafe10.rs index 927e69728c96..5861c15cd71d 100644 --- a/gcc/testsuite/rust/compile/unsafe10.rs +++ b/gcc/testsuite/rust/compile/unsafe10.rs @@ -1,5 +1,8 @@ #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { pub fn rotate_left(l: T, r: T) -> T; } diff --git a/gcc/testsuite/rust/execute/torture/closure1.rs b/gcc/testsuite/rust/execute/torture/closure1.rs index 62afa78a038d..e9564133b556 100644 --- a/gcc/testsuite/rust/execute/torture/closure1.rs +++ b/gcc/testsuite/rust/execute/torture/closure1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + extern "C" { fn printf(s: *const i8, ...); } diff --git a/gcc/testsuite/rust/execute/torture/closure2.rs b/gcc/testsuite/rust/execute/torture/closure2.rs index 8e1502dfa439..deca7845f8b3 100644 --- a/gcc/testsuite/rust/execute/torture/closure2.rs +++ b/gcc/testsuite/rust/execute/torture/closure2.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "fn_once"] pub trait FnOnce { #[lang = "fn_once_output"] diff --git a/gcc/testsuite/rust/execute/torture/closure3.rs b/gcc/testsuite/rust/execute/torture/closure3.rs index 8fa9445ab62a..98ec26143a38 100644 --- a/gcc/testsuite/rust/execute/torture/closure3.rs +++ b/gcc/testsuite/rust/execute/torture/closure3.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "fn_once"] pub trait FnOnce { #[lang = "fn_once_output"] diff --git a/gcc/testsuite/rust/execute/torture/closure4.rs b/gcc/testsuite/rust/execute/torture/closure4.rs index 07dca44308d0..070177607896 100644 --- a/gcc/testsuite/rust/execute/torture/closure4.rs +++ b/gcc/testsuite/rust/execute/torture/closure4.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + #[lang = "fn_once"] pub trait FnOnce { #[lang = "fn_once_output"] diff --git a/gcc/testsuite/rust/execute/torture/coercion1.rs b/gcc/testsuite/rust/execute/torture/coercion1.rs index 6ca28233d60c..335f4962104b 100644 --- a/gcc/testsuite/rust/execute/torture/coercion1.rs +++ b/gcc/testsuite/rust/execute/torture/coercion1.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + struct Foo(i32); trait Bar { fn baz(&self); diff --git a/gcc/testsuite/rust/execute/torture/coercion2.rs b/gcc/testsuite/rust/execute/torture/coercion2.rs index 047fd536dcaf..6be86020bdd7 100644 --- a/gcc/testsuite/rust/execute/torture/coercion2.rs +++ b/gcc/testsuite/rust/execute/torture/coercion2.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + struct Foo(i32); trait Bar { fn baz(&self); diff --git a/gcc/testsuite/rust/execute/torture/coercion3.rs b/gcc/testsuite/rust/execute/torture/coercion3.rs index ca66dfa05067..e88338ae2f3c 100644 --- a/gcc/testsuite/rust/execute/torture/coercion3.rs +++ b/gcc/testsuite/rust/execute/torture/coercion3.rs @@ -1,4 +1,7 @@ // { dg-output "123\n" } +#[lang = "sized"] +pub trait Sized {} + trait A { fn get_int(&self) -> i32; } diff --git a/gcc/testsuite/rust/execute/torture/copy_nonoverlapping1.rs b/gcc/testsuite/rust/execute/torture/copy_nonoverlapping1.rs index 39afd3424a40..15bb811773bd 100644 --- a/gcc/testsuite/rust/execute/torture/copy_nonoverlapping1.rs +++ b/gcc/testsuite/rust/execute/torture/copy_nonoverlapping1.rs @@ -1,4 +1,6 @@ #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} extern "rust-intrinsic" { pub fn copy_nonoverlapping(src: *const T, dst: *mut T, count: usize); @@ -16,4 +18,4 @@ fn main() -> i32 { *i_copy - *i } -} \ No newline at end of file +} diff --git a/gcc/testsuite/rust/execute/torture/derive_macro1.rs b/gcc/testsuite/rust/execute/torture/derive_macro1.rs index 6e0350de3de9..22cfaaae191c 100644 --- a/gcc/testsuite/rust/execute/torture/derive_macro1.rs +++ b/gcc/testsuite/rust/execute/torture/derive_macro1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Clone { fn clone(&self) -> Self; } diff --git a/gcc/testsuite/rust/execute/torture/derive_macro3.rs b/gcc/testsuite/rust/execute/torture/derive_macro3.rs index 716bd908f4e8..7b3a089d7514 100644 --- a/gcc/testsuite/rust/execute/torture/derive_macro3.rs +++ b/gcc/testsuite/rust/execute/torture/derive_macro3.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Clone { fn clone(&self) -> Self; } diff --git a/gcc/testsuite/rust/execute/torture/derive_macro4.rs b/gcc/testsuite/rust/execute/torture/derive_macro4.rs index 218bf617bd6d..c355ac7905f5 100644 --- a/gcc/testsuite/rust/execute/torture/derive_macro4.rs +++ b/gcc/testsuite/rust/execute/torture/derive_macro4.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub trait Clone { fn clone(&self) -> Self; } @@ -26,4 +29,4 @@ fn main() -> i32 { // should be 0 if all fields were cloned correctly l + r -} \ No newline at end of file +} diff --git a/gcc/testsuite/rust/execute/torture/index1.rs b/gcc/testsuite/rust/execute/torture/index1.rs index 4682978bdd0f..19e58e32b16e 100644 --- a/gcc/testsuite/rust/execute/torture/index1.rs +++ b/gcc/testsuite/rust/execute/torture/index1.rs @@ -1,4 +1,7 @@ // { dg-additional-options "-w" } +#[lang = "sized"] +pub trait Sized {} + #[lang = "index"] trait Index { type Output; diff --git a/gcc/testsuite/rust/execute/torture/issue-1120.rs b/gcc/testsuite/rust/execute/torture/issue-1120.rs index 59792b29a291..7dfa26fc14e9 100644 --- a/gcc/testsuite/rust/execute/torture/issue-1120.rs +++ b/gcc/testsuite/rust/execute/torture/issue-1120.rs @@ -1,6 +1,9 @@ // { dg-additional-options "-w" } #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] pub fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/execute/torture/issue-1133.rs b/gcc/testsuite/rust/execute/torture/issue-1133.rs index 8679bb932242..29f532e5c96a 100644 --- a/gcc/testsuite/rust/execute/torture/issue-1133.rs +++ b/gcc/testsuite/rust/execute/torture/issue-1133.rs @@ -1,6 +1,9 @@ // { dg-additional-options "-w" } #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] pub fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/execute/torture/issue-1198.rs b/gcc/testsuite/rust/execute/torture/issue-1198.rs index bbc58f0f3707..d5c3d895783a 100644 --- a/gcc/testsuite/rust/execute/torture/issue-1198.rs +++ b/gcc/testsuite/rust/execute/torture/issue-1198.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "deref"] pub trait Deref { type Target; diff --git a/gcc/testsuite/rust/execute/torture/issue-1232.rs b/gcc/testsuite/rust/execute/torture/issue-1232.rs index ce53da2d0339..6fb42b3167dc 100644 --- a/gcc/testsuite/rust/execute/torture/issue-1232.rs +++ b/gcc/testsuite/rust/execute/torture/issue-1232.rs @@ -2,6 +2,9 @@ // { dg-output "slice_access=3\r*\n" } #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/execute/torture/issue-1249.rs b/gcc/testsuite/rust/execute/torture/issue-1249.rs index 06911074c307..e7a261c1a0ba 100644 --- a/gcc/testsuite/rust/execute/torture/issue-1249.rs +++ b/gcc/testsuite/rust/execute/torture/issue-1249.rs @@ -1,6 +1,9 @@ // { dg-options "-w" } // { dg-output "1\r*\n2\r*\n" } +#[lang = "sized"] +pub trait Sized {} + extern "C" { fn printf(s: *const i8, ...); } diff --git a/gcc/testsuite/rust/execute/torture/issue-1436.rs b/gcc/testsuite/rust/execute/torture/issue-1436.rs index 96de5d691943..4e6996132de9 100644 --- a/gcc/testsuite/rust/execute/torture/issue-1436.rs +++ b/gcc/testsuite/rust/execute/torture/issue-1436.rs @@ -1,4 +1,7 @@ // { dg-options "-w" } +#[lang = "sized"] +pub trait Sized {} + mod intrinsics { extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] diff --git a/gcc/testsuite/rust/execute/torture/issue-1496.rs b/gcc/testsuite/rust/execute/torture/issue-1496.rs index af4201b7d3ed..36291a742368 100644 --- a/gcc/testsuite/rust/execute/torture/issue-1496.rs +++ b/gcc/testsuite/rust/execute/torture/issue-1496.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "deref"] pub trait Deref { type Target; diff --git a/gcc/testsuite/rust/execute/torture/issue-1720-2.rs b/gcc/testsuite/rust/execute/torture/issue-1720-2.rs index 35833dbb813a..9c5356ed736c 100644 --- a/gcc/testsuite/rust/execute/torture/issue-1720-2.rs +++ b/gcc/testsuite/rust/execute/torture/issue-1720-2.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + mod core { mod ops { #[lang = "add"] diff --git a/gcc/testsuite/rust/execute/torture/issue-1720.rs b/gcc/testsuite/rust/execute/torture/issue-1720.rs index 771d7eec5378..22182825490c 100644 --- a/gcc/testsuite/rust/execute/torture/issue-1720.rs +++ b/gcc/testsuite/rust/execute/torture/issue-1720.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + mod core { mod ops { #[lang = "add"] diff --git a/gcc/testsuite/rust/execute/torture/issue-2052.rs b/gcc/testsuite/rust/execute/torture/issue-2052.rs index 6c15eb3a470a..bf5d6a7cfbc4 100644 --- a/gcc/testsuite/rust/execute/torture/issue-2052.rs +++ b/gcc/testsuite/rust/execute/torture/issue-2052.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + #[lang = "fn_once"] pub trait FnOnce { #[lang = "fn_once_output"] diff --git a/gcc/testsuite/rust/execute/torture/issue-2179.rs b/gcc/testsuite/rust/execute/torture/issue-2179.rs index 53bacaaf2c18..86ed11f51c59 100644 --- a/gcc/testsuite/rust/execute/torture/issue-2179.rs +++ b/gcc/testsuite/rust/execute/torture/issue-2179.rs @@ -1,4 +1,7 @@ // { dg-output "123\n" } +#[lang = "sized"] +pub trait Sized {} + trait A { fn get_int(&self) -> i32; } diff --git a/gcc/testsuite/rust/execute/torture/issue-2180.rs b/gcc/testsuite/rust/execute/torture/issue-2180.rs index 3a7ea1044724..beed69620a0d 100644 --- a/gcc/testsuite/rust/execute/torture/issue-2180.rs +++ b/gcc/testsuite/rust/execute/torture/issue-2180.rs @@ -1,4 +1,7 @@ // { dg-output "123\n" } +#[lang = "sized"] +pub trait Sized {} + trait A { fn get_int(&self) -> i32; } diff --git a/gcc/testsuite/rust/execute/torture/issue-2236.rs b/gcc/testsuite/rust/execute/torture/issue-2236.rs index 1edc5a517628..850b99718ef6 100644 --- a/gcc/testsuite/rust/execute/torture/issue-2236.rs +++ b/gcc/testsuite/rust/execute/torture/issue-2236.rs @@ -1,4 +1,7 @@ // { dg-options "-w" } +#[lang = "sized"] +pub trait Sized {} + mod core { mod ops { #[lang = "deref"] diff --git a/gcc/testsuite/rust/execute/torture/issue-647.rs b/gcc/testsuite/rust/execute/torture/issue-647.rs index d76d43b61102..6a3565571ef1 100644 --- a/gcc/testsuite/rust/execute/torture/issue-647.rs +++ b/gcc/testsuite/rust/execute/torture/issue-647.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + struct Foo(T); struct Bar { diff --git a/gcc/testsuite/rust/execute/torture/issue-845.rs b/gcc/testsuite/rust/execute/torture/issue-845.rs index f96714d4bae6..b11ccd5374a1 100644 --- a/gcc/testsuite/rust/execute/torture/issue-845.rs +++ b/gcc/testsuite/rust/execute/torture/issue-845.rs @@ -4,6 +4,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + struct Foo {} trait Bar { diff --git a/gcc/testsuite/rust/execute/torture/issue-851.rs b/gcc/testsuite/rust/execute/torture/issue-851.rs index b3b2b480ec24..1361235b9781 100644 --- a/gcc/testsuite/rust/execute/torture/issue-851.rs +++ b/gcc/testsuite/rust/execute/torture/issue-851.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + enum Foo { A, B(T), diff --git a/gcc/testsuite/rust/execute/torture/issue-858.rs b/gcc/testsuite/rust/execute/torture/issue-858.rs index 51a156138449..0b1118b4f8d3 100644 --- a/gcc/testsuite/rust/execute/torture/issue-858.rs +++ b/gcc/testsuite/rust/execute/torture/issue-858.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + enum Foo { A, B(T), diff --git a/gcc/testsuite/rust/execute/torture/macros23.rs b/gcc/testsuite/rust/execute/torture/macros23.rs index 846352d04874..b27985d3befd 100644 --- a/gcc/testsuite/rust/execute/torture/macros23.rs +++ b/gcc/testsuite/rust/execute/torture/macros23.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + trait Valuable { const VALUE: i32; } diff --git a/gcc/testsuite/rust/execute/torture/macros28.rs b/gcc/testsuite/rust/execute/torture/macros28.rs index b011f9241494..46d9cfcac0c3 100644 --- a/gcc/testsuite/rust/execute/torture/macros28.rs +++ b/gcc/testsuite/rust/execute/torture/macros28.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + macro_rules! t { () => { i32 diff --git a/gcc/testsuite/rust/execute/torture/method2.rs b/gcc/testsuite/rust/execute/torture/method2.rs index 79a35eb53d81..e5f630a6d4fe 100644 --- a/gcc/testsuite/rust/execute/torture/method2.rs +++ b/gcc/testsuite/rust/execute/torture/method2.rs @@ -4,6 +4,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "deref"] pub trait Deref { type Target; diff --git a/gcc/testsuite/rust/execute/torture/method3.rs b/gcc/testsuite/rust/execute/torture/method3.rs index 7217d35c4b30..9a7865ca979c 100644 --- a/gcc/testsuite/rust/execute/torture/method3.rs +++ b/gcc/testsuite/rust/execute/torture/method3.rs @@ -4,6 +4,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "deref"] pub trait Deref { type Target; diff --git a/gcc/testsuite/rust/execute/torture/method4.rs b/gcc/testsuite/rust/execute/torture/method4.rs index ba1ffd1da361..e20618f06350 100644 --- a/gcc/testsuite/rust/execute/torture/method4.rs +++ b/gcc/testsuite/rust/execute/torture/method4.rs @@ -4,6 +4,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "deref"] pub trait Deref { type Target; diff --git a/gcc/testsuite/rust/execute/torture/operator_overload_1.rs b/gcc/testsuite/rust/execute/torture/operator_overload_1.rs index 064a77651ad2..9aed3933c42a 100644 --- a/gcc/testsuite/rust/execute/torture/operator_overload_1.rs +++ b/gcc/testsuite/rust/execute/torture/operator_overload_1.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "add"] pub trait Add { type Output; diff --git a/gcc/testsuite/rust/execute/torture/operator_overload_10.rs b/gcc/testsuite/rust/execute/torture/operator_overload_10.rs index 3fa5afd01f30..921ec5f6fe9a 100644 --- a/gcc/testsuite/rust/execute/torture/operator_overload_10.rs +++ b/gcc/testsuite/rust/execute/torture/operator_overload_10.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "deref"] pub trait Deref { type Target; diff --git a/gcc/testsuite/rust/execute/torture/operator_overload_11.rs b/gcc/testsuite/rust/execute/torture/operator_overload_11.rs index 94bc1cd9d965..f0359fb4d809 100644 --- a/gcc/testsuite/rust/execute/torture/operator_overload_11.rs +++ b/gcc/testsuite/rust/execute/torture/operator_overload_11.rs @@ -4,6 +4,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "bitand"] pub trait BitAnd { type Output; diff --git a/gcc/testsuite/rust/execute/torture/operator_overload_12.rs b/gcc/testsuite/rust/execute/torture/operator_overload_12.rs index d525ec44e8ff..2cd5c69f1e1f 100644 --- a/gcc/testsuite/rust/execute/torture/operator_overload_12.rs +++ b/gcc/testsuite/rust/execute/torture/operator_overload_12.rs @@ -4,6 +4,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "bitand_assign"] pub trait BitAndAssign { fn bitand_assign(&mut self, rhs: Rhs); diff --git a/gcc/testsuite/rust/execute/torture/operator_overload_2.rs b/gcc/testsuite/rust/execute/torture/operator_overload_2.rs index fab3a83b7f5f..686241547429 100644 --- a/gcc/testsuite/rust/execute/torture/operator_overload_2.rs +++ b/gcc/testsuite/rust/execute/torture/operator_overload_2.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "add"] pub trait Add { type Output; diff --git a/gcc/testsuite/rust/execute/torture/operator_overload_3.rs b/gcc/testsuite/rust/execute/torture/operator_overload_3.rs index 2bcb1c4267c3..6c1a8b8f8b8a 100644 --- a/gcc/testsuite/rust/execute/torture/operator_overload_3.rs +++ b/gcc/testsuite/rust/execute/torture/operator_overload_3.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "add"] pub trait Add { type Output; diff --git a/gcc/testsuite/rust/execute/torture/operator_overload_4.rs b/gcc/testsuite/rust/execute/torture/operator_overload_4.rs index e1fcbac1c777..c8235c6a822f 100644 --- a/gcc/testsuite/rust/execute/torture/operator_overload_4.rs +++ b/gcc/testsuite/rust/execute/torture/operator_overload_4.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "neg"] pub trait Neg { type Output; diff --git a/gcc/testsuite/rust/execute/torture/operator_overload_5.rs b/gcc/testsuite/rust/execute/torture/operator_overload_5.rs index 2ba87285ef16..eeef5bc576bb 100644 --- a/gcc/testsuite/rust/execute/torture/operator_overload_5.rs +++ b/gcc/testsuite/rust/execute/torture/operator_overload_5.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "not"] pub trait Not { type Output; diff --git a/gcc/testsuite/rust/execute/torture/operator_overload_6.rs b/gcc/testsuite/rust/execute/torture/operator_overload_6.rs index 50463e747619..d5ffae51fab0 100644 --- a/gcc/testsuite/rust/execute/torture/operator_overload_6.rs +++ b/gcc/testsuite/rust/execute/torture/operator_overload_6.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "add_assign"] pub trait AddAssign { fn add_assign(&mut self, rhs: Rhs); diff --git a/gcc/testsuite/rust/execute/torture/operator_overload_7.rs b/gcc/testsuite/rust/execute/torture/operator_overload_7.rs index 50107bb4324e..7226b26920bc 100644 --- a/gcc/testsuite/rust/execute/torture/operator_overload_7.rs +++ b/gcc/testsuite/rust/execute/torture/operator_overload_7.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "deref"] pub trait Deref { type Target; diff --git a/gcc/testsuite/rust/execute/torture/operator_overload_8.rs b/gcc/testsuite/rust/execute/torture/operator_overload_8.rs index e0338b917f52..4b589a8af458 100644 --- a/gcc/testsuite/rust/execute/torture/operator_overload_8.rs +++ b/gcc/testsuite/rust/execute/torture/operator_overload_8.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "deref"] pub trait Deref { type Target; diff --git a/gcc/testsuite/rust/execute/torture/operator_overload_9.rs b/gcc/testsuite/rust/execute/torture/operator_overload_9.rs index 608ad0fe94e1..5fc042850ed3 100644 --- a/gcc/testsuite/rust/execute/torture/operator_overload_9.rs +++ b/gcc/testsuite/rust/execute/torture/operator_overload_9.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + #[lang = "deref"] pub trait Deref { type Target; diff --git a/gcc/testsuite/rust/execute/torture/prefetch_data.rs b/gcc/testsuite/rust/execute/torture/prefetch_data.rs index dc049b136ddd..2a847fbcb397 100644 --- a/gcc/testsuite/rust/execute/torture/prefetch_data.rs +++ b/gcc/testsuite/rust/execute/torture/prefetch_data.rs @@ -1,5 +1,8 @@ #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { fn prefetch_read_data(addr: *const T, locality: i32); fn prefetch_write_data(addr: *const T, locality: i32); diff --git a/gcc/testsuite/rust/execute/torture/ref-pattern2.rs b/gcc/testsuite/rust/execute/torture/ref-pattern2.rs index 4c9e755ba84b..8e7172406c47 100644 --- a/gcc/testsuite/rust/execute/torture/ref-pattern2.rs +++ b/gcc/testsuite/rust/execute/torture/ref-pattern2.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + #[lang = "fn_once"] pub trait FnOnce { #[lang = "fn_once_output"] diff --git a/gcc/testsuite/rust/execute/torture/slice-magic.rs b/gcc/testsuite/rust/execute/torture/slice-magic.rs index b52aa3df5104..1f56187ee5d6 100644 --- a/gcc/testsuite/rust/execute/torture/slice-magic.rs +++ b/gcc/testsuite/rust/execute/torture/slice-magic.rs @@ -1,6 +1,9 @@ // { dg-additional-options "-w" } #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] pub fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/execute/torture/slice-magic2.rs b/gcc/testsuite/rust/execute/torture/slice-magic2.rs index cdc39f3dccae..20f113ef97d8 100644 --- a/gcc/testsuite/rust/execute/torture/slice-magic2.rs +++ b/gcc/testsuite/rust/execute/torture/slice-magic2.rs @@ -1,6 +1,9 @@ // { dg-additional-options "-w" } #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] pub fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/execute/torture/slice1.rs b/gcc/testsuite/rust/execute/torture/slice1.rs index 206082af6246..2683179c7586 100644 --- a/gcc/testsuite/rust/execute/torture/slice1.rs +++ b/gcc/testsuite/rust/execute/torture/slice1.rs @@ -1,4 +1,7 @@ // { dg-additional-options "-w" } +#[lang = "sized"] +pub trait Sized {} + struct FatPtr { data: *const T, len: usize, diff --git a/gcc/testsuite/rust/execute/torture/str-layout1.rs b/gcc/testsuite/rust/execute/torture/str-layout1.rs index c9bcf1631e21..fb3b4e34a7c2 100644 --- a/gcc/testsuite/rust/execute/torture/str-layout1.rs +++ b/gcc/testsuite/rust/execute/torture/str-layout1.rs @@ -2,6 +2,9 @@ // { dg-output "t1sz=5 t2sz=10\r*" } #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + mod mem { extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_transmute", since = "1.46.0")] diff --git a/gcc/testsuite/rust/execute/torture/trait1.rs b/gcc/testsuite/rust/execute/torture/trait1.rs index d4f5878ef18d..f8a5959edd52 100644 --- a/gcc/testsuite/rust/execute/torture/trait1.rs +++ b/gcc/testsuite/rust/execute/torture/trait1.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + struct S; impl S { diff --git a/gcc/testsuite/rust/execute/torture/trait10.rs b/gcc/testsuite/rust/execute/torture/trait10.rs index b0bdeab9091c..a5951223e072 100644 --- a/gcc/testsuite/rust/execute/torture/trait10.rs +++ b/gcc/testsuite/rust/execute/torture/trait10.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + struct Foo(i32); trait Bar { fn baz(&self); diff --git a/gcc/testsuite/rust/execute/torture/trait11.rs b/gcc/testsuite/rust/execute/torture/trait11.rs index ed7b7c9d6eed..093343c1be5d 100644 --- a/gcc/testsuite/rust/execute/torture/trait11.rs +++ b/gcc/testsuite/rust/execute/torture/trait11.rs @@ -1,4 +1,7 @@ /* { dg-output "3\r*\n" } */ +#[lang = "sized"] +pub trait Sized {} + extern "C" { fn printf(s: *const i8, ...); } diff --git a/gcc/testsuite/rust/execute/torture/trait12.rs b/gcc/testsuite/rust/execute/torture/trait12.rs index a4ba5be116e0..83cf107a99cc 100644 --- a/gcc/testsuite/rust/execute/torture/trait12.rs +++ b/gcc/testsuite/rust/execute/torture/trait12.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + trait FnLike { fn call(&self, arg: A) -> R; } diff --git a/gcc/testsuite/rust/execute/torture/trait13.rs b/gcc/testsuite/rust/execute/torture/trait13.rs index 49befb8fbb14..928a37c5d731 100644 --- a/gcc/testsuite/rust/execute/torture/trait13.rs +++ b/gcc/testsuite/rust/execute/torture/trait13.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + struct Foo(i32); trait Bar { fn baz(&self); diff --git a/gcc/testsuite/rust/execute/torture/trait2.rs b/gcc/testsuite/rust/execute/torture/trait2.rs index 9974f70da8c2..d5fd5466fe92 100644 --- a/gcc/testsuite/rust/execute/torture/trait2.rs +++ b/gcc/testsuite/rust/execute/torture/trait2.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + trait Foo { const A: i32 = 123; } diff --git a/gcc/testsuite/rust/execute/torture/trait3.rs b/gcc/testsuite/rust/execute/torture/trait3.rs index 6fe92ef70f96..668b43760b4b 100644 --- a/gcc/testsuite/rust/execute/torture/trait3.rs +++ b/gcc/testsuite/rust/execute/torture/trait3.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + trait A { fn a() -> i32 { 123 diff --git a/gcc/testsuite/rust/execute/torture/trait4.rs b/gcc/testsuite/rust/execute/torture/trait4.rs index 3b2d000780a0..61c2d1584332 100644 --- a/gcc/testsuite/rust/execute/torture/trait4.rs +++ b/gcc/testsuite/rust/execute/torture/trait4.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + struct Foo(i32); trait Bar { fn baz(&self); diff --git a/gcc/testsuite/rust/execute/torture/trait5.rs b/gcc/testsuite/rust/execute/torture/trait5.rs index f9c0dfdae74a..7cd7d1a19efc 100644 --- a/gcc/testsuite/rust/execute/torture/trait5.rs +++ b/gcc/testsuite/rust/execute/torture/trait5.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + struct Foo(i32); trait Bar { fn baz(&self); diff --git a/gcc/testsuite/rust/execute/torture/trait6.rs b/gcc/testsuite/rust/execute/torture/trait6.rs index 74363c2ddacd..de5ddc1ea9e8 100644 --- a/gcc/testsuite/rust/execute/torture/trait6.rs +++ b/gcc/testsuite/rust/execute/torture/trait6.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + pub trait Foo { type A; diff --git a/gcc/testsuite/rust/execute/torture/trait7.rs b/gcc/testsuite/rust/execute/torture/trait7.rs index fc1bbe87170d..21f1575218bd 100644 --- a/gcc/testsuite/rust/execute/torture/trait7.rs +++ b/gcc/testsuite/rust/execute/torture/trait7.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + pub trait Foo { type A; diff --git a/gcc/testsuite/rust/execute/torture/trait8.rs b/gcc/testsuite/rust/execute/torture/trait8.rs index c26737f58e6e..69e784ef3b44 100644 --- a/gcc/testsuite/rust/execute/torture/trait8.rs +++ b/gcc/testsuite/rust/execute/torture/trait8.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + pub trait Foo { type A; diff --git a/gcc/testsuite/rust/execute/torture/trait9.rs b/gcc/testsuite/rust/execute/torture/trait9.rs index 738d19352919..a1642f6018f5 100644 --- a/gcc/testsuite/rust/execute/torture/trait9.rs +++ b/gcc/testsuite/rust/execute/torture/trait9.rs @@ -3,6 +3,9 @@ extern "C" { fn printf(s: *const i8, ...); } +#[lang = "sized"] +pub trait Sized {} + trait FnLike { fn call(&self, arg: A) -> R; } diff --git a/gcc/testsuite/rust/execute/torture/transmute1.rs b/gcc/testsuite/rust/execute/torture/transmute1.rs index 40dcfdee0b3d..d89affd5b820 100644 --- a/gcc/testsuite/rust/execute/torture/transmute1.rs +++ b/gcc/testsuite/rust/execute/torture/transmute1.rs @@ -5,6 +5,9 @@ extern "rust-intrinsic" { fn transmute(value: T) -> U; } +#[lang = "sized"] +pub trait Sized {} + struct WrapI { inner: i32, } diff --git a/gcc/testsuite/rust/execute/torture/wrapping_op1.rs b/gcc/testsuite/rust/execute/torture/wrapping_op1.rs index ab4afd7ddde8..e0c100cd20cc 100644 --- a/gcc/testsuite/rust/execute/torture/wrapping_op1.rs +++ b/gcc/testsuite/rust/execute/torture/wrapping_op1.rs @@ -1,5 +1,8 @@ #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { pub fn wrapping_add(l: T, r: T) -> T; } diff --git a/gcc/testsuite/rust/execute/torture/wrapping_op2.rs b/gcc/testsuite/rust/execute/torture/wrapping_op2.rs index b24ebce56f16..692899281008 100644 --- a/gcc/testsuite/rust/execute/torture/wrapping_op2.rs +++ b/gcc/testsuite/rust/execute/torture/wrapping_op2.rs @@ -1,5 +1,8 @@ #![feature(intrinsics)] +#[lang = "sized"] +pub trait Sized {} + extern "rust-intrinsic" { pub fn wrapping_add(l: T, r: T) -> T; pub fn wrapping_sub(l: T, r: T) -> T; diff --git a/gcc/testsuite/rust/link/generic_function_0.rs b/gcc/testsuite/rust/link/generic_function_0.rs index 58b8eb13db66..179c822c7fc2 100644 --- a/gcc/testsuite/rust/link/generic_function_0.rs +++ b/gcc/testsuite/rust/link/generic_function_0.rs @@ -1,3 +1,6 @@ +// { dg-xfail-if "https://github.com/Rust-GCC/gccrs/issues/2349" { *-*-* } } +// { dg-excess-errors "" { xfail *-*-* } } + extern crate generic_function_1; use generic_function_1::generic_function; diff --git a/gcc/testsuite/rust/link/generic_function_1.rs b/gcc/testsuite/rust/link/generic_function_1.rs index 8fb0788e388e..46d0e825b9da 100644 --- a/gcc/testsuite/rust/link/generic_function_1.rs +++ b/gcc/testsuite/rust/link/generic_function_1.rs @@ -1,3 +1,6 @@ +#[lang = "sized"] +pub trait Sized {} + pub fn generic_function(a: X) -> X { a }