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
Eduard Burtescu
2d22243b0c
rustc: remove ty_unboxed_vec.
2014-04-06 14:05:32 +03:00
Daniel Micay
cbbc1fc843
vec: convert append
and append_one
to methods
...
These were only free functions on `~[T]` because taking self by-value
used to be broken.
2014-03-31 01:13:48 -04:00
Marvin Löbel
c356e3ba6a
Removed deprecated functions map
and flat_map
for vectors and slices.
2014-03-30 03:47:04 +02:00
Brian Anderson
451e8c1c61
Convert most code to new inner attribute syntax.
...
Closes #2569
2014-03-28 17:12:21 -07:00
Alex Crichton
0dbb909bf7
rustc: Fix fallout of removing get()
2014-03-22 08:48:20 -07:00
Alex Crichton
da3625161d
Removing imports of std::vec_ng::Vec
...
It's now in the prelude.
2014-03-20 09:30:14 -07:00
Daniel Micay
14f656d1a7
rename std::vec_ng -> std::vec
...
Closes #12771
2014-03-20 04:25:32 -04:00
Steven Fackler
0f2d46f396
Docify std::vec_ng
...
I also removed a couple of methods that were silly and added sort.
2014-03-18 22:03:17 -07:00
Eduard Burtescu
0bb6de3076
De-@ move maps and rework parts of trans.
2014-03-17 09:53:08 +02:00
Eduard Burtescu
9b1fee898f
De-@ ty::ctxt usage.
2014-03-17 09:53:06 +02:00
Felix S. Klock II
43c07244b3
librustc: Fix up fallout from the automatic conversion.
2014-03-08 21:41:32 +01:00
Patrick Walton
3b6e9d4a7a
librustc: Automatically change uses of ~[T]
to Vec<T>
in rustc.
2014-03-08 21:24:27 +01:00
Patrick Walton
c1ed4d7d41
librustc: Fix errors arising from the automated ~[T]
conversion
2014-03-01 22:40:53 -08:00
Eduard Burtescu
7a588ceff2
Rename a few typeck method-related structures to UpperCamelCase.
2014-02-26 16:01:36 +02:00
mr.Shu
70319f7b25
Changed NonCamelCaseTypes lint to warn by default
...
Added allow(non_camel_case_types) to librustc where necesary
Tried to fix problems with non_camel_case_types outside rustc
fixed failing tests
Docs updated
Moved #[allow(non_camel_case_types)] a level higher.
markdown.rs reverted
Fixed timer that was failing tests
Fixed another timer
2014-02-21 08:11:52 +01:00
Eduard Burtescu
a02b10a062
Refactored ast_map and friends, mainly to have Paths without storing them.
2014-02-14 08:43:29 +02:00
bors
68129d299b
auto merge of #12061 : pongad/rust/delorderable, r=cmr
...
#12057
2014-02-13 19:16:59 -08:00
Michael Darakananda
bf1464c413
Removed num::Orderable
2014-02-13 20:12:59 -05:00
Flavio Percoco
968633b60a
Replace crate
usage with krate
...
This patch replaces all `crate` usage with `krate` before introducing the
new keyword. This ensures that after introducing the keyword, there
won't be any compilation errors.
krate might not be the most expressive substitution for crate but it's a
very close abbreviation for it. `module` was already used in several
places already.
2014-02-13 20:52:07 +01:00
mr.Shu
ee3fa68fed
Fixed error starting with uppercase
...
Error messages cleaned in librustc/middle
Error messages cleaned in libsyntax
Error messages cleaned in libsyntax more agressively
Error messages cleaned in librustc more aggressively
Fixed affected tests
Fixed other failing tests
Last failing tests fixed
2014-02-08 20:59:38 +01:00
Patrick Walton
21f86855dd
librustc: De-@str
ident()
and str_of()
2014-02-02 01:44:49 +11:00
Patrick Walton
8e52b85d5a
libsyntax: De-@str
literal strings in the AST
2014-02-02 01:44:48 +11:00
Huon Wilson
39713b8295
Remove unnecessary parentheses.
2014-01-21 22:00:18 +11:00
Patrick Walton
119c6141f5
librustc: Remove @
pointer patterns from the language
2014-01-13 14:45:21 -08:00
Eduard Burtescu
5ad2a7825b
Removed obsolete 'e' prefix on ty_evec and ty_estr.
2014-01-11 16:40:23 +02:00
Eduard Burtescu
6b221768cf
libsyntax: Renamed types, traits and enum variants to CamelCase.
2014-01-09 22:25:28 +02:00
Marvin Löbel
90b394514d
Renamed Option::map_default and mutate_default to map_or and mutate_or_set
2014-01-08 00:53:40 +01:00
bors
8b71b6415d
auto merge of #11333 : cmr/rust/triage2, r=alexcrichton
2014-01-06 08:41:45 -08:00
Eduard Burtescu
3119d18e55
Disowned the Visitor.
2014-01-06 14:00:46 +02:00
Corey Richardson
ccaf0b4654
Remove a fixme
...
pcwalton says this is right, and it looks right to me too.
Closes #4731
2014-01-05 21:36:53 -05:00
klutzy
9cdad685a3
syntax::codemap: Add static DUMMY_SP
...
It replaces `dummy_sp()`.
2014-01-01 19:51:35 +09:00
Patrick Walton
cc0584731a
librustc: De-@mut
the def map.
...
This is the last `@mut` in `librustc` that does not depend on libsyntax.
2013-12-26 15:54:37 -08:00
Patrick Walton
d9c87c7a23
librustc: De-@mut
the moves map
2013-12-26 15:54:32 -08:00
Huon Wilson
2e8c522c62
std::vec: make the sorting closure use Ordering
rather than just being
...
(implicitly) less_eq.
2013-12-22 18:16:50 +11:00
Huon Wilson
1b1e4caa79
std::vec: add a sugary .sort() method for plain Ord sorting.
...
This moves the custom sorting to `.sort_by`.
2013-12-21 09:35:18 +11:00
Huon Wilson
48fedcb36f
extra: remove sort in favour of the std method.
...
Fixes #9676 .
2013-12-20 12:38:46 +11:00
Eduard Burtescu
a9c4b18b18
Box Block, fn_decl, variant and Ty in the AST, as they were inflating critical enum sizes.
2013-12-01 00:00:39 +02:00
Alex Crichton
ab387a6838
Register new snapshots
2013-11-28 20:27:56 -08:00
Patrick Walton
8ceb374ab7
librustc: Remove non-procedure uses of do
from librustc, librustdoc,
...
and librustpkg.
2013-11-26 08:25:00 -08:00
Patrick Walton
7e3f20133a
librustc: Change most uses of &fn()
to ||
.
2013-11-19 13:22:03 -08:00
Brian Anderson
85f107d8cb
Use '..' as slice wildcard in vectors
2013-11-18 16:19:48 -08:00
Luqman Aden
12308db3d2
libsyntax/librustc: Allow mut qualifier in patterns.
2013-10-25 01:21:07 -04:00
Alex Crichton
daf5f5a4d1
Drop the '2' suffix from logging macros
...
Who doesn't like a massive renaming?
2013-10-22 08:09:56 -07:00
Daniel Micay
6a90e80b62
option: rewrite the API to use composition
2013-10-09 09:17:29 -04:00
Dmitry Ermolov
da7f41104d
Fix bug in match checking
...
When `specialize`ing struct-like enum patterns, compare struct fields to
pattern fields, not pattern fields to pattern fields.
Closes #8351 .
2013-10-07 22:28:18 +04:00
Dmitry Ermolov
fdb49aa917
Hide internal stuff in check_match.rs
2013-10-07 13:33:50 +04:00
bors
97cd495aca
auto merge of #9638 : pnkfelix/rust/fsk-issue7526-attempt-to-catch-nonuc-statics-in-match-patterns, r=alexcrichton
...
r? anyone
Address scariest part of #7526 by adding a new more specific lint (that is set to warn by default, rather than allow).
2013-10-02 01:16:31 -07:00
Felix S. Klock II
2461b31026
incoporate suggestion from huonw to move code into lint.rs
2013-10-01 18:03:26 +02:00
Alex Crichton
1b80558be3
rustc: Remove usage of fmt!
2013-09-30 23:21:19 -07:00
Felix S. Klock II
155857f548
Revise error message to use phrase "all caps" instead of "uppercase".
...
This is to clarify that the lint is checking for THIS_THING and not This.
2013-10-01 03:10:19 +02:00
Felix S. Klock II
a076fef2b6
Add new lint: non_uppercase_pattern_statics, for #7526 .
...
This tries to warn about code like:
```rust
match (0,0) {
(0, aha) => { ... },
...
}
```
where `aha` is actually a static constant, not a binding.
2013-10-01 01:44:25 +02:00
blake2-ppc
b88517ec93
trans: Change @ast::Pat and @mut CrateContext in a few places
...
Use borrowed references in a few locations that were encountered when
working on other changes.
2013-09-30 19:37:17 +02:00