Commit Graph

43 Commits

Author SHA1 Message Date
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
Nilstrieb
9b80d85722 Manual find replace updates 2023-11-24 21:04:51 +01:00
Nilstrieb
87a354b15d Bless rustdoc-ui tests
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
Urgau
fc78d78988 MCP636: Adapt check-cfg tests to the new syntax 2023-10-13 13:51:03 +02:00
Urgau
ed922d8c72 check-cfg: update rustdoc ui check-cfg tests 2023-10-12 18:39:35 +02:00
Yuri Astrakhan
2c5ecf22a2 Fix windows test output. 2023-08-01 14:24:11 +02:00
Mara Bos
0e729404da Change default panic handler message format. 2023-07-29 11:42:50 +02:00
Urgau
a5f8dba4cd Improve check-cfg diagnostics (part 1) 2023-05-05 13:06:48 +02:00
jyn
5fa975142f Move some rustdoc-ui tests to subdirectories 2023-04-29 11:36:19 -05:00