Commit Graph

52188 Commits

Author SHA1 Message Date
Niko Matsakis
c74339052d rewrite foreign types lint not to trawl the HIR
It no longer reads from `ast_ty_to_ty_cache`, which was very wrong. It
also correctly handles higher-ranked regions.
2016-03-24 14:01:28 -04:00
Tshepang Lekhonkhobe
2c48214a1b doc: remove needless bindings 2016-03-24 19:58:43 +02:00
bors
dcfb8d72e9 Auto merge of #32465 - steveklabnik:rollup, r=steveklabnik
Rollup of 6 pull requests

- Successful merges: #32276, #32416, #32452, #32459, #32462, #32464
- Failed merges:
2016-03-24 09:25:02 -07:00
Steve Klabnik
b2dfb7c0a2 Rollup merge of #32464 - GuillaumeGomez:patch-6, r=steveklabnik
Improve some Option code example

Part of #29366.

r? @steveklabnik
2016-03-24 10:37:24 -04:00
Steve Klabnik
bce02a207a Rollup merge of #32462 - tclfs:patch-1, r=steveklabnik
Docs: some tiny corrections

TNT->`tnt`
firecracker->`firecracker`
2016-03-24 10:37:24 -04:00
Steve Klabnik
38c6593592 Rollup merge of #32459 - nrc:json-err-text, r=nikomatsakis
Include source text in JSON errors
2016-03-24 10:37:24 -04:00
Steve Klabnik
a3b9b42d44 Rollup merge of #32452 - GuillaumeGomez:patch-5, r=steveklabnik
Add code examples for libstd/time

Fixes #29379.

r? @steveklabnik
2016-03-24 10:37:24 -04:00
Steve Klabnik
7a38ac8e87 Rollup merge of #32416 - GuillaumeGomez:patch-3, r=steveklabnik
Add doc example to clone trait

Fixes #29346.

r? @steveklabnik
2016-03-24 10:37:23 -04:00
Steve Klabnik
87aee45988 Rollup merge of #32276 - brson:doc, r=alexcrichton
doc: Stdin is not writable
2016-03-24 10:37:23 -04:00
Niko Matsakis
091a00797e pacify the merciless tidy 2016-03-24 09:23:15 -04:00
Guillaume Gomez
b922d1a405 Improve some Option code example 2016-03-24 13:24:39 +01:00
Niko Matsakis
ed7c30b888 rework MIR visitor
We now visit more things (e.g., types) and also follow a deliberate
style designed to reduce omissions.
2016-03-24 06:23:59 -04:00
Tang Chenglong
ceaf5dfdc1 Docs: some tiny corrections
TNT->`tnt`
firecracker->`firecracker`
2016-03-24 14:49:40 +08:00
bors
dc1f6831eb Auto merge of #32219 - brson:lints, r=alexcrichton
Make warnings of renamed and removed lints themselves lints

This adds the `renamed_and_removed_lints` warning, defaulting
to the warning level.

Fixes #31141
2016-03-23 23:09:47 -07:00
Alex Burka
861644f2af address nits 2016-03-24 01:42:23 -04:00
Alex Burka
9f899a6659 error during parsing for malformed inclusive range
Now it is impossible for `...` or `a...` to reach HIR lowering
without a rogue syntax extension in play.
2016-03-24 01:42:23 -04:00
Alex Burka
9799cacba3 fatal error instead of ICE for impossible range during HIR lowering
End-less ranges (`a...`) don't parse but bad syntax extensions could
conceivably produce them. Unbounded ranges (`...`) do parse and are
caught here.

The other panics in HIR lowering are all for unexpanded macros, which
cannot be constructed by bad syntax extensions.
2016-03-24 01:33:31 -04:00
Alex Burka
cd80c1bb55 test errors for malformed inclusive ranges 2016-03-24 01:33:31 -04:00
Nick Cameron
180d6b55ca Tests 2016-03-24 15:54:22 +13:00
Nick Cameron
9757516f12 Include source text in JSON errors 2016-03-24 15:32:42 +13:00
NODA, Kai
a21c5f267a
Add core::ops::Range*::contains() as per rust-lang/rust#32311
Signed-off-by: NODA, Kai <nodakai@gmail.com>
2016-03-24 08:57:45 +08:00
Niko Matsakis
0769865f7f rewrite scope drop to be iterative
while I'm at it, remove the "extra caching" that I was doing for no good
reason except laziness. Basically before I was caching at each scope in
the chain, but there's not really a reason to do that, since the cached
entry point at level N is always equal to the last cached exit point
from level N-1.
2016-03-23 20:46:38 -04:00
Ulrik Sverdrup
f621193e5e Accept 0 as a valid str char boundary
Index 0 must be a valid char boundary (invariant of str that it contains
valid UTF-8 data).

If we check explicitly for index == 0, that removes the need to read the
byte at index 0, so it avoids a trip to the string's memory, and it
optimizes out the slicing index' bounds check whenever it is zero.

