Commit Graph

58 Commits

Author SHA1 Message Date
Michael Howell
9cf531d26f
doctests: build test bundle and harness separately
This prevents the included test case from getting at nightly-only
features when run on stable. The harness builds with
RUSTC_BOOTSTRAP, but the bundle doesn't.
2025-03-10 01:47:36 +01:00
Chris Denton
95a5ecc995
Enable relative-path-include-bytes on Windows 2025-02-16 10:40:04 +00:00
Ben Kimock
7dfc786df1 Enable more tests on Windows 2025-02-03 10:39:32 -05:00
许杰友 Jieyou Xu (Joe)
64768c5630
Rollup merge of #135736 - fmease:rustdoc-fix-flaky-test, r=GuillaumeGomez
rustdoc: Fix flaky doctest test

Fixes #135660.
2025-01-20 12:37:55 +08:00
León Orell Valerian Liehr
64d667ae78
rustdoc: Fix flaky doctest test 2025-01-19 18:41:11 +01:00
John Kåre Alsaker
4bf85c25ec Try to write the panic message with a single write_all call 2025-01-01 15:58:29 +01:00
peicuiping
09541c263e chore: fix some typos
Signed-off-by: peicuiping <ezc5@sina.cn>
2024-12-31 15:11:18 +08:00
Zalathar
835fbcbcab Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
Guillaume Gomez
2d914bed2d Add test to ensure passing --doctest_compilation_args multiple times work 2024-12-20 22:35:00 +01:00
Guillaume Gomez
2bd869082b Add regression test for --doctest-compilation-args 2024-12-20 15:17:47 +01:00
Guillaume Gomez
c367cc3ef5 Remove unneeded handling of backlines in doctest attributes 2024-12-16 17:59:07 +01:00
Guillaume Gomez
2383985342 Also handle cases where attributes are unclosed 2024-12-16 13:59:41 +01:00
Guillaume Gomez
9c4a61ff52 Add ui regression test for #134221 2024-12-16 11:47:56 +01:00
Eric Huss
6005d1c9f7 Update more 2024 tests to remove -Zunstable-options 2024-11-28 14:32:45 -08:00
Eric Huss
31c9222639 Stabilize the 2024 edition 2024-11-22 11:12:15 -08:00
Jubilee
62ba25de39
Rollup merge of #132210 - notriddle:notriddle/doctest-span-hack, r=GuillaumeGomez
rustdoc: make doctest span tweak a 2024 edition change

Fixes #132203

This is a compatibility hack, because I think the new behavior is better. When an A `include_str!` B, and B `include_str!` C, the path to C should be resolved relative to B, not A. That's how `include!` itself works, so that's how `include_str!` with should work.
2024-10-30 14:01:37 -07:00
Michael Howell
ac7de1a0d9 Ignore Windows due to its differing path syntax 2024-10-30 12:39:05 -07:00
许杰友 Jieyou Xu (Joe)
a864e30269
Rollup merge of #131096 - GuillaumeGomez:rm-no_unused, r=notriddle
rustdoc: Remove usage of `allow(unused)` attribute on `no_run` merged doctests

