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

Format dyn Trait better in type_name intrinsic #103774

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

compiler-errors
Copy link
Member

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

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.

@rustbot
Copy link
Collaborator

rustbot commented Oct 30, 2022

r? @eholk

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

@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

@@ -0,0 +1,18 @@
// run-pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't really testing anything about const is it?

This doesn't even need a ui test, so library/core/tests/any.rs might be a better location.

@eholk
Copy link
Contributor

eholk commented Nov 1, 2022

Looks good to me, but I like @RalfJung's suggestion to move the test to a unit test, so I'll hold off on approving it to give you a chance to make that change.

Feel free to r=me once done.

@bors
Copy link
Contributor

bors commented Nov 1, 2022

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

@rustbot
Copy link
Collaborator

rustbot commented Nov 1, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member Author

@bors r=eholk

@bors
Copy link
Contributor

bors commented Nov 1, 2022

📌 Commit e24df27 has been approved by eholk

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 Nov 1, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 2, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#103275 (Update tinystr)
 - rust-lang#103703 (Gate some parser recovery behind the check)
 - rust-lang#103774 (Format `dyn Trait` better in `type_name` intrinsic)
 - rust-lang#103807 (Add tracking issue for `string_extend_from_within`)
 - rust-lang#103855 (rustdoc: simplify mobile item-table CSS)
 - rust-lang#103862 (Use `ObligationCtxt` in `fully_normalize`)
 - rust-lang#103864 (Reorder `walk_` functions in intravisit.rs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit bbd3a10 into rust-lang:master Nov 2, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 2, 2022
@compiler-errors compiler-errors deleted the dyn-trait-in-type-name branch November 6, 2022 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

6 participants