Commit Graph

54479 Commits

Author SHA1 Message Date
Scott A Carr
79bf586d4b switch to BitVector, simplify target_block logic
clarify comments and panic message
2016-06-01 10:23:56 -07:00
bors
12d16599d8 Auto merge of #33814 - lambda:rtabort-use-platform-abort, r=alexcrichton
Open code the __fastfail intrinsic for rtabort! on windows

As described https://msdn.microsoft.com/en-us/library/dn774154.aspx

This is a Windows 8+ mechanism for terminating the process quickly,
which degrades to either an access violation or bugcheck in older versions.

I'm not sure this is better the the current mechanism of terminating
with an illegal instruction, but we recently converted unix to
terminate more correctly with SIGABORT, and this *seems* more correct
for windows.

[breaking-change]
2016-06-01 10:21:55 -07:00
Steven Allen
cde72b071c build: avoid repeated string concatenation in python 2016-06-01 12:29:39 -04:00
kennytm
1d7f34538d
Restore original meaning of std::fs::read_dir's example changed in #33958.
DirEntry.file_type().is_dir() will not follow symlinks, but the original
example (fs::metadata(&path).is_dir()) does. Therefore the change in
#33958 introduced a subtle difference that now it won't enter linked
folders. To preserve the same behavior, we use Path::is_dir() instead,
which does follow symlink.
2016-06-02 00:01:53 +08:00
Oliver Middleton
658253d30c Fix a few links in the book
Links to directories and direct links to doc.rust-lang.org don't work properly
when viewing the docs offline so fix them.
2016-06-01 16:53:14 +01:00
Guillaume Gomez
2b80753330 Add new error code tests 2016-06-01 16:30:13 +02:00
Guillaume Gomez
d211cd6550 Close unclosed code example in E0185 2016-06-01 16:17:21 +02:00
Jack O'Connor
df8d5baab7 allow for the future addition of a close method on File 2016-06-01 10:16:45 -04:00
Guillaume Gomez
c34676a7c4 Fix E0165 code examples 2016-06-01 16:02:23 +02:00
bors
c2cab1fd58 Auto merge of #33794 - petrochenkov:sanity, r=nrc
Add AST validation pass and move some checks to it

The purpose of this pass is to catch constructions that fit into AST data structures, but not permitted by the language. As an example, `impl`s don't have visibilities, but for convenience and uniformity with other items they are represented with a structure `Item` which has `Visibility` field.

This pass is intended to run after expansion of macros and syntax extensions (and before lowering to HIR), so it can catch erroneous constructions that were generated by them. This pass allows to remove ad hoc semantic checks from the parser, which can be overruled by syntax extensions and occasionally macros.

The checks can be put here if they are simple, local, don't require results of any complex analysis like name resolution or type checking and maybe don't logically fall into other passes. I expect most of errors generated by this pass to be non-fatal and allowing the compilation to proceed.

I intend to move some more checks to this pass later and maybe extend it with new checks, like, for example, identifier validity. Given that syntax extensions are going to be stabilized in the measurable future, it's important that they would not be able to subvert usual language rules.

In this patch I've added two new checks - a check for labels named `'static` and a check for lifetimes and labels named `'_`. The first one gives a hard error, the second one - a future compatibility warning.
Fixes https://github.com/rust-lang/rust/issues/33059 ([breaking-change])
cc https://github.com/rust-lang/rfcs/pull/1177

r? @nrc
2016-06-01 06:21:53 -07:00
Matt Kraai
68ac3e9ff0 Fix broken link name in bool documentation 2016-06-01 05:32:11 -07:00
Jeffrey Seyfried
dc5cc1b1f2 Run decorators on expanded AST. 2016-06-01 11:12:38 +00:00
bors
806a5535da Auto merge of #34004 - Manishearth:rollup, r=Manishearth
Rollup of 11 pull requests

- Successful merges: #33385, #33606, #33841, #33892, #33896, #33915, #33921, #33967, #33970, #33973, #33977
- Failed merges:
2016-06-01 00:28:44 -07:00
Manish Goregaokar
42e593a540 Rollup merge of #33977 - Ms2ger:create-and-enter, r=nrc
Take the def_map argument to TyCtxt::create_and_enter out of its RefCell.
2016-06-01 12:57:42 +05:30
Manish Goregaokar
86319f7f81 Rollup merge of #33973 - zackmdavis:stable_features_warning_notes_version_stabilized, r=brson
stable features lint warning mentions version stabilized