Fixes [#130681](https://github.com/rust-lang/rust/issues/130681).

It fixes the behaviour difference with the current doctests.

r? ``@notriddle``
2024-10-30 22:22:04 +08:00
Michael Howell
1819b4fa23 rustdoc: make doctest span tweak a 2024 edition change
Fixes #132203

This is a compatibility hack, because I think the new behavior is better.
When an A `include_str!` B, and B `include_str!` C, the path to C should
be resolved relative to B, not A. That's how `include!` itself works,
so that's how `include_str!` with should work.
2024-10-26 17:56:38 -07:00
Guillaume Gomez
aab2b6747d Add regression test for #131893 2024-10-24 21:35:15 +02:00
Urgau
77b3065ed2 Remove deprecation note in the non_local_definitions warning 2024-10-11 21:21:32 +02:00
Guillaume Gomez
b073ddcce5 Add regression tests for #130681 2024-10-01 17:08:01 +02:00
Guillaume Gomez
6f5f21adfc Rename doctest attribute standalone-crate into standalone_crate for coherency 2024-09-29 13:01:41 +02:00
Guillaume Gomez
632fed891d Improve mistyped docblock attribute warning messages 2024-09-28 18:38:11 +02:00
Guillaume Gomez
84d41e2fc1 Add regression tests for mistyped standalone-crate attribute 2024-09-28 18:38:11 +02:00
Urgau
2423e9e244 Update rustdoc doctest non_local_defs impl test 2024-09-23 10:01:59 +02:00
Urgau
cb58668748 Revert "Switch back non_local_definitions lint to allow-by-default"
This reverts commit 0c0dfb88ee.
2024-09-23 09:23:04 +02:00
Michael Howell
65e432db60 rustdoc: use the correct span for doctests 2024-09-19 13:57:44 -07:00
Guillaume Gomez
a708d0bc77 Fix commands syntax in rustdoc-ui tests 2024-08-13 20:14:57 +02:00
Guillaume Gomez
cbf6fe05e7 Add more merged doctests tests 2024-08-13 20:14:57 +02:00
Guillaume Gomez
4b1db071d1 Don't special-case if there is only one merged doctest 2024-08-13 20:14:56 +02:00
Guillaume Gomez
d512438435 Run mergeable doctest as part of standalone doctests if there is only one 2024-08-13 20:14:56 +02:00
Guillaume Gomez
112e44740e Disable merged doctests by default 2024-08-13 20:14:55 +02:00
Guillaume Gomez
2fd8d1c1ce Add/update rustdoc-ui tests to check new merged doctests 2024-08-13 20:14:54 +02:00
Guillaume Gomez
7ec3cabe17 Correctly handle doctests with invalid AST 2024-08-13 20:14:54 +02:00
Michael Howell
1d19c2c009 rustdoc: move invalid langstring test to UI 2024-08-09 07:57:46 -07:00
Esteban Küber
2d7795dfb9 Be more accurate about calculating display_col from a BytePos
No longer track "zero-width" chars in `SourceMap`, read directly from the line when calculating the `display_col` of a `BytePos`. Move `char_width` to `rustc_span` and use it from the emitter.

This change allows the following to properly align in terminals (depending on the font, the replaced control codepoints are rendered as 1 or 2 width, on my terminal they are rendered as 1, on VSCode text they are rendered as 2):

```
error: this file contains an unclosed delimiter
  --> $DIR/issue-68629.rs:5:17
   |
LL | ␜␟ts␀![{i
   |       -- unclosed delimiter
   |       |
   |       unclosed delimiter
LL | ␀␀  fn rݻoa>rݻm
   |                ^
```
2024-07-18 20:08:38 +00:00
Esteban Küber
692bc344d5 Make parse error suggestions verbose and fix spans
Go over all structured parser suggestions and make them verbose style.

When suggesting to add or remove delimiters, turn them into multiple suggestion parts.
2024-07-12 03:02:57 +00:00
Zalathar
9aaa0c5867 Always use a colon in //@ normalize-*: headers 2024-07-11 12:23:44 +10:00
Urgau
0c0dfb88ee Switch back non_local_definitions lint to allow-by-default
as request T-lang is requesting some major changes in the lint inner
workings in #126768#issuecomment-2192634762
2024-06-27 08:05:07 +02:00
Urgau
ab0e72781f Suggest standalone doctest for non-local impl defs 2024-06-15 13:00:53 +02:00
Urgau
402580bcd5 non_local_defs: improve exception note for impl and macro_rules!
- Remove wrong exception text for non-local macro_rules!
 - Simplify anonymous const exception note
2024-05-27 23:59:18 +02:00
Urgau
06c6a2d9d6 non_local_defs: switch to more friendly primary message 2024-05-27 23:58:55 +02:00
Urgau
712560cd03 Adjust #[macro_export]/doctest help suggestion for non_local_defs lint 2024-05-01 16:57:20 +02:00
Urgau
a20de73ccf Move --check-cfg documentation to stable books 2024-04-15 21:49:56 +02:00
Guillaume Gomez
8e817af3ae Update ui tests 2024-02-29 14:43:43 +01:00
许杰友 Jieyou Xu (Joe)
6e48b96692
[AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
bors
a90372c6e8 Auto merge of #118213 - Urgau:check-cfg-diagnostics-rustc-cargo, r=petrochenkov
Add more suggestions to unexpected cfg names and values

This pull request adds more suggestion to unexpected cfg names and values diagnostics:
 - it first adds a links to the [rustc unstable book](https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html) or the [Cargo reference](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg), depending if rustc is invoked by Cargo
 - it secondly adds a suggestion on how to expect the cfg name or value:
    *excluding well known names and values*
    - for Cargo: it suggest using a feature or `cargo:rust-check-cfg` in build script
    - for rustc: it suggest using `--check-cfg` (with the correct invocation)

Those diagnostics improvements are directed towards enabling users to fix the issue if the previous suggestions weren't good enough.

r? `@petrochenkov`
2023-12-13 19:45:57 +00:00
Urgau
5345a166fe Add more suggestion to unexpected cfg names and values 2023-12-13 17:48:04 +01:00
Guillaume Gomez
bb0fd665a8 Follow guidelines for lint suggestions 2023-12-12 15:43:20 +01:00