File: ret-pos-impl-trait-in-trait.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (35 lines) | stat: -rw-r--r-- 1,503 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#![crate_name = "user"]
//@ aux-crate:rpitit=ret-pos-impl-trait-in-trait.rs
//@ edition:2021

// Test that we can correctly render cross-crate RPITITs.
// In particular, check that we don't render the internal associated type generated by
// their desugaring. We count the number of associated items and ensure that it is exactly one.
// This is more robust than checking for the absence of the associated type.

//@ has user/trait.Trait.html
//@ has - '//*[@id="method.create"]' 'fn create() -> impl Iterator<Item = u64>'
// The class "method" is used for all three kinds of associated items at the time of writing.
//@ count - '//*[@id="main-content"]//section[@class="method"]' 1
pub use rpitit::Trait;

//@ has user/struct.Basic.html
//@ has - '//*[@id="method.create"]' 'fn create() -> impl Iterator<Item = u64>'
//@ count - '//*[@id="trait-implementations-list"]//*[@class="impl-items"]' 1
pub use rpitit::Basic;

//@ has user/struct.Intermediate.html
//@ has - '//*[@id="method.create"]' 'fn create() -> Range<u64>'
//@ count - '//*[@id="trait-implementations-list"]//*[@class="impl-items"]' 1
pub use rpitit::Intermediate;

//@ has user/struct.Advanced.html
//@ has - '//*[@id="method.create"]' 'fn create() -> impl Iterator<Item = u64>'
//@ count - '//*[@id="trait-implementations-list"]//*[@class="impl-items"]' 1
pub use rpitit::Advanced;

// Regression test for issue #113929:

//@ has user/trait.Def.html
//@ has - '//*[@id="method.def"]' 'fn def<T>() -> impl Default'
pub use rpitit::Def;