Commit Graph

96 Commits

Author SHA1 Message Date
Oliver Schneider
d732da813b
Use PathBuf instead of String where applicable 2017-12-14 11:22:08 +01:00
Jeffrey Seyfried
f79c7e442d Refactor MarkData field modern: bool to kind: MarkKind. 2017-12-12 13:15:09 -08:00
bors
c8ddf28527 Auto merge of #46497 - AgustinCB:issue-46311, r=petrochenkov
Modify message for keyword as identifier name

This is a temporary solution to #46311.

The message is generic enough to cover both cases and is probably a fine enough solution to the specific problem described in the task. However, the underlying reason for this to be wrong is that `next_token_inner` returns `Lifetime` even if the token is a label. That's not simple, as the syntax for both can be quite similar and it may need to take a look to the next token to make a decision. I'm not sure I have enough knowledge about the project to be able to solve that (yet!), so I thought I'll fix the immediate problem first.
2017-12-07 21:05:49 +00:00
Niko Matsakis
47b8ef51d4 don't print self symbol's internal index unless gensymed
It's just not useful. It also makes it hard to have tests that probe
internal state, since the interning number is very sensitive.

Dumping the number in the case of gensym is not ideal but will do for
now.
2017-12-07 05:28:01 -05:00
Agustin Chiappe Berrini
dd41929509 remove unused test 2017-12-07 04:00:22 -05:00
Agustin Chiappe Berrini
fb8ab18f50 remove unnecessary function 2017-12-07 03:56:31 -05:00
Agustin Chiappe Berrini
ce1fed7f52 address comments 2017-12-07 03:52:25 -05:00
bors
5a2465e2b4 Auto merge of #45953 - estebank:tab-4, r=nikomatsakis
Display `\t` in diagnostics code as four spaces

Follow up to #44386 using the unicode variable width machinery from #45711 to replace tabs in the source code when displaying a diagnostic error with four spaces (instead of only one), while properly accounting for this when calculating underlines.

Partly addresses #44618.
2017-12-06 21:05:53 +00:00
Agustin Chiappe Berrini
65ccf24ce8 and refactor to just move the checking 2017-12-06 04:28:01 -05:00
Michael Woerister
45439945c9 incr.comp.: Store Spans as (file,line,col,length) in incr.comp. cache.
The previous method ran into problems because ICH would treat Spans
as (file,line,col) but the cache contained byte offsets and its
possible for the latter to change while the former stayed stable.
2017-12-01 13:48:19 +01:00
Michael Woerister
409e39285d incr.comp.: Properly hash and encode macro expansion information. 2017-12-01 13:48:19 +01:00
Esteban Küber
9d80e2200a Display \t in diagnostics code as four spaces 2017-11-24 08:24:31 -08:00
John-John Tedro
b8891eebe4 Fix style in interner test 2017-11-13 07:55:20 +01:00
bors
54bbd56715 Auto merge of #45758 - nzig:explain-span-ctxt, r=petrochenkov
Add comment explaining the ctxt field in Span

As discussed in #45747.

r? @petrochenkov
2017-11-06 05:16:15 +00:00
Nadav Zingerman
0220600a0d Fix comment formatting 2017-11-05 01:24:20 +02:00
bors
12e6b53744 Auto merge of #45711 - tirr-c:unicode-span, r=estebank
Display spans correctly when there are zero-width or wide characters

Hopefully...
* fixes #45211
* fixes #8706

---

Before:
```
error: invalid width `7` for integer literal
  --> unicode_2.rs:12:25
   |
12 |     let _ = ("a̐éö̲", 0u7);
   |                         ^^^
   |
   = help: valid widths are 8, 16, 32, 64 and 128

error: invalid width `42` for integer literal
  --> unicode_2.rs:13:20
   |
13 |     let _ = ("아あ", 1i42);
   |                    ^^^^
   |
   = help: valid widths are 8, 16, 32, 64 and 128

error: aborting due to 2 previous errors
```

After:
```
error: invalid width `7` for integer literal
  --> unicode_2.rs:12:25
   |
12 |     let _ = ("a̐éö̲", 0u7);
   |                     ^^^
   |
   = help: valid widths are 8, 16, 32, 64 and 128

error: invalid width `42` for integer literal
  --> unicode_2.rs:13:20
   |
13 |     let _ = ("아あ", 1i42);
   |                      ^^^^
   |
   = help: valid widths are 8, 16, 32, 64 and 128

error: aborting due to 2 previous errors
```

Spans might display incorrectly on the browser.

r? @estebank
2017-11-04 23:09:19 +00:00
Nadav Zingerman
2304b3a7f1 Add comment explaining the ctxt field in Span 2017-11-04 15:54:03 +02:00
leonardo.yvens
1f4b630899 add auto keyword, parse auto trait, lower to HIR
Adds an `IsAuto` field to `ItemTrait` which flags if the trait was
declared as an `auto trait`.

Auto traits cannot have generics nor super traits.
2017-11-03 16:13:20 -02:00
Wonwoo Choi
272c2faa1d Display spans correctly when there are non-half-width characters 2017-11-03 03:15:39 +09:00
Vadim Petrochenkov
06f7f1f68b Optimize some span operations
Decode span data only once
2017-10-29 02:16:53 +03:00
Vadim Petrochenkov
e6115af4bd Implement dyn Trait syntax 2017-10-14 12:51:13 +03:00
kennytm
23a99f4e0e
Rollup merge of #44775 - MaloJaffre:debug-struct, r=sfackler
Refactor to use `debug_struct` in several Debug impls

