-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
vdbg! macro #4868
vdbg! macro #4868
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
10 Ignored Deployments
|
🟢 CI successful 🟢Thanks |
This change may fail to build
|
7725bc0
to
734916b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a default impl for items which implement #4868 (comment)Debug
but don't implement ValueDebugFormat
specifically?
@jridgewell isn't this already the case? |
Ohh, I didn't read the comments and thought we still needed an |
This PR could not be merged because the GitHub API returned an internal server error. To enable Kodiak on this pull request please remove the When the GitHub API returns an internal server error (HTTP status code 500), it is not safe for Kodiak to retry merging. For more information please see https://kodiakhq.com/docs/troubleshooting#merge-errors If you need help, you can open a GitHub issue, check the docs, or reach us privately at support@kodiakhq.com. |
### Description The `vdbg!` macro works the same way as the `dbg!` macro, with the additional benefit of automatically calling `ValueDebugFormat` implementations. This means that you can do: ```rust vdbg!(42, asset_ident_vc); vdbg!(42, asset_ident_vc; depth = 1); ``` and the macro will print out ```rust [src/main.rs:10] 42 = 42 [src/main.rs:10] some_vc = AssetIdent { path: FileSystemPath { fs: FileSystem(DiskFileSystem { name: "project", root: "...", }), path: "...", }, query: None, fragment: None, assets: [], modifiers: [], part: None, } ``` ```rust [src/main.rs:10] 42 = 42 [src/main.rs:10] asset_ident_vc = AssetIdent { path: FileSystemPath, query: core::option::Option<turbo_tasks::primitives::StringVc>, fragment: core::option::Option<turbo_tasks::primitives::StringVc>, assets: alloc::vec::Vec<(turbo_tasks::primitives::StringVc, turbopack_core::ident::AssetIdentVc)>, modifiers: alloc::vec::Vec<turbo_tasks::primitives::StringVc>, part: core::option::Option<turbopack_core::resolve::ModulePartVc>, } ``` This is an ergonomic improvement over having to call `.dbg()` or `.dbg_depth()` manually in four major ways: 1. No need to be in an async context and call `.await?`: the macro will spawn a task on its own. This means that it is no longer necessary to convert a `turbo_tasks::function` to async just to debug one of its arguments. 2. No need to import the `turbo_tasks::debug::ValueDebug` trait. You can call `turbo_tasks::vdbg!(...)` directly, of `vdbg!(...)` if you have it imported already. 3. No need to call `eprintln!` or `dbg!`: `vdbg!` calls `eprintln!` directly under the hood, with the same format as `dbg!`. 4. It's just one macro, with support for the `depth` argument baked in. ### Testing Instructions N/A link WEB-520
### Description The `vdbg!` macro works the same way as the `dbg!` macro, with the additional benefit of automatically calling `ValueDebugFormat` implementations. This means that you can do: ```rust vdbg!(42, asset_ident_vc); vdbg!(42, asset_ident_vc; depth = 1); ``` and the macro will print out ```rust [src/main.rs:10] 42 = 42 [src/main.rs:10] some_vc = AssetIdent { path: FileSystemPath { fs: FileSystem(DiskFileSystem { name: "project", root: "...", }), path: "...", }, query: None, fragment: None, assets: [], modifiers: [], part: None, } ``` ```rust [src/main.rs:10] 42 = 42 [src/main.rs:10] asset_ident_vc = AssetIdent { path: FileSystemPath, query: core::option::Option<turbo_tasks::primitives::StringVc>, fragment: core::option::Option<turbo_tasks::primitives::StringVc>, assets: alloc::vec::Vec<(turbo_tasks::primitives::StringVc, turbopack_core::ident::AssetIdentVc)>, modifiers: alloc::vec::Vec<turbo_tasks::primitives::StringVc>, part: core::option::Option<turbopack_core::resolve::ModulePartVc>, } ``` This is an ergonomic improvement over having to call `.dbg()` or `.dbg_depth()` manually in four major ways: 1. No need to be in an async context and call `.await?`: the macro will spawn a task on its own. This means that it is no longer necessary to convert a `turbo_tasks::function` to async just to debug one of its arguments. 2. No need to import the `turbo_tasks::debug::ValueDebug` trait. You can call `turbo_tasks::vdbg!(...)` directly, of `vdbg!(...)` if you have it imported already. 3. No need to call `eprintln!` or `dbg!`: `vdbg!` calls `eprintln!` directly under the hood, with the same format as `dbg!`. 4. It's just one macro, with support for the `depth` argument baked in. ### Testing Instructions N/A link WEB-520
### Description The `vdbg!` macro works the same way as the `dbg!` macro, with the additional benefit of automatically calling `ValueDebugFormat` implementations. This means that you can do: ```rust vdbg!(42, asset_ident_vc); vdbg!(42, asset_ident_vc; depth = 1); ``` and the macro will print out ```rust [src/main.rs:10] 42 = 42 [src/main.rs:10] some_vc = AssetIdent { path: FileSystemPath { fs: FileSystem(DiskFileSystem { name: "project", root: "...", }), path: "...", }, query: None, fragment: None, assets: [], modifiers: [], part: None, } ``` ```rust [src/main.rs:10] 42 = 42 [src/main.rs:10] asset_ident_vc = AssetIdent { path: FileSystemPath, query: core::option::Option<turbo_tasks::primitives::StringVc>, fragment: core::option::Option<turbo_tasks::primitives::StringVc>, assets: alloc::vec::Vec<(turbo_tasks::primitives::StringVc, turbopack_core::ident::AssetIdentVc)>, modifiers: alloc::vec::Vec<turbo_tasks::primitives::StringVc>, part: core::option::Option<turbopack_core::resolve::ModulePartVc>, } ``` This is an ergonomic improvement over having to call `.dbg()` or `.dbg_depth()` manually in four major ways: 1. No need to be in an async context and call `.await?`: the macro will spawn a task on its own. This means that it is no longer necessary to convert a `turbo_tasks::function` to async just to debug one of its arguments. 2. No need to import the `turbo_tasks::debug::ValueDebug` trait. You can call `turbo_tasks::vdbg!(...)` directly, of `vdbg!(...)` if you have it imported already. 3. No need to call `eprintln!` or `dbg!`: `vdbg!` calls `eprintln!` directly under the hood, with the same format as `dbg!`. 4. It's just one macro, with support for the `depth` argument baked in. ### Testing Instructions N/A link WEB-520
### Description The `vdbg!` macro works the same way as the `dbg!` macro, with the additional benefit of automatically calling `ValueDebugFormat` implementations. This means that you can do: ```rust vdbg!(42, asset_ident_vc); vdbg!(42, asset_ident_vc; depth = 1); ``` and the macro will print out ```rust [src/main.rs:10] 42 = 42 [src/main.rs:10] some_vc = AssetIdent { path: FileSystemPath { fs: FileSystem(DiskFileSystem { name: "project", root: "...", }), path: "...", }, query: None, fragment: None, assets: [], modifiers: [], part: None, } ``` ```rust [src/main.rs:10] 42 = 42 [src/main.rs:10] asset_ident_vc = AssetIdent { path: FileSystemPath, query: core::option::Option<turbo_tasks::primitives::StringVc>, fragment: core::option::Option<turbo_tasks::primitives::StringVc>, assets: alloc::vec::Vec<(turbo_tasks::primitives::StringVc, turbopack_core::ident::AssetIdentVc)>, modifiers: alloc::vec::Vec<turbo_tasks::primitives::StringVc>, part: core::option::Option<turbopack_core::resolve::ModulePartVc>, } ``` This is an ergonomic improvement over having to call `.dbg()` or `.dbg_depth()` manually in four major ways: 1. No need to be in an async context and call `.await?`: the macro will spawn a task on its own. This means that it is no longer necessary to convert a `turbo_tasks::function` to async just to debug one of its arguments. 2. No need to import the `turbo_tasks::debug::ValueDebug` trait. You can call `turbo_tasks::vdbg!(...)` directly, of `vdbg!(...)` if you have it imported already. 3. No need to call `eprintln!` or `dbg!`: `vdbg!` calls `eprintln!` directly under the hood, with the same format as `dbg!`. 4. It's just one macro, with support for the `depth` argument baked in. ### Testing Instructions N/A link WEB-520
Description
The
vdbg!
macro works the same way as thedbg!
macro, with the additional benefit of automatically callingValueDebugFormat
implementations.This means that you can do:
and the macro will print out
This is an ergonomic improvement over having to call
.dbg()
or.dbg_depth()
manually in four major ways:.await?
: the macro will spawn a task on its own. This means that it is no longer necessary to convert aturbo_tasks::function
to async just to debug one of its arguments.turbo_tasks::debug::ValueDebug
trait. You can callturbo_tasks::vdbg!(...)
directly, ofvdbg!(...)
if you have it imported already.eprintln!
ordbg!
:vdbg!
callseprintln!
directly under the hood, with the same format asdbg!
.depth
argument baked in.Testing Instructions
N/A
link WEB-520