Stefan Plantikow
c8467977c4
Merge branch 'master' into kmath
...
Conflicts:
src/libcore/float.rs
2012-01-05 17:20:13 +01:00
Stefan Plantikow
1f10ee365c
Moved generic float::min, max to core::math and cleaned up some imports
2012-01-05 17:11:34 +01:00
Marijn Haverbeke
cc929fc9f9
Clean up translating of def_ids in metadata reader
...
Reduces the amount of closure allocation, and makes the code cleaner.
2012-01-05 17:03:38 +01:00
Marijn Haverbeke
60ae1590af
Switch to new param kind bound syntax
...
And remove support for the old syntax
2012-01-05 15:50:02 +01:00
Marijn Haverbeke
1f71a0f48d
Clean up some FIXMEs related to impls
2012-01-05 14:55:23 +01:00
Marijn Haverbeke
3a20dda7ea
Get external interfaces / impls working
...
Issue #1227
2012-01-05 14:17:31 +01:00
Marijn Haverbeke
516fbed230
Fix bad spans for ast::ty parsing
...
The span would be pointing after the actual text.
2012-01-05 11:09:19 +01:00
Marijn Haverbeke
6559aa8bfb
Write the iface type of an impl in the crate data
...
Also, move checking of ifaces into the collect phase of typeck
to give further passes some guarantees.
Issue #1227
2012-01-05 11:04:41 +01:00
Marijn Haverbeke
3eb35900c7
Remove ty::bind_params_in_type
...
It does nothing that substitute_type_params can't do better.
2012-01-05 10:07:33 +01:00
Josh Matthews
0e98e64bc2
Add more item types to the ast_map so the test suite can build with debug info.
2012-01-05 01:20:51 -05:00
Marijn Haverbeke
3971b520bc
Use the right types for methods in trans_impl
...
This prevents misalignment between function and argument
types in corner cases.
2012-01-04 22:12:48 +01:00
Tim Chevalier
1e54684093
Reformat typestate error messages so as not to confuse emacs compilation mode
2012-01-04 10:53:56 -08:00
Marijn Haverbeke
94d40be746
Prevent typenames in param bounds from resolving to their own param
...
I.e. fn foo<T: seq<T>>(...). This leads to weird circularities that seem to
never make any sense, so it seems prudent to forbid it.
Issue #1227
2012-01-04 17:30:36 +01:00
Marijn Haverbeke
42f6608ffd
Add visit_ty_params to visit.rs
...
And use it to make typechecking of bounds less error-prone.
2012-01-04 17:30:36 +01:00
Marijn Haverbeke
a7e1a35f88
Properly typecheck and compile invocations of generic methods.
...
Aligning the type parameters of the ifaces, impls, and methods
correctly in typeck is almost brain surgery. Seems to work now for
everything I threw at it, but might still break in other corner cases.
Issue #1227
2012-01-04 17:28:51 +01:00
Lenny222
d1ffe5034b
"str": rename "str_from_cstr" to "from_cstr" (analogous to the other "from_*")
2012-01-04 09:33:07 +01:00
Tim Chevalier
439e28b751
Add missing ty_constr cases to trans::type_of_inner and ty::fold_ty.
...
Closes #970
2012-01-03 15:50:05 -08:00
Niko Matsakis
72a3667eb3
Allow tail expressions even in no_value blocks. Type checker
...
will guarantee they have unit type.
2012-01-03 13:13:52 -08:00
Niko Matsakis
de383bcfed
extend parser so that expressions that do not require semi-colons
...
to be statements are not considered expressions in the tail position
2012-01-03 13:13:51 -08:00
Niko Matsakis
9e1dc703d2
rewrite to put blk as 2nd arg
2012-01-03 13:13:51 -08:00
Niko Matsakis
e34abbacf6
minimal changes to permit fn blocks in expr
2012-01-03 13:13:51 -08:00
Brian Anderson
513a263e81
Merge pull request #1392 from Lenny222/list
...
list: add "is_not_empty" requirement to "head" and "tail" (analogous to "vec")
2012-01-03 12:18:53 -08:00
Marijn Haverbeke
4e88d5ae92
Make resolution of dictionaries on bounded params work
...
Issue #1227
2012-01-03 16:37:41 +01:00
Marijn Haverbeke
5ea3c96938
Wire in resolution of param bounds for method calls
...
Issue #1227
2012-01-03 16:18:40 +01:00
Marijn Haverbeke
506a6ec38b
Make syntax for impls less magical
...
The trick of interpreting parameters to the iface type as parameters
to the impl was just too magical.
Issue #1227
2012-01-03 15:37:41 +01:00
Marijn Haverbeke
e1dc40b271
More work on translating dictionary-passing
...
Reached a point where simple uses of interfaces without bounds work.
Issue #1227
2012-01-03 15:36:57 +01:00
Marijn Haverbeke
cdd806d324
Add a clause ty_ptr to ppaux::ty_to_str
...
Closes #1383
2012-01-02 15:42:13 +01:00
Marijn Haverbeke
8c14943dea
Properly handle expression blocks in kind.rs
...
It was only noticing them in expr_block form, not as function
bodies.
Closes #1390
2012-01-02 15:23:11 +01:00
Marijn Haverbeke
1741ef75ac
Write out vtables for interface implementations
...
Issue #1227
2012-01-02 15:15:28 +01:00
Marijn Haverbeke
371b61a23d
Drop two useless sub-passes from trans
...
Neither collect_tag_ctors nor the second pass in collect_items needed
to be separate passes.
Also remove obsolete obj_methods table kludge.
2012-01-02 15:15:28 +01:00
Marijn Haverbeke
a4694ce146
Create a trans_impl module
2012-01-02 15:15:27 +01:00
Marijn Haverbeke
3a1710d21e
Key tcx.ty_param_bounds on node_ids, not def_ids
...
This makes it clearer that it's only valid for local nodes.
2012-01-02 15:15:27 +01:00
Marijn Haverbeke
9f2369dc9f
Box arrays of parameter bounds
2012-01-02 15:15:27 +01:00
Marijn Haverbeke
270b4273e7
Pass bounds to trans::type_of_fn
2012-01-02 15:15:27 +01:00
Marijn Haverbeke
664a0443ad
More resolving and typechecking of bounded type parameters.
...
Extern interfaces still don't get recognized.
Issue #1227
2012-01-02 15:15:27 +01:00
Marijn Haverbeke
40d5f288c3
Check that type parameter bounds are interface types
...
Issue #1227
2012-01-02 15:15:27 +01:00
Marijn Haverbeke
bd6646e698
Make last-use pass properly handle closed-over variables
...
Closes #1399
2012-01-02 10:20:58 +01:00
Jyun-Yan You
4566578fbd
link with gcc44+
2012-01-01 20:18:55 -08:00
Jyun-Yan You
274fc1b59c
fix link error
2012-01-01 20:18:55 -08:00
Jyun-Yan You
21eadbe6f1
add missing library, enable segmented stacks for freebsd
2012-01-01 20:18:55 -08:00
User Jyyou
a59c4b1b47
freebsd support
2012-01-01 20:18:55 -08:00
Niko Matsakis
8319b5a252
add cap clause to pretty printer, with a test
2011-12-30 16:25:55 -08:00
Graydon Hoare
bfc9a499c2
Print usage messages to rustc and rustdoc when invoked with no args. Close #1394 .
2011-12-30 15:26:49 -08:00
Niko Matsakis
aa5382bb13
split proto from fn_decl, as not all fn_decls know the proto.
...
this will address the (crashing) new test added.
2011-12-29 20:29:28 -08:00
Graydon Hoare
36c55b20a8
Add support in lexer for utf8 identifiers. No NFKC logic in char yet.
2011-12-29 14:45:18 -08:00
Lenny222
d07c6e8a0e
list: use predicate to enforce non-empty requirement
2011-12-29 21:24:03 +01:00
Marijn Haverbeke
816b0ac8ae
Box ty_param_bounds_and_ty
...
It contains a vector, which shouldn't be copied all the time.
2011-12-29 09:29:08 +01:00
Graydon Hoare
2ed1005bd7
On second thought, re-land pull request #1385 with backquotes; easier to grep, can change in the future.
2011-12-28 13:41:31 -08:00
Graydon Hoare
f2c88c1b80
Merge pull request #1385 from Lenny222/quotes
...
Use singlequotes in the typechecker error messages too, to distinguish code and English
2011-12-28 13:08:28 -08:00
Graydon Hoare
51227c1e8a
Merge pull request #1389 from erickt/master
...
misc standard library additions
2011-12-28 13:05:02 -08:00
Marijn Haverbeke
9236fdf39f
Move the kind datatype to middle::ty
...
The AST no longer references it.
2011-12-28 21:18:16 +01:00
Marijn Haverbeke
1ed6a27548
Change representation of type params to handle interface bounds
...
Issue #1227
2011-12-28 21:18:16 +01:00
Erick Tryzelaar
5d84652f51
comp: minor cleanup.
2011-12-28 11:19:41 -08:00
Stefan Plantikow
7fd62bb2b5
Made matching machine types equal to float, int, uint ( fixes #1376 )
2011-12-28 18:02:49 +01:00
Lenny222
0b9751b141
Use singlequotes in the typechecker too, to distinguish code and English
2011-12-25 20:27:09 +01:00
Marijn Haverbeke
46cddffb8f
Go back to a single visit_fn function in visit.rs
2011-12-23 18:45:02 +01:00
Marijn Haverbeke
711ff657e2
Get rid of visit_fn_block in visit.rs
...
It seems redundant and error-prone.
2011-12-23 18:24:49 +01:00
Marijn Haverbeke
25e65239ad
Check impls methods against the type of their iface.
2011-12-23 18:11:36 +01:00
Marijn Haverbeke
057617c665
Parse iface
items and interface references in impl
items.
...
The (temporary) syntax is
iface seq<T> {
fn len() -> uint;
fn iter(f: block(T));
}
// The 'blah<T>' can be left of to default the name of the
// impl to seq<T>. The 'of seq<T>' can be left off when
// not implementing a named interface.
impl blah<T> of seq<T> for [T] {
fn len() -> uint { vec::len(self) }
fn iter(f: block(T)) { for x in self { f(x); } }
}
2011-12-23 18:09:25 +01:00
Marijn Haverbeke
9292744959
Use the same type of record in ty::ty_fn and ty::method
...
Removes some more code duplication.
2011-12-23 16:11:35 +01:00
Marijn Haverbeke
970f5cc0e4
Make ast::ty_method hold a fn_decl, rather than duplicating its fields
2011-12-23 13:32:17 +01:00
Graydon Hoare
f0dfbe7b1b
Register new snapshots, purge log_err and log_full in favour of log(...).
2011-12-22 17:53:53 -08:00
Graydon Hoare
ccb5b6fb25
Switch core macros to expand to log(level, ...).
2011-12-22 16:36:55 -08:00
Graydon Hoare
389329ef1e
Merge all 3 log syntaxes, tidy up residual misuses.
2011-12-22 16:14:00 -08:00
Graydon Hoare
dcd771cd48
Merge branch 'master' of github.com:graydon/rust
2011-12-22 14:50:52 -08:00
Graydon Hoare
8b580954fe
Register snapshots and switch logging over to use of log_full or #error / #debug.
2011-12-22 14:42:52 -08:00
Marijn Haverbeke
eacb629442
Work around unwinding bug
...
See issue #1374
2011-12-22 20:38:09 +01:00
Marijn Haverbeke
0490c36143
Unify some data structures in syntax::ast that were doing the same thing
...
As a preparation to removing some duplication in typeck.
2011-12-22 20:18:56 +01:00
Graydon Hoare
3b61064631
Revert all of yesterday's snapshots and try again. Cursed!
2011-12-22 10:30:04 -08:00
Graydon Hoare
47d27af228
Merge branch 'master' of github.com:graydon/rust
2011-12-22 09:30:03 -08:00
Marijn Haverbeke
07d7f828cd
Fix tag_var_cache to cache crate-external tags
...
And to not return a bogus mutable box.
2011-12-22 16:23:49 +01:00
Marijn Haverbeke
44f921c8a9
Do not use == and != to compare ty::t values
...
Issue #828
2011-12-22 15:05:38 +01:00
Marijn Haverbeke
3ee630bbee
Add ty::new_ty_hash, clean up comparing of ty::t's
2011-12-22 15:05:38 +01:00
Marijn Haverbeke
e2e077c831
Remove trivial cast checker
...
I consider the added complexity not justified at this point, and it
interacts badly with the patches for issue #828 . Feel free to discuss.
2011-12-22 15:04:00 +01:00
Graydon Hoare
047b02d5bc
More flailing on log syntax due to call-expr ambiguity in previous attempt.
2011-12-21 18:05:08 -08:00
Graydon Hoare
5d1cf2a872
Out-of-order-code typo. Snapshot again.
2011-12-21 15:43:38 -08:00
Graydon Hoare
8d9e7deab5
Switch log_expr to carrying a full expr:u32 for level. Add log_full variant that parses that expr, prepare for snapshot.
2011-12-21 14:31:31 -08:00
Niko Matsakis
627217fa55
valid cap clause for kind-ness too
2011-12-21 06:14:36 -08:00
Niko Matsakis
c03d14a33d
upgrade kind check
2011-12-21 06:14:36 -08:00
Niko Matsakis
01cb1044f7
update pprinter to understand ret type of block, add warnings
2011-12-21 06:14:35 -08:00
Niko Matsakis
6a90140941
Make { || ... } sugar for any type of closure, inferred
2011-12-21 06:14:35 -08:00
Haitao Li
1e4de33374
rustc: Exclude stdin from codemap files when lookup_pos
...
Fixes issue #1362
2011-12-21 22:07:48 +08:00
Graydon Hoare
3bc4da96f1
Inject "core macros" into default syntax-expansion environment. Bit of a kludge but enough to work on logging-via-macros.
2011-12-20 13:38:10 -08:00
Graydon Hoare
8bde865d09
Merge pull request #1349 from lht/driver
...
Separate driver rustc and librustc
2011-12-20 12:28:40 -08:00
Graydon Hoare
96d7f83eb0
Merge pull request #1350 from boggle/kmath
...
removed math leftovers from std
2011-12-20 12:28:07 -08:00
Marijn Haverbeke
4475ec863d
Fix misleading comment about type_is_pod
2011-12-20 20:47:03 +01:00
Stefan Plantikow
b957916e06
removed math leftovers from std
2011-12-20 18:07:36 +01:00
Haitao Li
bc95ccb536
Separate driver rustc and librustc
...
rustc is now a minimal wrapper of librustc.
2011-12-20 21:06:04 +08:00
Haitao Li
5cfcf20b25
rustc: Cleanup unused ext_map
2011-12-20 15:38:40 +08:00
Haitao Li
5e3ffb6cbd
rustc: Re-export the same name in different namespaces
...
Issue #1115 .
2011-12-20 15:38:40 +08:00
Haitao Li
bd300636ee
rustc: Implement re-export of renamed modules
...
Issue #1115
2011-12-20 15:38:40 +08:00
Niko Matsakis
55a2fd18ec
implement capture clauses (move, in particular) and integrate
...
them into type state and so forth
2011-12-19 14:07:46 -08:00
Niko Matsakis
41ae146057
integrate cap clause into type state, but not trans
2011-12-19 14:07:46 -08:00
Niko Matsakis
b2b2a430df
resolve capture clauses
2011-12-19 14:07:46 -08:00
Niko Matsakis
b0f1a5f051
when collecting free vars, track the span where it is used too
2011-12-19 14:07:46 -08:00
Niko Matsakis
98cbbbb642
impl the proper partial order between fn types
2011-12-19 14:07:46 -08:00
Erick Tryzelaar
9db3525e42
Fix a typo.
2011-12-19 07:27:16 -08:00
Marijn Haverbeke
e4e2d6d1a1
Fix bug in type parameter handling for impl methods
...
The parameters of the impl weren't being combined in the right way
with the parameters of the methods. The test worked only by accident.
Issue #1227
2011-12-19 15:43:02 +01:00
Marijn Haverbeke
619d7c3f72
Associate names with types introduced by items
...
Issue #828
This is not a full solution yet. To really get sane error messages,
we'll also have to guess the name to apply to literals, which seems
non-trivial.
2011-12-19 13:52:58 +01:00
Marijn Haverbeke
60acae4df7
Add type argument field to expr_path
...
This way, you can explicitly provide type parameters when calling a
generic method.
Issue #1227
2011-12-19 10:43:23 +01:00
Marijn Haverbeke
4d524b957f
Complain when multiple methods in the same scope match a call
...
Issue #1227
2011-12-19 10:13:42 +01:00
Marijn Haverbeke
7185ea35c3
Use quotes around tokens in parser error messages to make them more readable
...
Closes #1328
2011-12-19 09:59:51 +01:00
Josh Matthews
6637340c28
Properly calculate base working dir for compile units.
2011-12-19 03:42:58 -05:00
Josh Matthews
1d3d28bdf1
Long lines.
2011-12-19 02:52:21 -05:00
Josh Matthews
52dbe4cc1d
Fix merge error and rebasing changes for debug information.
2011-12-19 01:36:37 -05:00
Josh Matthews
df6052c4f8
Remove source line generation craziness. Ensure incorrect subprogram caches are not conflated. Generate ast_map entries for object members and resource constructors and destructors.
2011-12-18 23:53:44 -05:00
Josh Matthews
c6f16ed2c4
Hide extended, unfinished debug information behind --xg compiler flag.
2011-12-18 23:48:04 -05:00
Josh Matthews
8597077b7a
Clean up some names and factor out some common code.
2011-12-18 23:46:39 -05:00
Josh Matthews
61e8b44f20
Add support for vectors.
2011-12-18 23:46:39 -05:00
Josh Matthews
30d019d520
Add record debug information.
2011-12-18 23:46:39 -05:00
Josh Matthews
f43ed8f1bd
Fix up ast types after literal changes.
2011-12-18 23:44:21 -05:00
Josh Matthews
134585bb06
Add debug information for boxed and unique values.
2011-12-18 23:44:21 -05:00
Josh Matthews
064d757ece
Handle inferred basic types when generating debug information for types.
2011-12-18 23:44:21 -05:00
Josh Matthews
6c26b892e4
Add argument metadata and aborted return value code.
2011-12-18 23:44:21 -05:00
Josh Matthews
0752252737
Use proper size and alignment of types for debuginfo.
2011-12-18 23:44:21 -05:00
Josh Matthews
1da4b3b987
Fix build error after rebasing.
2011-12-18 23:44:21 -05:00
Josh Matthews
0b303523bd
Fix up local variable support so it actually works.
2011-12-18 23:44:21 -05:00
Josh Matthews
e95c56f855
Fix up subprogram composite type nodes, and lexical block context nodes.
2011-12-18 23:44:21 -05:00
Josh Matthews
544bcfece2
Fix LLVM assertions when lowering log statements.
2011-12-18 23:44:21 -05:00
Josh Matthews
fa6d871e11
Build fix.
2011-12-18 23:43:37 -05:00
Josh Matthews
e383004985
Add debug info for local vars, basic fundamental types, and lexical blocks, along with source line information generation for individual instructions.
2011-12-18 23:41:03 -05:00
Josh Matthews
10030a37d5
Generate basic debug info for files, functions and compile units.
2011-12-18 23:39:54 -05:00
Stefan Plantikow
fa27724a4b
std: getopts now uses result::t ( fixes #1289 )
2011-12-18 18:55:39 -08:00
Marijn Haverbeke
f4acaf6934
Only look for a matching method when normal field access fails
...
We should probalby warn when defining a method foo on {foo: int} etc.
This should reduce the amount of useless typevars that are allocated.
Issue #1227
2011-12-18 19:41:44 +01:00
Marijn Haverbeke
b36ade1367
Improve efficienty of impl cache in resolve
...
And fix a bug where importing anything from an external module would
import all impls in the module.
Issue #1227
2011-12-18 19:07:26 +01:00
Brian Anderson
cb5f636ff1
rustc: Don't emit compact unwind info on mac
...
It's not compatible with the subtlety of __morestack
2011-12-18 00:42:37 -08:00
Brian Anderson
555006a304
rustc: Remove --stack-growth option
2011-12-17 16:58:26 -08:00
Graham Fawcett
f14bc54b06
allow #[link_args] with #[nolink]. For now, fail if two modules link same lib, and second has link_args.
...
I think it should undefined to have multiple modules that link in the same
library, but provide different link arguments. Unfortunately we don't track
link_args by module -- they are just appended as discovered into the crate
store -- but for now, it should be an error to provide link_args on a module
that's already been included (with or without link_args).
2011-12-16 15:29:59 -08:00
Graham Fawcett
7ddd353ef6
implement #[nolink]; deprecate #[link_name = ""]; note in stdlib to remove empty link_name.
...
Can't remove them from stdlib until the snapshotted compiler supports #[nolink].
2011-12-16 15:29:59 -08:00
Marijn Haverbeke
b11268780e
Fix arg order for vec::map call
2011-12-16 22:29:01 +01:00
Marijn Haverbeke
58a81a68ed
Finish resolving and calling of crate-external impls
...
Issue #1227
2011-12-16 22:18:38 +01:00
Marijn Haverbeke
dd9693f211
Reserve node_id 0 for the crate top-level module
...
And define a const to refer to it.
2011-12-16 22:17:47 +01:00
Graydon Hoare
d1bca753b8
Switch fmt extension to reference extfmt that's in core.
2011-12-16 10:59:11 -08:00
Niko Matsakis
21cc0c6e69
revoke cleanup of sendable closure once construction completes
2011-12-16 08:06:44 -08:00
Niko Matsakis
52f76400b5
extend with ty_send_type and ty_opaque_closure
2011-12-16 08:06:44 -08:00
Niko Matsakis
ac6aba016e
rename iter2 to iteri to match typical convention
2011-12-16 07:17:29 -08:00
Niko Matsakis
2833ca478c
reorder args to the various vec, option fns so blk comes last
2011-12-16 07:17:23 -08:00
Marijn Haverbeke
0a3626161d
Write impl data to crate library files
...
(No one is actually reading it yet.)
Issue #1227
2011-12-16 14:17:52 +01:00
Marijn Haverbeke
d529757515
Make polymorphic impl methods work
...
Something will still have to be done to the AST to make it possible to
say `x.foo::<int>()`, since currently field access never allows type
parameters.
Issue #1227
2011-12-16 13:47:48 +01:00
Marijn Haverbeke
cff6bdd036
Change syntax for impl
...
Move the name of the bundle to the front, allow type parameters (not
handled yet), and add a 'for' keyword:
impl utils for int {
fn str() -> str { int::str(self) }
fn times(f: block()) { ... }
}
2011-12-16 11:46:57 +01:00
Marijn Haverbeke
4f826d81f6
Make 1.f parse as a field access on the integer 1
...
A dot is only considered part of a number when not followed by a letter
Closes #1306
2011-12-16 11:46:57 +01:00
Marijn Haverbeke
14fcb135a9
Improve resolution of impls
...
Issue #1227
2011-12-16 11:46:57 +01:00
Marijn Haverbeke
7efef98901
Make uses of self in impls compile
...
Get rid of expr_self_call, introduces def_self. `self` is now,
syntactically, simply a variable. A method implicitly brings a `self`
binding into scope.
Issue #1227
2011-12-16 11:46:57 +01:00
Marijn Haverbeke
1dd2f1ec03
Get very simple impl method calls to compile
...
Resolution is still dumb, and no self support yet.
2011-12-16 11:46:57 +01:00
Marijn Haverbeke
6a16f57c0a
Get a very primitive form of typechecking/resolving to work for impls
...
No conflict resolution or polymorphism yet.
Issue #1227
2011-12-16 11:46:57 +01:00
Marijn Haverbeke
888bc80025
Parse and resolve implementations.
...
Issue #1227
2011-12-16 11:46:57 +01:00
Haitao Li
9bb290c725
rustc: Implement non-renamed re-export across crates
...
First patch for issue #1115 . Not yet ready for re-exported modules which
are renamed when importing them.
2011-12-16 17:16:00 +08:00
Brian Anderson
1f8f6054d2
rustc: Box tag variants to avoid copies
2011-12-15 17:25:58 -08:00
Brian Anderson
26db74c811
rustc: Box the vectors returned from ty::tag_variants
2011-12-15 17:14:58 -08:00
Brian Anderson
a1b3e3ea10
rustc: Cache results of ty::tag_variants
2011-12-15 16:27:18 -08:00