Skip to content
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

Correctly analyze sealed status of traits with multiple supertraits. (#374) #375

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions src/adapter/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ fn rustdoc_sealed_traits() {
name: "TransitivelyTraitSealed".into(),
sealed: true,
},
Output {
name: "SealedTraitWithStdSupertrait".into(),
sealed: true,
},
Output {
name: "Unsealed".into(),
sealed: false,
Expand Down
2 changes: 1 addition & 1 deletion src/sealed_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn has_sealed_supertrait<'a>(indexed_crate: &IndexedCrate<'a>, inner: &'a Trait)
// TODO: Once we have the ability to do cross-crate analysis, consider
// whether this external trait is sealed. That can have
// some interesting SemVer implications as well.
return false;
continue;
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions test_crates/sealed_traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ pub trait DirectlyTraitSealed: private::Sealed {}
/// This trait is sealed since nobody can implement its supertrait.
pub trait TransitivelyTraitSealed: DirectlyTraitSealed {}

/// This trait is sealed, and happens to have more than one supertrait.
pub trait SealedTraitWithStdSupertrait: AsRef<()> + private::Sealed {}

pub trait Unsealed {}

/// This trait is sealed because its argument type is pub-in-priv,
Expand Down