1
Fork 0

Auto merge of #80090 - jyn514:tcx-in-render, r=GuillaumeGomez

Pass a `TyCtxt` through to `FormatRender`

This is the next step after https://github.com/rust-lang/rust/pull/79957 for https://github.com/rust-lang/rust/issues/76382. Eventually I plan to use this to remove `stability`, `const_stability`, and `deprecation` from `Item`, but that needs more extensive changes (in particular, https://github.com/rust-lang/rust/pull/75355 or something like it).

This has no actual changes to behavior, it's just moving types around.

ccc https://github.com/rust-lang/rust/pull/80014#issuecomment-746810284
This commit is contained in:
bors 2020-12-18 08:44:50 +00:00
commit d8d3ab96aa
7 changed files with 230 additions and 183 deletions

View file

@ -14,7 +14,7 @@ use crate::formats::item_type::ItemType;
use crate::json::types::*;
use crate::json::JsonRenderer;
impl JsonRenderer {
impl JsonRenderer<'_> {
pub(super) fn convert_item(&self, item: clean::Item) -> Option<Item> {
let item_type = ItemType::from(&item);
let clean::Item {
@ -57,10 +57,10 @@ impl JsonRenderer {
}
fn convert_span(&self, span: clean::Span) -> Option<Span> {
match span.filename(&self.sess) {
match span.filename(self.sess()) {
rustc_span::FileName::Real(name) => {
let hi = span.hi(&self.sess);
let lo = span.lo(&self.sess);
let hi = span.hi(self.sess());
let lo = span.lo(self.sess());
Some(Span {
filename: match name {
rustc_span::RealFileName::Named(path) => path,