Skip to content

Commit 17ec134

Browse files
committed
Update tests
1 parent 5b32681 commit 17ec134

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

tests/rustdoc/inline_cross/auxiliary/default-generic-args.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ pub struct Multi<A = u64, B = u64>(A, B);
4040

4141
pub type M0 = Multi<u64, ()>;
4242

43-
pub trait Trait<'a, T = &'a ()> {}
44-
45-
pub type F = dyn for<'a> Trait<'a>;
43+
pub trait Trait0<'a, T = &'a ()> {}
44+
pub type D0 = dyn for<'a> Trait0<'a>;
45+
46+
// Regression test for issue #119529.
47+
pub trait Trait1<T = (), const K: u32 = 0> {}
48+
pub type D1<T> = dyn Trait1<T>;
49+
pub type D2<const K: u32> = dyn Trait1<(), K>;
50+
pub type D3 = dyn Trait1;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub use default_generic_args::*;

tests/rustdoc/inline_cross/default-generic-args.rs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,14 @@ pub use default_generic_args::P1;
7979
pub use default_generic_args::P2;
8080

8181
// @has user/type.A0.html
82-
// Ensure that we elide generic arguments that are alpha-equivalent to their respective
83-
// generic parameter (modulo substs) (#1):
84-
// @has - '//*[@class="rust item-decl"]//code' "Alpha"
82+
// @has - '//*[@class="rust item-decl"]//code' "Alpha;"
8583
pub use default_generic_args::A0;
8684

8785
// @has user/type.A1.html
88-
// Ensure that we elide generic arguments that are alpha-equivalent to their respective
89-
// generic parameter (modulo substs) (#1):
90-
// @has - '//*[@class="rust item-decl"]//code' "Alpha"
86+
// Demonstrates that we currently don't elide generic arguments that are alpha-equivalent to their
87+
// respective generic parameter (after instantiation) for perf reasons (it would require us to
88+
// create an inference context).
89+
// @has - '//*[@class="rust item-decl"]//code' "Alpha<for<'arbitrary> fn(_: &'arbitrary ())>"
9190
pub use default_generic_args::A1;
9291

9392
// @has user/type.M0.html
@@ -97,8 +96,19 @@ pub use default_generic_args::A1;
9796
// @has - '//*[@class="rust item-decl"]//code' "Multi<u64, ()>"
9897
pub use default_generic_args::M0;
9998

100-
// @has user/type.F.html
101-
// FIXME: Ideally, we would elide `&'a ()` but `'a` is an escaping bound var which we can't reason
102-
// about at the moment since we don't keep track of bound vars.
103-
// @has - '//*[@class="rust item-decl"]//code' "dyn for<'a> Trait<'a, &'a ()>"
104-
pub use default_generic_args::F;
99+
// @has user/type.D0.html
100+
// @has - '//*[@class="rust item-decl"]//code' "dyn for<'a> Trait0<'a>"
101+
pub use default_generic_args::D0;
102+
103+
// Regression test for issue #119529.
104+
// Check that we correctly elide def ty&const args inside trait object types.
105+
106+
// @has user/type.D1.html
107+
// @has - '//*[@class="rust item-decl"]//code' "dyn Trait1<T>"
108+
pub use default_generic_args::D1;
109+
// @has user/type.D2.html
110+
// @has - '//*[@class="rust item-decl"]//code' "dyn Trait1<(), K>"
111+
pub use default_generic_args::D2;
112+
// @has user/type.D3.html
113+
// @has - '//*[@class="rust item-decl"]//code' "dyn Trait1;"
114+
pub use default_generic_args::D3;

0 commit comments

Comments
 (0)