Skip to content

Commit 36b7c54

Browse files
authored
Rollup merge of #147444 - jyn514:fully-qualified-paths, r=nnethercote
Allow printing a fully-qualified path in `def_path_str` Previously, the local crate would always be printed as a leading `crate::`. Allow resolving it to the crate name instead. This allows printing a fully qualified path with: ```rust let qualified_name = with_no_visible_paths!(with_resolve_crate_name!( with_no_trimmed_paths!(tcx.def_path_str(def_id)) )); ``` I found this useful for an out-of-tree rustc-driver. I do not currently have a usecase in mind upstream; I'm ok if you don't want this PR for that reason. See [#t-compiler/help > print a fully qualified path name? @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/print.20a.20fully.20qualified.20path.20name.3F/near/541560961) for additional context. This does not currently have tests. I am not aware of an easy way to test def-id printing, since it requires having access to a TyCtxt.
2 parents 08bff84 + 64a0ab5 commit 36b7c54

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)