about summary refs log tree commit diff
path: root/src/test/rustdoc
AgeCommit message (Collapse)AuthorLines
2021-03-16Auto merge of #82838 - Amanieu:rustdoc_asm, r=nagisabors-0/+31
Allow rustdoc to handle asm! of foreign architectures This allows rustdoc to process code containing `asm!` for architectures other than the current one. Since this never reaches codegen, we just replace target-specific registers and register classes with a dummy one. Fixes #82869
2021-03-15Replace `type_alias_impl_trait` by `min_type_alias_impl_trait` with no ↵Oli Scherer-3/+3
actual changes in behaviour This makes `type_alias_impl_trait` not actually do anything anymore
2021-03-14Address review commentsAmanieu d'Antras-0/+31
2021-03-13Avoid sorting predicates by `DefId`Aaron Hill-3/+3
Fixes issue #82920 Even if an item does not change between compilation sessions, it may end up with a different `DefId`, since inserting/deleting an item affects the `DefId`s of all subsequent items. Therefore, we use a `DefPathHash` in the incremental compilation system, which is stable in the face of changes to unrelated items. In particular, the query system will consider the inputs to a query to be unchanged if any `DefId`s in the inputs have their `DefPathHash`es unchanged. Queries are pure functions, so the query result should be unchanged if the query inputs are unchanged. Unfortunately, it's possible to inadvertantly make a query result incorrectly change across compilations, by relying on the specific value of a `DefId`. Specifically, if the query result is a slice that gets sorted by `DefId`, the precise order will depend on how the `DefId`s got assigned in a particular compilation session. If some definitions end up with different `DefId`s (but the same `DefPathHash`es) in a subsequent compilation session, we will end up re-computing a *different* value for the query, even though the query system expects the result to unchanged due to the unchanged inputs. It turns out that we have been sorting the predicates computed during `astconv` by their `DefId`. These predicates make their way into the `super_predicates_that_define_assoc_type`, which ends up getting used to compute the vtables of trait objects. This, re-ordering these predicates between compilation sessions can lead to undefined behavior at runtime - the query system will re-use code built with a *differently ordered* vtable, resulting in the wrong method being invoked at runtime. This PR avoids sorting by `DefId` in `astconv`, fixing the miscompilation. However, it's possible that other instances of this issue exist - they could also be easily introduced in the future. To fully fix this issue, we should 1. Turn on `-Z incremental-verify-ich` by default. This will cause the compiler to ICE whenver an 'unchanged' query result changes between compilation sessions, instead of causing a miscompilation. 2. Remove the `Ord` impls for `CrateNum` and `DefId`. This will make it difficult to introduce ICEs in the first place.
2021-03-05Rollup merge of #80763 - petrochenkov:pubusecrate, r=estebankMara-2/+2
resolve: Reduce scope of `pub_use_of_private_extern_crate` deprecation lint This lint was deny-by-default since July 2017, crater showed 7 uses on crates.io back then (https://github.com/rust-lang/rust/pull/42894#issuecomment-311921147). Unfortunately, the construction `pub use foo as bar` where `foo` is `extern crate foo;` was used by an older version `bitflags`, so turning it into an error causes too many regressions. So, this PR reduces the scope of the lint instead of turning it into a hard error, and only turns some more rarely used components of it into errors.
2021-03-04Rollup merge of #80527 - jyn514:rustdoc-lints, r=GuillaumeGomezYuki Okushi-1/+1
Make rustdoc lints a tool lint instead of built-in - Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links` (and similar for other rustdoc lints; I don't expect any others to be used frequently, though). - Ensure that the old lint names still work and give deprecation errors - Register lints even when running doctests - Move lint machinery into a separate file - Add `declare_rustdoc_lint!` macro Unblocks https://github.com/rust-lang/rust/pull/80300, https://github.com/rust-lang/rust/pull/79816, https://github.com/rust-lang/rust/pull/80965. Makes the strangeness in https://github.com/rust-lang/rust/pull/77364 more apparent to the end user (note that `missing_docs` is *not* moved to rustdoc in this PR). Closes https://github.com/rust-lang/rust/issues/78786. ## Current status This is blocked on #82620 (see https://github.com/rust-lang/rust/pull/80527#issuecomment-787401519)
2021-03-03Rollup merge of #81223 - GuillaumeGomez:generate-redirect-map, r=jyn514Yuki Okushi-0/+29
[rustdoc] Generate redirect map file Fixes #81134. So with this code: ```rust #![crate_name = "foo"] pub use private::Quz; pub use hidden::Bar; mod private { pub struct Quz; } #[doc(hidden)] pub mod hidden { pub struct Bar; } #[macro_export] macro_rules! foo { () => {} } ``` It generates: ```json { "foo/macro.foo!.html": "foo/macro.foo.html", "foo/private/struct.Quz.html": "foo/struct.Quz.html", "foo/hidden/struct.Bar.html": "foo/struct.Bar.html" } ``` Do the pathes look as you expected ````@pietroalbini?```` r? ````@jyn514````
2021-03-02Rollup merge of #82593 - sunfishcode:wasi-docs, r=alexcrichtonYuki Okushi-0/+32
Teach rustdoc how to display WASI. As a followup to [this comment] in #82420, this patch teaches rustdoc how to display WASI. [this comment]: https://github.com/rust-lang/rust/pull/82420#issuecomment-784523826 r? `@alexcrichton`
2021-03-01Rename rustdoc lints to be a tool lint instead of built-in.Joshua Nelson-1/+1
- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links` - Ensure that the old lint names still work and give deprecation errors - Register lints even when running doctests Otherwise, all `rustdoc::` lints would be ignored. - Register all existing lints as removed This unfortunately doesn't work with `register_renamed` because tool lints have not yet been registered when rustc is running. For similar reasons, `check_backwards_compat` doesn't work either. Call `register_removed` directly instead. - Fix fallout + Rustdoc lints for compiler/ + Rustdoc lints for library/ Note that this does *not* suggest `rustdoc::broken_intra_doc_links` for `rustdoc::intra_doc_link_resolution_failure`, since there was no time when the latter was valid.
2021-03-02Rollup merge of #82598 - GuillaumeGomez:rustdoc-rustc-pass, r=jyn514Guillaume Gomez-0/+2
Check stability and feature attributes in rustdoc Fixes #82588. cc `@Nemo157` `@camelid` r? `@jyn514`
2021-02-28Add a test in src/test/rustdoc/doc-cfg.rsDan Gohman-0/+32
2021-02-28Update rustdoc test to make it work with newly added rustc passesGuillaume Gomez-0/+2
2021-02-27Move test file, add test of generated linkLucas De Angelis-0/+3
2021-02-26Fix intra-doc handling of `Self` in enumLucas De Angelis-0/+8
Fixes #82209
2021-02-23* Fix some typoGuillaume Gomez-0/+24
* Improve documentation * Add a test to ensure that spotlighted traits from dependencies are taken into account as expected
2021-02-23Add tests for --generate-redirect-map optionGuillaume Gomez-0/+29
2021-02-23Rollup merge of #79423 - camelid:smart-punct, r=jyn514Dylan DPC-1/+31
Enable smart punctuation Closes #76690.
2021-02-22Rollup merge of #82351 - notriddle:docs-meta-description, r=jyn514Yuki Okushi-0/+38
Use the first paragraph, instead of cookie-cutter text, for rustdoc descriptions Partially addresses #82283.
2021-02-21Update src/test/rustdoc/description.rsMichael Howell-0/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-02-21Update src/test/rustdoc/description.rsMichael Howell-0/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-02-20Use has for non-regexesMichael Howell-6/+6
2021-02-20Fix formatting for description rustdoc UI testsMichael Howell-9/+14
2021-02-20Add rustdoc UI tests for new description behaviourMichael Howell-0/+31
2021-02-20Add test for no src links on dummy spansGuillaume Gomez-0/+12
2021-02-19Add tests for !Sized trait displayGuillaume Gomez-0/+17
2021-02-15Fix intra-doc link to raw pointer methodSimon Sapin-0/+1
CC https://github.com/rust-lang/rust/pull/80181
2021-02-13Rollup merge of #82040 - GuillaumeGomez:ensure-src-link, r=CraftSpiderYuki Okushi-0/+6
Add test to prevent src link regression Fixes #80502. This PR is simply about adding a test to prevent a regression. cc `@bugadani` `@CraftSpider` r? `@camelid`
2021-02-12Rollup merge of #79775 - jyn514:doctest, r=GuillaumeGomezDylan DPC-1/+1
Fix injected errors when running doctests on a crate named after a keyword Closes https://github.com/rust-lang/rust/issues/79771
2021-02-12Add test to prevent src link regressionGuillaume Gomez-0/+6
2021-02-11Fix injected errors when running doctests on a crate named after a keywordJoshua Nelson-1/+1
Unfortunately, this can't currently be tested. The problem is that we need the file to be compiled first to then be used as dependency, which cannot be done currently unfortunately in the rustdoc test suites. Example: ```rust // name this file "foo.rs" /// ``` /// let x = foo::foo(); /// ``` pub fn foo() {} ``` If you run `rustdoc --test foo.rs`, you'll get: ``` running 1 test test foo.rs - foo (line 1) ... FAILED failures: ---- foo.rs - foo (line 1) stdout ---- error[E0463]: can't find crate for `foo` --> foo.rs:0:1 | 2 | extern crate foo; | ^^^^^^^^^^^^^^^^^ can't find crate ``` If a test were possible, it would look something like ````rust #![crate_name = "mod"] #![crate_type = "lib"] //! ``` //! // NOTE: requires that the literal string 'mod' appears in the doctest for //! // the bug to appear //! assert_eq!(1, 1); //! ``` ````
2021-02-11resolve: Reduce scope of `pub_use_of_private_extern_crate` deprecation lintVadim Petrochenkov-2/+2
2021-02-10Do not ICE on range patterns in function argumentsLeSeulArtichaut-1/+1
2021-02-10Add regression test for #81289LeSeulArtichaut-0/+18
2021-02-08Fix `@has` checks "no closing quotation" errorCamelid-3/+3
Apparently `"foo\""` has different behavior from `'foo\''` in Python shlex. See the [discussion on Zulip][z] for more. [z]: https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.40has.20checks.20.22no.20closing.20quotation.22
2021-02-08Auto merge of #81313 - LeSeulArtichaut:revert-32558, r=jyn514bors-1/+1
Restore linking to itself in implementors section of trait page Reverts #32558 as proposed in [this Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Trait.20implementation.20self-links/near/223773273) r? `@jyn514` cc `@camelid`
2021-02-07Test that code does not get smart-punctuatedCamelid-0/+17
2021-02-07Enable smart punctuationCamelid-1/+14
2021-02-06Restore linking to itself in implementors section of trait pageLeSeulArtichaut-1/+1
2021-02-06Enable 'task list' markdown extensionJoshua Nelson-0/+13
- Add documentation about task lists
2021-01-27rustdoc: Render HRTB correctly for bare functionsCamelid-0/+29
The angle brackets were not rendered, so code like this: some_func: for<'a> fn(val: &'a i32) -> i32 would be rendered as: some_func: fn'a(val: &'a i32) -> i32 However, rendering with angle brackets is still invalid syntax: some_func: fn<'a>(val: &'a i32) -> i32 so now it renders correctly as: some_func: for<'a> fn(val: &'a i32) -> i32 ----- However, note that this code: some_trait: dyn for<'a> Trait<'a> will still render as: some_trait: dyn Trait<'a> which is not invalid syntax, but is still unclear. Unfortunately I think it's hard to fix that case because there isn't enough information in the `rustdoc::clean::Type` that this code operates on. Perhaps that case can be fixed in a later PR.
2021-01-24Rollup merge of #81302 - LeSeulArtichaut:80777-trait-render, r=jyn514Jonas Schievink-0/+19
Fix rendering of stabilization version for trait implementors Rustdoc compares an item's stabilization version with its parent's to not render it if they are the same. Here, the implementor was compared with itself, resulting in the stabilization version never getting shown. This probably needs a test. Fixes #80777. r? `@jyn514`
2021-01-23Fix rendering of stabilization version for trait implementorsLeSeulArtichaut-0/+19
2021-01-22rustdoc: Fix visibility of trait and impl itemsCamelid-0/+32
2021-01-21Auto merge of #80958 - bstrie:deptbdnums, r=KodrAusbors-1/+1
Deprecate-in-future the constants superceded by RFC 2700 Successor to #78335, re-opened after addressing the issues tracked in #68490. This PR makes use of the new ability to explicitly annotate an item as triggering the deprecated-in-future lint (via `rustc_deprecated(since="TBD"`, see #78381). We might call this *soft deprecation*; unlike with deprecation, users will *not* receive warnings when compiling code that uses these items *unless* they opt-in via `#[warn(deprecated_in_future)]`. Like deprecation, soft deprecation causes documentation to formally acknowledge that an item is marked for eventual deprecation (at a non-specific point in the future). With this new ability, we can sidestep all debate about when or on what timeframe something ought to be deprecated; as long as we can agree that something ought to be deprecated, we can receive much of the benefits of deprecation with none of the drawbacks. For these items specifically, the libs team has already agreed that they should be deprecated (see https://github.com/rust-lang/rust/issues/68490#issuecomment-747022696).
2021-01-20Deprecate-in-future the constants superceded by RFC 2700bstrie-1/+1
2021-01-20Remove flaky testJoshua Nelson-6/+0
See https://github.com/rust-lang/rust/pull/81197 for what's going on here; this is a temporary stopgap until someone has time to review the proper fix.
2021-01-17Feature-gate `pointer` and `reference` in intra-doc linksJoshua Nelson-0/+1
- Only feature gate associated items - Add docs to unstable book
2021-01-15Rollup merge of #80254 - Aaron1011:rustdoc-auto-param-env, r=estebankYuki Okushi-0/+37
Don't try to add nested predicate to Rustdoc auto-trait `ParamEnv` Fixes #80233 We already have logic in `evaluate_predicates` that tries to add unimplemented predicates to our `ParamEnv`. Trying to add a predicate that already holds can lead to errors later on, since projection will prefer trait candidates from the `ParamEnv` to predicates from an impl.
2021-01-13Update tests for extern block lintingMark Rousskov-15/+15
2021-01-12Simplify regression testTristan Dannenberg-4/+3
Co-authored-by: Joshua Nelson <joshua@yottadb.com>