Skip to content

Commit

Permalink
Add a test case with infinite importable paths. (obi1kenobi#287)
Browse files Browse the repository at this point in the history
* Add a test case with infinite importable paths.

* Make one more import public.

* Make the test crates `publish = false`.
  • Loading branch information
obi1kenobi authored Jan 28, 2023
1 parent aaba6b0 commit 5f1e43f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test_crates/infinite_importable_paths/new/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
publish = false
name = "infinite_importable_paths"
version = "0.1.0"
edition = "2021"

[dependencies]
23 changes: 23 additions & 0 deletions test_crates/infinite_importable_paths/new/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//! This package exports the functions:
//! - `foo`
//! - `nested::foo`
//! - `nested::nested::foo`
//! etc. with arbitrarily many repetitions of `nested` allowed.
//!
//! This package uses a different way of achieving the same thing
//! compared to its variant in the `old` directory.
//! No semver issues should be reported when comparing the two.
mod nested_other {
pub use super::nested;

pub fn foo() {}
}

pub mod nested {
pub use crate::nested_other::foo;

pub use crate::nested_other::nested;
}

pub use nested::foo;
7 changes: 7 additions & 0 deletions test_crates/infinite_importable_paths/old/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
publish = false
name = "infinite_importable_paths"
version = "0.1.0"
edition = "2021"

[dependencies]
13 changes: 13 additions & 0 deletions test_crates/infinite_importable_paths/old/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//! This package exports the functions:
//! - `foo`
//! - `nested::foo`
//! - `nested::nested::foo`
//! etc. with arbitrarily many repetitions of `nested` allowed.
pub mod nested {
pub use super::nested;

pub fn foo() {}
}

pub use nested::foo;

0 comments on commit 5f1e43f

Please sign in to comment.