Add tests for impl restriction rendering

This commit is contained in:
CoCo-Japan-pan
2026-06-02 19:10:08 +09:00
parent b5acf9501a
commit 5358c2fdbb
2 changed files with 29 additions and 0 deletions
@@ -0,0 +1,15 @@
//@ compile-flags: --document-private-items
#![crate_name = "c"]
#![feature(impl_restriction)]
//@ matches c/trait.Foo.html '//*[@class="stab impl_restriction"]' \
// 'This trait cannot be implemented outside c.$'
//@ has c/trait.Foo.html '//*[@class="stab impl_restriction"]//code' 'c'
pub impl(crate) trait Foo {}
pub mod inner {
//@ matches c/inner/trait.Bar.html '//*[@class="stab impl_restriction"]' \
// 'This trait cannot be implemented outside c::inner.$'
//@ has c/inner/trait.Bar.html '//*[@class="stab impl_restriction"]//code' 'c::inner'
pub impl(self) trait Bar {}
}
@@ -0,0 +1,14 @@
#![crate_name = "c"]
#![feature(impl_restriction)]
//@ matches c/trait.Foo.html '//*[@class="stab impl_restriction"]' \
// 'This trait cannot be implemented outside c.$'
//@ has c/trait.Foo.html '//*[@class="stab impl_restriction"]//code' 'c'
pub impl(crate) trait Foo {}
pub mod inner {
//@ matches c/inner/trait.Bar.html '//*[@class="stab impl_restriction"]' \
// 'This trait cannot be implemented outside c.$'
//@ has c/inner/trait.Bar.html '//*[@class="stab impl_restriction"]//code' 'c'
pub impl(self) trait Bar {}
}