Commit Graph

181 Commits

Author SHA1 Message Date
Erick Tryzelaar
8cdc3fda11 convert ast::ty into a struct 2013-01-20 14:08:18 -08:00
Erick Tryzelaar
4bcd19f6be Convert ast::{pat,field_pat,local_,arm} into structs 2013-01-14 20:52:28 -08:00
Erick Tryzelaar
3ea3136e84 convert ast::blk_ into a struct 2013-01-14 19:35:08 -08:00
Erick Tryzelaar
df7d376d25 Convert ast::def_id into a struct. 2013-01-14 18:14:16 -08:00
Erick Tryzelaar
bea67bde21 Change ast::path into a struct. 2013-01-14 18:14:16 -08:00
Tim Chevalier
cfa62cd5ee Make ast_util::path_name_i take a slice vector, eliminate a bad copy 2013-01-11 15:19:05 -08:00
Niko Matsakis
2b92962aa2 A collection of refactorings that I found it hard/tiresome to divide:
- Make `extern fn()` assignable to any closure type, rather than
  a subtype.
- Remove unused int_ty_set and float_ty_set
- Refactor variable unification and make it more DRY
- Do fn sub/lub/glb on the level of fn_sig
- Rename infer::to_str::ToStr to infer::to_str::InferStr
- Capitalize names of various types
- Correct hashing of FnMeta
- Convert various records-of-fns into structs-of-fns.  This is both
  eliminating use of deprecated features and more forwards compatible
  with fn reform.

r=pcwalton
2013-01-09 14:59:07 -08:00
Erick Tryzelaar
2891a49f0d core: rename vec.filter to vec.filtered 2013-01-09 08:55:37 -08:00
Erick Tryzelaar
93c2ebf994 syntax: convert ast::spanned into a struct 2013-01-09 08:55:36 -08:00
Patrick Walton
2db3abddcd librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc 2013-01-08 22:02:35 -08:00
Patrick Walton
44ab00ee37 Revert "librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc"
This reverts commit a8d37af247.
2013-01-08 19:29:16 -08:00
Patrick Walton
a8d37af247 librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc 2013-01-08 19:27:57 -08:00
Patrick Walton
57c599914a librustc: Terminate name searches at the nearest module scope for paths that contain at least two components. r=graydon 2012-12-27 10:02:54 -08:00
Erick Tryzelaar
8650c6f683 Switch from serialization to std::serialize. (snapshot) 2012-12-17 20:00:36 -08:00
Jakub Wieczorek
1968cb315a Add support for destructuring vectors in match expressions 2012-12-17 16:50:40 -08:00
Patrick Walton
cd120736cb librustc: Allow moves out of self. r=nmatsakis 2012-12-13 15:49:07 -08:00
Tim Chevalier
0046ed9462 Remove un-needed code for obsolete classes
and rename "class" to "struct" everywhere possible (except local
vars, I was too lazy for that) -- that is why this commit is so
big.

No review, just dead code removal and renaming.

Closes #3515
2012-12-10 18:45:01 -08:00
Patrick Walton
56ece46f7d librustc: Remove all legacy pattern bindings from libsyntax and librustc. rs=refactoring 2012-12-04 14:19:19 -08:00
Graydon Hoare
00c856c0b1 Update license, add license boilerplate to most files. Remainder will follow. 2012-12-03 17:12:14 -08:00
Tim Chevalier
daf28a421a Disallow dereferencing enum types when the variant is private
If an enum type's only variant is private, disallow dereferencing
values of its type.

Due to #4082, this only applies to enums that are in the same crate.

r=pcwalton

