Skip to content
New issue

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

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

Already on GitHub? # to your account

All verbosity checks in PrettyPrinter now go through PrettyPrinter::should_print_verbose #103764

Merged
merged 1 commit into from
Oct 31, 2022

Conversation

SarthakSingh31
Copy link
Contributor

Follow-up to #103428. That pr only partially fixed #94187. In some cases (like closures) std::any::type_name was still producing a different output when -Zverbose was enabled.

This pr fixes those cases and adds a new function PrettyPrinter::should_print_verbose. This function should always be used over self.tcx().sess.verbose() inside a impl PrettyPrinter.

Maybe closes #94187 now.

r? @compiler-errors

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 30, 2022
@rustbot
Copy link
Collaborator

rustbot commented Oct 30, 2022

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

@compiler-errors
Copy link
Member

This looks good to me. Thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 30, 2022

📌 Commit 8609364 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 30, 2022
@compiler-errors
Copy link
Member

@bors rollup

notriddle added a commit to notriddle/rust that referenced this pull request Oct 30, 2022
…mpiler-errors

All verbosity checks in `PrettyPrinter` now go through `PrettyPrinter::should_print_verbose`

Follow-up to rust-lang#103428. That pr only partially fixed rust-lang#94187. In some cases (like closures) `std::any::type_name` was still producing a different output when `-Zverbose` was enabled.

This pr fixes those cases and adds a new function `PrettyPrinter::should_print_verbose`. This function should always be used over `self.tcx().sess.verbose()` inside a `impl PrettyPrinter`.

Maybe closes rust-lang#94187 now.

r? `@compiler-errors`
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 31, 2022
Rollup of 8 pull requests

Successful merges:

 - rust-lang#97971 (Enable varargs support for calling conventions other than C or cdecl )
 - rust-lang#101428 (Add mir building test directory)
 - rust-lang#101944 (rustdoc: clean up `#toggle-all-docs`)
 - rust-lang#102101 (check lld version to choose correct option to disable multi-threading in tests)
 - rust-lang#102689 (Add a tier 3 target for the Sony PlayStation 1)
 - rust-lang#103746 (rustdoc: add support for incoherent impls on structs and traits)
 - rust-lang#103758 (Add regression test for reexports in search results)
 - rust-lang#103764 (All verbosity checks in `PrettyPrinter` now go through `PrettyPrinter::should_print_verbose`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e6ffd96 into rust-lang:master Oct 31, 2022
@rustbot rustbot added this to the 1.67.0 milestone Oct 31, 2022
@SarthakSingh31 SarthakSingh31 deleted the issue-94187-2 branch October 31, 2022 06:35
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Nov 2, 2022
…name, r=eholk

Format `dyn Trait` better in `type_name` intrinsic

Noticed this in rust-lang#103764 (though not related to that PR at all!)

```rust
trait Foo {
    type Bar;
}

fn main() {
    println!(
        "`dyn Fn(i32, i32) -> i32` => `{}`",
        std::any::type_name::<dyn Fn(i32, i32) -> i32>()
    );
    println!(
        "`dyn Foo<Bar = i32> + Send + Sync` => `{}`",
        std::any::type_name::<dyn Foo<Bar = i32> + Send + Sync>()
    );
}
```

```
`dyn Fn(i32, i32) -> i32` => `dyn core::ops::function::Fn<(i32, i32)>+Output = i32`
`dyn Foo<Bar = i32> + Send + Sync` => `dyn playground::Foo+Bar = i32+core::marker::Sync+core::marker::Send`
```

Just reuse `pretty_print_dyn_existential` which already makes an attempt to make its output stable.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

type_name depends on -Zverbose flag
4 participants