Also use `pad` and derive `Debug` for `Edge`.

Fixes #44771.
2017-10-10 22:43:57 +08:00
Malo Jaffré
679457ad2a Refactor to use debug_struct in several Debug impls
Fixes #44771.
2017-10-09 20:09:08 +02:00
Philip Craig
3a225c77bb Rename FileMap::path and change to an Option 2017-10-03 19:47:33 +10:00
Philip Craig
c27a82f193 Don't use remapped path when loading modules and include files 2017-09-30 16:32:45 +10:00
Vadim Petrochenkov
52251cd930 Compress "small" spans to 32 bits and intern "large" spans 2017-09-23 00:34:13 +03:00
Sergio Benitez
5d3626d0f2 Add impl From<Vec<Span>> for MultiSpan. 2017-09-09 02:09:10 -07:00
Ariel Ben-Yehuda
02b3ae63e2 enable desugaring-sensitive error messages and use them in Try
Maybe I should allow error messages to check the *specific* desugaring?
Thanks @huntiep for the idea!
2017-09-03 13:10:54 +03:00
Eduard-Mihai Burtescu
9988e798c0 Implement From<&str> for Symbol. 2017-08-31 23:23:52 +03:00
Vadim Petrochenkov
a0c32641fd Make fields of Span public again
This helps to avoid landing changes to rustc and rustfmt in one step
2017-08-30 01:41:05 +03:00
Vadim Petrochenkov
71dfe6487d Normalize order of lo and hi in Span::new 2017-08-30 01:39:51 +03:00
Vadim Petrochenkov
3da868dcb6 Make fields of Span private 2017-08-30 01:38:54 +03:00
Tamir Duberstein
b3f50caee0
*: remove crate_{name,type} attributes
Fixes #41701.
2017-08-25 16:18:21 -04:00
bors
4ac7646d39 Auto merge of #43832 - huntiep:compiler-desugaring-enum, r=nikomatsakis
Implement CompilerDesugaringKind enum

This is the first step outlined in #35946. I think that the variants of `CompilerDesugaringKind` should be changed, I didn't know what the official names for `...` and `<-` are.

I'm not to sure how tests for the compiler work, but I would imagine that tests should be added such that
`Symbol::intern(s) == CompilerDesugaringKind::from(s).as_symbol()` for valid `s`.
2017-08-18 00:26:08 +00:00
Hunter Praska
ff047a8a25
Use direct references to CompilerDesugaringKind 2017-08-16 18:46:48 -05:00
Zack M. Davis
1b6c9605e4 use field init shorthand EVERYWHERE
Like #43008 (f668999), but _much more aggressive_.
2017-08-15 15:29:17 -07:00
Hunter Praska
4acfef8f63
Implement CompilerDesugaringKind enum 2017-08-12 19:43:43 -05:00
Eduard-Mihai Burtescu
8a4facc3c3 syntax: #[allow_internal_unsafe] bypasses the unsafe_code lint in macros. 2017-08-12 09:14:50 +03:00
bors
0b5c0874b8 Auto merge of #43584 - arielb1:unused-reads, r=eddyb
Fix quadratic performance with lots of use statements

This fixes 2 problems that caused quadratic performance when lots of use-statements were present. After this patch, performance is linear (and very fast) even with 1M uses.

Fixes #43572.
Fixes #43573.

r? @eddyb
2017-08-02 05:56:06 +00:00
Ariel Ben-Yehuda
c9d14a846f syntax: avoid loading the same source-file multiple times
We already had a cache for file contents, but we read the source-file
before testing the cache, causing obvious slowness, so this just avoids
loading the source-file when the cache already has the contents.
2017-08-01 14:18:49 +03:00
Vadim Petrochenkov
a6993d6469 resolve: Fix instability in import suggestions 2017-07-30 12:27:57 +03:00
Vadim Petrochenkov
128f565dae Give span to angle bracketed generic arguments 2017-07-27 22:59:35 +03:00
Bruce Mitchener
539df8121b Fix some doc/comment typos. 2017-07-23 22:48:01 +07:00
Esteban Küber
6772661f37 Review comments 2017-07-21 16:49:09 -07:00
Esteban Küber
e99d309c56 Use the macro structure spans instead of the invocation 2017-07-20 21:27:22 -07:00
Alex Crichton
fd95db25b3 Merge remote-tracking branch 'origin/master' into proc_macro_api 2017-07-05 08:42:13 -07:00
petrochenkov
b33fd6d759 Change some terminology around keywords and reserved identifiers 2017-06-29 15:19:53 +03:00
Vadim Petrochenkov
e03948ef3e Make $crate a keyword 2017-06-29 15:19:52 +03:00
Jeffrey Seyfried
d4488b7df9 Simplify hygiene::Mark application, and
remove variant `Token::SubstNt` in favor of `quoted::TokenTree::MetaVar`.
2017-06-26 02:05:45 +00:00
Alex Crichton
be7ebdd512 Bump version and stage0 compiler 2017-06-19 22:25:05 -07:00