File tree 1 file changed +94
-10
lines changed
1 file changed +94
-10
lines changed Original file line number Diff line number Diff line change @@ -299,23 +299,107 @@ fn foo() {
299
299
}
300
300
301
301
#[ test]
302
- fn test_trait_items ( ) {
302
+ fn doc_links_items_simple ( ) {
303
+ check_doc_links (
304
+ r#"
305
+ //- /main.rs crate:main deps:krate
306
+ /// [`krate`]
307
+ //! [`Trait`]
308
+ //! [`function`]
309
+ //! [`CONST`]
310
+ //! [`STATIC`]
311
+ //! [`Struct`]
312
+ //! [`Enum`]
313
+ //! [`Union`]
314
+ //! [`Type`]
315
+ //! [`module`]
316
+ use self$0;
317
+
318
+ const CONST: () = ();
319
+ // ^^^^^ CONST
320
+ static STATIC: () = ();
321
+ // ^^^^^^ STATIC
322
+ trait Trait {
323
+ // ^^^^^ Trait
324
+ }
325
+ fn function() {}
326
+ // ^^^^^^^^ function
327
+ struct Struct;
328
+ // ^^^^^^ Struct
329
+ enum Enum {}
330
+ // ^^^^ Enum
331
+ union Union {__: ()}
332
+ // ^^^^^ Union
333
+ type Type = ();
334
+ // ^^^^ Type
335
+ mod module {}
336
+ // ^^^^^^ module
337
+ //- /krate.rs crate:krate
338
+ // empty
339
+ //^file krate
340
+ "# ,
341
+ )
342
+ }
343
+
344
+ #[ test]
345
+ fn doc_links_inherent_impl_items ( ) {
346
+ check_doc_links (
347
+ r#"
348
+ // /// [`Struct::CONST`]
349
+ // /// [`Struct::function`]
350
+ /// FIXME #9694
351
+ struct Struct$0;
352
+
353
+ impl Struct {
354
+ const CONST: () = ();
355
+ fn function() {}
356
+ }
357
+ "# ,
358
+ )
359
+ }
360
+
361
+ #[ test]
362
+ fn doc_links_trait_impl_items ( ) {
363
+ check_doc_links (
364
+ r#"
365
+ trait Trait {
366
+ type Type;
367
+ const CONST: usize;
368
+ fn function();
369
+ }
370
+ // /// [`Struct::Type`]
371
+ // /// [`Struct::CONST`]
372
+ // /// [`Struct::function`]
373
+ /// FIXME #9694
374
+ struct Struct$0;
375
+
376
+ impl Trait for Struct {
377
+ type Type = ();
378
+ const CONST: () = ();
379
+ fn function() {}
380
+ }
381
+ "# ,
382
+ )
383
+ }
384
+
385
+ #[ test]
386
+ fn doc_links_trait_items ( ) {
303
387
check_doc_links (
304
388
r#"
305
389
/// [`Trait`]
306
390
/// [`Trait::Type`]
307
391
/// [`Trait::CONST`]
308
- /// [`Trait::func `]
392
+ /// [`Trait::function `]
309
393
trait Trait$0 {
310
394
// ^^^^^ Trait
311
- type Type;
312
- // ^^^^ Trait::Type
313
- const CONST: usize;
314
- // ^^^^^ Trait::CONST
315
- fn func ();
316
- // ^^^^ Trait::func
317
- }
318
- "# ,
395
+ type Type;
396
+ // ^^^^ Trait::Type
397
+ const CONST: usize;
398
+ // ^^^^^ Trait::CONST
399
+ fn function ();
400
+ // ^^^^^^^^ Trait::function
401
+ }
402
+ "# ,
319
403
)
320
404
}
321
405
You can’t perform that action at this time.
0 commit comments