rust-lang / rust-lang/rust

compiletest: path normalizations are sensitive to diagnostics width, can lead to confusing failures

Open
#135,288 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-compiletest A-compiletest-normalizations A-testsuite C-bug D-diagnostic-infra T-bootstrap T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

See discussions at https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.60tests.5Cui.5Ctraits.5Cfn-pointer.5Cbare-fn-no-impl-fn-ptr-99875.2Ers.60 about tests like tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.rs.

Example:

20    --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11
21     |
22  LL |     takes(|_: Argument| -> Return { todo!() });
-      |     ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
+      |     ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for closure `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11: 14:34}`
24     |     |
25     |     required by a bound introduced by this call
26     |

-      = help: the trait `Trait` is not implemented for closure `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11: 14:34}`
28     = help: the trait `Trait` is implemented for fn pointer `fn(Argument) -> Return`
29  note: required by a bound in `takes`
30    --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:9:18

Note: some mismatched output was normalized before being compared
-      |     ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for closure `{closure@F:\rust\tests\ui\traits\fn-pointer\bare-fn-no-impl-fn-ptr-99875.rs:14:11: 14:34}`
+      |     ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for closure `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11: 14:34}`

Before compiletest path normalization, the length of the parent directories leading to the test file e.g. F:\rust\ vs F:\Longer\rust\ can influence the specific diagnostics shown as it affects the width.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining compiletest's path normalization and reproduce the issue with tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.rs using different parent-directory lengths. Trace how normalized paths affect diagnostic width, then verify that the test output and selected diagnostics no longer vary with the checkout path.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.