You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed this in the output running python x.py test locally:
Doc-tests alloc
error: no global memory allocator found but one is required; link to std or add #[global_allocator] to a static item that implements the GlobalAlloc trait.
Doc-tests panic_unwind
error: no global memory allocator found but one is required; link to std or add #[global_allocator] to a static item that implements the GlobalAlloc trait.
This error message is printed when running rustdoc --test src/liballoc/lib.rs […], but before running any test. The code printing it is in src/librustc_metadata/creader.rs. It looks like rustdoc is using that code in order to load the crate and find doctests in it. But since it’s not actually compiling this crate, not having an allocator is not a problem.
So I think there are two issues:
rustdoc keeps doing its thing even though there are errors. It probably should call something like abort_if_errors on its rustc::session::Session instance at some point.
This error should not occur in the first place. One way to inhibit it would be to tell creader that we’re "compiling" an rlib (CrateTypeRlib) rather than some other crate type. rlibs do not need (yet) to have an allocator defined. This is possibly this line:
The first issue could in some other situation hide a real problem, but in this case it makes the second one mostly harmless. The only bad consequence is some noise in the output of a test run.
Activity
glandium commentedon Jul 11, 2018
Same with panic_unwind:
SimonSapin commentedon Jul 11, 2018
This error message is printed when running
rustdoc --test src/liballoc/lib.rs […], but before running any test. The code printing it is insrc/librustc_metadata/creader.rs. It looks like rustdoc is using that code in order to load the crate and find doctests in it. But since it’s not actually compiling this crate, not having an allocator is not a problem.So I think there are two issues:
abort_if_errorson itsrustc::session::Sessioninstance at some point.creaderthat we’re "compiling" an rlib (CrateTypeRlib) rather than some other crate type. rlibs do not need (yet) to have an allocator defined. This is possibly this line:rust/src/librustdoc/test.rs
Line 76 in 4700e11
The first issue could in some other situation hide a real problem, but in this case it makes the second one mostly harmless. The only bad consequence is some noise in the output of a test run.
RalfJung commentedon Apr 18, 2019
Related: #54010
jethrogb commentedon Jul 3, 2019
@rustbot modify labels: +T-rustdoc
rustbot commentedon Jul 3, 2019
Error: Parsing label command in comment failed: ...ify labels|error: must have : or to as label starter at >| +T-rustdo...
Please let
@rust-lang/releaseknow if you're having trouble with this bot.Rollup merge of rust-lang#68357 - ollie27:rustdoc_test_errors, r=Guil…