Closes #818
2012-11-30 12:45:10 -08:00
Graydon Hoare
d783f4d7bb libs: Remove transitionary material on iter_bytes, add workcache to build. 2012-11-30 10:33:16 -08:00
Patrick Walton
a0617eae68 librustc: Eliminate most expressions of the form a.b() that are not method calls. rs=refactoring 2012-11-29 17:51:56 -08:00
Paul Stansifer
0f707f42c8 Distinguish stmt_macs that are followed by semicolons and those that aren't. 2012-11-29 12:09:10 -08:00
Paul Stansifer
ee076f63f9 Allow for macros to occur in statement position. 2012-11-29 12:09:10 -08:00
Patrick Walton
669fbddc44 librustc: Add explicit self to IterBytes. r=nmatsakis 2012-11-28 11:36:04 -08:00
Brian Anderson
81d20156cd Change spans to use byte offsets instead of char offsets 2012-11-16 12:06:44 -08:00
Brian Anderson
f67bfe9738 Add types for character position and byte position in the codemap 2012-11-14 15:18:29 -08:00
Brian Anderson
4c68084963 Convert most codemap types from records to structs 2012-11-12 16:21:39 -08:00
Patrick Walton
0fc952372a rustc: Support irrefutable patterns in function arguments. r=nmatsakis 2012-11-07 19:29:30 -08:00
Patrick Walton
599b4208fb rustc: Translate tuple struct constructors 2012-10-25 11:49:26 -07:00
Patrick Walton
91ae5412d8 rustc: Merge module and type namespaces. r=brson 2012-10-15 15:35:36 -07:00
Niko Matsakis
98887cc7ee remove ctor from ast (take 2) (no review: just dead code removal) 2012-10-12 19:46:37 -07:00
Niko Matsakis
cb55e246ba Use the Nth impl when translating a static method call, instead
of the 0th.  0th is only correct when there are no bound tps
on the trait.

Fixes #3741.
2012-10-12 17:46:43 -07:00
Tim Chevalier
6854265161 Remove comment that is now false 2012-10-11 16:00:30 -07:00
Tim Chevalier
22efa39382 Revert "Revert "Remove old auto_serialize2 code (needs snapshot)""
This reverts commit a33535e441.
2012-10-08 17:43:45 -07:00
Tim Chevalier
a33535e441 Revert "Remove old auto_serialize2 code (needs snapshot)"
This reverts commit 0bd6da8a8c.
2012-10-08 11:58:54 -07:00
Erick Tryzelaar
0bd6da8a8c Remove old auto_serialize2 code (needs snapshot) 2012-10-07 17:20:19 -07:00
Erick Tryzelaar
eb626e7119 Remove the old serializers (needs snapshot) 2012-10-07 17:20:19 -07:00
Erick Tryzelaar
e1c517ca48 migrate libsyntax/rustc to auto_serialize2 2012-10-07 10:32:25 -07:00
Patrick Walton
9284179311 libstd: Switch off legacy modes in both core and std. 2012-10-02 12:20:06 -07:00
Niko Matsakis
21519bc7e0 demode vec 2012-09-28 13:27:45 -07:00
Tim Chevalier
996ec62cbf Remove spurious by-ref argument to destructors
Destructors were internally declared with an extra (hidden) nil-typed
argument that was passed in by-ref mode. This was causing spurious
mode warnings. Deleted it. Also some misc. cleanup because I
couldn't help myself.
2012-09-26 19:42:02 -07:00
Niko Matsakis
67a8e7128a Demode vec::push (and convert to method) 2012-09-26 18:02:07 -07:00
Erick Tryzelaar
b96af73159 turn ast::ident into a struct
This will help with the auto_serialize2 migration. We have to change
ident from a type alias to uint into a unique type. We need to use
a struct instead of a "enum ident = token::str_num" because structs
support constants, but newtypes do not.
2012-09-26 16:20:24 -07:00
Tim Chevalier
101bc62ad9 Revert "fix modes on dtors"
This reverts commit d38b97a170.

(Accidentally checked this in, oops)
2012-09-26 10:43:11 -07:00
Tim Chevalier
d38b97a170 fix modes on dtors 2012-09-26 10:42:11 -07:00
Niko Matsakis
3d59ac3a19 De-mode vec::map, vec::eachi, vec::rev_each, vec::rev_eachi 2012-09-21 19:13:55 -07:00
Niko Matsakis
cfed923600 demode the each() method on vec and other iterables. 2012-09-19 17:03:01 -07:00
Graydon Hoare
1ffd90edbc Remove redundant hashmap constructor functions. 2012-09-19 15:51:44 -07:00
Niko Matsakis
9cf271fe96 De-mode vec::each() and many of the str iteration routines
Note that the method foo.each() is not de-moded, nor the other
vec routines.
2012-09-19 10:52:59 -07:00
Niko Matsakis
8d4928f780 Revert "replace explicit calls to vec::each with vec::each_ref, partially demode str"
This reverts commit 1be24f0758.

