-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Remove CURRENT_DEPTH
thread-local variable
#82815
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2292,14 +2292,16 @@ impl Clean<Item> for (&hir::MacroDef<'_>, Option<Symbol>) { | |
if matchers.len() <= 1 { | ||
format!( | ||
"{}macro {}{} {{\n ...\n}}", | ||
vis.print_with_space(cx.tcx, def_id, &cx.cache), | ||
// FIXME(camelid): this might create broken links! | ||
vis.print_with_space(cx.tcx, def_id, &cx.cache, 0), | ||
name, | ||
matchers.iter().map(|span| span.to_src(cx)).collect::<String>(), | ||
) | ||
} else { | ||
format!( | ||
"{}macro {} {{\n{}}}", | ||
vis.print_with_space(cx.tcx, def_id, &cx.cache), | ||
// FIXME(camelid): this might create broken links! | ||
vis.print_with_space(cx.tcx, def_id, &cx.cache, 0), | ||
Comment on lines
-2302
to
+2304
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
name, | ||
matchers | ||
.iter() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -414,7 +414,10 @@ crate fn resolve_type(cx: &mut DocContext<'_>, path: Path, id: hir::HirId) -> Ty | |
return Generic(kw::SelfUpper); | ||
} | ||
Res::Def(DefKind::TyParam, _) if path.segments.len() == 1 => { | ||
return Generic(Symbol::intern(&format!("{:#}", path.print(&cx.cache)))); | ||
// FIXME(camelid): I hope passing 0 as the depth doesn't break anything.... | ||
// Then again, I think used to be 0 anyway through CURRENT_DEPTH | ||
// because (I think) rendering hadn't started yet. | ||
return Generic(Symbol::intern(&format!("{:#}", path.print(&cx.cache, 0)))); | ||
Comment on lines
-417
to
+420
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think same as above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change makes me nervous, can you say why you think rendering hadn't started? I don't know exactly when this path is hit, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I understand, these changes make me a bit nervous too :)
My understanding is that all
Hmm, can you explain more what you mean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ok, this makes sense to me. The depth is only updated in
and cleaning never happens in
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't know when this line of code will be executed. Can you change it to an unconditional panic and document the standard library so I can see a backtrace of how it happens? If it never happens that probably means the whole thing is unreachable and we don't have to worry about it in the first place. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@jyn514 It turns out it is reachable! It panicked while documenting
I think that path is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think passing a depth of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, that makes sense to me. Could you add a comment about a) when this happens and b) why the depth of 0 is ok? |
||
} | ||
Res::SelfTy(..) | Res::Def(DefKind::TyParam | DefKind::AssocTy, _) => true, | ||
_ => false, | ||
|
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.
I believe this has the same behavior as before, but we should probably test it.
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.
I think this will break for macros in submodules (e.g.
pub mod inner { pub macro foo() {} }
).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.
Hmm, so it looks like we don't use links in macro visibilities on nightly anyway:
So I'm not sure how to test the changes :/
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.
That sounds like a bug, could you open an issue?
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.
Issue: #83000. Nice issue number :)