Comments (10)
This seems low priority. I value this feature though, so I'm willing to contribute to fixing this my self. But Id like pointers in knowing where to find the code relating to printing out file links. Like which repository.
from rust.
This seems low priority. I value this feature though, so I'm willing to contribute to fixing this my self. But Id like pointers in knowing where to find the code relating to printing out file links. Like which repository.
uh, rust-lang/rust?
from rust.
aiui doctests are actually extracted into a new file by librustdoc and then compiled, with no awareness of what their line/column was in the original file and thus no ability to offset them. you would have to probably poke at https://github.com/rust-lang/rust/blob/aec67e238d366c4c41373b272f19dd79ff5ec0f0/src/librustdoc/doctest.rs at minimum to address this.
( initially also said https://github.com/rust-lang/rust/blob/aec67e238d366c4c41373b272f19dd79ff5ec0f0/compiler/rustc_builtin_macros/src/source_util.rs but I think that's a red herring, now that I've reviewed the relevant assert!
code. )
from rust.
Related:
from rust.
By offset I meant I could probably first figure out what line the doctest itself is in the source file, then take that line number and add to what ever the current runner outputs. Seems simple enough? Or are there other things I need to worry about. My IDE seems to be able to figure out where a doctest lies (RustRover) assuming it is using some rust compiler API.
from rust.
By offset I meant I could probably first figure out what line the doctest itself is in the source file, then take that line number and add to what ever the current runner outputs. Seems simple enough?
The output is from the assert
inside the compiled binary.
from rust.
The runner doesn't know anything, it is only repeating this from the binary:
rust/library/core/src/panic/panic_info.rs
Lines 119 to 128 in ebcb862
It gets the location from here:
rust/library/core/src/panic/location.rs
Lines 88 to 90 in ebcb862
This is generated by compiler magic, about... here?
rust/compiler/rustc_middle/src/ty/context.rs
Line 1623 in ebcb862
But I believe the interesting code that actually determines the spans to output is here:
rust/compiler/rustc_middle/src/mir/mod.rs
Line 761 in ebcb862
Ideally we'd somehow convince rustdoc to use the original source spans while compiling this.
from rust.
oh, goofier solution:
during extraction, insert sufficient newlines.
from rust.
That seems be a good idea
from rust.
oh, goofier solution:
during extraction, insert sufficient newlines.
Might not work if the test is sufficiently close to the top of the file, I think.
from rust.
Related Issues (20)
- diagnostics should prefer naming items through the extern prelude instead of doc-hidden type aliases
- async lambda with capture ICE HOT 4
- std::net::TcpStream::connect_timeout on vxworks HOT 4
- async lambda fails to copy a value that is Copy HOT 12
- nightly ICE when building flexstr in release mode HOT 8
- `hir::Body`'s documentation incorrectly suggests it doesn't contain parmaeter info for closures
- error: internal compiler error: compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:486:17: cannot relate region: LUB('{erased}, '{erased}) HOT 12
- Help needed finding a test that changes behaviour when changing DefiningOpaqueTypes::No to Yes HOT 3
- Binary size creep on Fuchsia after commit 5ced3da HOT 6
- Type mismatch is incorrectly attributed in certain closures / async blocks
- ICE: Found unstable fingerprints for evaluate_obligation - computing whether enum is freeze - optimizing MIR
- Regression in `#[used]` attribute on Windows msvc HOT 16
- ICE in TaggedSerializer (serde) HOT 3
- missed optimization: coalesce PathBuf reallocation HOT 5
- `thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/link.rs:2700:27: index out of bounds: the len is 41 but the index is 41` HOT 2
- Vxworks build error for current master branch. Need to update some source. HOT 8
- rustdoc: add link prefix which would allow overwriting explicit links with item links
- Left-padding using format! does not work when using a fmt::Display as the argument HOT 4
- ICE: Cannot Eq compare incompatible types *mut T/#0 and *const T/#0 HOT 2
- Rust binaries cannot load relocatable libraries on macOS without `-rpath`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust.