Commit Graph

233 Commits

Author SHA1 Message Date
Michael Goulet
ce5f8c93fa Bless test fallout (duplicate diagnostics) 2024-03-20 13:00:34 -04:00
bors
bd459c2877 Auto merge of #122029 - estebank:drive-by-ui-test, r=oli-obk
When displaying multispans, ignore empty lines adjacent to `...`

```
error[E0308]: `match` arms have incompatible types
   --> tests/ui/codemap_tests/huge_multispan_highlight.rs:98:18
    |
6   |       let _ = match true {
    |               ---------- `match` arms have incompatible types
7   |           true => (
    |  _________________-
8   | |             // last line shown in multispan header
...   |
96  | |
97  | |         ),
    | |_________- this is found to be of type `()`
98  |           false => "
    |  __________________^
...   |
119 | |
120 | |         ",
    | |_________^ expected `()`, found `&str`

error[E0308]: `match` arms have incompatible types
   --> tests/ui/codemap_tests/huge_multispan_highlight.rs:215:18
    |
122 |       let _ = match true {
    |               ---------- `match` arms have incompatible types
123 |           true => (
    |  _________________-
124 | |
125 | |         1 // last line shown in multispan header
...   |
213 | |
214 | |         ),
    | |_________- this is found to be of type `{integer}`
215 |           false => "
    |  __________________^
216 | |
217 | |
218 | |         1 last line shown in multispan
...   |
237 | |
238 | |         ",
    | |_________^ expected integer, found `&str`
```
2024-03-19 22:11:59 +00:00
Esteban Küber
cc9631a371 When displaying multispans, ignore empty lines adjacent to ...
```
error[E0308]: `match` arms have incompatible types
   --> tests/ui/codemap_tests/huge_multispan_highlight.rs:98:18
    |
6   |       let _ = match true {
    |               ---------- `match` arms have incompatible types
7   |           true => (
    |  _________________-
8   | |             // last line shown in multispan header
...   |
96  | |
97  | |         ),
    | |_________- this is found to be of type `()`
98  |           false => "
    |  __________________^
...   |
119 | |
120 | |         ",
    | |_________^ expected `()`, found `&str`

error[E0308]: `match` arms have incompatible types
   --> tests/ui/codemap_tests/huge_multispan_highlight.rs:215:18
    |
122 |       let _ = match true {
    |               ---------- `match` arms have incompatible types
123 |           true => (
    |  _________________-
124 | |
125 | |         1 // last line shown in multispan header
...   |
213 | |
214 | |         ),
    | |_________- this is found to be of type `{integer}`
215 |           false => "
    |  __________________^
216 | |
217 | |
218 | |         1 last line shown in multispan
...   |
237 | |
238 | |         ",
    | |_________^ expected integer, found `&str`
```
2024-03-18 16:25:36 +00:00
Michael Goulet
c63f3feb0f Stabilize associated type bounds 2024-03-08 20:56:25 +00:00
bors
a655e648a9 Auto merge of #122190 - matthiaskrgr:rollup-9ol4y30, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #121025 (add known-bug tests for derive failure to detect packed repr)
 - #121194 (Refactor pre-getopts command line argument handling)
 - #121563 (Use `ControlFlow` in visitors.)
 - #122173 (Don't ICE in CTFE if raw/fn-ptr types differ)
 - #122175 (Bless tidy issues order)
 - #122179 (rustc: Fix typo)
 - #122181 (Fix crash in internal late lint checking)
 - #122183 (interpret: update comment about read_discriminant on uninhabited variants)

Failed merges:

 - #122076 (Tweak the way we protect in-place function arguments in interpreters)
 - #122132 (Diagnostic renaming 3)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-08 17:31:00 +00:00
Matthias Krüger
a8e3543b19
Rollup merge of #121194 - beetrees:rustc-raw-args, r=petrochenkov
Refactor pre-getopts command line argument handling

Rebased version of #111658. I've also fixed the Windows CI failure (although I don't have access to Windows to test it myself).
2024-03-08 13:22:25 +01:00
Oli Scherer
ae50e36dfa Merge collect_mod_item_types query into check_well_formed 2024-03-07 14:26:31 +00:00
Oli Scherer
8206cffc48 Merge check_mod_impl_wf and check_mod_type_wf 2024-03-07 06:27:09 +00:00
beetrees
63091b105d
Make arg_expand_all not short-circuit on first error 2024-03-07 00:19:55 +00:00
Guillaume Gomez
8e817af3ae Update ui tests 2024-02-29 14:43:43 +01:00
sisungo
da37c8f1f2
Fix tests that are affected by this change 2024-02-29 14:59:10 +08:00
许杰友 Jieyou Xu (Joe)
6e48b96692
[AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
Michael Goulet
fc7693d63b Clean inlined type alias with correct param-env 2024-02-12 04:51:49 +00:00
bors
1280928a99 Auto merge of #120767 - matthiaskrgr:rollup-0k8ib1c, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #119592 (resolve: Unload speculatively resolved crates before freezing cstore)
 - #120103 (Make it so that async-fn-in-trait is compatible with a concrete future in implementation)
 - #120206 (hir: Make sure all `HirId`s have corresponding HIR `Node`s)
 - #120214 (match lowering: consistently lower bindings deepest-first)
 - #120688 (GVN: also turn moves into copies with projections)
 - #120702 (docs: also check the inline stmt during redundant link check)
 - #120727 (exhaustiveness: Prefer "`0..MAX` not covered" to "`_` not covered")
 - #120734 (Add `SubdiagnosticMessageOp` as a trait alias.)
 - #120739 (improve pretty printing for associated items in trait objects)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-08 12:14:19 +00:00
Oli Scherer
8a5847f5c4 Already poison the type_of result of the anon const used in the typeof expression 2024-02-08 07:32:30 +00:00
bohan
0a50dba50b docs: also check the inline stmt during redundant link check 2024-02-07 15:43:32 +08:00
Matthias Krüger
ed27148812
Rollup merge of #116284 - RalfJung:no-nan-match, r=cjgillot
make matching on NaN a hard error, and remove the rest of illegal_floating_point_literal_pattern

These arms would never be hit anyway, so the pattern makes little sense. We have had a future-compat lint against float matches in general for a *long* time, so I hope we can get away with immediately making this a hard error.

This is part of implementing https://github.com/rust-lang/rfcs/pull/3535.

Closes https://github.com/rust-lang/rust/issues/41620 by removing the lint.

https://github.com/rust-lang/reference/pull/1456 updates the reference to match.
2024-02-05 11:07:26 +01:00
Nicholas Nethercote
4225a1e186 Don't hash lints differently to non-lints.
`Diagnostic::keys`, which is used for hashing and equating diagnostics,
has a surprising behaviour: it ignores children, but only for lints.
This was added in #88493 to fix some duplicated diagnostics, but it
doesn't seem necessary any more.

This commit removes the special case and only four tests have changed
output, with additional errors. And those additional errors aren't
exact duplicates, they're just similar. For example, in
src/tools/clippy/tests/ui/same_name_method.rs we currently have this
error:
```
error: method's name is the same as an existing method in a trait
  --> $DIR/same_name_method.rs:75:13
   |
LL |             fn foo() {}
   |             ^^^^^^^^^^^
   |
note: existing `foo` defined here
  --> $DIR/same_name_method.rs:79:9
   |
LL |         impl T1 for S {}
   |         ^^^^^^^^^^^^^^^^
```
and with this change we also get this error:
```
error: method's name is the same as an existing method in a trait
  --> $DIR/same_name_method.rs:75:13
   |
LL |             fn foo() {}
   |             ^^^^^^^^^^^
   |
note: existing `foo` defined here
  --> $DIR/same_name_method.rs:81:9
   |
LL |         impl T2 for S {}
   |         ^^^^^^^^^^^^^^^^
```
I think printing this second argument is reasonable, possibly even
preferable to hiding it. And the other cases are similar.
2024-01-31 08:25:29 +11:00
Ralf Jung
1254ee48c4 remove illegal_floating_point_literal_pattern lint 2024-01-26 17:25:02 +01:00
Matthias Krüger
16489f7b51
Rollup merge of #119730 - vuittont60:master, r=GuillaumeGomez
docs: fix typos
2024-01-18 20:56:19 +01:00
Guillaume Gomez
8914ca722c
Rollup merge of #119561 - notriddle:master, r=fmease
rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 5)

Follow up

* https://github.com/rust-lang/rust/pull/116214
* https://github.com/rust-lang/rust/pull/116432
* https://github.com/rust-lang/rust/pull/116824
* https://github.com/rust-lang/rust/pull/118105
2024-01-14 20:17:23 +01:00
George-lewis
d56cdd48cb Bless tests
Update tests
2024-01-13 12:46:58 -05:00
Matthias Krüger
f5387a1c38
Rollup merge of #119841 - nnethercote:rm-DiagnosticBuilder-buffer, r=oli-obk
Remove `DiagnosticBuilder::buffer`

`DiagnosticBuilder::buffer` doesn't do much, and part of what it does (for `-Ztreat-err-as-bug`) it shouldn't.

This PR strips it back, replaces its uses, and finally removes it, making a few cleanups in the vicinity along the way.

r? ``@oli-obk``
2024-01-11 19:42:51 +01:00
Oli Scherer
55cab535e7 Taint more aggressively in astconv 2024-01-11 09:03:26 +00:00
Nicholas Nethercote
2aac288c18 Use the right level with -Ztreat-err-as-bug.
Errors in `DiagCtxtInner::emit_diagnostic` are never set to
`Level::Bug`, because the condition never succeeds, because
`self.treat_err_as_bug()` is called *before* the error counts are
incremented.

This commit switches to `self.treat_next_err_as_bug()`, fixing the
problem. This changes the error message output to actually say "internal
compiler error".
2024-01-11 16:55:10 +11:00
vuittont60
1b08e25c9d
fix typo 2024-01-09 10:47:04 +08:00
Michael Goulet
f41ad1bc9c
Rollup merge of #119148 - estebank:bare-traits, r=davidtwco
Tweak suggestions for bare trait used as a type

```
error[E0782]: trait objects must include the `dyn` keyword
  --> $DIR/not-on-bare-trait-2021.rs:11:11
   |
LL | fn bar(x: Foo) -> Foo {
   |           ^^^
   |
help: use a generic type parameter, constrained by the trait `Foo`
   |
LL | fn bar<T: Foo>(x: T) -> Foo {
   |       ++++++++    ~
help: you can also use `impl Foo`, but users won't be able to specify the type paramer when calling the `fn`, having to rely exclusively on type inference
   |
LL | fn bar(x: impl Foo) -> Foo {
   |           ++++
help: alternatively, use a trait object to accept any type that implements `Foo`, accessing its methods at runtime using dynamic dispatch
   |
LL | fn bar(x: &dyn Foo) -> Foo {
   |           ++++

error[E0782]: trait objects must include the `dyn` keyword
  --> $DIR/not-on-bare-trait-2021.rs:11:19
   |
LL | fn bar(x: Foo) -> Foo {
   |                   ^^^
   |
help: use `impl Foo` to return an opaque type, as long as you return a single underlying type
   |
LL | fn bar(x: Foo) -> impl Foo {
   |                   ++++
help: alternatively, you can return an owned trait object
   |
LL | fn bar(x: Foo) -> Box<dyn Foo> {
   |                   +++++++    +
```

Fix #119525:

```

error[E0038]: the trait `Ord` cannot be made into an object
  --> $DIR/bare-trait-dont-suggest-dyn.rs:3:33
   |
LL | fn ord_prefer_dot(s: String) -> Ord {
   |                                 ^^^ `Ord` cannot be made into an object
   |
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
  --> $SRC_DIR/core/src/cmp.rs:LL:COL
   |
   = note: the trait cannot be made into an object because it uses `Self` as a type parameter
  ::: $SRC_DIR/core/src/cmp.rs:LL:COL
   |
   = note: the trait cannot be made into an object because it uses `Self` as a type parameter
help: consider using an opaque type instead
   |
LL | fn ord_prefer_dot(s: String) -> impl Ord {
   |                                 ++++
```
2024-01-05 10:57:20 -05:00
Matthias Krüger
9fa0c8e1c7
Rollup merge of #119184 - Rajveer100:branch-for-issue-118752, r=davidtwco
Switch from using `//~ERROR` annotations with `--error-format` to `error-pattern`

Fixes #118752

As noticed by ```@jyn514``` while working on a patch, tests failed due to `//~ERROR` annotations used in combination with the older `--error-format` which is now `error-pattern`.
2024-01-04 15:33:57 +01:00
Esteban Küber
698dfc322f Silence redundant warning when E0038 will be emitted 2024-01-04 00:46:33 +00:00
Michael Howell
a704e21c3f Add check-pass to ice tests 2024-01-03 15:33:13 -07:00
Michael Howell
35830fe218 rustdoc: rename issue-\d+.rs tests to have meaningful names (part 5) 2024-01-03 15:33:12 -07:00
Rajveer
af44e719fa Switch from using //~ERROR annotations with --error-format to error-pattern
Resolves Issue #118752
2023-12-21 16:45:29 +05:30
surechen
4897d5eccf Simple modification of diagnostic information
fixes #119067
2023-12-21 10:17:11 +08: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
58327c10c5 Add a test for a codeblock with multiple invalid attributes 2023-12-12 19:41:09 +01:00
Guillaume Gomez
bb0fd665a8 Follow guidelines for lint suggestions 2023-12-12 15:43:20 +01:00
Guillaume Gomez
98aa20b0a7 Add test for rustX codeblock attribute 2023-12-12 15:42:49 +01:00
Nicholas Nethercote
5d1d384443 Rename HandlerInner::delay_span_bug as HandlerInner::span_delayed_bug.
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug`
follows the pattern used everywhere else: `span_err`, `span_warning`,
etc.
2023-12-02 09:01:19 +11: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
Michael Howell
fdde5c77a8 rustdoc: move ICE tests to ui 2023-11-23 14:54:19 -07:00
Jake Goulding
469d34b39b Mark Rustdoc test as Linux-only
Due to incorrect CI configuration, this test was not being run on
macOS. aarch64-apple-darwin will start running it, so we correct the
configuration.
2023-11-08 08:53:58 -05:00
Nicholas Nethercote
5c462a32bd Remove support for compiler plugins.
They've been deprecated for four years.

This commit includes the following changes.
- It eliminates the `rustc_plugin_impl` crate.
- It changes the language used for lints in
  `compiler/rustc_driver_impl/src/lib.rs` and
  `compiler/rustc_lint/src/context.rs`. External lints are now called
  "loaded" lints, rather than "plugins" to avoid confusion with the old
  plugins. This only has a tiny effect on the output of `-W help`.
- E0457 and E0498 are no longer used.
- E0463 is narrowed, now only relating to unfound crates, not plugins.
- The `plugin` feature was moved from "active" to "removed".
- It removes the entire plugins chapter from the unstable book.
- It removes quite a few tests, mostly all of those in
  `tests/ui-fulldeps/plugin/`.

Closes #29597.
2023-11-04 08:50:46 +11:00
Oli Scherer
4512f211ae Accept less invalid Rust in rustdoc 2023-10-31 13:58:03 +00:00
Oli Scherer
e96ce20b34 s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
Matthias Krüger
ce407429dd
Rollup merge of #111072 - Urgau:check-cfg-new-syntax, r=petrochenkov
Add new simpler and more explicit syntax for check-cfg

<details>
<summary>
Old proposition (before the MCP)
</summary>

This PR adds a new simpler and more explicit syntax for check-cfg. It consist of two new form:
 - `exhaustive(names, values)`
 - `configure(name, "value1", "value2", ... "valueN")`

The preview forms `names(...)` and `values(...)` have implicit meaning that are not strait-forward. In particular `values(foo)`&`values(bar)` and `names(foo, bar)` are not equivalent which has created [some confusions](https://github.com/rust-lang/rust/pull/98080).

Also the `names()` and `values()` form are not clear either and again created some confusions where peoples believed that `values()`&`values(foo)` could be reduced to just `values(foo)`.

To fix that the two new forms are made to be explicit and simpler. See the table of correspondence:
  - `names()` -> `exhaustive(names)`
  - `values()` -> `exhaustive(values)`
  - `names(foo)` -> `exhaustive(names)`&`configure(foo)`
  - `values(foo)` -> `configure(foo)`
  - `values(feat, "foo", "bar")` -> `configure(feat, "foo", "bar")`
  - `values(foo)`&`values(bar)` -> `configure(foo, bar)`
  - `names()`&`values()`&`values(my_cfg)` -> `exhaustive(names, values)`&`configure(my_cfg)`

Another benefits of the new syntax is that it allow for further options (like conditional checking for --cfg, currently always on) without syntax change.

The two previous forms are deprecated and will be removed once cargo and beta rustc have the necessary support.

</details>

This PR is the first part of the implementation of [MCP636 - Simplify and improve explicitness of the check-cfg syntax](https://github.com/rust-lang/compiler-team/issues/636).

## New `cfg` form

It introduces the new [`cfg` form](https://github.com/rust-lang/compiler-team/issues/636) and deprecate the other two:
```
rustc --check-cfg 'cfg(name1, ..., nameN, values("value1", "value2", ... "valueN"))'
```

## Default built-in names and values

It also changes the default for the built-in names and values checking.

 - Built-in values checking would always be activated as long as a `--check-cfg` argument is present
 - Built-in names checking would always be activated as long as a `--check-cfg` argument is present **unless** if any `cfg(any())` arg is passed

~~**Note: depends on https://github.com/rust-lang/rust/pull/111068 but is reviewable (last two commits)!**~~

Resolve https://github.com/rust-lang/compiler-team/issues/636

r? `@petrochenkov`
2023-10-17 19:07:21 +02:00
Michael Howell
c0b6a5d340 rustdoc: add check-pass to ICE test with no expected output 2023-10-16 18:03:22 -07:00
Michael Howell
94b39e8c86 rustdoc: move ICE test to rustdoc-ui 2023-10-16 18:02:11 -07:00
Matthias Krüger
14663e09b7
Rollup merge of #116257 - estebank:issue-101351, r=b-naber
Suggest trait bounds for used associated type on type param

Fix #101351.

When an associated type on a type parameter is used, and the type parameter isn't constrained by the correct trait, suggest the appropriate trait bound:

```
error[E0220]: associated type `Associated` not found for `T`
 --> file.rs:6:15
  |
