Skip to content

Rollup of 7 pull requests #128222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8449d10
Extend rules of dead code analysis for impls for adts to impls for ty…
mu001999 Jun 27, 2024
ef121f2
Suggesting an available assoc item is always maybe-incorrect
fmease Jun 10, 2024
898448c
HIR ty lowering: Refactor the way the projectee ("QSelf") gets passed…
fmease Jun 14, 2024
3c8b108
Inside eager ty aliases on unresolved assoc tys suggest fully qualify…
fmease Jun 14, 2024
02a2f02
Suggest full trait ref (with placeholders) on unresolved assoc tys
fmease Jun 15, 2024
63a54d9
Don't suppress lint type_alias_bounds for ty aliases containing inher…
fmease Jun 14, 2024
a8b3dfd
Suppress lint type_alias_bounds for ty aliases containing const proje…
fmease Jun 14, 2024
fdf8f02
Improve the impl and diag output of lint type_alias_bounds
fmease Jun 15, 2024
d67b616
Make lint type_alias_bounds's removal sugg maybe-incorrect if the RHS…
fmease Jun 16, 2024
5859dff
Update the description of lint type_alias_bounds
fmease Jun 16, 2024
4dad2a3
rewrite interdependent-c-libraries to rmake
Oneirical Jul 19, 2024
c424bc6
rewrite compiler-rt-works-on-mingw to rmake
Oneirical Jul 19, 2024
e175b83
rewrite incr-foreign-head-span to rmake
Oneirical Jul 19, 2024
0d52289
rewrite dump-ice-to-disk to rmake
Oneirical Jul 9, 2024
f72bf8b
rewrite panic-abort-eh_frame to rmake
Oneirical Jul 9, 2024
bade142
migrate tests/run-make/extern-flag-disambiguates to rmake
lolbinarycat Jul 23, 2024
20c6713
note that rmake.rs files are not subject to automatic formatting
lolbinarycat Jul 23, 2024
7638889
clean up rmake test
lolbinarycat Jul 23, 2024
62dff66
use shorter link and remove entries wrongly added in rebase
lolbinarycat Jul 23, 2024
f4f57bf
Make Clone::clone a lang item
saethlin Jul 25, 2024
2fca4ea
Add a label to point to the lacking macro name definition
linyihai Jul 10, 2024
ceae371
Rollup merge of #126575 - fmease:update-lint-type_alias_bounds, r=com…
tgross35 Jul 26, 2024
a70dc29
Rollup merge of #127017 - mu001999-contrib:dead/enhance, r=pnkfelix
tgross35 Jul 26, 2024
96fb354
Rollup merge of #127523 - Oneirical:treasure-test, r=jieyouxu
tgross35 Jul 26, 2024
c5788d6
Rollup merge of #127557 - linyihai:issue-126694, r=compiler-errors
tgross35 Jul 26, 2024
4290de8
Rollup merge of #127989 - Oneirical:testricted-area, r=jieyouxu
tgross35 Jul 26, 2024
0f1ea63
Rollup merge of #128099 - lolbinarycat:extern-flag-disambiguates-rmak…
tgross35 Jul 26, 2024
97eade4
Rollup merge of #128170 - saethlin:clone-fn, r=compiler-errors
tgross35 Jul 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make Clone::clone a lang item
  • Loading branch information
saethlin committed Jul 25, 2024
commit f4f57bfccb98522f4aaa2942baaa5a381c7d952d
1 change: 1 addition & 0 deletions compiler/rustc_hir/src/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ language_item_table! {
StructuralPeq, sym::structural_peq, structural_peq_trait, Target::Trait, GenericRequirement::None;
Copy, sym::copy, copy_trait, Target::Trait, GenericRequirement::Exact(0);
Clone, sym::clone, clone_trait, Target::Trait, GenericRequirement::None;
CloneFn, sym::clone_fn, clone_fn, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::None;
Sync, sym::sync, sync_trait, Target::Trait, GenericRequirement::Exact(0);
DiscriminantKind, sym::discriminant_kind, discriminant_kind_trait, Target::Trait, GenericRequirement::None;
/// The associated item of the `DiscriminantKind` trait.
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir_transform/src/instsimplify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use crate::simplify::simplify_duplicate_switch_targets;
use crate::take_array;
use rustc_ast::attr;
use rustc_hir::LangItem;
use rustc_middle::bug;
use rustc_middle::mir::*;
use rustc_middle::ty::layout;
Expand Down Expand Up @@ -271,8 +272,7 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
return;
}

let trait_def_id = self.tcx.trait_of_item(fn_def_id);
if trait_def_id.is_none() || trait_def_id != self.tcx.lang_items().clone_trait() {
if !self.tcx.is_lang_item(fn_def_id, LangItem::CloneFn) {
return;
}

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ symbols! {
clobber_abi,
clone,
clone_closures,
clone_fn,
clone_from,
closure,
closure_lifetime_binder,
Expand Down
3 changes: 3 additions & 0 deletions library/core/src/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ pub trait Clone: Sized {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "cloning is often expensive and is not expected to have side effects"]
// Clone::clone is special because the compiler generates MIR to implement it for some types.
// See InstanceKind::CloneShim.
#[cfg_attr(not(bootstrap), lang = "clone_fn")]
fn clone(&self) -> Self;

/// Performs copy-assignment from `source`.
Expand Down
Loading