Commit Graph

162 Commits

Author SHA1 Message Date
Guillaume Gomez
ec10824e2d Remove unused import 2020-11-17 10:33:14 +01:00
Guillaume Gomez
63785c839d Add comment explaining why we can't split on error[{}]: because of the color escape characters 2020-11-17 10:33:14 +01:00
Guillaume Gomez
95ee1fc7ea Correctly detect color support 2020-11-17 10:33:14 +01:00
Guillaume Gomez
32d64edcf9 Simplfy color availability check 2020-11-17 10:33:14 +01:00
Guillaume Gomez
57bab5e020 Add check to get windows console type to decide to use colors or not 2020-11-17 10:32:48 +01:00
Guillaume Gomez
54e8216348 Update error code detection in compile_fail doctests 2020-11-17 10:32:48 +01:00
Guillaume Gomez
96a6a5fec1 Add color in rustdoc --test output 2020-11-17 10:32:48 +01:00
Joshua Nelson
d6c16e4253 Make all rustdoc functions and structs crate-private
This gives warnings about dead code.
2020-11-15 11:21:12 -05:00
Joshua Nelson
622c48e4f1 Allow making RUSTC_BOOTSTRAP conditional on the crate name
The main change is that `UnstableOptions::from_environment` now requires
an (optional) crate name. If the crate name is unknown (`None`), then the new feature is not available and you still have to use `RUSTC_BOOTSTRAP=1`. In practice this means the feature is only available for `--crate-name`, not for `#![crate_name]`; I'm interested in supporting the second but I'm not sure how.

Other major changes:

- Added `Session::is_nightly_build()`, which uses the `crate_name` of
the session
- Added `nightly_options::match_is_nightly_build`, a convenience method
for looking up `--crate-name` from CLI arguments.
`Session::is_nightly_build()`should be preferred where possible, since
it will take into account `#![crate_name]` (I think).
- Added `unstable_features` to `rustdoc::RenderOptions`

  There is a user-facing change here: things like `RUSTC_BOOTSTRAP=0` no
  longer active nightly features. In practice this shouldn't be a big
  deal, since `RUSTC_BOOTSTRAP` is the opposite of stable and everyone
  uses `RUSTC_BOOTSTRAP=1` anyway.

- Add tests

  Check against `Cheat`, not whether nightly features are allowed.
  Nightly features are always allowed on the nightly channel.

- Only call `is_nightly_build()` once within a function

- Use booleans consistently for rustc_incremental

  Sessions can't be passed through threads, so `read_file` couldn't take a
  session. To be consistent, also take a boolean in `write_file_header`.
2020-11-07 13:45:11 -05:00
Joshua Nelson
fa1b15f627 Preserve the parent module of DocFragments
- Add `parent_module` to `DocFragment`
- Require the `parent_module` of the item being inlined
- Preserve the hir_id for ExternCrates so rustdoc can find the parent module later
- Take an optional `parent_module` for `build_impl` and `merge_attrs`.
  Preserve the difference between parent modules for each doc-comment.
- Support arbitrarily many re-exports in from_ast. In retrospect this is
  probably not used and could be simplified to a single
  `Option<(Attrs, DefId)>`.
- Don't require the parent_module for all `impl`s, just inlined items

  In particular, this will be `None` whenever the attribute is not on a
  re-export.

- Only store the parent_module, not the HirId

  When re-exporting a re-export, the HirId is not available. Fortunately,
  `collect_intra_doc_links` doesn't actually need all the info from a
  HirId, just the parent module.
2020-10-08 00:29:34 -04:00
bjorn3
71bc62b9f6 Add option to pass a custom codegen backend from a driver 2020-09-27 14:16:42 +02:00
Aleksey Kladov
df975cf9c2 Rename rustdoc/test -> rustdoc/doctest
This modules contains the implementation of doctests, and not the
tests of rustdoc itself. This name is confusing, so let's rename it to
doctest for clarity.
2020-08-27 18:21:25 +02:00