Commit Graph

54006 Commits

Author SHA1 Message Date
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
Niko Matsakis
d3afbd6c4d more debug dumping in traits 2016-05-31 19:43:38 -04:00
Niko Matsakis
eaf13b2f01 better debug dumping with inference variables 2016-05-31 19:42:59 -04:00
Niko Matsakis
75543c08c7 simplify HR subtyping back to what we did before
A lot of the refactors, however, seem helpful, so leave those in,
particularly since we may want to make this change in the future.
2016-05-31 19:42:22 -04:00
Niko Matsakis
52b2db1cca warn if leak-check relies on LBRs that will change
When we do a "HR subtype" check, we replace all late-bound regions (LBR)
in the subtype with fresh variables, and skolemize the late-bound
regions in the supertype. If those skolemized regions from the supertype
wind up being super-regions (directly or indirectly) of either

- another skolemized region; or,
- some region that pre-exists the HR subtype check
  - e.g., a region variable that is not one of those created
    to represent bound regions in the subtype

then the subtype check fails.

What will change when we fix #32330 is that some of the LBR in the
subtype may become early-bound. In that case, they would no longer be in
the "permitted set" of variables that can be related to a skolemized
type.

So the foundation for this warning is to collect variables that we found
to be related to a skolemized type. For each of them, we have a
`BoundRegion` which carries a `Issue32330` flag. We check whether any of
those flags indicate that this variable was created from a lifetime
that will change from late- to early-bound. If so, we issue a warning
indicating that the results of compilation may change.

This is imperfect, since there are other kinds of code that will not
compile once #32330 is fixed. However, it fixes the errors observed in
practice on crater runs.
2016-05-31 19:41:25 -04:00
Niko Matsakis
08034eb1a5 add Issue32330 warning marker to bound regions
This indicates whether this `BoundRegion` will change from late to early
bound when issue 32330 is fixed. It also indicates the function on
which the lifetime is declared.
2016-05-31 19:41:25 -04:00
Niko Matsakis
11984340bf make HR algorithms account for region subtyping
Currently, we consider region subtyping a failure
if a skolemized lifetime is relatable to any
other lifetime in any way at all. But a more precise
formulation is to say that a skolemized lifetime:

- must not have any *incoming* edges in the region graph
- only has *outgoing* edges to nodes that are `'static`

To enforce the latter requirement, we add edges from `'static -> 'x` for
each lifetime '`x' reachable from a skolemized region.

We now have to add a new `pop_skolemized` routine to do cleanup.
Whereas before if there were *any* edges relating to a skolemized
region, we would return `Err` and hence rollback the transaction, we now
tolerate some edges and return `Ok`. Therefore, the `pop_skolemized`
routine runs and cleans up those edges.
2016-05-31 19:41:25 -04:00
Niko Matsakis
aecce2ba6e add flag for ReSkolemized 2016-05-31 19:12:35 -04:00
bors
601eb13dc4 Auto merge of #33857 - alexcrichton:new-stage0, r=nikomatsakis
mk: Prepare for a new stage0 compiler

This commit prepares the source for a new stage0 compiler, the 1.10.0 beta
compiler. These artifacts are hot off the bots and should be ready to go.
2016-05-31 16:12:16 -07:00
Alex Crichton
fa45670ce4 mk: Prepare for a new stage0 compiler
This commit prepares the source for a new stage0 compiler, the 1.10.0 beta
compiler. These artifacts are hot off the bots and should be ready to go.
2016-05-31 16:11:49 -07:00
Jack O'Connor
8be9625e2e document that Files close themselves automatically 2016-05-31 17:12:08 -04:00
Peter Atashian
d34ad3c3b2
Print linker arguments if calling the linker fails
Needed to diagnose https://github.com/rust-lang/rust/issues/33844

Signed-off-by: Peter Atashian <retep998@gmail.com>
2016-05-31 16:29:12 -04:00
Alex Crichton
ac19420535 rustbuild: Clean more on make clean
Be sure to not use the old build cache for the bootstrap build system nor the
old caches of the compiler/cargo extractions (in case something went wrong).

Closes #33986
2016-05-31 13:24:28 -07:00
Ivan Shapovalov
7b589f5afb hoedown: fix trigger of -Werror=misleading-indentation 2016-05-31 21:38:29 +03:00
Ariel Ben-Yehuda
e3cff797a7 normalize types in MIR typeck after erasing regions 2016-05-31 18:42:47 +03:00
Ms2ger
7463c95183 Take the def_map argument to TyCtxt::create_and_enter out of its RefCell. 2016-05-31 09:21:49 +02:00
bors
298730e703 Auto merge of #33960 - tbu-:pr_ref_clone_overflow, r=Aatch
Prevent the borrow counter from overflowing in `Ref::clone`

Fixes #33880.
2016-05-30 23:09:00 -07:00
Alex Crichton
b64c9d5670 std: Clean out old unstable + deprecated APIs
These should all have been deprecated for at least one cycle, so this commit
cleans them all out.
2016-05-30 20:46:32 -07:00
Zack M. Davis
06ebda837e revise explanation for E0429 (focus on error first) 2016-05-30 16:45:41 -07:00
bors
a967611d8f Auto merge of #33968 - srinivasreddy:slice.rs, r=Manishearth
Correct grammar; and remove redundant comment
2016-05-30 16:34:34 -07:00
Zack M. Davis
06c9e0f5f8 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.

This is in the matter of issue #33394.
2016-05-30 15:17:13 -07:00