Skip to content

Commit 8c02b40

Browse files
committed
---
yaml --- r: 210831 b: refs/heads/try c: 7555e70 h: refs/heads/master i: 210829: 3f1dd6f 210827: 629f6a0 210823: eda2009 210815: a3bb327 v: v3
1 parent c3a1c47 commit 8c02b40

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: 7ca560d6abc0217943db436bb4b738bf6977cf93
5+
refs/heads/try: 7555e7081df536796aa7163a456b6f8cc4649595
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/librustc_trans/save/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,16 @@ pub struct CrateData {
4242
pub number: u32,
4343
}
4444

45-
// Data for any entity in the Rust language. The actual data contained varied
46-
// with the kind of entity being queried. See the nested structs for details.
45+
/// Data for any entity in the Rust language. The actual data contained varied
46+
/// with the kind of entity being queried. See the nested structs for details.
4747
pub enum Data {
48+
/// Data for all kinds of functions and methods.
4849
FunctionData(FunctionData),
50+
/// Data for local and global variables (consts and statics).
4951
VariableData(VariableData),
5052
}
5153

54+
/// Data for all kinds of functions and methods.
5255
pub struct FunctionData {
5356
pub id: NodeId,
5457
pub name: String,
@@ -58,6 +61,7 @@ pub struct FunctionData {
5861
pub scope: NodeId,
5962
}
6063

64+
/// Data for local and global variables (consts and statics).
6165
pub struct VariableData {
6266
pub id: NodeId,
6367
pub name: String,

branches/try/src/librustc_trans/save/span_utils.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ impl<'a> SpanUtils<'a> {
230230
// Reparse span and return an owned vector of sub spans of the first limit
231231
// identifier tokens in the given nesting level.
232232
// example with Foo<Bar<T,V>, Bar<T,V>>
233-
// Nesting = 0: all idents outside of brackets: Vec<Foo>
234-
// Nesting = 1: idents within one level of brackets: Vec<Bar, Bar>
233+
// Nesting = 0: all idents outside of brackets: [Foo]
234+
// Nesting = 1: idents within one level of brackets: [Bar, Bar]
235235
pub fn spans_with_brackets(&self, span: Span, nesting: isize, limit: isize) -> Vec<Span> {
236236
let mut result: Vec<Span> = vec!();
237237

@@ -260,10 +260,20 @@ impl<'a> SpanUtils<'a> {
260260
token::BinOp(token::Shr) => -2,
261261
_ => 0
262262
};
263+
263264
// Ignore the `>::` in `<Type as Trait>::AssocTy`.
265+
266+
// The root cause of this hack is that the AST representation of
267+
// qpaths is horrible. It treats <A as B>::C as a path with two
268+
// segments, B and C and notes that there is also a self type A at
269+
// position 0. Because we don't have spans for individual idents,
270+
// only the whole path, we have to iterate over the tokens in the
271+
// path, trying to pull out the non-nested idents (e.g., avoiding 'a
272+
// in `<A as B<'a>>::C`). So we end up with a span for `B>::C` from
273+
// the start of the first ident to the end of the path.
264274
if !found_ufcs_sep && bracket_count == -1 {
265275
found_ufcs_sep = true;
266-
bracket_count += 1
276+
bracket_count += 1;
267277
}
268278
if ts.tok.is_ident() && bracket_count == nesting {
269279
result.push(self.make_sub_span(span, Some(ts.sp)).unwrap());
@@ -332,7 +342,7 @@ impl<'a> SpanUtils<'a> {
332342
}
333343

334344

335-
// Returns a list of the spans of idents in a patch.
345+
// Returns a list of the spans of idents in a path.
336346
// E.g., For foo::bar<x,t>::baz, we return [foo, bar, baz] (well, their spans)
337347
pub fn spans_for_path_segments(&self, path: &ast::Path) -> Vec<Span> {
338348
if generated_code(path.span) {

0 commit comments

Comments
 (0)