From acaf5841634862178c0542e8710e34402ea96c77 Mon Sep 17 00:00:00 2001 From: Predrag Gruevski Date: Sat, 4 Feb 2023 20:25:45 +0000 Subject: [PATCH] Add a test case for non-breaking item renaming. --- .../nonbreaking_item_rename/new/Cargo.toml | 7 +++++++ .../nonbreaking_item_rename/new/src/lib.rs | 20 +++++++++++++++++++ .../nonbreaking_item_rename/old/Cargo.toml | 7 +++++++ .../nonbreaking_item_rename/old/src/lib.rs | 13 ++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 test_crates/nonbreaking_item_rename/new/Cargo.toml create mode 100644 test_crates/nonbreaking_item_rename/new/src/lib.rs create mode 100644 test_crates/nonbreaking_item_rename/old/Cargo.toml create mode 100644 test_crates/nonbreaking_item_rename/old/src/lib.rs diff --git a/test_crates/nonbreaking_item_rename/new/Cargo.toml b/test_crates/nonbreaking_item_rename/new/Cargo.toml new file mode 100644 index 00000000..3a4887ad --- /dev/null +++ b/test_crates/nonbreaking_item_rename/new/Cargo.toml @@ -0,0 +1,7 @@ +[package] +publish = false +name = "nonbreaking_item_rename" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/test_crates/nonbreaking_item_rename/new/src/lib.rs b/test_crates/nonbreaking_item_rename/new/src/lib.rs new file mode 100644 index 00000000..50fea028 --- /dev/null +++ b/test_crates/nonbreaking_item_rename/new/src/lib.rs @@ -0,0 +1,20 @@ +mod internal { + pub struct NewName; + + pub enum NewEnum { + Foo, + } + + pub trait NewTrait {} + + pub fn new_fn() {} +} + +pub use internal::{NewName, NewEnum, NewTrait, new_fn}; + +// Re-export the items under their old names, +// so that this isn't a breaking change. +pub use NewName as OldName; +pub use NewEnum as OldEnum; +pub use NewTrait as OldTrait; +pub use new_fn as old_fn; diff --git a/test_crates/nonbreaking_item_rename/old/Cargo.toml b/test_crates/nonbreaking_item_rename/old/Cargo.toml new file mode 100644 index 00000000..3a4887ad --- /dev/null +++ b/test_crates/nonbreaking_item_rename/old/Cargo.toml @@ -0,0 +1,7 @@ +[package] +publish = false +name = "nonbreaking_item_rename" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/test_crates/nonbreaking_item_rename/old/src/lib.rs b/test_crates/nonbreaking_item_rename/old/src/lib.rs new file mode 100644 index 00000000..3335f18c --- /dev/null +++ b/test_crates/nonbreaking_item_rename/old/src/lib.rs @@ -0,0 +1,13 @@ +mod internal { + pub struct OldName; + + pub enum OldEnum { + Foo, + } + + pub trait OldTrait {} + + pub fn old_fn() {} +} + +pub use internal::{OldName, OldEnum, OldTrait, old_fn};