Spelling librustdoc
* associated * collected * correspondence * inlining * into * javascript * multiline * variadic Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
This commit is contained in:
parent
c6fb7b9815
commit
bb2f23c34f
11 changed files with 28 additions and 28 deletions
|
@ -528,7 +528,7 @@ pub(crate) fn build_impl(
|
||||||
items: trait_items,
|
items: trait_items,
|
||||||
polarity,
|
polarity,
|
||||||
kind: if utils::has_doc_flag(tcx, did, sym::fake_variadic) {
|
kind: if utils::has_doc_flag(tcx, did, sym::fake_variadic) {
|
||||||
ImplKind::FakeVaradic
|
ImplKind::FakeVariadic
|
||||||
} else {
|
} else {
|
||||||
ImplKind::Normal
|
ImplKind::Normal
|
||||||
},
|
},
|
||||||
|
|
|
@ -2356,7 +2356,7 @@ fn clean_impl<'tcx>(
|
||||||
items,
|
items,
|
||||||
polarity: tcx.impl_polarity(def_id),
|
polarity: tcx.impl_polarity(def_id),
|
||||||
kind: if utils::has_doc_flag(tcx, def_id.to_def_id(), sym::fake_variadic) {
|
kind: if utils::has_doc_flag(tcx, def_id.to_def_id(), sym::fake_variadic) {
|
||||||
ImplKind::FakeVaradic
|
ImplKind::FakeVariadic
|
||||||
} else {
|
} else {
|
||||||
ImplKind::Normal
|
ImplKind::Normal
|
||||||
},
|
},
|
||||||
|
|
|
@ -156,7 +156,7 @@ impl ExternalCrate {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempts to find where an external crate is located, given that we're
|
/// Attempts to find where an external crate is located, given that we're
|
||||||
/// rendering in to the specified source destination.
|
/// rendering into the specified source destination.
|
||||||
pub(crate) fn location(
|
pub(crate) fn location(
|
||||||
&self,
|
&self,
|
||||||
extern_url: Option<&str>,
|
extern_url: Option<&str>,
|
||||||
|
@ -751,7 +751,7 @@ pub(crate) enum ItemKind {
|
||||||
PrimitiveItem(PrimitiveType),
|
PrimitiveItem(PrimitiveType),
|
||||||
/// A required associated constant in a trait declaration.
|
/// A required associated constant in a trait declaration.
|
||||||
TyAssocConstItem(Type),
|
TyAssocConstItem(Type),
|
||||||
/// An associated associated constant in a trait impl or a provided one in a trait declaration.
|
/// An associated constant in a trait impl or a provided one in a trait declaration.
|
||||||
AssocConstItem(Type, ConstantKind),
|
AssocConstItem(Type, ConstantKind),
|
||||||
/// A required associated type in a trait declaration.
|
/// A required associated type in a trait declaration.
|
||||||
///
|
///
|
||||||
|
@ -2305,7 +2305,7 @@ impl Impl {
|
||||||
pub(crate) enum ImplKind {
|
pub(crate) enum ImplKind {
|
||||||
Normal,
|
Normal,
|
||||||
Auto,
|
Auto,
|
||||||
FakeVaradic,
|
FakeVariadic,
|
||||||
Blanket(Box<Type>),
|
Blanket(Box<Type>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2319,7 +2319,7 @@ impl ImplKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn is_fake_variadic(&self) -> bool {
|
pub(crate) fn is_fake_variadic(&self) -> bool {
|
||||||
matches!(self, ImplKind::FakeVaradic)
|
matches!(self, ImplKind::FakeVariadic)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn as_blanket_ty(&self) -> Option<&Type> {
|
pub(crate) fn as_blanket_ty(&self) -> Option<&Type> {
|
||||||
|
|
|
@ -491,7 +491,7 @@ impl Options {
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
|
||||||
//
|
//
|
||||||
// The original key values we have are the same as the DOM storage API keys and the
|
// The original key values we have are the same as the DOM storage API keys and the
|
||||||
// command line options, so contain `-`. Our Javascript needs to be able to look
|
// command line options, so contain `-`. Our JavaScript needs to be able to look
|
||||||
// these values up both in `dataset` and in the storage API, so it needs to be able
|
// these values up both in `dataset` and in the storage API, so it needs to be able
|
||||||
// to convert the names back and forth. Despite doing this kebab-case to
|
// to convert the names back and forth. Despite doing this kebab-case to
|
||||||
// StudlyCaps transformation automatically, the JS DOM API does not provide a
|
// StudlyCaps transformation automatically, the JS DOM API does not provide a
|
||||||
|
|
|
@ -514,7 +514,7 @@ struct Classifier<'src> {
|
||||||
|
|
||||||
impl<'src> Classifier<'src> {
|
impl<'src> Classifier<'src> {
|
||||||
/// Takes as argument the source code to HTML-ify, the rust edition to use and the source code
|
/// Takes as argument the source code to HTML-ify, the rust edition to use and the source code
|
||||||
/// file span which will be used later on by the `span_correspondance_map`.
|
/// file span which will be used later on by the `span_correspondence_map`.
|
||||||
fn new(src: &str, file_span: Span, decoration_info: Option<DecorationInfo>) -> Classifier<'_> {
|
fn new(src: &str, file_span: Span, decoration_info: Option<DecorationInfo>) -> Classifier<'_> {
|
||||||
let tokens = PeekIter::new(TokenIter { src, cursor: Cursor::new(src) });
|
let tokens = PeekIter::new(TokenIter { src, cursor: Cursor::new(src) });
|
||||||
let decorations = decoration_info.map(Decorations::new);
|
let decorations = decoration_info.map(Decorations::new);
|
||||||
|
@ -649,7 +649,7 @@ impl<'src> Classifier<'src> {
|
||||||
///
|
///
|
||||||
/// `before` is the position of the given token in the `source` string and is used as "lo" byte
|
/// `before` is the position of the given token in the `source` string and is used as "lo" byte
|
||||||
/// in case we want to try to generate a link for this token using the
|
/// in case we want to try to generate a link for this token using the
|
||||||
/// `span_correspondance_map`.
|
/// `span_correspondence_map`.
|
||||||
fn advance(
|
fn advance(
|
||||||
&mut self,
|
&mut self,
|
||||||
token: TokenKind,
|
token: TokenKind,
|
||||||
|
@ -895,7 +895,7 @@ fn exit_span(out: &mut impl Write, closing_tag: &str) {
|
||||||
/// flexible.
|
/// flexible.
|
||||||
///
|
///
|
||||||
/// Note that if `context` is not `None` and that the given `klass` contains a `Span`, the function
|
/// Note that if `context` is not `None` and that the given `klass` contains a `Span`, the function
|
||||||
/// will then try to find this `span` in the `span_correspondance_map`. If found, it'll then
|
/// will then try to find this `span` in the `span_correspondence_map`. If found, it'll then
|
||||||
/// generate a link for this element (which corresponds to where its definition is located).
|
/// generate a link for this element (which corresponds to where its definition is located).
|
||||||
fn string<T: Display>(
|
fn string<T: Display>(
|
||||||
out: &mut impl Write,
|
out: &mut impl Write,
|
||||||
|
@ -916,7 +916,7 @@ fn string<T: Display>(
|
||||||
/// * If `klass` is `Some` but `klass.get_span()` is `None`, it writes the text wrapped in a
|
/// * If `klass` is `Some` but `klass.get_span()` is `None`, it writes the text wrapped in a
|
||||||
/// `<span>` with the provided `klass`.
|
/// `<span>` with the provided `klass`.
|
||||||
/// * If `klass` is `Some` and has a [`rustc_span::Span`], it then tries to generate a link (`<a>`
|
/// * If `klass` is `Some` and has a [`rustc_span::Span`], it then tries to generate a link (`<a>`
|
||||||
/// element) by retrieving the link information from the `span_correspondance_map` that was filled
|
/// element) by retrieving the link information from the `span_correspondence_map` that was filled
|
||||||
/// in `span_map.rs::collect_spans_and_sources`. If it cannot retrieve the information, then it's
|
/// in `span_map.rs::collect_spans_and_sources`. If it cannot retrieve the information, then it's
|
||||||
/// the same as the second point (`klass` is `Some` but doesn't have a [`rustc_span::Span`]).
|
/// the same as the second point (`klass` is `Some` but doesn't have a [`rustc_span::Span`]).
|
||||||
fn string_without_closing_tag<T: Display>(
|
fn string_without_closing_tag<T: Display>(
|
||||||
|
@ -963,7 +963,7 @@ fn string_without_closing_tag<T: Display>(
|
||||||
|
|
||||||
if let Some(href_context) = href_context {
|
if let Some(href_context) = href_context {
|
||||||
if let Some(href) =
|
if let Some(href) =
|
||||||
href_context.context.shared.span_correspondance_map.get(&def_span).and_then(|href| {
|
href_context.context.shared.span_correspondence_map.get(&def_span).and_then(|href| {
|
||||||
let context = href_context.context;
|
let context = href_context.context;
|
||||||
// FIXME: later on, it'd be nice to provide two links (if possible) for all items:
|
// FIXME: later on, it'd be nice to provide two links (if possible) for all items:
|
||||||
// one to the documentation page and one to the source definition.
|
// one to the documentation page and one to the source definition.
|
||||||
|
|
|
@ -1392,7 +1392,7 @@ static DEFAULT_ID_MAP: Lazy<FxHashMap<Cow<'static, str>, usize>> = Lazy::new(||
|
||||||
|
|
||||||
fn init_id_map() -> FxHashMap<Cow<'static, str>, usize> {
|
fn init_id_map() -> FxHashMap<Cow<'static, str>, usize> {
|
||||||
let mut map = FxHashMap::default();
|
let mut map = FxHashMap::default();
|
||||||
// This is the list of IDs used in Javascript.
|
// This is the list of IDs used in JavaScript.
|
||||||
map.insert("help".into(), 1);
|
map.insert("help".into(), 1);
|
||||||
map.insert("settings".into(), 1);
|
map.insert("settings".into(), 1);
|
||||||
map.insert("not-displayed".into(), 1);
|
map.insert("not-displayed".into(), 1);
|
||||||
|
|
|
@ -122,9 +122,9 @@ pub(crate) struct SharedContext<'tcx> {
|
||||||
/// the crate.
|
/// the crate.
|
||||||
redirections: Option<RefCell<FxHashMap<String, String>>>,
|
redirections: Option<RefCell<FxHashMap<String, String>>>,
|
||||||
|
|
||||||
/// Correspondance map used to link types used in the source code pages to allow to click on
|
/// Correspondence map used to link types used in the source code pages to allow to click on
|
||||||
/// links to jump to the type's definition.
|
/// links to jump to the type's definition.
|
||||||
pub(crate) span_correspondance_map: FxHashMap<rustc_span::Span, LinkFromSrc>,
|
pub(crate) span_correspondence_map: FxHashMap<rustc_span::Span, LinkFromSrc>,
|
||||||
/// The [`Cache`] used during rendering.
|
/// The [`Cache`] used during rendering.
|
||||||
pub(crate) cache: Cache,
|
pub(crate) cache: Cache,
|
||||||
|
|
||||||
|
@ -531,7 +531,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
|
||||||
errors: receiver,
|
errors: receiver,
|
||||||
redirections: if generate_redirect_map { Some(Default::default()) } else { None },
|
redirections: if generate_redirect_map { Some(Default::default()) } else { None },
|
||||||
show_type_layout,
|
show_type_layout,
|
||||||
span_correspondance_map: matches,
|
span_correspondence_map: matches,
|
||||||
cache,
|
cache,
|
||||||
call_locations,
|
call_locations,
|
||||||
};
|
};
|
||||||
|
@ -647,7 +647,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
|
||||||
</div>\
|
</div>\
|
||||||
<noscript>\
|
<noscript>\
|
||||||
<section>\
|
<section>\
|
||||||
You need to enable Javascript be able to update your settings.\
|
You need to enable JavaScript be able to update your settings.\
|
||||||
</section>\
|
</section>\
|
||||||
</noscript>\
|
</noscript>\
|
||||||
<link rel=\"stylesheet\" \
|
<link rel=\"stylesheet\" \
|
||||||
|
@ -709,7 +709,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
|
||||||
</div>\
|
</div>\
|
||||||
<noscript>\
|
<noscript>\
|
||||||
<section>\
|
<section>\
|
||||||
<p>You need to enable Javascript to use keyboard commands or search.</p>\
|
<p>You need to enable JavaScript to use keyboard commands or search.</p>\
|
||||||
<p>For more information, browse the <a href=\"https://doc.rust-lang.org/rustdoc/\">rustdoc handbook</a>.</p>\
|
<p>For more information, browse the <a href=\"https://doc.rust-lang.org/rustdoc/\">rustdoc handbook</a>.</p>\
|
||||||
</section>\
|
</section>\
|
||||||
</noscript>",
|
</noscript>",
|
||||||
|
|
|
@ -665,7 +665,7 @@ impl FromWithTcx<clean::Impl> for Impl {
|
||||||
let clean::Impl { unsafety, generics, trait_, for_, items, polarity, kind } = impl_;
|
let clean::Impl { unsafety, generics, trait_, for_, items, polarity, kind } = impl_;
|
||||||
// FIXME: use something like ImplKind in JSON?
|
// FIXME: use something like ImplKind in JSON?
|
||||||
let (synthetic, blanket_impl) = match kind {
|
let (synthetic, blanket_impl) = match kind {
|
||||||
clean::ImplKind::Normal | clean::ImplKind::FakeVaradic => (false, None),
|
clean::ImplKind::Normal | clean::ImplKind::FakeVariadic => (false, None),
|
||||||
clean::ImplKind::Auto => (true, None),
|
clean::ImplKind::Auto => (true, None),
|
||||||
clean::ImplKind::Blanket(ty) => (false, Some(*ty)),
|
clean::ImplKind::Blanket(ty) => (false, Some(*ty)),
|
||||||
};
|
};
|
||||||
|
@ -740,7 +740,7 @@ impl FromWithTcx<clean::Variant> for Variant {
|
||||||
impl FromWithTcx<clean::Discriminant> for Discriminant {
|
impl FromWithTcx<clean::Discriminant> for Discriminant {
|
||||||
fn from_tcx(disr: clean::Discriminant, tcx: TyCtxt<'_>) -> Self {
|
fn from_tcx(disr: clean::Discriminant, tcx: TyCtxt<'_>) -> Self {
|
||||||
Discriminant {
|
Discriminant {
|
||||||
// expr is only none if going through the inlineing path, which gets
|
// expr is only none if going through the inlining path, which gets
|
||||||
// `rustc_middle` types, not `rustc_hir`, but because JSON never inlines
|
// `rustc_middle` types, not `rustc_hir`, but because JSON never inlines
|
||||||
// the expr is always some.
|
// the expr is always some.
|
||||||
expr: disr.expr(tcx).unwrap(),
|
expr: disr.expr(tcx).unwrap(),
|
||||||
|
|
|
@ -286,7 +286,7 @@ pub(crate) fn run(
|
||||||
let (cx, _) = Context::init(krate, renderopts, cache, tcx).map_err(|e| e.to_string())?;
|
let (cx, _) = Context::init(krate, renderopts, cache, tcx).map_err(|e| e.to_string())?;
|
||||||
|
|
||||||
// Collect CrateIds corresponding to provided target crates
|
// Collect CrateIds corresponding to provided target crates
|
||||||
// If two different versions of the crate in the dependency tree, then examples will be collcted from both.
|
// If two different versions of the crate in the dependency tree, then examples will be collected from both.
|
||||||
let all_crates = tcx
|
let all_crates = tcx
|
||||||
.crates(())
|
.crates(())
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
@ -13,11 +13,11 @@ rule d
|
||||||
// another line comment
|
// another line comment
|
||||||
e {}
|
e {}
|
||||||
|
|
||||||
rule f/* a multine
|
rule f/* a multiline
|
||||||
|
|
||||||
comment*/{}
|
comment*/{}
|
||||||
|
|
||||||
rule g/* another multine
|
rule g/* another multiline
|
||||||
|
|
||||||
comment*/h
|
comment*/h
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ function parseOptions(args) {
|
||||||
"executable_path": null,
|
"executable_path": null,
|
||||||
"no_sandbox": false,
|
"no_sandbox": false,
|
||||||
};
|
};
|
||||||
const correspondances = {
|
const correspondences = {
|
||||||
"--doc-folder": "doc_folder",
|
"--doc-folder": "doc_folder",
|
||||||
"--tests-folder": "tests_folder",
|
"--tests-folder": "tests_folder",
|
||||||
"--debug": "debug",
|
"--debug": "debug",
|
||||||
|
@ -73,7 +73,7 @@ function parseOptions(args) {
|
||||||
}
|
}
|
||||||
opts["jobs"] = parseInt(arg_value);
|
opts["jobs"] = parseInt(arg_value);
|
||||||
} else if (arg !== "--file") {
|
} else if (arg !== "--file") {
|
||||||
opts[correspondances[arg]] = arg_value;
|
opts[correspondences[arg]] = arg_value;
|
||||||
} else {
|
} else {
|
||||||
opts["files"].push(arg_value);
|
opts["files"].push(arg_value);
|
||||||
}
|
}
|
||||||
|
@ -82,9 +82,9 @@ function parseOptions(args) {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
} else if (arg === "--no-sandbox") {
|
} else if (arg === "--no-sandbox") {
|
||||||
console.log("`--no-sandbox` is being used. Be very careful!");
|
console.log("`--no-sandbox` is being used. Be very careful!");
|
||||||
opts[correspondances[arg]] = true;
|
opts[correspondences[arg]] = true;
|
||||||
} else if (correspondances[arg]) {
|
} else if (correspondences[arg]) {
|
||||||
opts[correspondances[arg]] = true;
|
opts[correspondences[arg]] = true;
|
||||||
} else {
|
} else {
|
||||||
console.log("Unknown option `" + arg + "`.");
|
console.log("Unknown option `" + arg + "`.");
|
||||||
console.log("Use `--help` to see the list of options");
|
console.log("Use `--help` to see the list of options");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue