mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-11-03 13:13:18 +00:00 
			
		
		
		
	Merge #11916
11916: internal: Add more doc-link tests r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
		
						commit
						5ac07a89ef
					
				@ -299,21 +299,105 @@ fn foo() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[test]
 | 
			
		||||
fn test_trait_items() {
 | 
			
		||||
fn doc_links_items_simple() {
 | 
			
		||||
    check_doc_links(
 | 
			
		||||
        r#"
 | 
			
		||||
//- /main.rs crate:main deps:krate
 | 
			
		||||
/// [`krate`]
 | 
			
		||||
//! [`Trait`]
 | 
			
		||||
//! [`function`]
 | 
			
		||||
//! [`CONST`]
 | 
			
		||||
//! [`STATIC`]
 | 
			
		||||
//! [`Struct`]
 | 
			
		||||
//! [`Enum`]
 | 
			
		||||
//! [`Union`]
 | 
			
		||||
//! [`Type`]
 | 
			
		||||
//! [`module`]
 | 
			
		||||
use self$0;
 | 
			
		||||
 | 
			
		||||
const CONST: () = ();
 | 
			
		||||
   // ^^^^^ CONST
 | 
			
		||||
static STATIC: () = ();
 | 
			
		||||
    // ^^^^^^ STATIC
 | 
			
		||||
trait Trait {
 | 
			
		||||
   // ^^^^^ Trait
 | 
			
		||||
}
 | 
			
		||||
fn function() {}
 | 
			
		||||
// ^^^^^^^^ function
 | 
			
		||||
struct Struct;
 | 
			
		||||
    // ^^^^^^ Struct
 | 
			
		||||
enum Enum {}
 | 
			
		||||
  // ^^^^ Enum
 | 
			
		||||
union Union {__: ()}
 | 
			
		||||
   // ^^^^^ Union
 | 
			
		||||
type Type = ();
 | 
			
		||||
  // ^^^^ Type
 | 
			
		||||
mod module {}
 | 
			
		||||
 // ^^^^^^ module
 | 
			
		||||
//- /krate.rs crate:krate
 | 
			
		||||
// empty
 | 
			
		||||
//^file krate
 | 
			
		||||
"#,
 | 
			
		||||
    )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[test]
 | 
			
		||||
fn doc_links_inherent_impl_items() {
 | 
			
		||||
    check_doc_links(
 | 
			
		||||
        r#"
 | 
			
		||||
// /// [`Struct::CONST`]
 | 
			
		||||
// /// [`Struct::function`]
 | 
			
		||||
/// FIXME #9694
 | 
			
		||||
struct Struct$0;
 | 
			
		||||
 | 
			
		||||
impl Struct {
 | 
			
		||||
    const CONST: () = ();
 | 
			
		||||
    fn function() {}
 | 
			
		||||
}
 | 
			
		||||
"#,
 | 
			
		||||
    )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[test]
 | 
			
		||||
fn doc_links_trait_impl_items() {
 | 
			
		||||
    check_doc_links(
 | 
			
		||||
        r#"
 | 
			
		||||
trait Trait {
 | 
			
		||||
    type Type;
 | 
			
		||||
    const CONST: usize;
 | 
			
		||||
    fn function();
 | 
			
		||||
}
 | 
			
		||||
// /// [`Struct::Type`]
 | 
			
		||||
// /// [`Struct::CONST`]
 | 
			
		||||
// /// [`Struct::function`]
 | 
			
		||||
/// FIXME #9694
 | 
			
		||||
struct Struct$0;
 | 
			
		||||
 | 
			
		||||
impl Trait for Struct {
 | 
			
		||||
    type Type = ();
 | 
			
		||||
    const CONST: () = ();
 | 
			
		||||
    fn function() {}
 | 
			
		||||
}
 | 
			
		||||
"#,
 | 
			
		||||
    )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[test]
 | 
			
		||||
fn doc_links_trait_items() {
 | 
			
		||||
    check_doc_links(
 | 
			
		||||
        r#"
 | 
			
		||||
/// [`Trait`]
 | 
			
		||||
/// [`Trait::Type`]
 | 
			
		||||
/// [`Trait::CONST`]
 | 
			
		||||
/// [`Trait::func`]
 | 
			
		||||
/// [`Trait::function`]
 | 
			
		||||
trait Trait$0 {
 | 
			
		||||
   // ^^^^^ Trait
 | 
			
		||||
    type Type;
 | 
			
		||||
type Type;
 | 
			
		||||
  // ^^^^ Trait::Type
 | 
			
		||||
    const CONST: usize;
 | 
			
		||||
const CONST: usize;
 | 
			
		||||
   // ^^^^^ Trait::CONST
 | 
			
		||||
    fn func();
 | 
			
		||||
    // ^^^^ Trait::func
 | 
			
		||||
fn function();
 | 
			
		||||
// ^^^^^^^^ Trait::function
 | 
			
		||||
}
 | 
			
		||||
    "#,
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user