Niko Matsakis
30b47649ea
new liveness pass to supercede last_use / initedness
2012-05-24 09:52:03 -07:00
Niko Matsakis
a3be0b1054
fix classes and parameterized ifaces; remove needless self check
...
ref #1726 , #2434
2012-05-24 06:49:40 -07:00
Niko Matsakis
bd573becf5
change region scope of call arguments, old one was unsound
...
improve error message to describe kind of deref'd ptr using sigil
2012-05-24 05:19:44 -07:00
Eric Holk
5f154770e2
Prevent capturing non-copyable things in closures.
2012-05-23 15:46:43 -07:00
Eric Holk
6fa1a084f7
A shareable atomically reference counted pointer wrapper.
...
Needs more tests to ensure safety, and probably some more work on usability too.
2012-05-23 14:58:16 -07:00
Brian Anderson
27427a950a
Merge pull request #2430 from mmeyerho/master
...
Added support for #! comments. Closes issue 1772.
2012-05-22 20:39:53 -07:00
Tim Chevalier
ed357af980
Convert more resource tests to use classes with dtors
...
And monomorphize dtors correctly.
2012-05-22 22:12:18 -04:00
Margaret Meyerhofer
4f10c19215
Merge branch 'master' of git://github.com/mozilla/rust
2012-05-22 18:23:32 -07:00
Margaret Meyerhofer
6077647878
Added a test for #! comments
2012-05-22 18:03:26 -07:00
Brian Anderson
a32392d032
Merge pull request #2427 from msullivan/shifts
...
Get rid of the >>> operator and make >> logical or arithmetic depending ...
2012-05-22 17:50:04 -07:00
Michael Sullivan
2a9bf0959b
Add a test for Issue #2428 .
2012-05-22 16:35:10 -07:00
Michael Sullivan
15cef374b9
Get rid of the >>> operator and make >> logical or arithmetic depending on the signedness. Closes #2417 .
2012-05-22 14:59:15 -07:00
Eric Holk
0b2f2cabbe
Send is no longer a subkind of copy. This allows for sendable, but non-copyable resources. Closes #2420 .
2012-05-22 14:10:32 -07:00
Lindsey Kuper
af418d97c0
Test illustrating issue #2263 .
2012-05-21 13:04:30 -07:00
Niko Matsakis
34b42eeb65
change list so that it must be used in a purely boxed fashion
...
The old way was inconsistent---the head was unboxed but the
tail was boxed. This resulted in numerous needless copies and
also made the borrow check unhappy, because the head tended to be
stored in mutable memory.
2012-05-21 09:37:34 -07:00
Niko Matsakis
cf6ad6d62a
move io over to dvec
2012-05-18 20:00:50 -07:00
Niko Matsakis
81caf926b4
test for #2378
2012-05-18 20:00:50 -07:00
Niko Matsakis
da204e1d73
add swappable/dvec modules
2012-05-18 20:00:50 -07:00
Niko Matsakis
19ec5a41ed
allow region ptrs to be cast to uints
2012-05-18 19:07:19 -07:00
Brian Anderson
e546c4820b
rustc: Don't copy vecs in seq_preconds. Huge perf win on some tests
...
Compile time for the included test goes from 5min to 18s.
2012-05-18 15:59:00 -07:00
Niko Matsakis
09b9447eb6
remove line so that pretty printer doesn't mess it up
2012-05-18 14:32:38 -07:00
Niko Matsakis
2f284cefa0
xfail-test failing test
2012-05-18 14:32:38 -07:00
Niko Matsakis
a559329692
test that we preserve boxes in patterns---still one bug
2012-05-18 14:32:37 -07:00
Brian Anderson
3f283bb168
rustc: Don't recurse in seq_preconds. Consumes too much stack
2012-05-18 14:28:39 -07:00
Niko Matsakis
afca68b820
test file I had lying around and had forgotten to commit
2012-05-18 10:38:18 -07:00
Paul Stansifer
0eef34bacb
add #include_bin[]
2012-05-18 10:05:25 -07:00
Paul Stansifer
ac2faad26e
Fold #include_str into the other source_utils.rs syntax extensions.
2012-05-18 10:05:25 -07:00
Paul Stansifer
07e775404f
add #mod[], which expands to the current module path
2012-05-18 10:05:25 -07:00
Paul Stansifer
88f4d06941
New syntax extensions: #line[], #col[], #file[], #stringify[], #include[]
2012-05-18 10:05:24 -07:00
Graydon Hoare
9752523f3a
Include intrinsic module in all crates, emit visit glue, fn intrinsic::visit_ty. Not yet working.
2012-05-16 18:24:00 -07:00
Niko Matsakis
21fc3af031
add xfail-fast directives for borrowck tests
2012-05-16 12:44:54 -07:00
Niko Matsakis
63210ecddb
correct preservation of explicit borrows like "let x = &*y;"
2012-05-16 07:19:19 -07:00
Tim Chevalier
7df7a9d8ac
Start porting tests to use classes with dtors instead of resources
2012-05-15 20:35:57 -07:00
Tim Chevalier
fa5cc5bcd0
Generate drop glue correctly for classes with destructors
2012-05-15 18:00:41 -07:00
Niko Matsakis
adb61e3e99
get preservation of boxes working, at least in simple cases
2012-05-15 13:38:16 -07:00
Niko Matsakis
efa2252cfc
add a test that current fails b/c we do not preserve boxes
2012-05-15 11:49:09 -07:00
Lindsey Kuper
b8880e3254
Remove be
keyword.
...
Closes #2227 .
2012-05-15 10:41:14 -07:00
Graydon Hoare
d899c3a579
More work on reflection, now calls iface visitors back as well.
2012-05-14 15:49:10 -07:00
Tim Chevalier
5428a22b95
First cut at dtors for classes
...
Classes with dtors should compile now. Haven't yet tested
whether they actually run correctly.
Beginnings of support for #2295 , though that won't be done until
there's more test cases and resources are removed.
2012-05-14 14:26:10 -07:00
Niko Matsakis
63eb8e0e87
move purity checking into borrowck, addresses #1422
2012-05-11 14:05:58 -07:00
Graydon Hoare
2585384c97
First working monomorphic type-reflection.
2012-05-11 13:10:07 -07:00
Niko Matsakis
b4d1f1b2c1
replace mutbl pass with borrowck
2012-05-10 21:14:43 -07:00
Paul Stansifer
f943667af3
Remove do ... while
loops from the tests and docs.
2012-05-10 15:27:42 -07:00
Niko Matsakis
50a3dd40ae
implement new borrow ck (disabled by default)
2012-05-09 17:00:19 -07:00
Niko Matsakis
5e7229b72c
reduce self type to a special type parameter
2012-05-09 07:11:59 -07:00
Marijn Haverbeke
96a159a6ea
Support visibility modifiers and attributes on view items
...
Issue #1893
Tangentially, issue #2357
2012-05-08 23:14:24 +02:00
Tim Chevalier
1e6da7b38d
Add another test case for #2288
...
Added a test case for #2288 . It's xfailed for now, pending #2364
2012-05-07 14:43:31 -07:00
Tim Chevalier
4f105e4025
In resolve, visit the path in an iface ref
...
Necessary to resolve any type arguments in a ref to a parameterized
iface. This meant that, for example:
class A implements B<int> { ...
didn't work before, because the "int" in B's argument wasn't getting
visited, and thus wasn't getting resolved. Now it works.
Partially addresses Issue #2288 , but I also want to check that class
ty params can appear as the type arguments to ifaces (for example,
class A<T> implements B<T> {...
should work.)
2012-05-07 14:43:31 -07:00
Niko Matsakis
8a9df5aa38
make it illegal to implicitly capture mutable variables
...
this is the final part of #1273
2012-05-07 13:22:42 -07:00
Niko Matsakis
50ec6bd2c3
new cap clause syntax
2012-05-04 12:33:08 -07:00
Niko Matsakis
cfa09d35a3
Revert "allow fn exprs to omit arg types"
...
This reverts commit 1ba4ca4c4a
.
2012-05-03 14:42:34 -07:00
Niko Matsakis
1ba4ca4c4a
allow fn exprs to omit arg types
...
also, avoid using type variables for fn args with omitted types
unless necessary. This will be important for bound regions in
fn types.
fixes #2093
2012-05-03 14:32:32 -07:00
Graydon Hoare
6e5c8a7fb8
More shape fixes for evecs.
2012-05-03 14:11:54 -07:00
Graydon Hoare
11a5d10bf2
Implement better shape code for evec, estr.
2012-05-03 13:09:02 -07:00
Niko Matsakis
f4cc5ff226
remove extra type parameter from ptr::is_null() and friends
2012-05-02 21:47:14 -07:00
Brian Anderson
358dc59538
test: xfail-win32 run-pass/native-struct
2012-05-02 19:07:35 -07:00
Brian Anderson
11354963b3
rustc: Hack around some FFI bustage. Unbreak servo
2012-05-02 18:35:29 -07:00
Brian Anderson
1e410f6206
rt: Fix some record alignment issues on windows
2012-05-02 18:32:20 -07:00
Brian Anderson
e2910bf264
Revert "rt: Fix some record alignment issues on windows"
...
This reverts commit a2457f5864
.
2012-05-02 18:25:22 -07:00
Brian Anderson
a2457f5864
rt: Fix some record alignment issues on windows
2012-05-02 17:55:58 -07:00
Tim Chevalier
0247d85575
xfail-fast class-separate-impl
2012-05-02 15:10:54 -07:00
Tim Chevalier
c2382f9ebf
Add test for issue 2287
...
Test that it's possible to write "impl of B for A" outside a class,
where A is a class type. This didn't require any extra work, but it's
still good to have a regression test.
Closes #2287
2012-05-02 14:45:21 -07:00
Tim Chevalier
e0da0dd446
Test for issue 2286
...
which is really kind of a non-issue because class methods aren't
items that can be selectively imported/exported anyhow, unlike enum
variants. But, might as well have a test.
2012-05-02 14:02:44 -07:00
Tim Chevalier
3d4ef74c9b
Encode the ifaces a class implements in metadata
...
This lets you use class A as if it had type B if A implements B,
and A and B are in different crates from your own.
Closes #2285
2012-05-02 13:38:56 -07:00
Tim Chevalier
164039e867
Don't re-export a glob-imported ID when the same ID is defined within
...
a module
See the test case I added (issue-2316-c) for a concrete example.
issue-2316 also contains the originally reported test case. resolve
was using bitwise or instead of logical or when checking exports,
resulting in excessively eager evaluation. A one-line fix that took
six hours to isolate ;-)
2012-05-01 08:43:17 -07:00
Niko Matsakis
2db4259b35
Stop inferring bot/static when types/regions are unconstrained.
...
Also, some other changes that came up along the way:
- add a 'blk' region for the current block.
- detect unused type/region variables.
2012-04-30 19:53:02 -07:00
Niko Matsakis
e348567f77
new, simpler approach to the iter library
2012-04-27 16:57:50 -07:00
Brian Anderson
09624a676a
test: Enable an assert in run-pass/rec-align-32-bit.rs
2012-04-27 00:12:42 -07:00
Brian Anderson
e4277472d2
core: Split sys::align_of into min_align_of, pref_align_of
2012-04-27 00:12:42 -07:00
Brian Anderson
f4f909b8b5
rustc: Add min_align_of, pref_align_of intrinsic, deprecate align_of
2012-04-27 00:12:39 -07:00
Brian Anderson
597d9b4dd0
test: xfail-win32 run-pass/rec-align-32-bit.rs
2012-04-26 19:55:57 -07:00
Brian Anderson
bbc4a74dc6
rt: Fix shape alignment of 64-bit ints on x86. Issue #2303
2012-04-26 18:30:58 -07:00
Niko Matsakis
825fd1808e
lots of work to make iface/impls parameterized by regions
...
- paths can now take region parameters, replacing the dirty hack
I was doing before of abusing vstores. vstores are now a bit
of a hack though.
- fix various small bugs:
- we never checked that iface types were compatible when casting
to an iface with `as`
- we allowed nonsense like int<int>
- and more! (actually that may be it)
2012-04-25 19:26:56 -07:00
Brian Anderson
e21161b336
test: Fix run-pass/enum-mach-type-compat on x86
2012-04-25 16:06:57 -07:00
Brian Anderson
60ec812b3a
test: Fix and un-xfail run-pass/use
2012-04-25 15:58:33 -07:00
Brian Anderson
c9439ad755
test: Remove run-pass/user.rs. Old test for unimplemented feature
2012-04-25 15:56:21 -07:00
Brian Anderson
df0ef528b9
rustc: Use LLVM named structs for enum types
2012-04-25 15:49:25 -07:00
Marijn Haverbeke
10120cce0f
typeck: Take more care to pass down expected types
...
This helps with prototype inference and avoids some 'must be known
in this context' errors.
2012-04-25 17:45:29 +02:00
Marijn Haverbeke
9f99c3263b
Rewrite exhaustiveness checker
...
Issue #2111
2012-04-25 09:15:17 +02:00
Brian Anderson
31853f31bf
build: Don't require full target libs to run compiletest tests
...
Only build through librustsyntax, which some tests do rely on.
2012-04-24 13:30:03 -07:00
Tim Chevalier
2d793ef498
Add a cross-crate test for casting classes to ifaces
2012-04-24 10:47:53 -07:00
Tim Chevalier
f7641286b2
Allow classes to be cast to ifaces that are in the same crate
...
I had to xfail one existing test case (class-implements-int) because,
I think, of the same bug described in #2272 .
2012-04-23 21:15:03 -07:00
Niko Matsakis
b04b415e0d
encode the borrowing table, add a simple cross-crate borrowing test
2012-04-23 16:41:11 -07:00
Niko Matsakis
30d563839e
Various regions fixes.
2012-04-23 08:02:59 -07:00
Marijn Haverbeke
f2a60a6b02
Fix long line in test
2012-04-23 09:54:27 +02:00
Marijn Haverbeke
dfdca5d538
Fix broken determination of external method type param count
...
Closes #2185
2012-04-23 09:25:14 +02:00
Brian Anderson
7235f3cee2
syntax: Eliminate 'mutable' keyword. Closes #2254
2012-04-21 14:27:20 -07:00
Graydon Hoare
90f82e171d
Get borrowing working on fixed evecs.
2012-04-20 12:11:55 -07:00
Tim Chevalier
37b0549730
Add new syntax for patterns that match the head constructor only
...
Adds a new kind of pattern C(*) where C is a constructor that may
have any number of fields. This pattern matches any value
constructed with C, without binding names for any of the fields.
Closes #1701 .
2012-04-20 00:56:46 -07:00
Niko Matsakis
3d6c79109e
update syntax to include a slash
2012-04-19 21:01:11 -07:00
Niko Matsakis
3c995fb8f3
make nominal types optionally parameterized by a self region.
...
Issue #2201 .
2012-04-19 21:01:11 -07:00
Niko Matsakis
bbfb83c2c5
Test for issue #1899 . It works now.
2012-04-19 20:54:23 -07:00
Niko Matsakis
171c89f4c5
Fix for #1989 , #1469 : when marking in CC, walk fn@ box like other boxes
2012-04-19 20:34:26 -07:00
Graydon Hoare
f641dce852
Get evec slices and unique-evec slice-borrowing working.
2012-04-19 16:51:37 -07:00
Graydon Hoare
1e51196f33
Get fixed-size evecs working.
2012-04-19 15:52:50 -07:00
Brian Anderson
9a8a04629e
syntax: Put the main parser interface in mod parse
2012-04-18 10:50:50 -07:00
Graydon Hoare
70a9ce626d
Implement slice-borrowing on estr-uniq and str values.
2012-04-17 15:15:20 -07:00
Niko Matsakis
35a93e61d4
rewrite region resolution so it takes place in typeck
2012-04-16 19:48:00 -07:00
Graydon Hoare
82727b926f
Get explicit unique estrs working.
2012-04-16 16:17:51 -07:00
Brian Anderson
c461fc869c
test: Add xfailed test for #2196
2012-04-16 13:51:40 -07:00
Brian Anderson
f466a2fa8f
rustc: -L also indicates the location of native libraries
...
-L currently specifies paths to search for Rust crates
Building crates that use native libraries is difficult. When the
library is located somewhere unexpected there is no way
to tell rustc additional paths to look in.
If libclang is located at `.` then rustc is not going to
know that and linking will fail.
To get around that I often end up inserting
#[link_args = "-L."] native mod m { }
into other crates to get them to build.
Now you just `rustc -L .` and it builds.
This doesn't do any rpathing so it's still up to somebody else
to put the library somewhere it will be found or use LD_LIBRARY_PATH
This feature comes with a single, XFAILed test, because I could
not think of a way to test it. Odd.
2012-04-16 12:33:21 -07:00
Brian Anderson
658b6a741b
test: Simulate abstract methods with template modules
2012-04-14 02:14:05 -07:00
Brian Anderson
611061b6c3
test: Add a test for interesting module template polymorphism
2012-04-14 00:15:12 -07:00
Niko Matsakis
247db704a9
integrate simple notion of borrowing into trans
2012-04-13 21:06:57 -07:00
Niko Matsakis
4d73185f3e
new borrowing tests (not all passing)
2012-04-13 21:06:56 -07:00
Niko Matsakis
f099359cfa
add test for issue #1466 that runs with CC ZEAL enabled.
...
Fixes #1466 . (Unable to reproduce)
2012-04-13 12:41:37 -07:00
Niko Matsakis
dfc548ddda
add option exec-env to set env variables during test execution
2012-04-13 12:41:37 -07:00
Niko Matsakis
27f1c2b742
first stab at type checking for borrow: not integrated into trans
2012-04-13 10:41:46 -07:00
Tim Chevalier
ea0063788b
Add a run-fail test for result::get, get rid of a FIXME. Also some random other tests, mostly xfailed.
2012-04-12 20:24:07 -07:00
Graydon Hoare
8a7fd4a04f
Support general warnings and errors in lint pass via flags and attrs. Close #1543 .
2012-04-12 17:31:49 -07:00
Tim Chevalier
d7ba59eb6e
Test that a class can implement an interface defined in a different crate
2012-04-11 18:55:30 -07:00
Niko Matsakis
3e6943d820
refactor fixup_self
2012-04-11 17:21:53 -07:00
Niko Matsakis
c1c60c023e
first attempt at an assignability check
2012-04-11 17:21:53 -07:00
Tim Chevalier
5c12cd72f4
Allow classes to implement ifaces
...
Introduce syntax like:
iface animal { ... }
class cat implements animal { ... }
to allow classes to implement ifaces. Casting classes to ifaces
is *not* yet supported. ifaces that a class implements are not
yet included in metadata.
The syntax is subject to change, and may go away completely if we
decide to use duck typing to relate classes with ifaces (see
http://smallcultfollowing.com/babysteps/blog/2012/04/10/declared-vs-duckish-typing/ )
2012-04-11 16:20:01 -07:00
Graydon Hoare
f34eae8802
Translate slice-strings and make fixed-strings carry their null.
2012-04-11 12:07:19 -07:00
Graydon Hoare
7a3b290245
Add vstore/evec/estr to compiler.
2012-04-11 11:08:40 -07:00
Graydon Hoare
0c94cd5d43
Add some xfailed estr tests.
2012-04-11 11:08:40 -07:00
Tim Chevalier
fd26743bed
Generic classes and generic class methods work cross-crate
...
Classes can have ty params now. So can methods inside classes.
That was probably true before, but now it should still work if you
call methods in a class that's defined in a different crate. Yay!
2012-04-10 11:01:36 -07:00
Haitao Li
1dac883282
test: Remove duplicated auxliary tests
2012-04-10 16:59:35 +08:00
Niko Matsakis
24e921f7d4
make anything used in a resource body always reachable
...
(they appear to be uncond. inlined)
Fixes #2170 .
2012-04-09 16:36:59 -07:00
Haitao Li
2ce28899e4
test: Don't share auxiliary modules
2012-04-09 00:18:18 +08:00
Haitao Li
cc66599c1f
Xfail-fast a case on window
2012-04-08 23:14:57 +08:00
Haitao Li
101f83ecef
Fix a missing un-xfailed case
...
Issue #1230
2012-04-08 22:09:15 +08:00
Haitao Li
7d227f21f7
Check metadata hash when loading transitive dependent crates
...
Fix issue #2138
2012-04-08 21:19:15 +08:00
Brian Anderson
a6e748a1d9
rustc: Hash the CMH into symbol names
2012-04-07 17:50:49 -07:00
Brian Anderson
e0f2341da1
test: Add another test using multiple versions of the same crate
2012-04-07 17:40:25 -07:00
Brian Anderson
320e6cebf4
test: Un-xfail run-pass/crateresolve2
2012-04-07 17:39:59 -07:00
Brian Anderson
19b7a7d803
Revert "Mangle exported names using node IDs rather than types"
...
This reverts commit c83d61de93
.
2012-04-07 17:29:06 -07:00
Niko Matsakis
1e42c9a367
Do not consider ty_bot to be a "resolved type".
...
Fixes #2149 . Fixes #2150 . Fixes #2151 .
2012-04-07 17:12:48 -07:00
Haitao Li
7aaa120bcc
Check version when resolving transitive dependent crates
...
Issue #2138
2012-04-08 02:05:09 +08:00
Haitao Li
2f42b14b4f
Use version and hash in crate_map name
...
Related issue #2137
2012-04-07 22:11:23 +08:00
Haitao Li
13686b6778
Use real crate name in crate_map name
...
`use` statement may introduce an crate name alias. This patch always
uses the link attrbute "name" as the crate's name when building the
crate map.
Closes #1706
2012-04-07 22:08:54 +08:00
Marijn Haverbeke
c902eafa14
Convert old-style for loops to new-style
...
Most could use the each method, but because of the hack used to
disambiguate old- and new-style loops, some had to use vec::each.
(This hack will go away soon.)
Issue #1619
2012-04-06 20:38:23 +02:00
Brian Anderson
9c88e5ef5a
test: Refactor the crateresolve tests
...
Keep their aux builds from stomping on each other
2012-04-06 10:58:03 -07:00
Niko Matsakis
051f24da25
add static region and also fix regions to be contravariant
2012-04-05 21:16:28 -07:00
Brian Anderson
2577bd9df3
rustc: Don't assume that all crates with the same name are the same
2012-04-05 20:53:16 -07:00
Tim Chevalier
c83d61de93
Mangle exported names using node IDs rather than types
...
Use node IDs rather than types to ensure exported names are unique.
duplicate symbol. Closes #2074 .
2012-04-05 18:22:53 -07:00
Niko Matsakis
b91c9f803d
simplify typing rule for vector addition: use mutability of LHS
2012-04-05 15:18:26 -07:00
Niko Matsakis
79cbdba037
new tests for things we'll have to fix eventually
2012-04-05 15:18:26 -07:00
Tim Chevalier
98b07ddc82
Rename task::task_builder to task::builder
...
Closes #2120 .
2012-04-05 14:09:32 -07:00
Niko Matsakis
c0d61795de
wip: refactor repr of regions
...
- we now distinguish bound/free parameters (see region-param
test case for why this is necessary)
- we also track bounds on region variables
- also, restructure fold_ty() to have multiple variants without
duplication instead of one overloaded folder. This also allows
for using block functions.
2012-04-04 19:41:23 -07:00
Graydon Hoare
2577e3eafc
Tidy up predicate names in libcore. Should close #1431 .
2012-04-04 18:08:55 -07:00
Brian Anderson
38ed2ea096
rustc: Allow consts to refer to other consts
2012-04-04 15:03:39 -07:00
Brian Anderson
e325146eb4
Merge remote-tracking branch 'brson/mainthread'
...
Conflicts:
src/rt/rust_kernel.cpp
src/rt/rust_scheduler.cpp
src/rt/rust_scheduler.h
2012-04-03 20:30:01 -07:00
Brian Anderson
c0e12854ed
rt: Fix bugs in the osmain scheduler
2012-04-03 18:01:13 -07:00
Tim Chevalier
5571a9a193
also xfail class-typarams (doesn't work on Windows)
2012-04-03 17:47:07 -07:00
Tim Chevalier
bc5e10dd1b
xfail - metadata encoding doesn't work, which breaks Windows
2012-04-03 17:16:14 -07:00
Tim Chevalier
1f892dcb01
Monomorphize class constructors, support generic classes and class methods
...
Allow class methods to have type parameters (this is a change from the
original classes proposal).
Add test cases for classes with type parameters, and classes with methods
that have their own type parameters.
2012-04-03 16:23:50 -07:00
Brian Anderson
bef72447e7
core: Add a scheduler mode, osmain, to spawn onto the main scheduler
2012-04-03 14:28:30 -07:00
Brian Anderson
5d54defce4
core: Add extension methods for vec
2012-03-29 20:56:50 -07:00
Niko Matsakis
76d0a13ae5
resolve type variables with no constraints to bot
2012-03-29 19:41:09 -07:00
Tim Chevalier
c7082ce8e8
Require "self" as base expression for intra-class method or field references
...
All field or method references within a class must begin with "self." now.
A bare reference to a field or method in the same class will no longer
typecheck.
2012-03-29 12:22:01 -07:00
Tim Chevalier
f7bbe537c1
Allow explicit self-calls within classes
...
Allow writing self.f() within a class that has a method f. In a future
commit, this syntax will be required. For now, you can write either
self.f() or f().
I added a "privacy" field to all methods (whether class methods or not),
which allowed me to refactor the AST somewhat (getting rid of the
class_item type; now there's just class_member).
2012-03-28 20:30:07 -07:00
Niko Matsakis
23f92ea370
Detect and report types which could never be instantiated.
...
Fixes #2063 .
2012-03-28 17:02:54 -07:00
Patrick Walton
18a97d71f9
test: Un-XFAIL regions-mock-trans.rs and regions-mock-trans-impls.rs
2012-03-28 14:31:23 -07:00
Patrick Walton
3c398d28a4
rustc: Universally quantify regions when calling functions. Un-XFAIL regions-addr-of-ret.rs.
2012-03-28 14:24:18 -07:00
Tim Chevalier
ca6636d6b6
Allow references to "self" within classes
...
Allow writing self.f within a class that has a field f. Currently,
the compiler accepts either self.f or f. In a future commit I'll
require writing self.f and not f.
Not sure whether self.f() works if f is a method (making sure that
works next).
2012-03-28 14:19:00 -07:00
Tim Chevalier
edb747ceed
Enforce mutability declarations in classes; correct shapes for classes
...
1. Enforce mutability declarations on class fields. Don't allow any
mutation of class fields not declared as mutable (except inside the
constructor).
2. Handle classes correctly in shape (treat classes like records).
2012-03-27 22:11:58 -07:00
Marijn Haverbeke
064f82d68d
Support returning from loop blocks
...
The code is somewhat invasive, but it seems hard to do this in a
clean way, since the design itself involves a bunch of 'action
at a distance'.
Issue #1819
2012-03-27 12:33:13 +02:00
Graydon Hoare
6e6798c4e1
Bulk-edit mutable -> mut.
2012-03-26 18:35:18 -07:00
Brian Anderson
45a709766c
rustc: Begin eliminating ext's dependency on the session
2012-03-26 17:16:26 -07:00
Tim Chevalier
c282810ab0
Enforce privacy declarations for class fields and methods
2012-03-26 10:00:33 -07:00
Marijn Haverbeke
87e097a853
Disallow ret inside of block functions
...
Also adds proper checking for cont/break being inside a loop.
Closes #1854
Issue #1619
2012-03-26 12:45:47 +02:00
Niko Matsakis
ac4294a176
add test that was failing from tedh
2012-03-24 21:59:16 -07:00
Niko Matsakis
bf9d714d46
Avoid unifying vars when possible; handle bot (more) correctly
2012-03-24 21:38:43 -07:00
Patrick Walton
f507b54f19
test: Rename run-pass/simple-regions.rs to run-pass/regions-simple.rs
...
This groups all the region tests under regions-*.
2012-03-24 19:21:51 -07:00
Tim Chevalier
aae14e352a
Allow methods to call other methods in the same class
2012-03-23 23:10:45 -07:00
Tim Chevalier
bebdfe8ce8
Add another test for cross-crate method calls
2012-03-23 23:10:45 -07:00
Niko Matsakis
f5edb5ee18
xfail-test regions tests
2012-03-23 22:06:39 -07:00
Tim Chevalier
8bbd78075f
Handle self correctly when translating classes
...
This change uses the same code for handling the "self" reference for
classes as is already used for impls/ifaces. This allows removing the
extra maybe_self_id argument (which was just for classes) to trans_closure
that I added before. I also rewrote the translation for class ctors so
that it doesn't generate new AST nodes (instead translating directly).
Also changed visit so that it visits class ctors correctly with visit_fn,
and changed typestate to not do return-checking when visiting a class ctor.
2012-03-23 20:37:50 -07:00
Patrick Walton
cab4f1685b
test: Add a test case that ensures ret &EXPR
works.
2012-03-23 16:18:28 -07:00
Patrick Walton
7592dae949
test: Fix unresolved name in regions-mock-trans-impls.rs
2012-03-23 15:44:37 -07:00
Patrick Walton
c56ec7b02a
test: Add a version of the "mock-trans" regions test case that uses impls
2012-03-23 15:28:47 -07:00
Patrick Walton
b9c4dbeb33
test: Fix leak in regions-mock-trans
2012-03-23 15:17:34 -07:00
Patrick Walton
df77eb433b
test: Fix whitespace at EOL
2012-03-23 15:05:39 -07:00
Patrick Walton
aa0f25ae31
test: Add a trans.rs-workalike test case for regions
2012-03-23 14:42:39 -07:00
Patrick Walton
7931a61ebb
rustc: Redo region inference to be a bit less broken
2012-03-23 12:22:58 -07:00
Marijn Haverbeke
84019aa0dc
Keep an explicit map of things that have to be spilled
...
This prevents us from spilling locals more than once.
Closes #2040
2012-03-23 16:08:01 +01:00
Marijn Haverbeke
894b7469d6
Replace most uses of intrinsics in core with builtins
...
Issue #1981
2012-03-23 10:49:47 +01:00
Tim Chevalier
73a0c17d77
Make cross-crate calls to class methods work
2012-03-22 20:32:47 -07:00
Brian Anderson
f7f1490d6e
rt: Run resource destructors during cycle collection
2012-03-22 19:07:31 -07:00
Niko Matsakis
dc07280b08
make --enforce-mut-vars always on, add mut annotations to remaining files
2012-03-22 09:58:19 -07:00
Tim Chevalier
30c272cb3a
methods work
...
Cross-crate method calls don't work yet. Added
run-pass/class-method-cross-crate to test that, but it's xfailed
References to fields within methods don't work yet. Added
run-pass/class-methods to test that, but it's also xfailed
2012-03-21 13:53:21 -07:00
Niko Matsakis
7cc0f554ae
add test for commit 9502fb99e0
2012-03-21 08:23:31 -07:00
Niko Matsakis
cce2751461
Adjust arena definition to be compatible with placement new
2012-03-21 05:46:31 -07:00
Niko Matsakis
cfcbec3cc3
Implement an initial version of placement new.
2012-03-20 20:39:40 -07:00
Graydon Hoare
084fe56ad5
Conditionalize test to only run double/byte/double test on x64 for now.
2012-03-20 17:34:21 -07:00
Graydon Hoare
faacbb38f0
Xfail struct-return test. x64 ABI is not quite right yet.
2012-03-20 17:13:48 -07:00
Tim Chevalier
b06dc884e5
Class methods WIP
...
In particular, use the ast::method type to represent a class method,
and try to reuse as much iface code as possible. (This makes sense now
since I'll be allowing polymorphic class methods.)
2012-03-20 17:07:07 -07:00
Graydon Hoare
855c99ea75
Some tests for passing and returning structures by value on x64. Close #1402 . Close #1970 .
2012-03-20 16:44:56 -07:00
Brian Anderson
b181ea415e
core: Rename unsafe::leak to unsafe::forget. Closes #2031
2012-03-20 15:20:37 -07:00
Tim Chevalier
e3a1c5c96a
Encode both private and public class fields in metadata
...
This is necessary to calculate the correct offsets for field references.
Simple cross-crate class tests (still with fields only) now pass.
2012-03-16 20:36:07 -07:00
Brian Anderson
154a3fdf44
rustc: Unify impl self types in the opposite order so variance is correct
2012-03-16 17:06:15 -07:00
Tim Chevalier
1680ccce1e
Classes WIP
...
Cross-crate metadata for classes works well enough that programs with
classes in other crates compile successfully, but output wrong results.
Checking in work so far to avoid merge hassles. (Tests are xfailed.)
2012-03-16 15:28:05 -07:00
Niko Matsakis
e399ddbf17
allow binding of fn~, make result fn@. fixes 1899.
2012-03-16 17:48:53 -04:00
Patrick Walton
0972571cdd
test: Add a test case for self regions and typeclass implementations
2012-03-15 18:13:57 -07:00
Brian Anderson
9e480708a2
core:: Eliminate str::sbuf. Replace with *u8
2012-03-14 18:19:08 -07:00
Brian Anderson
3864d6d845
std: Rename the hashmap constructors to conform to new standards
...
Instead of using the new_ prefix just name them after their type
2012-03-14 18:19:08 -07:00
Niko Matsakis
a3d2882ffd
fixup auto_serialize's treatment of nullary variants
2012-03-14 21:05:06 -04:00
Patrick Walton
b516913a5d
test: Remove unsafe from the region tests
2012-03-14 16:18:33 -07:00