Include all contents of first line of scraped item
This commit is contained in:
parent
686663a49e
commit
1ab23bda9c
@ -196,7 +196,8 @@ where
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let file = tcx.sess.source_map().lookup_char_pos(span.lo()).file;
|
let source_map = tcx.sess.source_map();
|
||||||
|
let file = source_map.lookup_char_pos(span.lo()).file;
|
||||||
let file_path = match file.name.clone() {
|
let file_path = match file.name.clone() {
|
||||||
FileName::Real(real_filename) => real_filename.into_local_path(),
|
FileName::Real(real_filename) => real_filename.into_local_path(),
|
||||||
_ => None,
|
_ => None,
|
||||||
@ -217,6 +218,8 @@ where
|
|||||||
let fn_entries = self.calls.entry(fn_key).or_default();
|
let fn_entries = self.calls.entry(fn_key).or_default();
|
||||||
|
|
||||||
trace!("Including expr: {:?}", span);
|
trace!("Including expr: {:?}", span);
|
||||||
|
let enclosing_item_span =
|
||||||
|
source_map.span_extend_to_prev_char(enclosing_item_span, '\n', false);
|
||||||
let location = CallLocation::new(span, enclosing_item_span, &file);
|
let location = CallLocation::new(span, enclosing_item_span, &file);
|
||||||
fn_entries.entry(abs_path).or_insert_with(mk_call_data).locations.push(location);
|
fn_entries.entry(abs_path).or_insert_with(mk_call_data).locations.push(location);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
deps := ex
|
||||||
|
|
||||||
|
-include ../rustdoc-scrape-examples-multiple/scrape.mk
|
||||||
|
|
||||||
|
all: scrape
|
@ -0,0 +1,8 @@
|
|||||||
|
struct Foo;
|
||||||
|
impl Foo {
|
||||||
|
fn bar() { foobar::ok(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
Foo::bar();
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]//code' ' '
|
||||||
|
|
||||||
|
pub fn ok() {}
|
Loading…
x
Reference in New Issue
Block a user