To accomplish this, we alter the checks in `rustc::middle::stability` to
use the `StabilityLevel` defined in `syntax::attr` (which includes the
version in which the feature was stabilized) rather than the local
`StabilityLevel` in the same module, and make the
`declared_stable_lang_features` field of
`syntax::feature_gate::Features` hold a Vec of feature-name, span
tuples (in analogy to the `declared_lib_features` field) rather than
just spans.

Fixes #33394.

![stable_features_version_lint_before_and_after](https://cloud.githubusercontent.com/assets/1076988/15659237/5d952a3a-267c-11e6-9181-c9e612eefd7d.png)

r? @brson (tagging Brian because he [wrote](https://github.com/rust-lang/rust/pull/21958) the lint)
2016-06-01 12:57:42 +05:30
Manish Goregaokar
e214c3e2da Rollup merge of #33970 - arielb1:normal-type-check, r=eddyb
normalize types in MIR typeck after erasing regions

this fixes the MIR bug @frankmcsherry encountered.

r? @eddyb
2016-06-01 12:57:42 +05:30
Manish Goregaokar
eba82bb569 Rollup merge of #33967 - dsprenkels:enum_pattern_resolve_ice, r=petrochenkov
resolve: record pattern def when `resolve_pattern` returns `Err(true)`

I propose a fix for issue #33293.

In 1a374b8, (pr #33046) fixed the error reporting of a specific case, but the change that was introduced did not make sure that `record_def` was called in all cases, which lead to an ICE in [1].
This change restores the original `else` case, but keeps the changes that were committed in 1a374b8.

[1] `rustc::middle::mem_categorization::MemCategorizationContext::cat_pattern_`
2016-06-01 12:57:42 +05:30
Manish Goregaokar
0e65b75b39 Rollup merge of #33921 - jameysharp:patch-1, r=alexcrichton
Inline simple Cursor write calls

Implementing the Write trait for Cursors over slices is so light-weight that under some circumstances multiple writes can be fused into a single instruction. In general I think inlining these functions is a good idea because most of the code can be constant-folded and copy-propagated away.

Closes issue #33916.

r? @alexcrichton
2016-06-01 12:57:42 +05:30
Manish Goregaokar
d9cd460f6c Rollup merge of #33915 - GuillaumeGomez:err-codes, r=steveklabnik
Add new error code tests

r? @steveklabnik
2016-06-01 12:57:41 +05:30
Manish Goregaokar
67e158fc4c Rollup merge of #33896 - strake:next_code_point, r=aturon
make core::str::next_code_point work on arbitrary iterator
2016-06-01 12:57:41 +05:30
Manish Goregaokar
7694e18d43 Rollup merge of #33892 - seanmonstar:slice-eq-ptr, r=alexcrichton
core: check pointer equality when comparing byte slices

If pointer address and length are the same, it should be the same slice.

In experiments, I've seen that this doesn't happen as often in debug builds, but release builds seem to optimize to using a single pointer more often.
2016-06-01 12:57:41 +05:30
Manish Goregaokar
4721f3a543 Rollup merge of #33841 - LeoTestard:macro-sequence-lhs, r=pnkfelix
Reject a LHS formed of a single sequence TT during `macro_rules!` checking.

This was already rejected during expansion. Encountering malformed LHS or RHS during expansion is now considered a bug.

Follow up to #33689.

r? @pnkfelix

Note: this can break code that defines such macros but does not use them.
2016-06-01 12:57:41 +05:30
Manish Goregaokar
cbfe74c3c8 Rollup merge of #33606 - tshepang:future-talk, r=brson
doc: format! may or may not handle streams in future

No need to talk about that here
2016-06-01 12:57:41 +05:30
Manish Goregaokar
b0e88279c7 Rollup merge of #33385 - cheercroaker:doc-correction, r=brson
Mention initial year of publication only for the documentation copyright

I have corrected the "copyright expiration year" that was still 2015 in the documentation copyright notice.

According to #31007 it seems that we could go one step further and simplify the copyright notice to only mention the year of original publication ("Copyright © 2011" in this case).

Let me know if you would prefer this copyright notice to only mention the year of original publication (please make sure that it is really 2011 as stated in the current version of the documentation, and not 2010 like Rust's code) and I'll make the simplification.
2016-06-01 12:57:40 +05:30
Andrey Tonkih
e3adad6587 Implement split_off for BTreeMap and BTreeSet (RFC 509) 2016-06-01 10:02:25 +03:00
bors
433d70cda2 Auto merge of #33141 - tshepang:python-love, r=brson
some Python nits and fixes
2016-05-31 21:37:42 -07:00
bors
ad5fbaf57c Auto merge of #33979 - retep998:why-the-long-face, r=alexcrichton
Attempt to diagnose #33844

https://github.com/rust-lang/rust/issues/33844 is a spurious failure that causes builds to fail due to the linker command sometimes failing with error 206, which means that the command is too long. This PR makes rustc print out the linker arguments in that case so the reason for it being so long can be diagnosed and hopefully fixed.

r? @alexcrichton
2016-05-31 18:49:48 -07:00
Niko Matsakis
480d18ca31 kill some unused imports 2016-05-31 21:05:43 -04:00
Scott A Carr
9d34c280d9 generate fewer basic blocks for variant switches 2016-05-31 17:08:00 -07:00
Niko Matsakis
4038b5b3ee add def-ids from nominal types into TraitSelect
This way we distinguish, in particular, `Foo: Sized`
and `Bar: Sized`, which fixes #33850.
2016-05-31 19:59:57 -04:00
Niko Matsakis
63bb0847bd expand DepNode::TraitSelect to include type ids
To handle the general case, we include a vector of def-ids, so that we
can account for things like `(Foo, Bar)` which references both `Foo` and
`Bar`. This means it is not Copy, so re-jigger some APIs to use
borrowing more intelligently.
2016-05-31 19:59:57 -04:00
Niko Matsakis
5dc6a058b2 extend type alias test to include a clean rev 2016-05-31 19:59:57 -04:00
Niko Matsakis
be1819f14b add a series of tests for changes to structs
These tests reveal that the edges are in some cases
too strict.
2016-05-31 19:59:57 -04:00
Niko Matsakis
d3d2fc51f7 some new tests 2016-05-31 19:59:34 -04:00
Niko Matsakis
72b97070ff do not use fresh regions in return type
This test was abusing #32330; cleanup the code some.
2016-05-31 19:59:34 -04:00
Niko Matsakis
136a83ad4d fallout in tests
in some cases we give more specific messages or fewer
duplicates, now that we have cache and make fewer region variables
2016-05-31 19:59:33 -04:00
Niko Matsakis
ad97f296d3 add FIXME to fulfill 2016-05-31 19:59:33 -04:00
Niko Matsakis
38995c9029 consult cache in projection 2016-05-31 19:59:33 -04:00
Niko Matsakis
6751d68f25 cleanup imports for cache 2016-05-31 19:59:03 -04:00
Niko Matsakis
5368432538 thread vtable-closure obligations to result
the vtable.nested obligations were being dropped on the floor.
2016-05-31 19:58:44 -04:00
Niko Matsakis
24d4f10ab2 change to use higher_ranked_match
also, consolidate the return type into from a tuple into a struct
`Progress`
2016-05-31 19:58:44 -04:00
Niko Matsakis
21eb36608e create but do not use a projection cache 2016-05-31 19:44:43 -04:00
Niko Matsakis
d042ce2ed3 add a snapshottable hashmap 2016-05-31 19:44:05 -04:00
Niko Matsakis
5cff88f2a0 add a higher-ranked match routine
Currently, when projecting out of a higher-ranked where-clause, we
instantiate all higher-ranked regions with lifetime variables. This is
unnecessary since the language rules ought to guarantee (modulo #32330)
that each of those higher-ranked regions is equated with some regions
from the input types. This routine figures out what those regions are
and just uses them. Also, since #32330 is not fully fixed, it detects
when we may have unconstrained variables and indicates that in its
return value.
2016-05-31 19:44:05 -04:00
Niko Matsakis
b40529c5a9 projection predicates can be copy 2016-05-31 19:44:05 -04:00
Niko Matsakis
9ef768c811 add trailing comma 2016-05-31 19:44:04 -04:00
Niko Matsakis
de6c52d5ea make region-param-def encoding more DRY
we used to have two separate routines, one in tyencode/tydecode, and one
in encode/decode.
2016-05-31 19:44:04 -04:00
Niko Matsakis
8770d0f34a remove VerifyRegSubReg and cleanup region infer
We used to make region->region edges part of the verify set, but this
change stores them like other edges, as a full-fledged constraint.
Besides making the code somewhat cleaner, this allows them to be more
easily dropped as part of `pop_skolemized`. This change also refactors
the code a bit to remove some intermediate data structures that are no
longer particular useful (e.g., VarValue).
2016-05-31 19:43:38 -04:00
Niko Matsakis
cacbb2147f add trailing comma 2016-05-31 19:43:38 -04:00
Niko Matsakis
7cf63a2a72 more debug dumping in trans 2016-05-31 19:43:38 -04:00