Commit Graph

16026 Commits

Author SHA1 Message Date
Jed Davis
c0f6909f7e base::iter_structural_ty: structs and records 2013-03-06 20:41:57 -08:00
Jed Davis
68b3f0d8a4 base::iter_structural_ty: tuples 2013-03-06 20:41:57 -08:00
Jed Davis
ca450e345f Move trans_enum_variant to trans::adt.
As a result, trans_enum_variant no longer cares what kind of enum it's
dealing with, so the "degen" parameter goes away in a bunch of places.
2013-03-06 20:41:57 -08:00
Jed Davis
6bb6baba2c Renovate cast-to-int 2013-03-06 20:41:57 -08:00
Jed Davis
075affa50d Convert const field extraction to trans::adt 2013-03-06 20:41:57 -08:00
Jed Davis
59daf76a8d Make functional-update struct consts not an ICE 2013-03-06 20:41:57 -08:00
Jed Davis
f0c6a8ebe9 Test for struct-like variants in consts 2013-03-06 20:41:57 -08:00
Jed Davis
bb689c09f5 Convert const ADT construction to trans::adt.
Also converts const cast-from-enum, because it used the same routine to
get the discriminant as what's renovated to construct the enums.

Also fixes ICE on struct-like variants as consts, and provides a slightly
less bad ICE for functional-update-like struct expressions in consts.
2013-03-06 20:41:57 -08:00
Jed Davis
2a028c5ab8 Convert newtype "dereference" to trans::adt.
Note that in the ByValue case (which can't happen? yet?) we're still
effectively bitcasting, I think.  So this change adds a way to assert
that that's safe.

Note also, for future reference, that LLVM's instcombine pass will turn
a bitcast into a GEP(0, 0, ...) if possible.
2013-03-06 20:41:57 -08:00
Jed Davis
80844f993d Add regression tests for a subtle aspect of expr_struct translation.
The first is reduced from a case in rustdoc (originally involving an
ARC); the other is related.  No committed version has gotten these
wrong, but when I broke them it showed up only in rustdoc; there was
nothing in the test suite (or the compiler!) that failed.

The general issue is that the statics and trans have to agree on order
of evaluation, or else you get use-after-move-out-of errors at runtime.
2013-03-06 20:41:57 -08:00
Jed Davis
c7325c4172 Convert the rest of the adt GEPi's in _match 2013-03-06 20:41:57 -08:00
Jed Davis
3a4714d92e Renovate field projection expressions 2013-03-06 20:41:57 -08:00
Jed Davis
40313fb6b0 Renovate nullary variant construction 2013-03-06 20:41:57 -08:00
Jed Davis
fdd28451f6 Convert expr_struct to use adt, and try to share code with tuples. 2013-03-06 20:41:57 -08:00
Jed Davis
5cbc2571c1 Renovate expr_tup translation 2013-03-06 20:41:57 -08:00
Jed Davis
b673b26f03 Factor out discriminant loading more, for use in casts. 2013-03-06 20:41:57 -08:00
Jed Davis
a5030e7615 Wrap const structs in as many LLVM structs as the non-const case.
This, like the previous change for unit-like enums, is only necessary
until everything is fully converted to use trans::adt.
2013-03-06 20:40:42 -08:00
Jed Davis
e09a843973 Handle unit-like types specially.
This change remains separate from the addition of adt.rs, even though
it's necessary for compatibility with pre-trans::adt representation,
to serve as an example of a change to the representation logic.
2013-03-06 20:37:59 -08:00
Jed Davis
7b2b4faba8 Add a test for enum discriminant range overflow.
It causes an LLVM assertion for every host/target word-size combination
on incoming at the time of this writing.
2013-03-06 20:37:28 -08:00
Jed Davis
04ecab909a Re-add discriminant range annotations 2013-03-06 20:37:28 -08:00
Jed Davis
8a1706610b Avoid unnecessary casts in struct_GEP 2013-03-06 20:37:28 -08:00
Jed Davis
5e2302a56f Convert type_of to use trans::adt. 2013-03-06 20:37:28 -08:00
Jed Davis
c4682dcabe Convert match on enums to use trans::adt. 2013-03-06 20:37:28 -08:00
Jed Davis
626ad484fe Unified algebraic datatype representation implementation, initial version.
Later changes on this branch adapt the rest of rustc::middle::trans
to use this module instead of scattered hard-coded knowledge of
representations; a few of them also have improvements or cleanup for
adt.rs (and many added comments) that weren't drastic enough to justify
changing history to move them into this commit.
2013-03-06 20:37:23 -08:00
bors
c3c018f8ab auto merge of #5256 : thestinger/rust/bool, r=brson 2013-03-06 19:12:40 -08:00
bors
b269ce2782 auto merge of #5255 : jbclements/rust/remove-parse-value-ident, r=graydon
After the removal of the "restricted keyword" feature in 0c82c00dc4 , there's no longer any difference between parse_ident() and parse_value_ident(), and therefore no difference between parse parse_path_without_tps() and parse_value_path().  I've collapsed all of these, removing the redundant functions and eliminating the need for two higher-order arguments.
2013-03-06 17:48:39 -08:00
Brian Anderson
c707a2d73c Update uv submodule 2013-03-06 17:44:22 -08:00
bors
95c07479dd auto merge of #5182 : youknowone/rust/enum-cast, r=brson
Fix #4926
2013-03-06 16:51:47 -08:00
bors
8c3728f839 auto merge of #5125 : nikomatsakis/rust/issue-4846-lifetime-defaults, r=nikomatsakis
Work towards #4846.

- Institute new region defaults where all omitted regions get a fresh lifetime.
- Require explicit region names except in functions.
- Fix a bug in region parameterization inference.  I've been putting this off because it will not be important when we remove RP inference in favor of explicit declarations, but then it was blocking this patch.

r? @pcwalton
2013-03-06 13:45:51 -08:00
Niko Matsakis
078fd23a07 fix test to not use fn expr 2013-03-06 16:19:21 -05:00
Niko Matsakis
9792002c6a Cheat and temporarily work around a pretty-printer bug
that will go away with the new region syntax.
2013-03-06 16:18:46 -05:00
Niko Matsakis
7e4ed28fa5 patch up pretty printing of things with both lifetime and type parameters 2013-03-06 15:12:58 -05:00
Niko Matsakis
3280e5a33d Improve error messages when illegal lifetimes are used 2013-03-06 15:12:58 -05:00
Niko Matsakis
d26f6eddfd Convert region parameterization to change defaults and handle
methods correctly
2013-03-06 15:12:58 -05:00
Niko Matsakis
824b9e7dbf convert FnCtxt methods from @mut self to &self 2013-03-06 15:12:57 -05:00
Niko Matsakis
4077d7b8b7 Permit either foo/&self or foo<'self> 2013-03-06 15:12:57 -05:00
Niko Matsakis
3168fe06ff Add manual &self/ and &static/ and /&self declarations that
are currently inferred.  New rules are coming that will require
them to be explicit.  All add some explicit self declarations.
2013-03-06 15:12:57 -05:00
bors
02623871ed auto merge of #5246 : brson/rust/demode, r=brson
r?
2013-03-06 11:51:57 -08:00
Brian Anderson
f1a8b58811 rustc: De-mode some bits of trans 2013-03-06 11:18:34 -08:00
bors
876b6ba792 auto merge of #5253 : nikomatsakis/rust/issue-5243, r=graydon
them to be non-monomorphic.  Merely having lifetime parameters
is not enough to qualify for that status.  Fixes #5243.

r?
2013-03-06 10:54:58 -08:00
Daniel Micay
7782aa82d2 bool: make the from_str function a FromStr impl 2013-03-06 13:05:59 -05:00
Niko Matsakis
704cd648ac Fix a bug with region-parameterized enums etc where trans considered
them to be non-monomorphic.  Merely having lifetime parameters
is not enough to qualify for that status.  Fixes #5243.
2013-03-06 13:01:16 -05:00
John Clements
8bb537e68d finish removing parse_value_ident 2013-03-06 09:41:52 -08:00
John Clements
88451878f8 removed unused abstraction over paths and value_paths 2013-03-06 09:41:47 -08:00
bors
4b79a58d9d auto merge of #5252 : nikomatsakis/rust/issue-5087-make-trait-not-impl-self, r=pcwalton
Two changes:

- The first fixes an inconsistency in coherence whereby extension methods were added to the inherent methods table, but only in cross-crate scenarios.  This causes some minor fallout in tests and so forth.  In one case (comm) I added inherent and trait methods so as to avoid the need to import traits like `GenericPort` just to use a port.

- The second makes objects not implement the associated trait, as discussed in #5087.

r? @pcwalton
2013-03-06 09:27:59 -08:00
bors
67100ddb35 auto merge of #5251 : bstrie/rust/deimpselfcore2, r=pcwalton 2013-03-06 08:39:54 -08:00
Niko Matsakis
5653fe666d Remove trailing whitespace. 2013-03-06 11:02:20 -05:00
Niko Matsakis
6d764cc361 Make object types not implement associated trait. Fixes #5087. 2013-03-06 11:02:19 -05:00
Niko Matsakis
6267339d68 Fix bug in coherence that causes all cross-crate impls to be regarded as
inherent impls, not just those of the `impl Type` variety.
2013-03-06 11:02:19 -05:00
Ben Striegel
12f06bb496 Finish de-implicit-selifizng libcore 2013-03-06 04:00:25 -05:00