rust/compiler
bors 7d7de5bf3c Auto merge of #139088 - spastorino:ergonomic-ref-counting-2, r=nikomatsakis
Ergonomic ref counting: optimize away clones when possible

This PR build on top of https://github.com/rust-lang/rust/pull/134797. It optimizes codegen of ergonomic ref-counting when the type being `use`d is only known to be copy after monomorphization. We avoid codening a clone and generate bitwise copy instead.

RFC: https://github.com/rust-lang/rfcs/pull/3680
Tracking issue: https://github.com/rust-lang/rust/issues/132290
Project goal: https://github.com/rust-lang/rust-project-goals/issues/107

r? `@nikomatsakis`

This PR could better sit on top of https://github.com/rust-lang/rust/pull/131650 but as it did not land yet I've decided to just do minimal changes. It may be the case that doing what I'm doing regress the performance and we may need to go the full route of https://github.com/rust-lang/rust/pull/131650.
cc `@saethlin` in this regard.
2025-04-10 09:08:23 +00:00
..
rustc Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_abi Remove redundant words 2025-04-09 18:46:50 +08:00
rustc_arena Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_ast Rollup merge of #139465 - EnzymeAD:autodiff-sret, r=oli-obk 2025-04-07 22:29:21 +10:00
rustc_ast_ir Use -Wunused_crate_dependencies for compiler crates. 2025-03-20 08:59:43 +11:00
rustc_ast_lowering Rollup merge of #139455 - Skgland:remove_rust-intrinsic_ABI, r=oli-obk 2025-04-07 22:29:20 +10:00
rustc_ast_passes Rollup merge of #139035 - nnethercote:PatKind-Missing, r=oli-obk 2025-04-07 22:29:17 +10:00
rustc_ast_pretty Rollup merge of #139112 - m-ou-se:super-let, r=lcnr 2025-04-07 22:29:18 +10:00
rustc_attr_data_structures add rustc_macro_edition_2021 2025-03-19 17:37:35 +01:00
rustc_attr_parsing Avoid kw::Empty when dealing with rustc_allowed_through_unstable_modules. 2025-03-25 16:48:03 +11:00
rustc_baked_icu_data Add unreachable_pub to RUSTC_LINT_FLAGS for compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_borrowck Auto merge of #139536 - matthiaskrgr:rollup-j6goald, r=matthiaskrgr 2025-04-08 22:51:10 +00:00
rustc_builtin_macros refactor: simplify function-info gathering 2025-04-06 22:08:40 +02:00
rustc_codegen_cranelift update docs 2025-04-06 21:41:47 +02:00
rustc_codegen_gcc Rollup merge of #138949 - madsmtm:rename-to-darwin, r=WaffleLapkin 2025-04-04 08:02:05 +02:00
rustc_codegen_llvm Rollup merge of #139465 - EnzymeAD:autodiff-sret, r=oli-obk 2025-04-07 22:29:21 +10:00
rustc_codegen_ssa Auto merge of #139088 - spastorino:ergonomic-ref-counting-2, r=nikomatsakis 2025-04-10 09:08:23 +00:00
rustc_const_eval Make LevelAndSource a struct 2025-04-03 09:17:55 +00:00
rustc_data_structures update cfgs 2025-04-09 12:29:59 +01:00
rustc_driver Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_driver_impl Auto merge of #138947 - madsmtm:refactor-apple-versions, r=Noratrieb 2025-04-06 10:16:28 +00:00
rustc_error_codes update/bless tests 2025-04-06 21:41:47 +02:00
rustc_error_messages update cfgs 2025-04-09 12:29:59 +01:00
rustc_errors Rollup merge of #139468 - compiler-errors:has_stashed_diagnostic, r=oli-obk 2025-04-09 14:52:38 +02:00
rustc_expand Implement super let. 2025-04-04 09:44:19 +02:00
rustc_feature replace version placeholder 2025-04-09 12:29:59 +01:00
rustc_fluent_macro Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_fs_util Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_graphviz Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_hashes Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_hir Rollup merge of #139112 - m-ou-se:super-let, r=lcnr 2025-04-07 22:29:18 +10:00
rustc_hir_analysis Use a query rather than recomputing the tail repeatedly 2025-04-09 20:26:58 +00:00
rustc_hir_pretty Rollup merge of #139112 - m-ou-se:super-let, r=lcnr 2025-04-07 22:29:18 +10:00
rustc_hir_typeck Rollup merge of #139364 - Kohei316:feat/doc-hidden-suggestion, r=nnethercote 2025-04-09 14:52:37 +02:00
rustc_incremental Auto merge of #138629 - Zoxc:graph-anon-hashmap, r=oli-obk 2025-03-24 15:02:09 +00:00
rustc_index Use {Decodable,Encodable}_NoContext in type_ir 2025-03-15 06:34:36 +00:00
rustc_index_macros Add unreachable_pub to RUSTC_LINT_FLAGS for compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_infer clean code: remove Deref<Target=RegionKind> impl for Region and use .kind() 2025-04-08 10:51:41 +08:00
rustc_interface borrowck typeck children together with their parent 2025-04-08 00:34:40 +02:00
rustc_lexer Replace rustc_lexer/unescape with rustc-literal-escaper crate 2025-04-04 14:44:45 +02:00
rustc_lint Auto merge of #139552 - matthiaskrgr:rollup-b194mk8, r=matthiaskrgr 2025-04-09 05:39:18 +00:00
rustc_lint_defs impl !PartialOrd for HirId 2025-04-03 09:22:21 +00:00
rustc_llvm Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
rustc_log Use -Wunused_crate_dependencies for compiler crates. 2025-03-20 08:59:43 +11:00
rustc_macros Move codec module back into middle 2025-03-15 06:42:48 +00:00
rustc_metadata Restrict some queries by def-kind more 2025-04-07 18:10:28 +00:00
rustc_middle Auto merge of #139088 - spastorino:ergonomic-ref-counting-2, r=nikomatsakis 2025-04-10 09:08:23 +00:00
rustc_mir_build Make use generated TerminatorKind::Call have call_source Use 2025-04-07 16:53:11 -03:00
rustc_mir_dataflow Auto merge of #138414 - matthiaskrgr:rollup-9ablqdb, r=matthiaskrgr 2025-03-12 17:27:43 +00:00
rustc_mir_transform Auto merge of #139327 - cjgillot:gvn-place, r=oli-obk 2025-04-09 08:50:33 +00:00
rustc_monomorphize for large assignment lint, use the correct span for checking for duplicate lints 2025-04-08 21:22:20 +02:00
rustc_next_trait_solver Auto merge of #139000 - compiler-errors:rigid-missing-item, r=lcnr 2025-04-10 04:03:59 +00:00
rustc_parse Allow for reparsing failure when reparsing a pasted metavar. 2025-04-08 12:06:42 +10:00
rustc_parse_format Update rustc-literal-escaper version to 0.0.2 2025-04-04 22:26:10 +02:00
rustc_passes Rollup merge of #139455 - Skgland:remove_rust-intrinsic_ABI, r=oli-obk 2025-04-07 22:29:20 +10:00
rustc_pattern_analysis Fix stack overflow in exhaustiveness due to recursive HIR opaque type values 2025-04-07 22:41:48 +00:00
rustc_privacy privacy: Visit types and traits in impls in type privacy lints 2025-03-25 12:40:02 +03:00
rustc_query_impl Add a dep kind for use of the anon node with zero dependencies 2025-04-02 07:35:05 +02:00
rustc_query_system Add a dep kind for use of the anon node with zero dependencies 2025-04-02 07:35:05 +02:00
rustc_resolve Rollup merge of #139035 - nnethercote:PatKind-Missing, r=oli-obk 2025-04-07 22:29:17 +10:00
rustc_sanitizers Encode synthetic by-move coroutine body with a different DefPathData 2025-03-30 22:53:21 +00:00
rustc_serialize Convert rustc_serialize integration tests to unit tests. 2025-03-20 08:59:50 +11:00
rustc_session Auto merge of #138947 - madsmtm:refactor-apple-versions, r=Noratrieb 2025-04-06 10:16:28 +00:00
rustc_smir remove compiler support for extern "rust-intrinsic" blocks 2025-04-06 21:32:58 +02:00
rustc_span Auto merge of #139281 - petrochenkov:ctxtdecod6, r=wesleywiser 2025-04-05 06:18:04 +00:00
rustc_symbol_mangling clean code: remove Deref<Target=RegionKind> impl for Region and use .kind() 2025-04-08 10:51:41 +08:00
rustc_target remove compiler support for extern "rust-intrinsic" blocks 2025-04-06 21:32:58 +02:00
rustc_trait_selection Auto merge of #139000 - compiler-errors:rigid-missing-item, r=lcnr 2025-04-10 04:03:59 +00:00
rustc_traits Rollup merge of #138394 - lcnr:yeet-variant, r=compiler-errors 2025-03-12 10:19:32 -07:00
rustc_transmute Add #[cfg(test)] for Transition in dfa 2025-03-18 07:17:16 +00:00
rustc_ty_utils Use a query rather than recomputing the tail repeatedly 2025-04-09 20:26:58 +00:00
rustc_type_ir Auto merge of #139000 - compiler-errors:rigid-missing-item, r=lcnr 2025-04-10 04:03:59 +00:00
rustc_type_ir_macros Fold visit into ty 2025-03-15 06:34:36 +00:00
stable_mir let rustc_smir host stable_mir for refactoring 2025-04-05 18:23:07 +08:00