Not quite ready.
2012-09-18 21:41:13 -07:00
Niko Matsakis
1be24f0758 replace explicit calls to vec::each with vec::each_ref, partially demode str 2012-09-18 21:31:00 -07:00
Niko Matsakis
5d540de769 fixup mutability of vec::each, make iter_bytes pure
also, change DVec() to work with imm vectors rather than mut ones
2012-09-12 13:29:31 -07:00
Tim Chevalier
f8b3eaae82 Make all moves explicit in libsyntax 2012-09-10 18:28:47 -07:00
Brian Anderson
cb7a5395dd Convert std::map to camel case 2012-09-10 17:08:36 -07:00
Brian Anderson
3bd1f32cd9 Convert all kind bounds to camel case. Remove send, owned keywords. 2012-09-07 18:10:11 -07:00
Graydon Hoare
5d823d46ad Migrate std::map to use core:#️⃣:Hash trait. Disable many hokey hashes. 2012-09-07 17:24:16 -07:00
Tim Chevalier
53ce42dc4f Implement &-patterns
Closes #2855
2012-09-07 17:09:07 -07:00
Patrick Walton
c21b3ff818 rustc: Make "ne" use traits 2012-09-07 12:44:53 -07:00
Patrick Walton
8ff18acc82 libsyntax: "import" -> "use" 2012-09-04 11:43:23 -07:00
Tim Chevalier
4128cc4cb4 Make utility funs in core::int, core::uint, etc. not by-reference
Closes #3302
2012-08-31 16:21:47 -07:00
Patrick Walton
6e7d5e1cbd rustc: Implement "use mod" 2012-08-31 11:20:50 -07:00
Patrick Walton
a1c11cab2d rustc: Make <=, >=, and > use traits as well 2012-08-29 19:23:15 -07:00
Patrick Walton
96534365c2 rustc: Make < and = into traits 2012-08-29 18:25:22 -07:00
Brian Anderson
c0c8d3aa8f core: Demode int/uint mods 2012-08-29 16:23:36 -07:00
Brian Anderson
8337fa1a54 Camel case the option type 2012-08-26 15:56:16 -07:00
Niko Matsakis
a8f1bee457 fix some unused pattern binding warnings 2012-08-24 15:37:21 -07:00
Michael Sullivan
0f996f70a6 Remove purity from fn_decl and move it out to containing AST elements. 2012-08-23 19:40:01 -07:00
Paul Stansifer
1153b5dcc8 intern identifiers 2012-08-22 14:59:25 -07:00
Niko Matsakis
652b312122 more sound treatment of fn& regions; change all & to be distinct 2012-08-21 10:28:34 -07:00
Patrick Walton
3038968f28 rustc: Perform some AST surgery to separate out class fields from methods 2012-08-15 16:20:35 -07:00
Patrick Walton
bdb206f285 rustc: Parse labeled loop, break, and again 2012-08-15 16:20:34 -07:00
Brian Anderson
6a0720b439 Convert impls to new syntax 2012-08-08 18:19:24 -07:00
Patrick Walton
4f98e80db1 rustc: Do some plumbing work in preparation for common fields in enums 2012-08-08 17:15:37 -07:00
Patrick Walton
438765da59 rustc: Box struct_defs 2012-08-07 17:46:51 -07:00
Michael Sullivan
7f7f47620e Implement static typeclass methods. Closes #3132. 2012-08-07 17:18:14 -07:00
Patrick Walton
a3f9e18b7a libsyntax: Allow users of the visitor to visit struct defs 2012-08-07 15:55:33 -07:00
Brian Anderson
42540841f3 Add missing comma 2012-08-07 14:34:00 -07:00
Patrick Walton
727c7c7499 rustc: Add stub support for struct variants to the AST 2012-08-07 14:25:53 -07:00
Brian Anderson
2772b2e5c7 syntax: Make match arm parsing more restrictive again
Require comma separators for all expression types except the plain block
2012-08-07 12:23:43 -07:00
Patrick Walton
253dfc3387 rustc: Implement pattern matching for structs 2012-08-06 17:36:24 -07:00
Brian Anderson
ecaf9e39c9 Convert alt to match. Stop parsing alt 2012-08-06 15:36:30 -07:00
Brian Anderson
025d86624d Switch alts to use arrows 2012-08-05 22:08:09 -07:00
Niko Matsakis
31c5cec55b Purge placement new; Make borrowck know about unary move.
cc #3071
2012-08-02 22:36:36 -07:00
Lindsey Kuper
65e0e30e59 Make typeck::collect aware of provided methods in traits. 2012-08-02 17:15:36 -07:00
Michael Sullivan
2fe299d1a5 Extend ast_map to know about method declarations in traits. 2012-08-02 16:02:30 -07:00
Niko Matsakis
97452c0ca1 Remove modes from map API and replace with regions.
API is (for now) mostly by value, there are options to use it by
reference if you like.  Hash and equality functions must be pure
and by reference (forward looking to the day when something
like send_map becomes the standard map).
2012-08-02 15:53:28 -07:00
Brian Anderson
b355936b4d Convert ret to return 2012-08-01 19:16:06 -07:00
Brian Anderson
507fba57d1 syntax: Allow any block-like expr to be used as alt arm w/o comma separator 2012-08-01 17:57:03 -07:00
Patrick Walton
b414db041b rustc: Parse by-reference pattern bindings with the "ref" keyword 2012-07-31 19:26:25 -07:00
Niko Matsakis
c206d024eb accept naked exprs with commas in pattern arms
pretty printing will use them, but indentation is slightly off
if the expr is long
2012-07-31 15:41:26 -07:00
Paul Stansifer
fd52df1901 Fix pretty-printer breakage: 1000f -> 1000. 2012-07-31 11:03:22 -07:00
Graydon Hoare
290f079474 Frontend bits for #2317, general const-expr classification. 2012-07-30 19:06:06 -07:00
Patrick Walton
93c2f5e0e4 rustc: Use coherence for operator overloading.
The only use of the old-style impls is now placement new.
2012-07-27 19:35:24 -07:00
Tim Chevalier
a0d05844ed Correctly forbid upvars in nested impls, traits and classes
Previously, resolve was allowing impls, traits or classes that were
nested within a fn to refer to upvars, as well as referring to type
parameters bound by the fn. Fixing this required adding a new kind of
def: def_typaram_binder, which can refer to any of an impl, trait or
class that has bound ty params. resolve uses this to enforce that
methods can refer to their parent item's type parameters, but not to
outer items' type parameters; other stages ignore it. I also made
sure that impl, trait and class methods get checked inside a
MethodRibKind thing so as to forbid upvars, and changed the definition
of MethodRibKind so that its second argument is an optional node_id
(so that required trait method signatures can be checked with a
MethodRibKind as well).
2012-07-27 17:31:42 -07:00
Patrick Walton
afd9a75c9e rustc: Fix cross-crate max/min-class-style constructors 2012-07-26 15:30:15 -07:00
Patrick Walton
978ca03cb2 Revert "accept naked exprs with commas in pattern arms" due to pretty-printing failures
This reverts commit f712b2d76b.

In alt arms, the parser needs to do a little lookahead to determine
whether it's looking at a record literal or a block.

Also there are some indentation issues in the expected source.
2012-07-19 07:53:55 -07:00
Niko Matsakis
f712b2d76b accept naked exprs with commas in pattern arms
pretty printing will use them, but indentation is slightly off
if the expr is long
2012-07-18 20:16:41 -07:00
Patrick Walton
db020ab63c rustc: Implement and enforce instance coherence 2012-07-17 15:46:43 -07:00
Tim Chevalier
b5729bd600 Support attributes on class ctors and dtors
Closes #2660
2012-07-17 12:40:59 -07:00