With this change, the following examples all change from having a read of
the byte at 0 and a branch to possibly panicing, to having the bounds
checking optimized away.

```rust
pub fn split(s: &str) -> (&str, &str) {
    s.split_at(0)
}

pub fn both(s: &str) -> &str {
    &s[0..s.len()]
}

pub fn first(s: &str) -> &str {
    &s[..0]
}

pub fn last(s: &str) -> &str {
    &s[0..]
}
```
2016-03-24 01:25:59 +01:00
Brian Anderson
addde1fd6f Make warnings of renamed and removed lints themselves lints
This adds the `renamed_and_removed_lints` warning, defaulting
to the warning level.

Fixes #31141
2016-03-23 23:41:48 +00:00
Brian Anderson
b013ad55aa doc: Stdin is locked for reads, not writes 2016-03-23 23:39:01 +00:00
bors
43843d06ea Auto merge of #32455 - TimNN:patch-1, r=alexcrichton
add naked function tracking issue # to feature gate definition
2016-03-23 16:24:39 -07:00
Ulrik Sverdrup
80e7a1be35 Mark str::split_at inline 2016-03-23 22:03:06 +01:00
Niko Matsakis
a276e755e7 introduce "call-site-scope" as the outermost scope
also, when exiting a scope, assign the final goto terminator with the
target scope's id
2016-03-23 16:42:55 -04:00
Niko Matsakis
1c0fa34310 Update borrowck to use repr::* instead of a mix
We should probably settle on some conventions here. In MIR code, I have
generally been importing `*`, but perhaps borrowck does not want to do
that.
2016-03-23 16:42:54 -04:00
Niko Matsakis
2b96cfb143 add comments on remaining fields 2016-03-23 16:42:54 -04:00
Niko Matsakis
c36707a284 Add ScopeAuxiliaryVec, return MIR+aux via tuple
It's nice to be able to index with a scope-id,
but coherence rules prevent us from implementing
`Index<ScopeId>` for `Vec<ScopeAuxiliary>`, and I'd
prefer that `ScopeAuxiliary` remain in librustc_mir,
just for compilation time reasons.
2016-03-23 16:42:54 -04:00
Niko Matsakis
70d0123082 Address nit: Remove ScopedDataVec newtype 2016-03-23 16:42:54 -04:00
Niko Matsakis
b3d2059b08 Address nit: block.unit() 2016-03-23 16:42:54 -04:00
Niko Matsakis
c1a53a60e7 Address nit: doc-comments on fields 2016-03-23 16:42:54 -04:00
Niko Matsakis
a2bab6f3e1 Address nit: use doc-comments for fields of VarDecl 2016-03-23 16:42:53 -04:00
Niko Matsakis
14a5657a9a Rename MirPlusPlus to MirAndScopeAuxiliary 2016-03-23 16:42:53 -04:00
Niko Matsakis
f66fd8972f replace DUMMY_SP on resume with span from fn 2016-03-23 16:42:53 -04:00
Niko Matsakis
cb04e495dc rewrite drop code
This was triggered by me wanting to address a use of DUMMY_SP, but
actually I'm not sure what would be a better span -- I guess the span
for the function as a whole.
2016-03-23 16:42:53 -04:00
Niko Matsakis
f976e222e9 fix bug in simplify_cfg with inf. loops 2016-03-23 16:42:53 -04:00
Niko Matsakis
a61c1759c7 allow dumping intermediate IR with -Z dump-mir 2016-03-23 16:42:53 -04:00
Niko Matsakis
0d93989cf5 adjust pretty printer to print scopes / auxiliary 2016-03-23 16:42:53 -04:00
Niko Matsakis
d32bde3311 augment MIR pretty printer to print scopes 2016-03-23 16:42:52 -04:00
Niko Matsakis
caac0b969f reformat mir text pretty printer 2016-03-23 16:42:52 -04:00
Niko Matsakis
9d00deee96 add span/scope-id to terminator 2016-03-23 16:42:52 -04:00
Niko Matsakis
3a16f57fbb extend Terminator into a struct so it can have additional fields 2016-03-23 16:42:52 -04:00
Niko Matsakis
e752d4cde3 track the innermost scope for every stmt 2016-03-23 16:37:48 -04:00
Niko Matsakis
323d7f4e98 record a scope for each VarDecl 2016-03-23 16:37:48 -04:00
Niko Matsakis
464c02e336 integrate scopes into MIR 2016-03-23 16:37:48 -04:00
bors
98f0a9128f Auto merge of #32454 - eddyb:rollup, r=eddyb
Rollup of 11 pull requests

- Successful merges: #32404, #32420, #32423, #32425, #32429, #32430, #32431, #32434, #32437, #32441, #32443
- Failed merges:
2016-03-23 12:33:04 -07:00
Tim Neumann
7027521daa add naked function tracking issue # to feature gate definition 2016-03-23 17:14:19 +01:00