Commit Graph

225 Commits

Author SHA1 Message Date
Jakub Wieczorek
9b9cce2316 Add scaffolding for assigning alpha-numeric codes to rustc diagnostics 2014-07-11 00:32:00 +02:00
Richo Healey
12c334a77b std: Rename the ToStr trait to ToString, and to_str to to_string.
[breaking-change]
2014-07-08 13:01:43 -07:00
bors
6959931498 auto merge of #15508 : jakub-/rust/struct-pattern-witness, r=alexcrichton 2014-07-08 04:21:40 +00:00
bors
c175ed4425 auto merge of #15440 : pcwalton/rust/struct-aliases, r=brson
Closes #4508.

r? @nick29581
2014-07-07 21:01:42 +00:00
Jakub Wieczorek
947942e42c Improve non-exhaustive pattern witnesses for structs with multiple fields 2014-07-07 22:00:34 +02:00
Jakub Wieczorek
9f460e7af8 Properly bind nested pattern bindings when there's more than one
Fixes #15488.
2014-07-07 00:26:41 +02:00
Jakub Wieczorek
1aa23b8e1c Fix #15453 2014-07-05 16:32:13 +02:00
Patrick Walton
aaaf7e00ec librustc: Accept type aliases for structures in structure literals and
structure patterns.

Closes #4508.
2014-07-04 17:07:31 -07:00
Jakub Wieczorek
c2c27faa35 Fix #12285
Unit-like struct patterns are irrefutable, no need for a branch.
2014-07-04 00:29:47 +02:00
Jakub Wieczorek
6b6edf4702 Improve code reuse between trans/_match.rs and check_match.rs
The specialization logic for patterns is really the same in both
exhaustiveness/reachability checking and codegen.
2014-07-03 09:17:47 +02:00
Jakub Wieczorek
9b3f9d9444 Change exhaustiveness analysis to permit multiple constructors per pattern
Slice patterns are different from the rest in that a single slice pattern
does not have a distinct constructor if it contains a variable-length subslice
pattern. For example, the pattern [a, b, ..tail] can match a slice of length 2, 3, 4
and so on.

As a result, the decision tree for exhaustiveness and redundancy analysis should
explore each of those constructors separately to determine if the pattern could be useful
when specialized for any of them.
2014-07-02 18:27:12 +02:00
Patrick Walton
75146fd59c librustc: Check function argument patterns for legality of by-move
bindings.

This will break code that incorrectly did things like:

    fn f(a @ box b: Box<String>) {}

Fix such code to not rely on undefined behavior.

Closes #12534.

[breaking-change]
2014-06-24 17:23:41 -07:00
Jakub Wieczorek
c484c2d1f8 Fix #15129
Add support for unit literals to const_eval.
2014-06-24 17:22:48 -07:00
bors
9a583bb931 auto merge of #15086 : jakub-/rust/xc-struct-variants-match, r=alexcrichton
Turns out field names of struct variants are not encoded in crate metadata.
2014-06-23 09:16:36 +00:00
Jakub Wieczorek
26e692dd39 Fix spurious non-exhaustive errors for cross-crate struct variants 2014-06-21 23:54:48 +02:00
Jakub Wieczorek
d4da4ba4b2 Fix a #14731 regression in missing_constructor() for vector patterns
Fixes #15080.
2014-06-21 20:36:17 +02:00
Jakub Wieczorek
abce42afa3 Address review comments 2014-06-20 17:41:19 +02:00
Jakub Wieczorek
76f7eeef52 Fix #14393
String patterns should have a single constructor of arity 0.
2014-06-20 17:08:57 +02:00
Jakub Wieczorek
34407dcdbb Provide a witness pattern for non-exhaustive patterns
Fixed #4321
2014-06-20 17:08:57 +02:00
Jakub Wieczorek
f5e513b2b2 Check pattern refutability the same way exhaustiveness is checked 2014-06-20 17:08:57 +02:00
Alex Crichton
ade807c6dc rustc: Obsolete the @ syntax entirely
This removes all remnants of `@` pointers from rustc. Additionally, this removes
the `GC` structure from the prelude as it seems odd exporting an experimental
type in the prelude by default.

Closes #14193
[breaking-change]
2014-06-14 10:45:37 -07:00
Alex Crichton
54c2a1e1ce rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
Niko Matsakis
0f03b5608c Move Def out of syntax crate, where it does not belong 2014-06-06 19:51:23 -04:00
Jakub Wieczorek
774f36b5d8 Remove further code duplication 2014-06-02 20:49:44 +02:00
Jakub Wieczorek
19e10e3a81 Improve code reuse in check_match::specialize() 2014-06-02 18:41:48 +02:00
Alex Crichton
748bc3ca49 std: Rename {Eq,Ord} to Partial{Eq,Ord}
This is part of the ongoing renaming of the equality traits. See #12517 for more
details. All code using Eq/Ord will temporarily need to move to Partial{Eq,Ord}
or the Total{Eq,Ord} traits. The Total traits will soon be renamed to {Eq,Ord}.

cc #12517

[breaking-change]
2014-05-30 15:52:24 -07:00
bors
729ee20338 auto merge of #14483 : ahmedcharles/rust/patbox, r=alexcrichton 2014-05-29 12:11:40 -07:00
bors
ff2bf58e9e auto merge of #14481 : alexcrichton/rust/no-format-strbuf, r=sfackler
* Removes `format_strbuf!()`
2014-05-29 03:31:39 -07:00
Keegan McAllister
5fdd0e4b05 Add AST node for pattern macros 2014-05-28 12:42:21 -07:00
Alex Crichton
42aed6bde2 std: Remove format_strbuf!()
This was only ever a transitionary macro.
2014-05-28 08:35:41 -07:00
Ahmed Charles
4e3db5e0f4 Rename PatUniq to PatBox. Fixes part of #13910. 2014-05-27 22:19:29 -07:00
bors
911cc9c352 auto merge of #14414 : richo/rust/features/nerf_unused_string_fns, r=alexcrichton
This should block on #14323
2014-05-27 17:46:48 -07:00
Richo Healey
1f1b2e42d7 std: Rename strbuf operations to string
[breaking-change]
2014-05-27 12:59:31 -07:00
Huon Wilson
0df221e993 rustc: provide more precise information about refutable patterns.
The compiler now points exactly which part(s) of a pattern are
refutable, rather than just highlighting the whole pattern.
2014-05-27 09:24:37 +10:00
Huon Wilson
f2a137829e syntax: desugar a for loop to a let binding to get better error
messages when the pattern is refutable.

This means the compiler points directly to the pattern and said that the
problem is the pattern being refutable (rather than just saying that
some value isn't covered in the `match` as it did previously).

Fixes #14390.
2014-05-27 09:24:37 +10:00
Patrick Walton
36195eb91f libstd: Remove ~str from all libstd modules except fmt and str. 2014-05-22 14:42:01 -07:00
Alex Crichton
0089215472 rustc: Avoid an unwrap() in check_match
Closes #12369
2014-05-20 21:42:30 -07:00
Alex Crichton
40d3241a4a rustc: Avoid out of bounds in check_match
Closes #12116
2014-05-20 21:34:10 -07:00
Michael Darakananda
fdb30cd22c Removed unnecessary arguments for walk_* functions 2014-05-14 02:20:25 -04:00
Edward Wang
21867fa127 check_match: get rid of superfluous clones 2014-05-13 17:24:07 -07:00
Edward Wang
5bf268d0b0 Fix #8391
Closes #8391
2014-05-13 17:24:07 -07:00
bors
239557de6d auto merge of #13724 : nikomatsakis/rust/expr-use-visitor, r=pnkfelix
Pre-step towards issue #12624 and others: Introduce ExprUseVisitor, remove the
moves computation. ExprUseVisitor is a visitor that walks the AST for a
function and calls a delegate to inform it where borrows, copies, and moves
occur.

In this patch, I rewrite the gather_loans visitor to use ExprUseVisitor, but in
future patches, I think we could rewrite regionck, check_loans, and possibly
other passes to use it as well. This would refactor the repeated code between
those places that tries to determine where copies/moves/etc occur.

r? @alexcrichton
2014-05-01 04:36:50 -07:00
Nick Cameron
f3c33893b6 Remove internal support for fixed length strings 2014-04-29 13:10:23 +12:00
Nick Cameron
c0ff3caae1 Refactor ty_str to use a ~(str) representation.
Similar to my recent changes to ~[T]/&[T], these changes remove the vstore abstraction and represent str types as ~(str) and &(str). The Option<uint> in ty_str is the length of the string, None if the string is dynamically sized.
2014-04-28 21:02:18 +12:00
Niko Matsakis
96dfed2b62 Pre-step towards issue #12624 and others: Introduce ExprUseVisitor, remove the
moves computation. ExprUseVisitor is a visitor that walks the AST for a
function and calls a delegate to inform it where borrows, copies, and moves
occur.

In this patch, I rewrite the gather_loans visitor to use ExprUseVisitor, but in
future patches, I think we could rewrite regionck, check_loans, and possibly
other passes to use it as well. This would refactor the repeated code between
those places that tries to determine where copies/moves/etc occur.
2014-04-24 19:59:49 -04:00
Eduard Burtescu
1350fbdb24 rustc: de-@ some RefCell's. 2014-04-22 19:06:43 +03:00
Eduard Burtescu
158d7a19b3 rustc: move the method and vtable maps into ty::ctxt. 2014-04-22 17:18:20 +03:00
Nick Cameron
37306c1d25 Refactor ty_vec represent &[T] as &([T])
Refactores all uses of ty_vec and associated things to remove the vstore abstraction (still used for strings, for now). Pointers to vectors are stored as ty_rptr or ty_uniq wrapped around a ty_vec. There are no user-facing changes. Existing behaviour is preserved by special-casing many instances of pointers containing vectors. Hopefully with DST most of these hacks will go away. For now it is useful to leave them hanging around rather than abstracting them into a method or something.

Closes #13554.
2014-04-20 12:41:53 +12:00
Richo Healey
919889a1d6 Replace all ~"" with "".to_owned() 2014-04-18 17:25:34 -07:00
Eduard Burtescu
b61764b609 rustc: rename ty::vstore and its variants to UpperCamelCase. 2014-04-10 20:18:46 +03:00