6 |     field: T::Associated,
  |               ^^^^^^^^^^ there is a similarly named associated type `Associated` in the trait `Foo`
  |
help: consider restricting type parameter `T`
  |
5 | struct Generic<T: Foo> {
  |                 +++++
  ```

When an associated type on a type parameter has a typo, suggest fixing
it:

```
error[E0220]: associated type `Baa` not found for `T`
  --> $DIR/issue-55673.rs:9:8
   |
LL |     T::Baa: std::fmt::Debug,
   |        ^^^ there is a similarly named associated type `Bar` in the trait `Foo`
   |
help: change the associated type name to use `Bar` from `Foo`
   |
LL |     T::Bar: std::fmt::Debug,
   |        ~~~
```
2023-10-16 19:10:49 +02:00
Esteban Küber
20c622e456 Tweak wording 2023-10-13 19:18:46 +00:00
Esteban Küber
781e86477c Suggest trait bounds for used associated type on type param
Fix #101351.

When an associated type on a type parameter is used, and the type
parameter isn't constrained by the correct trait, suggest the
appropriate trait bound:

```
error[E0220]: associated type `Associated` not found for `T`
 --> file.rs:6:15
  |
6 |     field: T::Associated,
  |               ^^^^^^^^^^ there is a similarly named associated type `Associated` in the trait `Foo`
  |
help: consider restricting type parameter `T`
  |
5 | struct Generic<T: Foo> {
  |                 +++++
  ```

When an associated type on a type parameter has a typo, suggest fixing
it:

```
error[E0220]: associated type `Baa` not found for `T`
  --> $DIR/issue-55673.rs:9:8
   |
LL |     T::Baa: std::fmt::Debug,
   |        ^^^ there is a similarly named associated type `Bar` in the trait `Foo`
   |
help: change the associated type name to use `Bar` from `Foo`
   |
LL |     T::Bar: std::fmt::Debug,
   |        ~~~
```
2023-10-13 19:13:56 +00: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
Alex Macleod
5453a9f34d Add a note to duplicate diagnostics 2023-10-05 01:04:41 +00:00
Guillaume Gomez
79f3fe48b0 Add regression test for #102467 2023-09-24 14:09:38 +02:00
Guillaume Gomez
295ec09b63 Update tests for custom classes 2023-09-19 17:29:39 +02:00
Guillaume Gomez
494fdcd8ec Add new rustdoc-ui test for custom_code_classes_in_docs feature 2023-09-19 13:19:15 +02:00
Guillaume Gomez
c17abf124c Update tests for custom_code_classes_in_docs feature 2023-09-17 15:11:44 +02:00
Guillaume Gomez
7681f63cab Implement new eBNF for codeblock attributes 2023-09-15 21:32:28 +02:00
Guillaume Gomez
4ce17fa30e Add support for double quotes in markdown codeblock attributes 2023-09-15 21:32:28 +02:00
Guillaume Gomez
f5561842e3 Add tests for custom_code_classes_in_docs feature 2023-09-15 21:32:28 +02:00
Michael Howell
3df9b4d65d rustdoc: use unicode-aware checks for redundant explicit link fastpath
Fixes #115064
2023-08-21 14:25:26 -07:00
Kyle Lin
25919b09a9 Add regression test for inline doc 2023-08-18 15:31:36 +08:00
Kyle Lin
62113f6657 fix unescaped_backticks error 2023-08-18 15:31:32 +08:00
Kyle Lin
ecb26376e5 narrow down the lint trigger constraint 2023-08-18 15:19:22 +08:00
Kyle Lin
fe17ae3af6 add missing deny lint 2023-08-18 15:19:18 +08:00
Kyle Lin
0e2f2cccd7 Add check-pass tests and fix test behavior 2023-08-18 15:19:18 +08:00
Kyle Lin
5ce6cc7df3 Still resolving rustdoc resolution panicking 2023-08-18 15:19:17 +08:00
Kyle Lin
46df95817d Support Reference & ReferenceUnknown link lint 2023-08-18 15:19:16 +08:00
Kyle Lin
c7369891ba Refactor lint from rustc to rustdoc 2023-08-18 15:19:15 +08:00
Kyle Lin
e583318aa8 fix trailing whitespace 2023-08-18 15:19:12 +08:00
Kyle Lin
f1b23f29db bless test output 2023-08-18 15:19:11 +08:00
Kyle Lin
1c6b237f9e add more tests 2023-08-18 15:19:11 +08:00
Kyle Lin
65e24a57bb Fix resolution caching 2023-08-18 15:19:10 +08:00
Kyle Lin
da582a71d2 Add warn level lint redundant_explicit_links
- Currently it will panic due to the resolution's caching issue
2023-08-18 15:19:08 +08:00
Yuri Astrakhan
2c5ecf22a2 Fix windows test output. 2023-08-01 14:24:11 +02:00
Mara Bos
893bb8e1ce Fix test output. 2023-07-29 11:42:53 +02:00
Mara Bos
0e729404da Change default panic handler message format. 2023-07-29 11:42:50 +02:00
Lukas Markeffsky
637ea3f746 validate doc(masked) 2023-07-24 18:04:35 +02:00
Lukas Markeffsky
237ed1630f add tests for broken links in unused doc strings 2023-07-22 13:02:49 +02:00
bors
0646a5d1aa Auto merge of #113622 - RickleAndMortimer:issue-113184-fix, r=oli-obk
add links to query documentation for E0391

This PR adds links to https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for the rustc --explain E0391 and within the compiler error itself.

Fixes: #113184
2023-07-20 03:18:41 +00:00
Esteban Küber
8eb5843a59 On nightly, dump ICE backtraces to disk
Implement rust-lang/compiler-team#578.

When an ICE is encountered on nightly releases, the new rustc panic
handler will also write the contents of the backtrace to disk. If any
`delay_span_bug`s are encountered, their backtrace is also added to the
file. The platform and rustc version will also be collected.
2023-07-19 14:10:07 +00:00
nxya
a903ac5124 fix issue-110629-private-type-cycle-dyn test 2023-07-19 10:02:15 -04:00
nxya
e6e8892051 added links as a note 2023-07-18 09:27:35 -04:00
nxya
f92a9f6808 add links to query documentation for E0391 2023-07-18 09:27:26 -04:00
nxya
bef91ee687 added links as a note 2023-07-18 09:20:25 -04:00
nxya
c429a72db9 add links to query documentation for E0391 2023-07-18 09:20:25 -04:00
Michael Howell
1a77d9a54d rustdoc: get unnormalized link destination for suggestions
Fixes #110111

This bug, and the workaround in this commit, is closely linked to
[raphlinus/pulldown-cmark#441], getting offsets of link
components. In particular, pulldown-cmark doesn't provide the
offsets of the contents of a link.

To work around this, rustdoc parser parts of a link definition
itself.

[raphlinus/pulldown-cmark#441]: https://github.com/raphlinus/pulldown-cmark/issues/441
2023-05-26 18:38:46 -07:00
Michael Goulet
bd7e8b5ef9
Rollup merge of #111152 - lukas-code:markdown-parsers-are-hard, r=GuillaumeGomez
update `pulldown-cmark` to `0.9.3`

This PR updates `pulldown-cmark` to version `0.9.3`, which does two main things:
* Pulls in https://github.com/raphlinus/pulldown-cmark/pull/643 to fix https://github.com/rust-lang/rust/issues/111117
* Allows parsing strikethrough with single tildes, e.g. `~foo~` -> ~foo~. This matches the [GFM spec](https://github.github.com/gfm/#strikethrough-extension-).

Full changelog: https://github.com/raphlinus/pulldown-cmark/pull/646
2023-05-25 13:57:59 -07:00
Guillaume Gomez
bcdfda1b6b Add regression test for #111189 2023-05-23 15:33:43 +02:00
Lukas Markeffsky
b63cc5c307 rustdoc: add regression test for broken link due to double backticks 2023-05-22 11:35:25 +02:00
Ulrich Weigand
cac7e42b52 Fix backtrace normalization in ice-bug-report-url.rs
This test case currently fails on s390x, and probably other
platforms where the last line of a backtrace does not contain
and " at <source location>" specification.

The problem with the existing normalization lines
// normalize-stderr-test "\s*\d{1,}: .*\n" -> ""
// normalize-stderr-test "\s at .*\n" -> ""
is that \s matches all whitespace, including newlines, so the
first (but not second) of these regexes may merge multiple
lines.  Thus the output differs depending on which of these
matches on the last line of a backtrace.

As the whitespace used in backtraces is just normal space
characters, change both regexes to just match at least one
space character instead:
// normalize-stderr-test " +\d{1,}: .*\n" -> ""
// normalize-stderr-test " + at .*\n" -> ""
2023-05-11 13:59:38 +02:00
Matthias Krüger
8ec84dd523
Rollup merge of #110989 - jyn514:bug-report-url, r=WaffleLapkin
Make the BUG_REPORT_URL configurable by tools

This greatly simplifies how hard it is to set a custom bug report url; previously tools had to copy
the entire hook implementation.

I haven't changed clippy in case they want to make the change upstream instead of the subtree, but
I'm happy to do so here if the maintainers want - cc ````@rust-lang/clippy````

Fixes https://github.com/rust-lang/rust/issues/109486.
2023-05-06 13:30:04 +02:00
Urgau
a5f8dba4cd Improve check-cfg diagnostics (part 1) 2023-05-05 13:06:48 +02:00
jyn
2469afef1a Make the BUG_REPORT_URL configurable by tools
This greatly simplifies how hard it is to set a custom bug report url; previously tools had to copy
the entire hook implementation.

- Switch clippy to the new hook

  This also adds a `extra_info` callback so clippy can include its own version number, which differs
  from rustc's.

- Call `install_ice_hook` in rustfmt
2023-05-01 21:44:04 -05:00
Michael Goulet
bec7193072 Don't use implied trait predicates in gather_explicit_predicates_of 2023-05-01 15:45:28 +00:00
Matthias Krüger
5dec8dff7b
Rollup merge of #110631 - notriddle:notriddle/impl-trait-cycle, r=GuillaumeGomez
rustdoc: catch and don't blow up on impl Trait cycles

Fixes #110629

An odd feature of Rust is that `Foo` is invalid, but `Bar` is okay:

    type Foo<'a, 'b> = Box<dyn PartialEq<Foo<'a, 'b>>>;
    type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>>;

To get it right, track every time rustdoc descends into a type alias, so if it shows up twice, it can be write the path instead of infinitely expanding it.
2023-04-30 16:25:46 +02:00
Michael Howell
b1d08275a9 rustdoc: catch and don't blow up on impl Trait cycles
An odd feature of Rust is that `Foo` is invalid, but `Bar` is okay:

    type Foo<'a, 'b> = Box<dyn PartialEq<Foo<'a, 'b>>>;
    type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>>;

To get it right, track every time rustdoc descends into a type alias,
so if it shows up twice, it can be write the path instead of
infinitely expanding it.
2023-04-29 16:53:02 -07:00
Matthias Krüger
4b79276e60
Rollup merge of #110981 - jyn514:rustdoc-tests, r=notriddle
Move most rustdoc-ui tests into subdirectories

This makes it easier to know where to add a new test, and makes the top-level directory less overwhelming.
2023-04-30 01:14:58 +02:00