Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

path trimming: ignore type aliases #78052

Merged
merged 2 commits into from Feb 7, 2021
Merged

Conversation

@da-x
Copy link
Member

@da-x da-x commented Oct 17, 2020

Continuation of #73996.

@rust-highfive
Copy link
Collaborator

@rust-highfive rust-highfive commented Oct 17, 2020

r? @davidtwco

(rust_highfive has picked a reviewer for you, use r? to override)

@petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Oct 17, 2020

I'm not sure what is the logic here besides "this makes Result unique by getting rid of io::Result and friends".
Is it applicable to other types that are not Result?
Maybe Result should be special-cased as a "well-known" type from prelude instead?

@da-x da-x force-pushed the da-x:path-trimming-type-aliases branch from e86c1e2 to 52c95cd Oct 17, 2020
@da-x
Copy link
Member Author

@da-x da-x commented Oct 17, 2020

Not sure about treating this as special case. If there are other type names colliding with type aliases, the tests don't reveal them. We'll get a better picture by listing all the type aliases in std and core.

@bors
Copy link
Contributor

@bors bors commented Oct 17, 2020

The latest upstream changes (presumably #77373) made this pull request unmergeable. Please resolve the merge conflicts.

Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author
@jyn514 jyn514 added the T-compiler label Oct 18, 2020
Copy link
Member

@davidtwco davidtwco left a comment

Implementation LGTM; I think I like this change, but I'd like to clarify a few things. These are the primary cases that this concerns, right?

  • Alias has same name as type that it aliases - alias would be printed using the full path, but (more common) use of type wouldn't (e.g. Result). This seems reasonable, improves the common case and I don't think it'd lead to much confusion.
  • Alias has the same name as an entirely unrelated type (from a different crate, for example), alias would be printed using the full path and if unrelated type were used then it would have its short path printed. Could this lead to a user using alias Foo without a path throughout their code, and then having type Foo (used in their code as foo::Foo) be printed without the full path in diagnostics? That seems like it could be confusing.
@da-x
Copy link
Member Author

@da-x da-x commented Oct 20, 2020

@davidtwco can you point to cases where paths to aliases are being printed? AFAIK the type system resolves type aliases so that printed types are fully resolved and are not related to them at all.

@davidtwco
Copy link
Member

@davidtwco davidtwco commented Oct 20, 2020

@davidtwco can you point to cases where paths to aliases are being printed? AFAIK the type system resolves type aliases so that printed types are fully resolved and are not related to them at all.

I was just assuming that was the behaviour. If that isn't the case then I think I'm happy with this change.

@Dylan-DPC
Copy link
Member

@Dylan-DPC Dylan-DPC commented Nov 7, 2020

@davidtwco do you wish to review this again? Or can we consider "happy with this change" as an approval? (pending the trivial conflicts)

@davidtwco
Copy link
Member

@davidtwco davidtwco commented Nov 8, 2020

@davidtwco do you wish to review this again? Or can we consider "happy with this change" as an approval? (pending the trivial conflicts)

Apologies, I should have been clearer and followed-up - I'm happy to see this land after a rebase.

@da-x da-x force-pushed the da-x:path-trimming-type-aliases branch from 52c95cd to 247c9c7 Nov 8, 2020
@bors
Copy link
Contributor

@bors bors commented Nov 24, 2020

The latest upstream changes (presumably #78343) made this pull request unmergeable. Please resolve the merge conflicts.

Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author
@crlf0710
Copy link
Contributor

@crlf0710 crlf0710 commented Dec 11, 2020

@da-x Ping from triage. I'm sorry but this seems needs a rebase again.

@da-x da-x force-pushed the da-x:path-trimming-type-aliases branch from 247c9c7 to 98f43e1 Dec 13, 2020
@davidtwco
Copy link
Member

@davidtwco davidtwco commented Dec 21, 2020

Apologies again for being so slow to get back to this review - looks good now.

@bors r+

@bors
Copy link
Contributor

@bors bors commented Dec 21, 2020

📌 Commit 98f43e1 has been approved by davidtwco

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 21, 2020
…vidtwco

path trimming: ignore type aliases

Continuation of rust-lang#73996.
@bors
Copy link
Contributor

@bors bors commented Dec 21, 2020

Testing commit 98f43e1 with merge 3aa1bf2...

@rust-log-analyzer
Copy link
Collaborator

@rust-log-analyzer rust-log-analyzer commented Dec 21, 2020

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
diff of stderr:

2   --> $DIR/typeck.rs:10:22
3    |
4 LL |         Ok(x) if let Err(_) = x => {},
-    |                      ^^^^^^ expected enum `Option`, found enum `std::result::Result`
+    |                      ^^^^^^ expected enum `Option`, found enum `Result`
6    |
7    = note: expected enum `Option<bool>`
-               found enum `std::result::Result<_, _>`
+               found enum `Result<_, _>`
10 error[E0308]: mismatched types
11   --> $DIR/typeck.rs:12:22



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2294-if-let-guard/typeck/typeck.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args rfc-2294-if-let-guard/typeck.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2294-if-let-guard/typeck.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2294-if-let-guard/typeck" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2294-if-let-guard/typeck/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0308]: mismatched types
  --> /checkout/src/test/ui/rfc-2294-if-let-guard/typeck.rs:10:22
   |
LL |         Ok(x) if let Err(_) = x => {},
   |                      ^^^^^^ expected enum `Option`, found enum `Result`
   |
   = note: expected enum `Option<bool>`
              found enum `Result<_, _>`
error[E0308]: mismatched types
  --> /checkout/src/test/ui/rfc-2294-if-let-guard/typeck.rs:12:22
   |
   |
LL |         Ok(x) if let 0 = x => {},
   |                      ^ expected enum `Option`, found integer
   |
   = note: expected enum `Option<bool>`
              found type `{integer}`
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0308`.

---

Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-9/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--llvm-version" "9.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:16:57
@bors
Copy link
Contributor

@bors bors commented Dec 21, 2020

💔 Test failed - checks-actions

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 29, 2021
…as-schievink

Rollup of 15 pull requests

Successful merges:

 - rust-lang#78052 (path trimming: ignore type aliases)
 - rust-lang#79023 (Add `core::stream::Stream`)
 - rust-lang#80886 (Stabilize raw ref macros)
 - rust-lang#80959 (Stabilize `unsigned_abs`)
 - rust-lang#81210 (BTreeMap: correct node size test case for choices of B)
 - rust-lang#81291 (Support FRU pattern with `[feature(capture_disjoint_fields)]`)
 - rust-lang#81409 (Slight simplification of chars().count())
 - rust-lang#81468 (cfg(version): treat nightlies as complete)
 - rust-lang#81472 (Clone entire `TokenCursor` when collecting tokens)
 - rust-lang#81491 (Balance sidebar `Deref` cycle check with main content)
 - rust-lang#81495 (rustdoc: Remove unnecessary optional)
 - rust-lang#81499 (Updated Vec::splice documentation)
 - rust-lang#81501 (update rustfmt to v1.4.34)
 - rust-lang#81512 (Add missing variants in match binding)
 - rust-lang#81515 (Fix typo in pat.rs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@jonas-schievink
Copy link
Member

@jonas-schievink jonas-schievink commented Jan 29, 2021

@bors r- rollup=iffy failed in #81528 (comment)

@davidtwco
Copy link
Member

@davidtwco davidtwco commented Jan 30, 2021

Looks like disabling trimmed paths for that test either didn't work, or there were trimmed paths in the output that weren't undone.

@bors
Copy link
Contributor

@bors bors commented Feb 1, 2021

The latest upstream changes (presumably #80851) made this pull request unmergeable. Please resolve the merge conflicts.

@da-x da-x force-pushed the da-x:path-trimming-type-aliases branch from 9dc0d1d to 0752415 Feb 4, 2021
@da-x
Copy link
Member Author

@da-x da-x commented Feb 4, 2021

My mistake so far was not building with profiler = true - now that I noticed and fixed that, my local tests cover these outputs. Even so, I've kept the commit to disable trimmed path for code coverage, as it is more relevant for error messages, and to reduce noise for other devs.

Let's see how it runs now. :)

@da-x
Copy link
Member Author

@da-x da-x commented Feb 4, 2021

@bors r=davidtwco

@bors
Copy link
Contributor

@bors bors commented Feb 4, 2021

📌 Commit 0752415 has been approved by davidtwco

@bors
Copy link
Contributor

@bors bors commented Feb 5, 2021

The latest upstream changes (presumably #81257) made this pull request unmergeable. Please resolve the merge conflicts.

@da-x da-x force-pushed the da-x:path-trimming-type-aliases branch from 0752415 to 6495029 Feb 6, 2021
@da-x
Copy link
Member Author

@da-x da-x commented Feb 6, 2021

@bors r=davidtwco

@bors
Copy link
Contributor

@bors bors commented Feb 6, 2021

📌 Commit 6495029 has been approved by davidtwco

@bors
Copy link
Contributor

@bors bors commented Feb 6, 2021

Testing commit 6495029 with merge 08fdbd59b7db4f7ad9c11628f27d8e7c7986d8a1...

@bors
Copy link
Contributor

@bors bors commented Feb 7, 2021

☀️ Test successful - checks-actions
Approved by: davidtwco
Pushing 08fdbd5 to master...

@bors bors added the merged-by-bors label Feb 7, 2021
@bors bors merged commit 08fdbd5 into rust-lang:master Feb 7, 2021
11 checks passed
11 checks passed
PR (mingw-check, ubuntu-latest-xl)
Details
PR (x86_64-gnu-llvm-9, ubuntu-latest-xl)
Details
PR (x86_64-gnu-tools, 1, ubuntu-latest-xl)
Details
auto
Details
try
Details
master
Details
bors build finished
Details
bors build finished
Details
bors build finished
Details
bors build finished
Details
homu Test successful
Details
@rustbot rustbot added this to the 1.52.0 milestone Feb 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet