Commit Graph

912 Commits

Author SHA1 Message Date
Luqman Aden
eadd358b2a Correct type signature for start lang item. 2013-03-30 19:59:21 -07:00
bors
6dd20c8186 auto merge of #5630 : erickt/rust/serial, r=erickt
@nikomatsakis and I were talking about how the serializers were a bit too complicated. None of the users of With the `emit_option` and `read_option` functions, the serializers are now moving more high level. This patch series continues that trend. I've removed support for emitting specific string and vec types, and added support for emitting mapping types.
2013-03-30 15:42:43 -07:00
Erick Tryzelaar
810c4d8a1e rustc: fix astencode test 2013-03-30 15:04:24 -07:00
Niko Matsakis
6965fe4bce Add AbiSet and integrate it into the AST.
I believe this patch incorporates all expected syntax changes from extern
function reform (#3678). You can now write things like:

    extern "<abi>" fn foo(s: S) -> T { ... }
    extern "<abi>" mod { ... }
    extern "<abi>" fn(S) -> T

The ABI for foreign functions is taken from this syntax (rather than from an
annotation).  We support the full ABI specification I described on the mailing
list.  The correct ABI is chosen based on the target architecture.

Calls by pointer to C functions are not yet supported, and the Rust type of
crust fns is still *u8.
2013-03-29 18:36:20 -07:00
Erick Tryzelaar
0de7635f53 Merge remote-tracking branch 'remotes/origin/incoming' into serial 2013-03-29 17:48:44 -07:00
Erick Tryzelaar
529ae38605 Merge remote-tracking branch 'remotes/origin/incoming' into serial 2013-03-29 17:41:32 -07:00
Patrick Walton
1e91595520 librustc: Remove fail_unless! 2013-03-29 16:39:08 -07:00
Brian Anderson
518c295a03 Register snapshots 2013-03-29 11:30:42 -07:00
Erick Tryzelaar
31563f53d9 Merge remote-tracking branch 'remotes/origin/incoming' into serial 2013-03-29 09:06:36 -07:00
Erick Tryzelaar
90b3658cd6 std: remove Encoder::read_rec and Decoder::emit_rec 2013-03-29 07:05:54 -07:00
bors
5da9e12778 auto merge of #5570 : alexcrichton/rust/fix-unused-imports, r=sanxiyn
Before it wouldn't warn about unused imports in the list if something in the list was used. These commits fix that case, add a test, and remove all unused imports in lists of imports throughout the compiler.
2013-03-29 05:57:44 -07:00
bors
f7a2371c17 auto merge of #5614 : graydon/rust/static-linkage-bug, r=catamorphism
re bug that @nikomatsakis was hitting: when you define a `static` (old: `const`) containing a `&` or `&[]` expression, it will create temporaries (the underlying pointee) by creating a throwaway symbol for each temporary, each with _global_ linkage, and each named `"const"`. LLVM will helpfully rename multiple copies of this throwaway symbol to `"const1"` and `"const2"` and so forth in the _same_ library. But if you have _2 libraries_ -- say, libcore and librustc -- that both do this, the dynamic linker (at least on linux) will happily do horrible things like make the slice in one library point to the bytes of the vector from the other library. This is obviously a recipe for much hilarity and head-scratching.

The solution is to change the linkage to something else, internal or (in the case of this patch) _private_.

It will require a snapshot to integrate this into stage0 and thereby fix the problem / unblock patches that were hitting this in stage1.
2013-03-28 21:48:49 -07:00
Alex Crichton
be57d745d2 Removing unused imports 2013-03-28 23:56:46 -04:00
Alex Crichton
cc83049a56 Fix warning about unused imports in import lists
Before, if anything in a list was used, the entire list was considered to be
used. This corrects this and also warns on a span of the actual unused import
instead of the entire list.
2013-03-28 23:56:45 -04:00
bors
f81459211d auto merge of #5593 : luqmana/rust/inline-asm, r=catamorphism
Clean things up a bit. Also, allow selecting intel syntax in addition to the default AT&T dialect.
2013-03-28 18:18:46 -07:00
Graydon Hoare
1163f69c84 rustc: fix linkage of internal static nodes. 2013-03-28 18:15:35 -07:00
Luqman Aden
a3996c1626 Tidy. 2013-03-28 16:34:10 -07:00
Patrick Walton
0a002d79b4 librustc: Remove common fields and nested enums from the language 2013-03-28 11:30:01 -07:00
bors
3dbf2c3c5c auto merge of #5592 : pcwalton/rust/xc-extern-statics, r=pcwalton 2013-03-28 03:51:51 -07:00
bors
d31053277a auto merge of #5586 : pcwalton/rust/expr-repeat-vstore, r=graydon
r? @graydon
2013-03-28 01:33:48 -07:00
bors
d7ba0acbf5 auto merge of #5579 : dbaupp/rust/rustc-typo-limit, r=catamorphism
Impose a limit so that the typo suggester only shows reasonable
suggestions (i.e. don't suggest `args` when the error is `foobar`).

A tiny bit of progress on #2281.
2013-03-27 23:10:19 -07:00
bors
84ddff3909 auto merge of #5578 : erickt/rust/incoming, r=jbclements,erickt
Hey folks,

This patch series does some work on the json decoder, specifically with auto decoding of enums. Previously, we would take this code:

```
enum A {
    B,
    C(~str, uint)
}
```

and would encode a value of this enum to either `["B", []]` or `["C", ["D", 123]]`. I've changed this to `"B"` or `["C", "D", 123]`. This matches the style of the O'Caml json library [json-wheel](http://mjambon.com/json-wheel.html). I've added tests to make sure all this work.

In order to make this change, I added passing a `&[&str]` vec to `Decode::emit_enum_variant` so the json decoder can convert the name of a variant into it's position. I also changed the impl of `Encodable` for `Option<T>` to have the right upper casing.

I also did some work on the parser, which allows for `fn foo<T: ::cmp::Eq>() { ... }` statements (#5572), fixed the pretty printer properly expanding `debug!("...")` expressions, and removed `ast::expr_vstore_fixed`, which doesn't appear to be used anymore.
2013-03-27 21:51:53 -07:00
Andrew Paseltiner
f02ee42a86 derive Eq and Clone impls where applicable 2013-03-27 22:04:23 -04:00
Luqman Aden
63df1e9085 librustc: remove already addressed XXX 2013-03-27 16:29:32 -07:00
Luqman Aden
778f84524b librustc: add default per arch clobbers for asm. 2013-03-27 15:41:58 -07:00
Luqman Aden
b867fe41de libsyntax: Allow selecting intel style asm. 2013-03-27 15:41:58 -07:00
Luqman Aden
203d691a6b libsyntax: use a struct for inline asm in ast. 2013-03-27 15:41:58 -07:00
Luqman Aden
727a565f1e librustc: Move inline asm stuff to different mod. 2013-03-27 15:41:58 -07:00
Patrick Walton
58338dd3d0 librustc: Fix ICE with cross-crate extern statics. rs=bugfix 2013-03-27 15:41:43 -07:00
Patrick Walton
70b56fa5e9 librustc: Allow expr_repeat to be used with any vstore 2013-03-27 14:13:07 -07:00
Patrick Walton
e5dda811a9 librustc: Allow expr_repeat to be used with any vstore 2013-03-27 13:53:03 -07:00
bors
995425badb auto merge of #5558 : nikomatsakis/rust/issue-4920-autoref-index-operator, r=nikomatsakis
Per discussion on IRC.

r? @pcwalton
2013-03-27 13:27:58 -07:00
Niko Matsakis
2a74fda316 Fix pretty-printer test failure by carrying the bound lifetime names through
the types.  Initially I thought it would be necessary to thread this data
through not only the AST but the types themselves, but then I remembered that
the pretty printer only cares about the AST.  Regardless, I have elected to
leave the changes to the types intact since they will eventually be needed.  I
left a few FIXMEs where it didn't seem worth finishing up since the code wasn't
crucial yet.
2013-03-27 11:35:04 -07:00
Niko Matsakis
069529bc5c Autoref the argument to the index operator (#4920) 2013-03-27 13:04:03 -04:00
Huon Wilson
ab5346d119 librustc: Limit the typo suggestions to reasonable suggests.
Impose a limit so that the typo suggester only shows reasonable
suggestions (i.e. don't suggest `args` when the error is `foobar`).
2013-03-28 02:19:40 +11:00
Erick Tryzelaar
83e831bc22 syntax: Remove deprecated expr_vstore_fixed 2013-03-27 07:04:16 -07:00
Erick Tryzelaar
7a199d41a9 syntax: fix pretty printing __log stmts 2013-03-27 07:04:15 -07:00
Erick Tryzelaar
4d6dcefcbb std: Decode::read_enum_variant should pass in the variant names
Because the json::Decoder uses the string variant name, we need a
way to correlate the string to the enum index. This passes in a
static &[&str] to read_enum_variant, which allows the json::Decoder
to know which branch it's trying to process.
2013-03-27 07:04:13 -07:00
Niko Matsakis
2c17ff7dbc Simplify and remove unnecessary use of ast_map 2013-03-27 07:10:04 -04:00
Niko Matsakis
aa67deff33 remove sty_by_ref, though traces still remain due to dtors 2013-03-27 07:09:16 -04:00
Patrick Walton
f41a510631 librustc: Remove obsolete syntax 2013-03-26 21:30:18 -07:00
Patrick Walton
0a4d0f37ca librustc: Enforce that extern mod directives come first, then use directives, then items.
Resolve them in this order as well.
2013-03-26 21:30:17 -07:00
Patrick Walton
8b56a8380b librustc: Modify all code to use new lifetime binder syntax 2013-03-26 21:30:17 -07:00
Patrick Walton
15688eaf28 librustc: Require explicit lifetime binders 2013-03-26 21:29:35 -07:00
Patrick Walton
3b2fcf9f59 librustc: Fix bug with newtype structs containing dtors 2013-03-26 21:29:35 -07:00
Patrick Walton
a376f46862 librustc: Stop parsing [T * N]. 2013-03-26 21:29:35 -07:00
Patrick Walton
142dbd65da librustc: Remove all uses of the old [T * N] fixed-length vector syntax 2013-03-26 21:29:34 -07:00
Daniel Micay
34c5a09ce3 option: rm functions that duplicate methods 2013-03-26 22:44:40 -04:00
Alex Crichton
dbe1354321 Move ast_map::map to LinearMap 2013-03-26 19:21:05 -04:00
Alex Crichton
17459d0bd3 rustc: Purge of HashMap, fixing segfaulting cases
Various FIXME comments added around to denote copies which when removed cause
the compiler to segfault at some point before stage2. None of these copies
should even be necessary.
2013-03-26 19:21:04 -04:00
Alex Crichton
6f812fef1b rustc: Remove uses of oldmap::HashMap 2013-03-26 19:21:04 -04:00
Alex Crichton
fa7772893a Remove unused imports throughout 2013-03-26 19:20:02 -04:00
bors
3d588c5286 auto merge of #5555 : Kimundi/rust/str-dealloc-3, r=catamorphism
- Most functions that used to return `~[~str]` for a list of substrings got turned into iterators over `&str` slices
- Some cleanup of apis, docs and code layout
2013-03-26 15:07:07 -07:00
Niko Matsakis
3ca7c225e5 Stop writing directly to the final type/method/vtable sidetables from astconv
and from typeck, which is verboten.  We are supposed to write inference results
into the FnCtxt and then these get copied over in writeback.  Add assertions
that no inference by-products are added to this table.

Fixes #3888
Fixes #4036
Fixes #4492
2013-03-26 15:39:12 -04:00
Niko Matsakis
6f2783d515 Add various debug statements to trans that I used to help track down the
problem and which seem like they could be useful in the future.
2013-03-26 15:16:58 -04:00
Niko Matsakis
e11d13f3de Rip out old code that still structured method calls as a
expr_call(expr_field(...)) rather than an expr_method_call.
There is probably more such code in trans that should be removed.
2013-03-26 15:16:58 -04:00
Niko Matsakis
5f52669296 Fix #4855: handle bot in regionck 2013-03-26 14:12:13 -04:00
Marvin Löbel
b9de2b5787 Switched over a bunch of splitting funktions to non-allocating iterators 2013-03-26 14:59:17 +01:00
bors
74fb263f7a auto merge of #5546 : nikomatsakis/rust/ty_region-useful-span, r=catamorphism
r? @catamorphism
2013-03-26 06:58:10 -07:00
bors
47ddb59b80 auto merge of #5525 : dbaupp/rust/minor_fixups, r=graydon
Kills some warnings, and implements str::each_char_reverse so that it actually iterates. The test case wasn't detecting a failure, since the loop body was never executed.
2013-03-25 21:18:57 -07:00
bors
02d5f090dc auto merge of #5524 : luqmana/rust/repeat-loop, r=pcwalton
`let v = [24, ..1000];` now more or less emits the same IR as:

```Rust
let mut i = 0;
while i < 1000 {
    v[i] = 24;
    i += 1;
}
```

LLVM will still turn it into a memset if possible with optimization on.
2013-03-25 20:16:01 -07:00
bors
b48e6998d7 auto merge of #5509 : thestinger/rust/oldmap, r=brson
The reasoning for doing it this way is that it's much easier to transition method-by-method to the `Map` API than trying to do the migration all at once.

I found an issue unrelated to my changes in one of the run-fail tests - if it uses `LinearMap`, it still fails but exits with 0. I xfailed it for now and opened [an issue](https://github.com/mozilla/rust/issues/5512), because it's not caused by these changes.
2013-03-25 18:01:04 -07:00
Luqman Aden
e7f42f140b Expand on cleanups in trans for expr_repeat and add to tests. 2013-03-25 15:46:10 -07:00
Niko Matsakis
057c40d5bd make ty_region give a useful span when it fails 2013-03-25 17:39:15 -04:00
Huon Wilson
89a7407c99 librustc: clean-up expr_repeat loop generation: use native integers 2013-03-24 14:19:31 -07:00
Huon Wilson
12df65470f Kill some warnings: unused imports and old #[deny(..)]s. 2013-03-25 01:17:23 +11:00
Luqman Aden
441313fc0c librustc: emit loop for expr_repeat instead of 2n instructions in [x, ..n] 2013-03-24 00:59:44 -07:00
bors
a56ec8c134 auto merge of #5515 : nikomatsakis/rust/issue-5514-flexible-coherence-rules, r=pcwalton
See issue #5514

r? @pcwalton
2013-03-23 12:36:53 -07:00
Niko Matsakis
a1b4afe067 Update coherence rules to be more flexible for impl Trait for Type 2013-03-23 09:49:47 -04:00
Daniel Micay
11ca2efce1 turn std::oldmap into a wrapper around LinearMap 2013-03-23 02:16:14 -04:00
Patrick Walton
6d81307a9b librustc: Add explicit lifetime binders and new lifetime notation in core/std/syntax/rustc 2013-03-22 22:24:35 -07:00
Patrick Walton
85c9fc6f8f librustc: Remove the const declaration form everywhere 2013-03-22 22:24:35 -07:00
bors
e9b077c0e9 auto merge of #5488 : pcwalton/rust/depure, r=pcwalton 2013-03-22 13:00:56 -07:00
Patrick Walton
e7c60c141b librustc: Remove pure from libsyntax and librustc. 2013-03-22 12:57:27 -07:00
bors
b6f9aa1fd7 auto merge of #5483 : pcwalton/rust/static-syntax, r=graydon
r? @nikomatsakis
2013-03-22 11:21:48 -07:00
Patrick Walton
4634f7edae librustc: Remove all uses of static from functions. rs=destatic 2013-03-22 10:27:39 -07:00
Alex Crichton
c0bbc6242f Removing some unused imports 2013-03-22 11:49:45 -04:00
Andrew Paseltiner
9966eaaba4 rustc: replace uses of old deriving attribute with new one 2013-03-22 06:24:19 -04:00
bors
9584c60871 auto merge of #5484 : pcwalton/rust/snapshots, r=pcwalton 2013-03-22 00:00:50 -07:00
bors
d52408d46a auto merge of #5480 : pcwalton/rust/at-const, r=pcwalton
r? @catamorphism
2013-03-21 20:39:51 -07:00
Patrick Walton
e7dbe6cd6f librustc: Register new snapshots 2013-03-21 18:10:20 -07:00
Patrick Walton
94327d00c6 librustc: Replace the &static bound with 'static 2013-03-21 17:31:35 -07:00
Patrick Walton
d4fee24c7c librustc: Forbid destructors from being attached to any structs that might contain non-Owned fields. r=nmatsakis 2013-03-21 17:31:34 -07:00
Marvin Löbel
0a47cd5ef1 Un-renamed trim and substr functions. 2013-03-21 23:06:05 +01:00
Marvin Löbel
ee2f3d9673 Switched over substr and trim functions in str to be non-allocating, temporary renamed them to better track use-sites 2013-03-21 23:06:04 +01:00
bors
6aa612a909 auto merge of #5461 : catamorphism/rust/flagless, r=nikomatsakis
r? @nikomatsakis The typechecker previously passed around a boolean return flag to
indicate whether it saw something with type _|_ (that is, something
it knows at compile-time will definitely diverge) and also had some
manual checks for the `ty_err` pseudo-type that represents a previous
type error. This was because the typing rules implemented by the
typechecker didn't properly propagate _|_ and ty_err. I fixed it.

This also required changing expected error messages in a few tests,
as now we're printing out fewer derived errors -- in fact, at this
point we should print out no derived errors, so report any that
you see (ones that include "[type error]") as bugs.
2013-03-21 11:46:00 -07:00
Tim Chevalier
f36f9fc91c rustc: Comments only - explain the invariant about ty_err and ty_bot a little 2013-03-21 11:32:57 -07:00
Patrick Walton
5726fd4526 librustc: Forbid access to cross-crate private static methods 2013-03-21 09:47:17 -07:00
bors
56d288d0dc auto merge of #5464 : luqmana/rust/const-pat, r=pcwalton
r? @pcwalton
2013-03-21 08:49:13 -07:00
bors
b8899138f8 auto merge of #5466 : Kimundi/rust/view-slice-rename, r=bstrie
A slice now always refers to something that returns an borrowed pointer, views don't exist anymore. If you want to have an explictit copy of a slice, use `to_owned()`
2013-03-21 07:06:54 -07:00
bors
0b4f2687ce auto merge of #5470 : sanxiyn/rust/remove-oldmap-2, r=sanxiyn
Referencing #4986.
2013-03-21 06:15:58 -07:00
Seo Sanghyeon
e2b9cddbbb Switch impls_seen from oldmap 2013-03-21 22:11:30 +09:00
Marvin Löbel
9d9a209e9a back-renamed slice_DBG_BRWD, slice_V_DBG_BRWD -> slice, slice_DBG_UNIQ -> slice_unique 2013-03-21 14:05:57 +01:00
Seo Sanghyeon
f0beb8c059 Switch CoherenceInfo from oldmap 2013-03-21 20:55:28 +09:00
Seo Sanghyeon
dad5c3029d Time type checking passes separately 2013-03-21 19:28:58 +09:00
bors
3ac89737ca auto merge of #5465 : sanxiyn/rust/remove-oldmap, r=sanxiyn
Improves resolve by 20% as measured by time-passes on rustc.
2013-03-21 01:21:51 -07:00
Seo Sanghyeon
f68f2282c1 Switch Module.import_resolutions from oldmap 2013-03-21 17:10:57 +09:00
Luqman Aden
2ed80c35e2 librustc: Fix path-qualified and cross-crate constants in match patterns. 2013-03-21 00:38:30 -07:00
Seo Sanghyeon
e84323e9b8 Switch Module.children from oldmap 2013-03-21 16:26:38 +09:00
Tim Chevalier
db00362313 Make typechecker compositional
The typechecker previously passed around a boolean return flag to
indicate whether it saw something with type _|_ (that is, something
it knows at compile-time will definitely diverge) and also had some
manual checks for the `ty_err` pseudo-type that represents a previous
type error. This was because the typing rules implemented by the
typechecker didn't properly propagate _|_ and ty_err. I fixed it.

This also required changing expected error messages in a few tests,
as now we're printing out fewer derived errors -- in fact, at this
point we should print out no derived errors, so report any that
you see (ones that include "[type error]") as bugs.
2013-03-20 19:44:38 -07:00
Marvin Löbel
a7d296f24c renamed str::view -> slice_DBG_BRWD
renamed str::slice -> slice_DBG_UNIQ
changed vec slice method -> to_owned()
renamed vec view method  -> slice_V_DBG_BRWD
2013-03-21 01:50:32 +01:00
bors
6f3d1686b2 auto merge of #5447 : erickt/rust/incoming, r=graydon
This normalizes the how we call reverse iteration functions. It also adds a char_len method, and a method to iterate backwards over a string.
2013-03-20 15:30:50 -07:00
bors
99ac243e7b auto merge of #5445 : nikomatsakis/rust/issue-3678-refactor-trans_call, r=graydon
Refactor trans_call to separate out the translation of the arguments, environment, and return pointer.  Towards #3678.  r? @brson
2013-03-20 13:15:58 -07:00
bors
0847d52a86 auto merge of #5450 : pcwalton/rust/warnings, r=graydon
r? @graydon
2013-03-20 11:52:09 -07:00
Patrick Walton
e72d011f68 librustc: Remove debug code and add scary warnings for rusti/rustpkg 2013-03-20 11:44:01 -07:00
Niko Matsakis
ad70c748c3 Apply explicit self transformation before we enter check_fn 2013-03-20 06:17:03 -04:00
Niko Matsakis
00f97b9fb0 Refactor the self-info so that the def-id is carried in ty_self()
and the fn_ctxt doesn't need any self_info field at all.

Step towards fixing `fn(&self)` (cc #4846) to have a distinct
lifetime.
2013-03-20 06:14:53 -04:00
bors
db4dc1ffe2 auto merge of #5443 : alexcrichton/rust/less-bad-copy, r=catamorphism
Removes a lot of instances of `/*bad*/ copy` throughout libsyntax/librustc. On the plus side, this shaves about 2s off of the runtime when compiling `librustc` with optimizations.

Ideally I would have run a profiler to figure out which copies are the most critical to remove, but in reality there was a liberal amount of `git grep`s along with some spot checking and removing the easy ones.
2013-03-20 00:09:47 -07:00
Alex Crichton
3fac7cce8f rustc: Remove some bad copies throughout 2013-03-20 01:28:32 -04:00
bors
f3c879fdd8 auto merge of #5442 : pcwalton/rust/extern-block-restriction, r=pcwalton
r? @graydon
2013-03-19 21:57:49 -07:00
Erick Tryzelaar
fe74a1c9a2 core: rename vec::rev_each{,i} to vec::each{,i}_reverse
I'm making this change because the _reverse suffix is more commonly
used in libcore/libstd.
2013-03-19 20:24:04 -07:00
Patrick Walton
2e7ec80bcc librustc: Enforce privacy for static methods.
This starts moving a bunch of privacy checks into the privacy
checking phase and out of resolve.
2013-03-19 13:40:48 -07:00
bors
e1888948c6 auto merge of #5426 : nikomatsakis/rust/issue-4846-lifetimes-in-expl-self, r=pcwalton
(this will be needed for snapshotting at some point)

r? @pcwalton
2013-03-19 12:43:14 -07:00
bors
a14ec73cd2 auto merge of #5356 : jld/rust/enum-less-magic, r=graydon
Fixes #1645.
2013-03-19 11:43:10 -07:00
Niko Matsakis
e821671989 Refactor trans_call to separate out the translation of the arguments, environment, and return pointer 2013-03-19 14:40:34 -04:00
Luqman Aden
8b66578e66 Allow expressions that are not just a single value for repeated fixed length vector syntax. 2013-03-18 17:31:41 -07:00
Luqman Aden
787f5bb0db Now actually allow using constants in those constant expressions for [T * n]. 2013-03-18 17:31:41 -07:00
Luqman Aden
42f95d055c Allow constant expressions in [Type * n]. 2013-03-18 17:31:41 -07:00
Patrick Walton
e78f2e2ac5 librustc: Make the compiler ignore purity.
For bootstrapping purposes, this commit does not remove all uses of
the keyword "pure" -- doing so would cause the compiler to no longer
bootstrap due to some syntax extensions ("deriving" in particular).
Instead, it makes the compiler ignore "pure". Post-snapshot, we can
remove "pure" from the language.

There are quite a few (~100) borrow check errors that were essentially
all the result of mutable fields or partial borrows of `@mut`. Per
discussions with Niko I think we want to allow partial borrows of
`@mut` but detect obvious footguns. We should also improve the error
message when `@mut` is erroneously reborrowed.
2013-03-18 17:21:16 -07:00
Patrick Walton
c4db4faefa libsyntax: Stop parsing old lifetimes, except for the ones on data type declarations. 2013-03-18 17:21:15 -07:00
Patrick Walton
352c070365 librustc: Convert all uses of old lifetime notation to new lifetime notation. rs=delifetiming 2013-03-18 17:21:14 -07:00
Niko Matsakis
a6187c62e9 Make &self permit explicit lifetimes, but don't really use them
(this will be needed for snapshotting at some point).
2013-03-18 15:03:37 -04:00
Luqman Aden
83f2d4ab3d Fix type_use for inline asm. 2013-03-15 18:57:19 -07:00
Luqman Aden
d68b98a5bf Don't use by_val for passing asm operands. 2013-03-15 18:55:44 -07:00
Luqman Aden
3d56936be3 Tidy. 2013-03-15 18:55:44 -07:00
Luqman Aden
e182ac4bbd Actually use no or multiple operands properly. 2013-03-15 18:55:44 -07:00
Luqman Aden
9ead7dad93 Implicitly use addr_of for output operands in asm. 2013-03-15 18:55:44 -07:00
Luqman Aden
59dcbd9f1c Initial support for output operands in asm. 2013-03-15 18:55:44 -07:00
Luqman Aden
d8ab47e7f9 Properly handle input operands for inline asm. 2013-03-15 18:55:43 -07:00
Luqman Aden
6d078db952 Actually pass inline asm operands around. 2013-03-15 18:55:43 -07:00
Luqman Aden
471d2b1765 Inline asm exprs should be RvalueStmtExpr. 2013-03-15 18:55:43 -07:00
Patrick Walton
1c8490b0d9 librustc: Remove another deprecated use of as Trait. rs=burningtree 2013-03-14 08:03:05 -07:00
Patrick Walton
aa4c19b6ab librustc: Allow path-qualified constants in patterns 2013-03-13 20:07:11 -07:00
Patrick Walton
8fa66e8e07 librustc: Remove implicit self from the language, except for old-style drop blocks. 2013-03-13 20:07:10 -07:00
Patrick Walton
a410652bc9 librustc: Remove "base types" from the language. 2013-03-13 20:07:09 -07:00
Patrick Walton
b85158e23a librustc: Remove overloaded operator autoderef. 2013-03-13 20:07:09 -07:00
Patrick Walton
b1c699815d librustc: Don't accept as Trait anymore; fix all occurrences of it. 2013-03-13 20:07:09 -07:00
Patrick Walton
24a0de4e7f librustc: Separate out trait storage from evec/estr storage 2013-03-13 20:07:08 -07:00
ILyoan
688c4c403d Remove unused import in librustc 2013-03-14 09:52:51 +09:00
ILyoan
1095bbe5eb Remove unused variable 2013-03-14 09:52:51 +09:00
bors
ab5472a724 auto merge of #5307 : nikomatsakis/rust/remove-by-val, r=nikomatsakis
This is done in two steps:

First, we make foreign functions not consider modes at all.  This is because previously ++ mode was the only way to pass structs to foreign functions and so forth.  We also add a lint mode warning if you use `&&` mode in a foreign function, since the semantics of that change (it used to pass a pointer to the C function, now it doesn't).

Then, we remove by value and make it equivalent to `+` mode.  At the same time, we stop parsing `-` mode and convert all uses of it to `+` mode (it was already being parsed to `+` mode anyhow).

This obsoletes pull request #5298.

r? @brson
2013-03-13 14:57:55 -07:00
Niko Matsakis
852619d5d7 Remove ++ mode from the compiler (it is parsed as + mode)
and obsolete `-` mode altogether (it *was* parsed as `+` mode).
2013-03-13 17:00:09 -04:00
Niko Matsakis
efc7f82bc4 Revamp foreign code not to consider the Rust modes. This requires
adjusting a few foreign functions that were declared with by-ref
mode.  This also allows us to remove by-val mode in the near future.

With copy mode, though, we have to be careful because Rust will implicitly pass
somethings by pointer but this may not be the C ABI rules.  For example, rust
will pass a struct Foo as a Foo*.  So I added some code into the adapters to
fix this (though the C ABI rules may put the pointer back, oh well).

This patch also includes a lint mode for the use of by-ref mode
in foreign functions as the semantics of this have changed.
2013-03-13 16:59:37 -04:00
bors
67b0f3d5b2 auto merge of #5339 : catamorphism/rust/less-copy, r=catamorphism 2013-03-13 13:57:56 -07:00
bors
7e6020db63 auto merge of #5319 : brson/rust/debuginfo, r=brson
Continuing #5140 

For the sake of getting this merged I've disabled debuginfo tests on mac (where running gdb needs root). Please feel free to follow up with further improvements.
2013-03-13 11:34:00 -07:00
bors
695e9fd13c auto merge of #5293 : brson/rust/logging, r=brson
r? @graydon

This removes `log` from the language. Because we can't quite implement it as a syntax extension (probably need globals at the least) it simply renames the keyword to `__log` and hides it behind macros.

After this the only way to log is with `debug!`, `info!`, etc. I figure that if there is demand for `log!` we can add it back later.

I am not sure that we ever agreed on this course of action, though I *think* there is consensus that `log` shouldn't be a statement.
2013-03-13 10:40:07 -07:00
Jed Davis
a301db7eef Represent enums with regular structs; no more alignment-breaking casts. 2013-03-13 10:25:49 -07:00
Tim Chevalier
f9269a1bda rustc: One Less Bad Copy 2013-03-12 10:04:35 -07:00
Luqman Aden
18b71a7831 Add alignstack option for inline asm. 2013-03-12 01:03:35 -07:00
Luqman Aden
7f500ab4c1 Keep everything tidy. 2013-03-12 01:03:34 -07:00
Luqman Aden
5aa734d6a1 Parse operands properly and add a way to indicate volatile asm. 2013-03-12 01:03:34 -07:00
Luqman Aden
bcc6c3e3db Require unsafe block for inline assembly. 2013-03-12 01:03:34 -07:00
Luqman Aden
fc78b93c41 Wrap llvm::InlineAsm::AsmDialect 2013-03-12 01:03:34 -07:00
Luqman Aden
ecccc0d649 Parse inline assembly. 2013-03-12 01:03:34 -07:00
Brian Anderson
82f190355b Remove uses of log 2013-03-11 23:19:42 -07:00
bors
9b9ffd5b41 auto merge of #5304 : jld/rust/const-adjustments, r=graydon
These changes make const translation use adjustments (autodereference, autoreference, bare-fn-to-closure), like normal code does, replacing some ad-hoc logic that wasn't always right.

As a convenient side-effect, explicit dereference (both of pointers and of newtypes) is also supported in const expressions.

There is also a “bonus fix” for a bug in the pretty-printer exposed by one of the added tests.
2013-03-11 21:12:43 -07:00
Brian Leibig
c978025d0d Debuginfo revamp 2013-03-11 14:09:06 -07:00
bors
ce24ebb858 auto merge of #5314 : jld/rust/adt-simplification, r=pcwalton
Struct and enum representations have some complicatedness that's no longer needed.  Now that everything's in one place and has access to anything we'd want to know about the type, flatten some of that out.  Slight changes to representations in some cases.
2013-03-11 11:54:49 -07:00
Patrick Walton
08c840205e librustc: Lint the old drop destructor notation off 2013-03-11 09:36:00 -07:00
Patrick Walton
7353568cd8 librustc: Remove old-style operator overloading 2013-03-11 09:36:00 -07:00
Patrick Walton
dc4869945c librustc: Remove newtype enums from librustc 2013-03-11 09:35:59 -07:00
Patrick Walton
d18f785457 librustc: Replace all uses of fn() with &fn(). rs=defun 2013-03-11 09:35:58 -07:00
Seo Sanghyeon
9e85589ad3 Implement vector destructuring from tail 2013-03-11 19:01:51 +09:00
Jed Davis
9eaa608b04 Get rid of the Unit enum representation.
The only thing we really lose is that C-like enums with one variant and a
non-zero discriminant now take up space, but I do not think this is a
common usage.  As previously noted, that was mostly there for
transitional compatibility with the pre-adt.rs codebase.
2013-03-11 00:01:04 -07:00
Jed Davis
e6b5e00ea2 Simplify struct representation.
Out goes the extra layer of struct wrapping; the destructedness flag is
added to the end of the struct.  This means that, if the struct
previously had alignment padding at the end, the flag will live there
instead of increasing the struct size.
2013-03-10 23:57:38 -07:00
Niko Matsakis
62aa8d7de9 Simplify the interface to check_fn by pulling some of the madness out to its callers 2013-03-10 15:05:22 -04:00
Jed Davis
1df0a0ba0f Const dereference works now, so allow it. 2013-03-09 17:40:59 -08:00
Jed Davis
122e4a28b8 Don't copy const data to do an autoderef+autoref. 2013-03-09 17:40:59 -08:00
Jed Davis
e42afd3129 Let const_deref "dereference" newtypes. 2013-03-09 17:40:59 -08:00
Jed Davis
5ca1d353de Implement most of adjustment handling for consts.
Changes the ad-hoc closure adjustment into using adjustment info instead
of being separately driven from types, and likewise for autoderef.

Also takes care of autoref (the cases we should be seeing in consts,
at least, since we can't be doing method calls which would need the
ref-to-vec mode), which didn't quite work right previously.

However, "dereference" of a newtype isn't handled yet....
2013-03-09 17:40:59 -08:00
Jed Davis
5571ca9b21 Break out const_addr_of. 2013-03-09 17:40:59 -08:00
Niko Matsakis
7cbd4b20ee Remove @ast::Region and replace with @ast::Lifetime.
Modify pretty-printer to emit lifetimes and fix a few minor
parser bugs that this uncovered.
2013-03-09 19:43:59 -05:00
Ben Striegel
fdf69dd7b0 Finish de-implicit-selfing everything but the test suite 2013-03-08 19:34:39 -05:00
Alex Crichton
2c87920f52 test: Removing dvec uses 2013-03-08 09:54:41 -05:00
Alex Crichton
2a72099063 rustc: Remove uses of DVec 2013-03-08 09:54:20 -05:00
Patrick Walton
d661711cc2 test: Fix tests. 2013-03-07 22:37:58 -08:00
Patrick Walton
9a17ef9b52 librustc: Stop parsing assert. 2013-03-07 22:37:57 -08:00
Patrick Walton
d7e74b5e91 librustc: Convert all uses of assert over to fail_unless! 2013-03-07 22:37:57 -08:00
Patrick Walton
0ea031bcb8 librustc: Remove record patterns from the compiler 2013-03-07 22:37:03 -08:00
Patrick Walton
954ae9c975 libsyntax: Remove struct literal expressions from the compiler 2013-03-07 22:32:55 -08:00
Patrick Walton
4e3dbfe052 librustc: Remove structural record types from the compiler 2013-03-07 22:32:54 -08:00
Patrick Walton
239e64242c libsyntax: Stop parsing structural record types 2013-03-07 22:32:52 -08:00
Josh Matthews
27668fbfab Allow casting integers to unsafe pointers in constant expressions. 2013-03-07 15:36:55 -05:00
Josh Matthews
7bb03345cf Inline constants across crates. 2013-03-07 15:34:52 -05:00
Josh Matthews
50277ec555 Permit casting region pointers to unsafe ones. 2013-03-07 14:48:28 -05:00
Jed Davis
a69ec175f8 GC now-unused imports 2013-03-06 20:41:58 -08:00
Jed Davis
1f9bc64bae adt.rs renaming: "field" rather than "element"; set_discr -> start_init.
This way "field" refers to the abstraction and "element" (as in get_elt,
"get element pointer", etc.) refers to the low-level LLVM operations.
2013-03-06 20:41:58 -08:00
Jed Davis
e13111fc5a Even more comments for ADT-related interfaces 2013-03-06 20:41:58 -08:00
Jed Davis
6840b48074 trans_cast_to_int is hard to explain; make it trans_get_discr instead. 2013-03-06 20:41:58 -08:00
Jed Davis
8dca7be1df A little more cosmetic cleanup 2013-03-06 20:41:58 -08:00
Jed Davis
d6acb96c9c Add lots of comments to adt.rs, and some minor cleanup. 2013-03-06 20:41:58 -08:00
Jed Davis
a9026c7f19 Memoize trans::adt::represent_type 2013-03-06 20:41:58 -08:00
Jed Davis
a8237a46f1 Bonus Fix: typarams are no longer inhabited 2013-03-06 20:41:58 -08:00
Jed Davis
8105da8067 GC the now-unused old layout helpers 2013-03-06 20:41:58 -08:00
Jed Davis
b6bcf1a81f Finish removing struct layout dependencies from glue. 2013-03-06 20:41:58 -08:00
Jed Davis
71b6e945c1 glue::trans_struct_drop -> adt 2013-03-06 20:41:58 -08:00
Jed Davis
5ca4fdfc98 Convert trans_tuple_struct to trans::adt.
Surely this cannot be the best way to get the type.
2013-03-06 20:41:57 -08:00
Jed Davis
29d0430c56 Convert iter_structural_ty to trans::adt 2013-03-06 20:41:57 -08:00
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