Commit graph

83 commits

Author SHA1 Message Date
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
Inokentiy Babushkin
271133b03e
External spans: address review.
* The lazy loading mechanism has been moved to a more appropriate place.
* Return values from the functions invoked there are properly used.
* Documentation has gotten some minor improvements.
* Possibly some larger restructuring will need to take place still.
2017-06-12 15:37:26 +02:00
Inokentiy Babushkin
9a8bbe9da9
Added hash verification to external source loading. 2017-06-11 13:48:54 +02:00
Inokentiy Babushkin
a5b8851e22
Added consumption logic for external sources in FileMap
We now fetch source lines from the `external_src` member as a secondary
fallback if no regular source is present, that is, if the file map
belongs to an external crate and the source has been fetched from disk.
2017-06-11 13:31:40 +02:00
Inokentiy Babushkin
c04aa4ed0c
Improved lazy external source loading and inserted calls. 2017-06-11 11:47:00 +02:00
Inokentiy Babushkin
c2c31b2db3
Added external crates' sources to FileMap.
They are now handled in their own member to prevent mutating access to
the `src` member. This way, we can safely load external sources, while
keeping the mutation of local source strings off-limits.
2017-06-10 21:08:32 +02:00
Inokentiy Babushkin
dd8f7cd126
Moved FileMap construction to it's own constructor.
The rationale is that BOM stripping is needed for lazy source loading
for external crates, and duplication can be avoided by moving the
corresponding functionality to libsyntax_pos.
2017-06-10 16:09:51 +02:00
Inokentiy Babushkin
3d2cff0c94
Added source hashes to FileMap
We can use these to perform lazy loading of source files belonging to
external crates. That way we will be able to show the source code of
external spans that have been translated.
2017-06-10 13:39:39 +02:00
Wesley Wiser
c47df30a0b syntax_pos::Symbol should not implement Sync
Fixes #42407
2017-06-05 21:52:34 -04:00
Jeffrey Seyfried
3eb235b45e Improve intercrate hygiene. 2017-05-25 05:52:11 +00:00
Jeffrey Seyfried
dde8dc61dd Improve efficiency. 2017-05-25 05:52:10 +00:00
Jeffrey Seyfried
bfa2ef62a1 Hygienize librustc_typeck. 2017-05-25 05:52:05 +00:00
Jeffrey Seyfried
1f175fa35d Hygienize librustc_resolve. 2017-05-25 05:51:50 +00:00
Alex Crichton
ab54f4b226 rustc: Remove #![unstable] annotation
These are now no longer necessary with `-Z force-unstable-if-unmarked`
2017-05-11 16:03:05 -07:00