Skip to content

Commit

Permalink
Fix rustdoc error with no providec crate-type, fix scrape examples bu…
Browse files Browse the repository at this point in the history
…tton colors w/ themes
  • Loading branch information
willcrichton committed Dec 7, 2022
1 parent bcdab87 commit 0709e53
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use rustc_interface::interface;
use rustc_middle::hir::nested_filter;
use rustc_middle::ty::{ParamEnv, Ty, TyCtxt};
use rustc_resolve as resolve;
use rustc_session::config::{self, ErrorOutputType};
use rustc_session::config::{self, CrateType, ErrorOutputType};
use rustc_session::lint;
use rustc_session::Session;
use rustc_span::symbol::sym;
Expand Down Expand Up @@ -247,6 +247,7 @@ pub(crate) fn create_config(
Some((lint.name_lower(), lint::Allow))
});

let crate_types = if crate_types.is_empty() { vec![CrateType::Rlib] } else { crate_types };
let test = scrape_examples_options.map(|opts| opts.scrape_tests).unwrap_or(false);
// plays with error output here!
let sessopts = config::Options {
Expand Down
8 changes: 6 additions & 2 deletions src/librustdoc/doctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use rustc_middle::hir::nested_filter;
use rustc_middle::ty::TyCtxt;
use rustc_parse::maybe_new_parser_from_source_str;
use rustc_parse::parser::attr::InnerAttrPolicy;
use rustc_session::config::{self, ErrorOutputType};
use rustc_session::config::{self, CrateType, ErrorOutputType};
use rustc_session::parse::ParseSess;
use rustc_session::{lint, Session};
use rustc_span::edition::Edition;
Expand Down Expand Up @@ -68,7 +68,11 @@ pub(crate) fn run(options: RustdocOptions) -> Result<(), ErrorGuaranteed> {

debug!(?lint_opts);

let crate_types = options.crate_types.clone();
let crate_types = if options.crate_types.is_empty() {
vec![CrateType::Rlib]
} else {
options.crate_types.clone()
};

let sessopts = config::Options {
maybe_sysroot: options.maybe_sysroot.clone(),
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,7 @@ in storage.js
.scraped-example .code-wrapper .next,
.scraped-example .code-wrapper .prev,
.scraped-example .code-wrapper .expand {
color: var(--main-color);
position: absolute;
top: 0.25em;
z-index: 1;
Expand Down

0 comments on commit 0709e53

Please sign in to comment.