From 063a1d2920b29e7754bf5cf8d106eaf54cd68165 Mon Sep 17 00:00:00 2001 From: frankwang <73262844+Frank-III@users.noreply.github.com> Date: Mon, 27 Jan 2025 15:00:56 -0800 Subject: [PATCH] replace `object_safe` with `dyn_compatible` (#1083) related: https://github.com/obi1kenobi/trustfall-rustdoc-adapter/pull/718 Should we not rename the query name yet? but should I rename the test name and all `make_me_non_object_safe` functions? --------- Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com> --- ...ron => trait_no_longer_dyn_compatible.ron} | 10 +++++----- src/query.rs | 2 +- .../trait_added_supertrait/new/src/lib.rs | 2 +- .../trait_added_supertrait/old/src/lib.rs | 2 +- .../new/src/lib.rs | 20 +++++++++---------- .../old/src/lib.rs | 20 +++++++++---------- .../new/src/lib.rs | 12 +++++------ .../old/src/lib.rs | 12 +++++------ .../new/src/lib.rs | 20 +++++++++---------- .../old/src/lib.rs | 20 +++++++++---------- .../new/Cargo.toml | 2 +- .../new/src/lib.rs | 0 .../old/Cargo.toml | 2 +- .../old/src/lib.rs | 0 .../trait_method_default_impl_removed.snap | 4 ++-- ...ap => trait_no_longer_dyn_compatible.snap} | 4 ++-- 16 files changed, 66 insertions(+), 66 deletions(-) rename src/lints/{trait_no_longer_object_safe.ron => trait_no_longer_dyn_compatible.ron} (81%) rename test_crates/{trait_no_longer_object_safe => trait_no_longer_dyn_compatible}/new/Cargo.toml (65%) rename test_crates/{trait_no_longer_object_safe => trait_no_longer_dyn_compatible}/new/src/lib.rs (100%) rename test_crates/{trait_no_longer_object_safe => trait_no_longer_dyn_compatible}/old/Cargo.toml (65%) rename test_crates/{trait_no_longer_object_safe => trait_no_longer_dyn_compatible}/old/src/lib.rs (100%) rename test_outputs/query_execution/{trait_no_longer_object_safe.snap => trait_no_longer_dyn_compatible.snap} (92%) diff --git a/src/lints/trait_no_longer_object_safe.ron b/src/lints/trait_no_longer_dyn_compatible.ron similarity index 81% rename from src/lints/trait_no_longer_object_safe.ron rename to src/lints/trait_no_longer_dyn_compatible.ron index 052357a7..1d926d4b 100644 --- a/src/lints/trait_no_longer_object_safe.ron +++ b/src/lints/trait_no_longer_dyn_compatible.ron @@ -1,6 +1,6 @@ SemverQuery( - id: "trait_no_longer_object_safe", - human_readable_name: "trait no longer object safe", + id: "trait_no_longer_dyn_compatible", + human_readable_name: "trait no longer dyn compatible", description: "A trait is no longer object safe, meaning it can no longer be used as `dyn Trait`.", required_update: Major, lint_level: Deny, @@ -12,7 +12,7 @@ SemverQuery( item { ... on Trait { visibility_limit @filter(op: "=", value: ["$public"]) @output - object_safe @filter(op: "=", value: ["$true"]) + dyn_compatible @filter(op: "=", value: ["$true"]) importable_path { path @output @tag public_api @filter(op: "=", value: ["$true"]) @@ -25,7 +25,7 @@ SemverQuery( ... on Trait { visibility_limit @filter(op: "=", value: ["$public"]) name @output - object_safe @filter(op: "!=", value: ["$true"]) + dyn_compatible @filter(op: "!=", value: ["$true"]) importable_path { path @filter(op: "=", value: ["%path"]) @@ -45,6 +45,6 @@ SemverQuery( "public": "public", "true": true, }, - error_message: "Trait is no longer object safe, which breaks `dyn Trait` usage.", + error_message: "Trait is no longer dyn compatible, which breaks `dyn Trait` usage.", per_result_error_template: Some("trait {{name}} in file {{span_filename}}:{{span_begin_line}}"), ) diff --git a/src/query.rs b/src/query.rs index 6ef1a429..4e7a6af2 100644 --- a/src/query.rs +++ b/src/query.rs @@ -1220,7 +1220,7 @@ add_lints!( trait_missing, trait_must_use_added, trait_newly_sealed, - trait_no_longer_object_safe, + trait_no_longer_dyn_compatible, trait_now_doc_hidden, trait_removed_associated_constant, trait_removed_associated_type, diff --git a/test_crates/trait_added_supertrait/new/src/lib.rs b/test_crates/trait_added_supertrait/new/src/lib.rs index 7f4770d8..0b89bad9 100644 --- a/test_crates/trait_added_supertrait/new/src/lib.rs +++ b/test_crates/trait_added_supertrait/new/src/lib.rs @@ -17,7 +17,7 @@ pub trait WillGainAnotherOneSealed: TraitOne + TraitTwo + sealed::Sealed {} pub trait WillGainStdOne: Sync {} pub trait WillGainStdTwo: core::fmt::Debug {} pub trait WillGainStdThree: PartialEq { - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillChangeStdToCore: core::fmt::Debug {} diff --git a/test_crates/trait_added_supertrait/old/src/lib.rs b/test_crates/trait_added_supertrait/old/src/lib.rs index c41c3171..61b60046 100644 --- a/test_crates/trait_added_supertrait/old/src/lib.rs +++ b/test_crates/trait_added_supertrait/old/src/lib.rs @@ -17,7 +17,7 @@ pub trait WillGainAnotherOneSealed: TraitOne + sealed::Sealed {} pub trait WillGainStdOne {} pub trait WillGainStdTwo {} pub trait WillGainStdThree { - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillChangeStdToCore: std::fmt::Debug {} diff --git a/test_crates/trait_associated_const_added/new/src/lib.rs b/test_crates/trait_associated_const_added/new/src/lib.rs index eb75da8e..cf1fb0f2 100644 --- a/test_crates/trait_associated_const_added/new/src/lib.rs +++ b/test_crates/trait_associated_const_added/new/src/lib.rs @@ -5,59 +5,59 @@ mod sealed { pub trait WillGainConstWithoutDefault { const BAR: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainConstWithoutDefaultSealed: sealed::Sealed { const BAR: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainConstWithoutDefaultAndSeal: sealed::Sealed { const BAR: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainConstWithDefault { const BAR: bool = true; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainConstWithDefaultSealed: sealed::Sealed { const BAR: bool = true; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainAnotherConstWithoutDefault { const ONE: bool; const TWO: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainAnotherConstWithoutDefaultSealed: sealed::Sealed { const ONE: bool; const TWO: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainADocHiddenConst { #[doc(hidden)] const BAR: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait ConstWithoutDefaultUnchanged { const BAR: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait ConstDocHidden { #[doc(hidden)] const BAR: bool = true; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } diff --git a/test_crates/trait_associated_const_added/old/src/lib.rs b/test_crates/trait_associated_const_added/old/src/lib.rs index eacda234..25d90a5e 100644 --- a/test_crates/trait_associated_const_added/old/src/lib.rs +++ b/test_crates/trait_associated_const_added/old/src/lib.rs @@ -3,46 +3,46 @@ mod sealed { } pub trait WillGainConstWithoutDefault { - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainConstWithoutDefaultSealed: sealed::Sealed { - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainConstWithoutDefaultAndSeal { - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainConstWithDefault { - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainConstWithDefaultSealed: sealed::Sealed { - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainAnotherConstWithoutDefault { const ONE: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainAnotherConstWithoutDefaultSealed: sealed::Sealed { const ONE: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainADocHiddenConst { - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait ConstWithoutDefaultUnchanged { const BAR: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait ConstDocHidden { #[doc(hidden)] const BAR: bool = true; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } diff --git a/test_crates/trait_associated_const_default_removed/new/src/lib.rs b/test_crates/trait_associated_const_default_removed/new/src/lib.rs index 51761b6b..64eee676 100644 --- a/test_crates/trait_associated_const_default_removed/new/src/lib.rs +++ b/test_crates/trait_associated_const_default_removed/new/src/lib.rs @@ -4,33 +4,33 @@ mod sealed { pub trait WillLoseDefault { const ONE: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillLoseDefaultSealed: sealed::Sealed { const ONE: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait Unchanged { const ONE: bool = true; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait UnchangedSealed: sealed::Sealed { const ONE: bool = true; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait UnchangedNoDefault { const ONE: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait UnchangedNoDefaultSealed: sealed::Sealed { const ONE: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } diff --git a/test_crates/trait_associated_const_default_removed/old/src/lib.rs b/test_crates/trait_associated_const_default_removed/old/src/lib.rs index bdf275ba..6a56e98e 100644 --- a/test_crates/trait_associated_const_default_removed/old/src/lib.rs +++ b/test_crates/trait_associated_const_default_removed/old/src/lib.rs @@ -5,33 +5,33 @@ mod sealed { pub trait WillLoseDefault { const ONE: bool = true; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillLoseDefaultSealed: sealed::Sealed { const ONE: bool = true; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait Unchanged { const ONE: bool = true; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait UnchangedSealed: sealed::Sealed { const ONE: bool = true; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait UnchangedNoDefault { const ONE: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait UnchangedNoDefaultSealed: sealed::Sealed { const ONE: bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } diff --git a/test_crates/trait_associated_type_added/new/src/lib.rs b/test_crates/trait_associated_type_added/new/src/lib.rs index c0167839..66faffdc 100644 --- a/test_crates/trait_associated_type_added/new/src/lib.rs +++ b/test_crates/trait_associated_type_added/new/src/lib.rs @@ -7,63 +7,63 @@ mod sealed { pub trait WillGainTypeWithoutDefault { type Bar; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainTypeWithoutDefaultSealed: sealed::Sealed { type Bar; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainTypeWithoutDefaultAndSeal: sealed::Sealed { type Bar; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainTypeWithDefault { type Bar = bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainTypeWithDefaultSealed: sealed::Sealed { type Bar = bool; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainAnotherTypeWithoutDefault { type One; type Two; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainAnotherTypeWithoutDefaultSealed: sealed::Sealed { type One; type Two; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainADocHiddenType { #[doc(hidden)] type Bar; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait TypeWithoutDefaultUnchanged { type Bar; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait TypeDocHidden { #[doc(hidden)] type Bar; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } diff --git a/test_crates/trait_associated_type_added/old/src/lib.rs b/test_crates/trait_associated_type_added/old/src/lib.rs index 70ce4787..d6212658 100644 --- a/test_crates/trait_associated_type_added/old/src/lib.rs +++ b/test_crates/trait_associated_type_added/old/src/lib.rs @@ -5,49 +5,49 @@ mod sealed { } pub trait WillGainTypeWithoutDefault { - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainTypeWithoutDefaultSealed: sealed::Sealed { - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainTypeWithoutDefaultAndSeal { - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainTypeWithDefault { - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainTypeWithDefaultSealed: sealed::Sealed { - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainAnotherTypeWithoutDefault { type One; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainAnotherTypeWithoutDefaultSealed: sealed::Sealed { type One; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait WillGainADocHiddenType { - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait TypeWithoutDefaultUnchanged { type Bar; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } pub trait TypeDocHidden { #[doc(hidden)] type Bar; - fn make_me_non_object_safe() -> Self; + fn make_me_non_dyn_compatible() -> Self; } diff --git a/test_crates/trait_no_longer_object_safe/new/Cargo.toml b/test_crates/trait_no_longer_dyn_compatible/new/Cargo.toml similarity index 65% rename from test_crates/trait_no_longer_object_safe/new/Cargo.toml rename to test_crates/trait_no_longer_dyn_compatible/new/Cargo.toml index 55b0aec7..17d8e068 100644 --- a/test_crates/trait_no_longer_object_safe/new/Cargo.toml +++ b/test_crates/trait_no_longer_dyn_compatible/new/Cargo.toml @@ -1,6 +1,6 @@ [package] publish = false -name = "trait_no_longer_object_safe" +name = "trait_no_longer_dyn_compatible" version = "0.1.0" edition = "2021" diff --git a/test_crates/trait_no_longer_object_safe/new/src/lib.rs b/test_crates/trait_no_longer_dyn_compatible/new/src/lib.rs similarity index 100% rename from test_crates/trait_no_longer_object_safe/new/src/lib.rs rename to test_crates/trait_no_longer_dyn_compatible/new/src/lib.rs diff --git a/test_crates/trait_no_longer_object_safe/old/Cargo.toml b/test_crates/trait_no_longer_dyn_compatible/old/Cargo.toml similarity index 65% rename from test_crates/trait_no_longer_object_safe/old/Cargo.toml rename to test_crates/trait_no_longer_dyn_compatible/old/Cargo.toml index 55b0aec7..17d8e068 100644 --- a/test_crates/trait_no_longer_object_safe/old/Cargo.toml +++ b/test_crates/trait_no_longer_dyn_compatible/old/Cargo.toml @@ -1,6 +1,6 @@ [package] publish = false -name = "trait_no_longer_object_safe" +name = "trait_no_longer_dyn_compatible" version = "0.1.0" edition = "2021" diff --git a/test_crates/trait_no_longer_object_safe/old/src/lib.rs b/test_crates/trait_no_longer_dyn_compatible/old/src/lib.rs similarity index 100% rename from test_crates/trait_no_longer_object_safe/old/src/lib.rs rename to test_crates/trait_no_longer_dyn_compatible/old/src/lib.rs diff --git a/test_outputs/query_execution/trait_method_default_impl_removed.snap b/test_outputs/query_execution/trait_method_default_impl_removed.snap index 8007a930..b36c06ca 100644 --- a/test_outputs/query_execution/trait_method_default_impl_removed.snap +++ b/test_outputs/query_execution/trait_method_default_impl_removed.snap @@ -49,12 +49,12 @@ expression: "&query_execution_results" "visibility_limit": String("public"), }, ], - "./test_crates/trait_no_longer_object_safe/": [ + "./test_crates/trait_no_longer_dyn_compatible/": [ { "method_name": String("by_ref"), "name": String("RefTrait"), "path": List([ - String("trait_no_longer_object_safe"), + String("trait_no_longer_dyn_compatible"), String("RefTrait"), ]), "span_begin_line": Uint64(3), diff --git a/test_outputs/query_execution/trait_no_longer_object_safe.snap b/test_outputs/query_execution/trait_no_longer_dyn_compatible.snap similarity index 92% rename from test_outputs/query_execution/trait_no_longer_object_safe.snap rename to test_outputs/query_execution/trait_no_longer_dyn_compatible.snap index ad02b054..0fef716c 100644 --- a/test_outputs/query_execution/trait_no_longer_object_safe.snap +++ b/test_outputs/query_execution/trait_no_longer_dyn_compatible.snap @@ -37,11 +37,11 @@ expression: "&query_execution_results" "visibility_limit": String("public"), }, ], - "./test_crates/trait_no_longer_object_safe/": [ + "./test_crates/trait_no_longer_dyn_compatible/": [ { "name": String("RefTrait"), "path": List([ - String("trait_no_longer_object_safe"), + String("trait_no_longer_dyn_compatible"), String("RefTrait"), ]), "span_begin_line": Uint64(2),