Skip to content

Commit aa6a2f4

Browse files
committed
Rename whence to span
It's called `span` elsewhere in the compiler and `span` is also less surprising. `whence` is whimsical, but not super clear :)
1 parent c6e4db6 commit aa6a2f4

File tree

3 files changed

+53
-53
lines changed

3 files changed

+53
-53
lines changed

src/librustdoc/clean/mod.rs

+19-19
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl Clean<Item> for doctree::Module<'_> {
256256

257257
// determine if we should display the inner contents or
258258
// the outer `mod` item for the source code.
259-
let whence = {
259+
let span = {
260260
let sm = cx.sess().source_map();
261261
let outer = sm.lookup_char_pos(self.where_outer.lo());
262262
let inner = sm.lookup_char_pos(self.where_inner.lo());
@@ -272,7 +272,7 @@ impl Clean<Item> for doctree::Module<'_> {
272272
Item {
273273
name: Some(name),
274274
attrs,
275-
source: whence.clean(cx),
275+
source: span.clean(cx),
276276
visibility: self.vis.clean(cx),
277277
stability: cx.stability(self.id).clean(cx),
278278
deprecation: cx.deprecation(self.id).clean(cx),
@@ -912,7 +912,7 @@ impl Clean<Item> for doctree::Function<'_> {
912912
Item {
913913
name: Some(self.name.clean(cx)),
914914
attrs: self.attrs.clean(cx),
915-
source: self.whence.clean(cx),
915+
source: self.span.clean(cx),
916916
visibility: self.vis.clean(cx),
917917
stability: cx.stability(self.id).clean(cx),
918918
deprecation: cx.deprecation(self.id).clean(cx),
@@ -1020,7 +1020,7 @@ impl Clean<Item> for doctree::Trait<'_> {
10201020
Item {
10211021
name: Some(self.name.clean(cx)),
10221022
attrs,
1023-
source: self.whence.clean(cx),
1023+
source: self.span.clean(cx),
10241024
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
10251025
visibility: self.vis.clean(cx),
10261026
stability: cx.stability(self.id).clean(cx),
@@ -1044,7 +1044,7 @@ impl Clean<Item> for doctree::TraitAlias<'_> {
10441044
Item {
10451045
name: Some(self.name.clean(cx)),
10461046
attrs,
1047-
source: self.whence.clean(cx),
1047+
source: self.span.clean(cx),
10481048
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
10491049
visibility: self.vis.clean(cx),
10501050
stability: cx.stability(self.id).clean(cx),
@@ -1830,7 +1830,7 @@ impl Clean<Item> for doctree::Struct<'_> {
18301830
Item {
18311831
name: Some(self.name.clean(cx)),
18321832
attrs: self.attrs.clean(cx),
1833-
source: self.whence.clean(cx),
1833+
source: self.span.clean(cx),
18341834
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
18351835
visibility: self.vis.clean(cx),
18361836
stability: cx.stability(self.id).clean(cx),
@@ -1850,7 +1850,7 @@ impl Clean<Item> for doctree::Union<'_> {
18501850
Item {
18511851
name: Some(self.name.clean(cx)),
18521852
attrs: self.attrs.clean(cx),
1853-
source: self.whence.clean(cx),
1853+
source: self.span.clean(cx),
18541854
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
18551855
visibility: self.vis.clean(cx),
18561856
stability: cx.stability(self.id).clean(cx),
@@ -1880,7 +1880,7 @@ impl Clean<Item> for doctree::Enum<'_> {
18801880
Item {
18811881
name: Some(self.name.clean(cx)),
18821882
attrs: self.attrs.clean(cx),
1883-
source: self.whence.clean(cx),
1883+
source: self.span.clean(cx),
18841884
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
18851885
visibility: self.vis.clean(cx),
18861886
stability: cx.stability(self.id).clean(cx),
@@ -1899,7 +1899,7 @@ impl Clean<Item> for doctree::Variant<'_> {
18991899
Item {
19001900
name: Some(self.name.clean(cx)),
19011901
attrs: self.attrs.clean(cx),
1902-
source: self.whence.clean(cx),
1902+
source: self.span.clean(cx),
19031903
visibility: Inherited,
19041904
stability: cx.stability(self.id).clean(cx),
19051905
deprecation: cx.deprecation(self.id).clean(cx),
@@ -2047,7 +2047,7 @@ impl Clean<Item> for doctree::Typedef<'_> {
20472047
Item {
20482048
name: Some(self.name.clean(cx)),
20492049
attrs: self.attrs.clean(cx),
2050-
source: self.whence.clean(cx),
2050+
source: self.span.clean(cx),
20512051
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
20522052
visibility: self.vis.clean(cx),
20532053
stability: cx.stability(self.id).clean(cx),
@@ -2062,7 +2062,7 @@ impl Clean<Item> for doctree::OpaqueTy<'_> {
20622062
Item {
20632063
name: Some(self.name.clean(cx)),
20642064
attrs: self.attrs.clean(cx),
2065-
source: self.whence.clean(cx),
2065+
source: self.span.clean(cx),
20662066
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
20672067
visibility: self.vis.clean(cx),
20682068
stability: cx.stability(self.id).clean(cx),
@@ -2093,7 +2093,7 @@ impl Clean<Item> for doctree::Static<'_> {
20932093
Item {
20942094
name: Some(self.name.clean(cx)),
20952095
attrs: self.attrs.clean(cx),
2096-
source: self.whence.clean(cx),
2096+
source: self.span.clean(cx),
20972097
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
20982098
visibility: self.vis.clean(cx),
20992099
stability: cx.stability(self.id).clean(cx),
@@ -2114,7 +2114,7 @@ impl Clean<Item> for doctree::Constant<'_> {
21142114
Item {
21152115
name: Some(self.name.clean(cx)),
21162116
attrs: self.attrs.clean(cx),
2117-
source: self.whence.clean(cx),
2117+
source: self.span.clean(cx),
21182118
def_id: def_id.to_def_id(),
21192119
visibility: self.vis.clean(cx),
21202120
stability: cx.stability(self.id).clean(cx),
@@ -2168,7 +2168,7 @@ impl Clean<Vec<Item>> for doctree::Impl<'_> {
21682168
let make_item = |trait_: Option<Type>, for_: Type, items: Vec<Item>| Item {
21692169
name: None,
21702170
attrs: self.attrs.clean(cx),
2171-
source: self.whence.clean(cx),
2171+
source: self.span.clean(cx),
21722172
def_id: def_id.to_def_id(),
21732173
visibility: self.vis.clean(cx),
21742174
stability: cx.stability(self.id).clean(cx),
@@ -2219,7 +2219,7 @@ impl Clean<Vec<Item>> for doctree::ExternCrate<'_> {
22192219
vec![Item {
22202220
name: None,
22212221
attrs: self.attrs.clean(cx),
2222-
source: self.whence.clean(cx),
2222+
source: self.span.clean(cx),
22232223
def_id: DefId { krate: self.cnum, index: CRATE_DEF_INDEX },
22242224
visibility: self.vis.clean(cx),
22252225
stability: None,
@@ -2284,7 +2284,7 @@ impl Clean<Vec<Item>> for doctree::Import<'_> {
22842284
vec![Item {
22852285
name: None,
22862286
attrs: self.attrs.clean(cx),
2287-
source: self.whence.clean(cx),
2287+
source: self.span.clean(cx),
22882288
def_id: DefId::local(CRATE_DEF_INDEX),
22892289
visibility: self.vis.clean(cx),
22902290
stability: None,
@@ -2326,7 +2326,7 @@ impl Clean<Item> for doctree::ForeignItem<'_> {
23262326
Item {
23272327
name: Some(self.name.clean(cx)),
23282328
attrs: self.attrs.clean(cx),
2329-
source: self.whence.clean(cx),
2329+
source: self.span.clean(cx),
23302330
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
23312331
visibility: self.vis.clean(cx),
23322332
stability: cx.stability(self.id).clean(cx),
@@ -2342,7 +2342,7 @@ impl Clean<Item> for doctree::Macro<'_> {
23422342
Item {
23432343
name: Some(name.clone()),
23442344
attrs: self.attrs.clean(cx),
2345-
source: self.whence.clean(cx),
2345+
source: self.span.clean(cx),
23462346
visibility: Public,
23472347
stability: cx.stability(self.hid).clean(cx),
23482348
deprecation: cx.deprecation(self.hid).clean(cx),
@@ -2367,7 +2367,7 @@ impl Clean<Item> for doctree::ProcMacro<'_> {
23672367
Item {
23682368
name: Some(self.name.clean(cx)),
23692369
attrs: self.attrs.clean(cx),
2370-
source: self.whence.clean(cx),
2370+
source: self.span.clean(cx),
23712371
visibility: Public,
23722372
stability: cx.stability(self.id).clean(cx),
23732373
deprecation: cx.deprecation(self.id).clean(cx),

src/librustdoc/doctree.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub struct Struct<'hir> {
8989
pub generics: &'hir hir::Generics<'hir>,
9090
pub attrs: &'hir [ast::Attribute],
9191
pub fields: &'hir [hir::StructField<'hir>],
92-
pub whence: Span,
92+
pub span: Span,
9393
}
9494

9595
pub struct Union<'hir> {
@@ -100,7 +100,7 @@ pub struct Union<'hir> {
100100
pub generics: &'hir hir::Generics<'hir>,
101101
pub attrs: &'hir [ast::Attribute],
102102
pub fields: &'hir [hir::StructField<'hir>],
103-
pub whence: Span,
103+
pub span: Span,
104104
}
105105

106106
pub struct Enum<'hir> {
@@ -109,7 +109,7 @@ pub struct Enum<'hir> {
109109
pub generics: &'hir hir::Generics<'hir>,
110110
pub attrs: &'hir [ast::Attribute],
111111
pub id: hir::HirId,
112-
pub whence: Span,
112+
pub span: Span,
113113
pub name: Symbol,
114114
}
115115

@@ -118,7 +118,7 @@ pub struct Variant<'hir> {
118118
pub id: hir::HirId,
119119
pub attrs: &'hir [ast::Attribute],
120120
pub def: &'hir hir::VariantData<'hir>,
121-
pub whence: Span,
121+
pub span: Span,
122122
}
123123

124124
pub struct Function<'hir> {
@@ -128,7 +128,7 @@ pub struct Function<'hir> {
128128
pub name: Symbol,
129129
pub vis: &'hir hir::Visibility<'hir>,
130130
pub header: hir::FnHeader,
131-
pub whence: Span,
131+
pub span: Span,
132132
pub generics: &'hir hir::Generics<'hir>,
133133
pub body: hir::BodyId,
134134
}
@@ -139,7 +139,7 @@ pub struct Typedef<'hir> {
139139
pub name: Symbol,
140140
pub id: hir::HirId,
141141
pub attrs: &'hir [ast::Attribute],
142-
pub whence: Span,
142+
pub span: Span,
143143
pub vis: &'hir hir::Visibility<'hir>,
144144
}
145145

@@ -148,7 +148,7 @@ pub struct OpaqueTy<'hir> {
148148
pub name: Symbol,
149149
pub id: hir::HirId,
150150
pub attrs: &'hir [ast::Attribute],
151-
pub whence: Span,
151+
pub span: Span,
152152
pub vis: &'hir hir::Visibility<'hir>,
153153
}
154154

@@ -161,7 +161,7 @@ pub struct Static<'hir> {
161161
pub attrs: &'hir [ast::Attribute],
162162
pub vis: &'hir hir::Visibility<'hir>,
163163
pub id: hir::HirId,
164-
pub whence: Span,
164+
pub span: Span,
165165
}
166166

167167
pub struct Constant<'hir> {
@@ -171,7 +171,7 @@ pub struct Constant<'hir> {
171171
pub attrs: &'hir [ast::Attribute],
172172
pub vis: &'hir hir::Visibility<'hir>,
173173
pub id: hir::HirId,
174-
pub whence: Span,
174+
pub span: Span,
175175
}
176176

177177
pub struct Trait<'hir> {
@@ -183,7 +183,7 @@ pub struct Trait<'hir> {
183183
pub bounds: &'hir [hir::GenericBound<'hir>],
184184
pub attrs: &'hir [ast::Attribute],
185185
pub id: hir::HirId,
186-
pub whence: Span,
186+
pub span: Span,
187187
pub vis: &'hir hir::Visibility<'hir>,
188188
}
189189

@@ -193,7 +193,7 @@ pub struct TraitAlias<'hir> {
193193
pub bounds: &'hir [hir::GenericBound<'hir>],
194194
pub attrs: &'hir [ast::Attribute],
195195
pub id: hir::HirId,
196-
pub whence: Span,
196+
pub span: Span,
197197
pub vis: &'hir hir::Visibility<'hir>,
198198
}
199199

@@ -208,7 +208,7 @@ pub struct Impl<'hir> {
208208
pub for_: &'hir hir::Ty<'hir>,
209209
pub items: Vec<&'hir hir::ImplItem<'hir>>,
210210
pub attrs: &'hir [ast::Attribute],
211-
pub whence: Span,
211+
pub span: Span,
212212
pub vis: &'hir hir::Visibility<'hir>,
213213
pub id: hir::HirId,
214214
}
@@ -219,7 +219,7 @@ pub struct ForeignItem<'hir> {
219219
pub name: Symbol,
220220
pub kind: &'hir hir::ForeignItemKind<'hir>,
221221
pub attrs: &'hir [ast::Attribute],
222-
pub whence: Span,
222+
pub span: Span,
223223
}
224224

225225
// For Macro we store the DefId instead of the NodeId, since we also create
@@ -229,7 +229,7 @@ pub struct Macro<'hir> {
229229
pub hid: hir::HirId,
230230
pub def_id: hir::def_id::DefId,
231231
pub attrs: &'hir [ast::Attribute],
232-
pub whence: Span,
232+
pub span: Span,
233233
pub matchers: Vec<Span>,
234234
pub imported_from: Option<Symbol>,
235235
}
@@ -240,7 +240,7 @@ pub struct ExternCrate<'hir> {
240240
pub path: Option<String>,
241241
pub vis: &'hir hir::Visibility<'hir>,
242242
pub attrs: &'hir [ast::Attribute],
243-
pub whence: Span,
243+
pub span: Span,
244244
}
245245

246246
pub struct Import<'hir> {
@@ -250,7 +250,7 @@ pub struct Import<'hir> {
250250
pub attrs: &'hir [ast::Attribute],
251251
pub path: &'hir hir::Path<'hir>,
252252
pub glob: bool,
253-
pub whence: Span,
253+
pub span: Span,
254254
}
255255

256256
pub struct ProcMacro<'hir> {
@@ -259,7 +259,7 @@ pub struct ProcMacro<'hir> {
259259
pub kind: MacroKind,
260260
pub helpers: Vec<Symbol>,
261261
pub attrs: &'hir [ast::Attribute],
262-
pub whence: Span,
262+
pub span: Span,
263263
}
264264

265265
pub fn struct_type_from_def(vdata: &hir::VariantData<'_>) -> StructType {

0 commit comments

Comments
 (0)