@@ -60,14 +60,6 @@ pub fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition)
60
60
out
61
61
}
62
62
63
- // FIXME:
64
- // BUG: For Option::Some
65
- // Returns https://doc.rust-lang.org/nightly/core/prelude/v1/enum.Option.html#variant.Some
66
- // Instead of https://doc.rust-lang.org/nightly/core/option/enum.Option.html
67
- // This could be worked around by turning the `EnumVariant` into `Enum` before attempting resolution,
68
- // but it's really just working around the problem. Ideally we need to implement a slightly different
69
- // version of import map which follows the same process as rustdoc. Otherwise there'll always be some
70
- // edge cases where we select the wrong import path.
71
63
fn get_doc_link ( db : & RootDatabase , definition : Definition ) -> Option < String > {
72
64
// Get the outermost definition for the moduledef. This is used to resolve the public path to the type,
73
65
// then we can join the method, field, etc onto it if required.
@@ -396,7 +388,7 @@ mod tests {
396
388
397
389
fn check ( ra_fixture : & str , expect : Expect ) {
398
390
let ( analysis, position) = analysis_and_position ( ra_fixture) ;
399
- let url = analysis. external_docs ( position) . unwrap ( ) . unwrap ( ) ;
391
+ let url = analysis. external_docs ( position) . unwrap ( ) . expect ( "could not find url for symbol" ) ;
400
392
401
393
expect. assert_eq ( & url)
402
394
}
@@ -474,4 +466,29 @@ pub struct Foo {
474
466
expect ! [ [ r##"https://docs.rs/test/*/test/struct.Foo.html#structfield.field"## ] ] ,
475
467
) ;
476
468
}
469
+
470
+ // FIXME: ImportMap will return re-export paths instead of public module
471
+ // paths. The correct path to documentation will never be a re-export.
472
+ // This problem stops us from resolving stdlib items included in the prelude
473
+ // such as `Option::Some` correctly.
474
+ #[ ignore = "ImportMap may return re-exports" ]
475
+ #[ test]
476
+ fn test_reexport_order ( ) {
477
+ check (
478
+ r#"
479
+ pub mod wrapper {
480
+ pub use module::Item;
481
+
482
+ pub mod module {
483
+ pub struct Item;
484
+ }
485
+ }
486
+
487
+ fn foo() {
488
+ let bar: wrapper::It<|>em;
489
+ }
490
+ "# ,
491
+ expect ! [ [ r#"https://docs.rs/test/*/test/wrapper/module/struct.Item.html"# ] ] ,
492
+ )
493
+ }
477
494
}
0 commit comments