about summary refs log tree commit diff
path: root/tests/rustdoc-ui
AgeCommit message (Collapse)AuthorLines
2024-09-12rustdoc: re-bless stderrs after renaming the test caseMichael Howell-4/+4
2024-09-12rustdoc: rename `issue-\d+.rs` tests to have meaningful namesMichael Howell-0/+0
2024-09-12Add URL and crate_name to test casesMichael Howell-2/+5
2024-09-09rustdoc: add two regression testsLeón Orell Valerian Liehr-0/+52
2024-08-18Adjust expected errors for a `rustdoc` testTrevor Gross-22/+5
`pulldown-cmark` has slightly different behavior between 0.11.0 and 0.11.2, causing one of the `unportable-markdown` tests to no longer emit an error. Per [1], remove the error annotation and bless the output. [1]: https://github.com/rust-lang/rust/pull/128722#issuecomment-2295522292
2024-08-14Auto merge of #129060 - matthiaskrgr:rollup-s72gpif, r=matthiaskrgrbors-9/+4
Rollup of 7 pull requests Successful merges: - #122884 (Optimize integer `pow` by removing the exit branch) - #127857 (Allow to customize `// TODO:` comment for deprecated safe autofix) - #129034 (Add `#[must_use]` attribute to `Coroutine` trait) - #129049 (compiletest: Don't panic on unknown JSON-like output lines) - #129050 (Emit a warning instead of an error if `--generate-link-to-definition` is used with other output formats than HTML) - #129056 (Fix one usage of target triple in bootstrap) - #129058 (Add mw back to review rotation) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-13Fix commands syntax in rustdoc-ui testsGuillaume Gomez-9/+9
2024-08-13Only keep "useful" code in `tests/rustdoc-ui/2024-doctests-checks.rs`Guillaume Gomez-24/+8
2024-08-13Add doctest to ensure that doctests with crate-level attributes are not part ↵Guillaume Gomez-0/+34
of merged doctest
2024-08-13Add more merged doctests testsGuillaume Gomez-0/+21
2024-08-13Don't special-case if there is only one merged doctestGuillaume Gomez-39/+19
2024-08-13Run mergeable doctest as part of standalone doctests if there is only oneGuillaume Gomez-11/+30
2024-08-13Add 2024 edition doctests to cover corner casesGuillaume Gomez-0/+55
2024-08-13Disable merged doctests by defaultGuillaume Gomez-1/+0
2024-08-13Add/update `rustdoc-ui` tests to check new merged doctestsGuillaume Gomez-9/+42
2024-08-13Correctly handle doctests with invalid ASTGuillaume Gomez-0/+111
2024-08-13Update rustdoc-ui test for `--generate-link-to-definition` optionGuillaume Gomez-1/+4
2024-08-13Remove duplicated rustdoc ui testGuillaume Gomez-8/+0
2024-08-09rustdoc: move invalid langstring test to UIMichael Howell-0/+17
2024-08-07Rollup merge of #128755 - yaahc:jj-crlf, r=estebankMatthias Krüger-27/+27
Integrate crlf directly into related test file instead via of .gitattributes resolves https://github.com/rust-lang/rust/issues/128708 This PR seeks to resolve a contributor papercut when using jj to manage the git repo locally which does not support .gitattributes. It does so by integrating the crlf characters directly into the related test and disabling Git's end of line normalization logic across platforms for that specific file, instead of configuring git to always check out the files with alternative eol characters. related documentation: https://git-scm.com/docs/gitattributes#Documentation/gitattributes.txt-Unset-1
2024-08-06Integrate crlf directly into related test file instead via of .gitattributesJane Losare-Lusby-27/+27
2024-08-06Add regression test for #69264Guillaume Gomez-0/+24
2024-08-06On short error format, append primary span label to messageEsteban Küber-2/+2
The `error-format=short` output only displays the path, error code and main error message all in the same line. We now add the primary span label as well after the error message, to provide more context.
2024-07-29Structured suggestion for `extern crate foo` when `foo` isn't resolved in importEsteban Küber-3/+12
When encountering a name in an import that could have come from a crate that wasn't imported, use a structured suggestion to suggest `extern crate foo;` pointing at the right place in the crate. When encountering `_` in an import, do not suggest `extern crate _;`. ``` error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star-3.rs:2:9 | LL | use spam::*; | ^^^^ maybe a missing crate `spam`? | help: consider importing the `spam` crate | LL + extern crate spam; | ```
2024-07-25Rollup merge of #128111 - estebank:no-question, r=fmeaseMatthias Krüger-6/+6
Do not use question as label We don't want to have questions in the diagnostic output. Instead, we use wording that communicates uncertainty, like "might": ``` error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star-3.rs:2:9 | LL | use spam::*; | ^^^^ you might be missing crate `spam` | = help: consider adding `extern crate spam` to use the `spam` crate ```
2024-07-25Rollup merge of #127528 - estebank:ascii-control-chars, r=oli-obkMatthias Krüger-1/+1
Replace ASCII control chars with Unicode Control Pictures Replace ASCII control chars like `CR` with Unicode Control Pictures like `␍`: ``` error: bare CR not allowed in doc-comment --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:3:32 | LL | /// doc comment with bare CR: '␍' | ^ ``` Centralize the checking of unicode char width for the purposes of CLI display in one place. Account for the new replacements. Remove unneeded tracking of "zero-width" unicode chars, as we calculate these in the `SourceMap` as needed now.
2024-07-24Do not use question as labelEsteban Küber-6/+6
We don't want to have questions in the diagnostic output. Instead, we use wording that communicates uncertainty, like "might": ``` error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star-3.rs:2:9 | LL | use spam::*; | ^^^^ you might be missing crate `spam` | = help: consider adding `extern crate spam` to use the `spam` crate ```
2024-07-22Revert suggestion verbosity changeEsteban Küber-24/+12
2024-07-22On generic and lifetime removal suggestion, do not leave behind stray `,`Esteban Küber-1/+1
2024-07-22Change suggestion message wordingEsteban Küber-4/+4
2024-07-22Use verbose suggestion for "wrong # of generics"Esteban Küber-12/+24
2024-07-21Move all error reporting into rustc_trait_selectionMichael Goulet-1/+1
2024-07-18Be more accurate about calculating `display_col` from a `BytePos`Esteban Küber-1/+1
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-18Rollup merge of #127878 - estebank:assoc-item-removal, r=fmeaseMatthias Krüger-8/+23
Fix associated item removal suggestion We were previously telling people to write what was already there, instead of removal (treating it as a `help`). We now properly suggest to remove the code that needs to be removed. ``` error[E0229]: associated item constraints are not allowed here --> $DIR/E0229.rs:13:25 | LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} | ^^^^^^^ associated item constraint not allowed here | help: consider removing this associated item binding | LL - fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} LL + fn baz<I>(x: &<I as Foo>::A) {} | ```
2024-07-17Fix associated item removal suggestionEsteban Küber-8/+23
We were previously telling people to write what was already there, instead of removal. ``` error[E0229]: associated item constraints are not allowed here --> $DIR/E0229.rs:13:25 | LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} | ^^^^^^^ associated item constraint not allowed here | help: consider removing this associated item binding | LL - fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} LL + fn baz<I>(x: &<I as Foo>::A) {} | ```
2024-07-15Move rustc_infer::infer::error_reporting to rustc_infer::error_reporting::inferMichael Goulet-1/+1
2024-07-15Rollup merge of #127407 - estebank:parser-suggestions, r=oli-obkMatthias Krüger-1/+6
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-12Move assertion-free rustdoc ice tests to rustdoc-uiMichael Howell-0/+52
2024-07-12Make parse error suggestions verbose and fix spansEsteban Küber-1/+6
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-11Auto merge of #127311 - oli-obk:do_not_count_errors, r=compiler-errorsbors-21/+3
Avoid follow-up errors and ICEs after missing lifetime errors on data structures Tuple struct constructors are functions, so when we call them typeck will use the signature tuple struct constructor function to provide type hints. Since typeck mostly ignores and erases lifetimes, we end up never seeing the error lifetime in writeback, thus not tainting the typeck result. Now, we eagerly taint typeck results by tainting from `resolve_vars_if_possible`, which is called all over the place. I did not carry over all the `crashes` test suite tests, as they are really all the same cause (missing or unknown lifetime names in tuple struct definitions or generic arg lists). fixes #124262 fixes #124083 fixes #125155 fixes #125888 fixes #125992 fixes #126666 fixes #126648 fixes #127268 fixes #127266 fixes #127304
2024-07-11Avoid follow-up errors and ICEs after missing lifetime errors on data structuresOli Scherer-21/+3
2024-07-11Always use a colon in `//@ normalize-*:` headersZalathar-39/+39
2024-07-04Rollup merge of #127301 - estebank:fix-suggestions, r=UrgauMatthias Krüger-20/+100
Tweak some structured suggestions to be more verbose and accurate Addressing some issues I found while working on #127282. ``` error: this URL is not a hyperlink --> $DIR/auxiliary/include-str-bare-urls.md:1:11 | LL | HEADS UP! https://example.com MUST SHOW UP IN THE STDERR FILE! | ^^^^^^^^^^^^^^^^^^^ | = note: bare URLs are not automatically turned into clickable links note: the lint level is defined here --> $DIR/include-str-bare-urls.rs:14:9 | LL | #![deny(rustdoc::bare_urls)] | ^^^^^^^^^^^^^^^^^^ help: use an automatic link instead | LL | HEADS UP! <https://example.com> MUST SHOW UP IN THE STDERR FILE! | + + ``` ``` error[E0384]: cannot assign twice to immutable variable `v` --> $DIR/assign-imm-local-twice.rs:7:5 | LL | v = 1; | ----- first assignment to `v` LL | println!("v={}", v); LL | v = 2; | ^^^^^ cannot assign twice to immutable variable | help: consider making this binding mutable | LL | let mut v: isize; | +++ ``` ``` error[E0393]: the type parameter `Rhs` must be explicitly specified --> $DIR/issue-22560.rs:9:23 | LL | trait Sub<Rhs=Self> { | ------------------- type parameter `Rhs` must be specified for this ... LL | type Test = dyn Add + Sub; | ^^^ | = note: because of the default `Self` reference, type parameters must be specified on object types help: set the type parameter to the desired type | LL | type Test = dyn Add + Sub<Rhs>; | +++++ ``` ``` error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable --> $DIR/issue-33819.rs:4:34 | LL | Some(ref v) => { let a = &mut v; }, | ^^^^^^ cannot borrow as mutable | help: try removing `&mut` here | LL - Some(ref v) => { let a = &mut v; }, LL + Some(ref v) => { let a = v; }, | ``` ``` help: remove the invocation before committing it to a version control system | LL - dbg!(); | ``` ``` error[E0308]: mismatched types --> $DIR/issue-39974.rs:1:21 | LL | const LENGTH: f64 = 2; | ^ expected `f64`, found integer | help: use a float literal | LL | const LENGTH: f64 = 2.0; | ++ ``` ``` error[E0529]: expected an array or slice, found `Vec<i32>` --> $DIR/match-ergonomics.rs:8:9 | LL | [&v] => {}, | ^^^^ pattern cannot match with input type `Vec<i32>` | help: consider slicing here | LL | match x[..] { | ++++ ``` ``` error[E0609]: no field `0` on type `[u32; 1]` --> $DIR/parenthesized-deref-suggestion.rs:10:21 | LL | (x as [u32; 1]).0; | ^ unknown field | help: instead of using tuple indexing, use array indexing | LL | (x as [u32; 1])[0]; | ~ + ```
2024-07-04Adjust rustdoc automatic link suggestionEsteban Küber-20/+100
Use more accurate spans for multipart suggestion.
2024-07-01rustdoc: add usable lint for pulldown-cmark-0.11 parsing changesMichael Howell-0/+102
2024-06-28Rollup merge of #127016 - bvanjoi:fix-126986, r=GuillaumeGomezMatthias Krüger-0/+528
docs: check if the disambiguator matches its suffix Fixes #126986 This PR makes it will not continue resolving when its disambiguator doesn't match the suffix format.
2024-06-28Rollup merge of #127015 - Urgau:non_local_def-tmp-allow, r=lqdMatthias Krüger-3/+9
Switch back `non_local_definitions` lint to allow-by-default This PR switch back (again) the `non_local_definitions` lint to allow-by-default as T-lang is requesting some (major) changes in the lint inner workings in https://github.com/rust-lang/rust/issues/126768#issuecomment-2192634762. This PR will need to be beta-backported, as the lint is currently warn-by-default in beta.
2024-06-28add test for #126986bohan-86/+109
2024-06-28docs: check if the disambiguator matches its suffixbohan-0/+505
2024-06-27Switch back `non_local_definitions` lint to allow-by-defaultUrgau-3/+9
as request T-lang is requesting some major changes in the lint inner workings in #126768#issuecomment-2192634762