Commit Graph

111 Commits

Author SHA1 Message Date
Alex Crichton 2df07ddc25 Fix implicit leaks of imports throughout libraries
Also touch up use of 'pub' and move some tests around so the tested functions
don't have to be 'pub'
2013-02-28 18:00:34 -05:00
Niko Matsakis c623d21e38 Introduce lifetime declarations into the lists of type parameters.
Major changes are:
- replace ~[ty_param] with Generics structure, which includes
  both OptVec<TyParam> and OptVec<Lifetime>;
- the use of syntax::opt_vec to avoid allocation for empty lists;

cc #4846
2013-02-27 19:42:09 -05:00
Erick Tryzelaar bc62bd3782 libsyntax: make enum variants take refs 2013-02-19 10:02:51 -08:00
Niko Matsakis a32498d846 Make ~fn non-copyable, make &fn copyable, split barefn/closure types,
correct handling of moves for struct-record update.

Part of #3678.  Fixes #2828, #3904, #4719.
2013-02-07 05:53:30 -08:00
Nick Desaulniers 7868b6bf55 Remove fail keyword from lexer & parser and clean up remaining calls to
fail

Fix merge conflicts - Issue 4524
2013-02-01 00:15:42 -08:00
Niko Matsakis 71478f9ce3 Workaround for #4717: pad contents of ast. rs=breakage 2013-01-31 16:56:12 -08:00
Niko Matsakis 0682ad0eb9 Finalize moves-based-on-type implementation.
Changes:

- Refactor move mode computation
- Removes move mode arguments, unary move, capture clauses
  (though they still parse for backwards compatibility)
- Simplify how moves are handled in trans
- Fix a number of illegal copies that cropped up
- Workaround for bug involving def-ids in params
  (see details below)

Future work (I'll open bugs for these...):

- Improve error messages for moves that are due
  to bindings
- Add support for moving owned content like a.b.c
  to borrow check, test in trans (but I think it'll
  "just work")
- Proper fix for def-ids in params

Def ids in params:

Move captures into a map instead of recomputing.

This is a workaround for a larger bug having to do with the def-ids associated
with ty_params, which are not always properly preserved when inlining.  I am
not sure of my preferred fix for the larger bug yet.  This current fix removes
the only code in trans that I know of which relies on ty_param def-ids, but
feels fragile.
2013-01-31 12:09:00 -08:00
Patrick Walton b070590564 libsyntax: De-export libsyntax. rs=deexporting 2013-01-29 14:42:23 -08:00
Graydon Hoare 84825ee310 librustc: Make the default sigil for block lambdas & instead of @. 2013-01-15 17:57:45 -08:00
Patrick Walton 2a1b6c4de9 librustc: Implement &static as the replacement for Durable. r=nmatsakis 2013-01-10 11:16:54 -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
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
Jakub Wieczorek 1968cb315a Add support for destructuring vectors in match expressions 2012-12-17 16:50:40 -08:00
Graydon Hoare e24ae85025 syntax: remove most code handling old-style syntax extensions. 2012-12-12 15:02:47 -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
Patrick Walton f34833abfc librustc: Make a.b() always a method call. r=nmatsakis 2012-11-30 20:41:46 -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
Brian Anderson be6613e048 Remove the crate language 2012-11-26 18:13:54 -08:00
Brian Anderson ddbff6fd2a syntax: Remove cdir_syntax. Unused 2012-11-18 18:09:41 -08:00
Patrick Walton 32ad4ae4cd librustc: Require the #[derivable] attribute, remove the significance of "impl Foo : Bar;", and allow only a subset of methods in a trait to be derived. r=brson 2012-11-14 11:36:55 -08:00
Patrick Walton 0fc952372a rustc: Support irrefutable patterns in function arguments. r=nmatsakis 2012-11-07 19:29:30 -08:00
Niko Matsakis b0ed151539 Cleanup how we handle proto in types, remove unsound subtyping
Fixes #1896 which was never truly fixed, just masked.
The given tests would have failed had they used `~fn()` and
not `@fn()`.  They now result in compilation errors.

Fixes #2978.

Necessary first step for #2202, #2263.
2012-11-06 08:56:29 -08:00
Patrick Walton be93b29d30 rustc: Implement parsing and typechecking for "once fn" 2012-11-05 13:17:02 -08:00
Tim Chevalier 62f98c8ff8 Preserve parenthesization in the AST
Maintain explicit "paren" nodes in the AST so we can pretty-print
without having to guess where parens should go. We may revisit this
in the future.

r=graydon
2012-10-30 15:05:32 -07:00
Tim Chevalier 087cbb55d0 Remove <- operator from the compiler
Yield an obsolete syntax error on things like "let foo <- bar;"
and "foo <- bar;" r=brson

Progress on #3466
2012-10-23 12:10:19 -07:00
Patrick Walton 3bf0a9b094 rustc: Implement typechecking for simple monomorphic derivable traits on monomorphic types. r=brson 2012-10-23 10:45:23 -07:00
Tim Chevalier 46d4bbbae4 Simplify the AST representation of ty param bounds
Change ast::ty_param_bound so that all ty param bounds are represented
as traits, with no special cases for Copy/Send/Owned/Const.
typeck::collect generates the special cases.

A consequence of this is that code using the #[no_core] attribute
can't use the Copy kind/trait. Probably not a big deal?

As a side effect, any user-defined traits that happen to be called
Copy, etc. in the same module override the built-in Copy trait.

r=nmatsakis

Closes #2284
2012-10-22 09:01:12 -07:00
Patrick Walton 91ae5412d8 rustc: Merge module and type namespaces. r=brson 2012-10-15 15:35:36 -07:00
Tim Chevalier 7237268b70 Allow enum discriminator exprs to refer to declared consts
Also some work towards #3521

Closes #2428
2012-10-15 12:28:29 -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
Tim Chevalier 7bdab1e4a4 Revert "remove ctor from ast"
This reverts commit ed3689d57c.
2012-10-08 09:00:23 -07:00
Niko Matsakis ed3689d57c remove ctor from ast 2012-10-08 06:36:42 -07:00
Brian Anderson 438bdd687b core: More option demoding 2012-09-27 17:49:10 -07:00
Brian Anderson e8fe718bfd core: Replace map/map_default with map_ref/map_default_ref 2012-09-26 20:15:23 -07:00
Graydon Hoare 9c6ae65865 Support visibility qualifiers in crate directives properly. 2012-09-24 17:29:32 -07:00
Brian Anderson 4a78f9b166 core: Demode option 2012-09-23 17:15:00 -07:00
Niko Matsakis cfed923600 demode the each() method on vec and other iterables. 2012-09-19 17:03:01 -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
Tim Chevalier 53ce42dc4f Implement &-patterns
Closes #2855
2012-09-07 17:09:07 -07:00
Patrick Walton 8ff18acc82 libsyntax: "import" -> "use" 2012-09-04 11:43:23 -07:00
Patrick Walton 96534365c2 rustc: Make < and = into traits 2012-08-29 18:25:22 -07:00