bors
4967bd0508
auto merge of #7325 : artagnon/rust/resolve-module, r=cmr
...
Fix #7322 .
I started out with a band-aid approach to special-case the duplicate module error using `is_duplicate_module`, but thought this would be better in the long term.
2013-06-25 13:11:11 -07:00
Ramkumar Ramachandra
9f80591d84
resolve: report duplicate module definitions
...
add_child() is responsible for reporting errors about type, value, and
module duplicate definitions. Although it checks for all three, it uses
namespace_to_str() to convert a Namespace value into a string before
printing an error like:
error: duplicate definition of type `foo`
^^^^
note: first definition of type foo here:
^^^^
Unfortunately, this string can only be one of "type" or
"value" (corresponding to TypeNS and ValueNS respectively), and it
reports duplicate modules as duplicate types.
To alleviate the problem, define a special NamespaceError enum to define
more specialized errors, and use it instead of attempting to reuse the
Namespace enum.
Reported-by: Corey Richardson <corey@octayn.net>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
2013-06-25 23:58:48 +05:30
Alex Crichton
92424f0670
Add the warnings
lint attribute
2013-06-25 08:55:15 -07:00
Alex Crichton
8fdc8f392c
Support foreign 'static mut' variables as well
2013-06-23 18:00:32 -07:00
Alex Crichton
1841b31c61
Add 'static mut' items to the language
2013-06-23 17:59:35 -07:00
Ben Blum
c454e95fac
Add basic test cases for closure bounds. ( #3569 )
2013-06-23 14:40:18 -04:00
Ben Blum
f4ccb2fa85
Add tests for not-kind-checked trait bounds.
2013-06-23 14:40:18 -04:00
Ben Blum
394f455b5e
Fix error messages in test cases, since fns/traits now pretty-print with a bounds list
2013-06-23 13:53:39 -04:00
bors
c17ff80e01
auto merge of #7267 : luqmana/rust/issue-5792, r=cmr
...
Fixes #5792
2013-06-23 07:52:55 -07:00
Daniel Micay
d2e9912aea
vec: remove BaseIter implementation
...
I removed the `static-method-test.rs` test because it was heavily based
on `BaseIter` and there are plenty of other more complex uses of static
methods anyway.
2013-06-23 02:05:20 -04:00
James Miller
761fc16c60
Fix-up PP Code to reflect new lifetime param syntax
2013-06-22 12:38:40 +12:00
Luqman Aden
41e90f2156
Add test for duplicate definitions of structs and enum struct variants.
2013-06-20 19:23:31 -04:00
Ben Blum
643be38cfe
Hide the once-move-out privilege for stack fns behind '-Z once-fns'
2013-06-19 15:53:05 -04:00
Ben Blum
c1f037e6ac
Add tests for once functions ( #2549 ).
2013-06-19 14:25:51 -04:00
Niko Matsakis
eb48c29681
Add copies to type params with Copy bound
2013-06-16 12:47:36 -04:00
bors
1ba6fa4777
auto merge of #7110 : thestinger/rust/iterator, r=brson
2013-06-14 21:37:27 -07:00
Daniel Micay
585f5f7f79
add IteratorUtil to the prelude
2013-06-14 23:15:42 -04:00
Daniel Micay
ec27644870
automated whitespace fixes
2013-06-13 18:03:08 -04:00
Huon Wilson
abadece3ba
std: remove the invalid NullTerminatedStr instance for &'static str.
...
A slice of a 'static str is still 'static, but doesn't necessarily
have the null terminator.
2013-06-13 14:12:08 +10:00
Luqman Aden
47772bcb73
Add tests for duplicate methods on traits/impls.
2013-06-12 02:46:38 -04:00
bors
df5b0c040c
auto merge of #7046 : luqmana/rust/issue-7044, r=sanxiyn
...
Fixes #7044 .
2013-06-10 20:52:32 -07:00
Luqman Aden
693b9ce4e8
Add test for #7044 .
2013-06-10 18:06:56 -04:00
Huon Wilson
c32fb53cf9
std: remove str::{len, slice, is_empty} in favour of methods.
2013-06-10 23:02:54 +10:00
Alex Crichton
b6cccb3d81
Track the source of the type_target and value_target separately for ImportResolutions
2013-06-09 21:42:57 -07:00
bors
1f0c05ff74
auto merge of #7018 : bill-myers/rust/fix_7017, r=thestinger
...
Minimally fixes #7017 , we were overwriting the result and thus ignoring attributes before the last.
csearch::get_item_attrs and decoder::get_item_attrs should probably also be changed to each_item_attrs using the for protocol, but that's just a minor performance/style issue.
2013-06-08 19:16:11 -07:00
Bill Myers
54ec7ab057
add test for RcMut being Const and Owned, tests #7017 being fixed
2013-06-09 03:43:58 +02:00
bors
4aa77198cb
auto merge of #6992 : Blei/rust/fix-autoderef-ice, r=catamorphism
...
Related to #5062 , but doesn't fix that one.
2013-06-08 12:40:15 -07:00
Huon Wilson
513d2292e5
std: remove foldr and alli methods in vec
2013-06-09 02:22:23 +10:00
Huon Wilson
ed299af625
std: remove fold[lr] in favour of iterators
2013-06-09 02:22:23 +10:00
Philipp Brüschweiler
c74f39782f
Add test for #5062
2013-06-08 09:34:38 +02:00
Philipp Brüschweiler
c786b68dd3
Add a test that causes an ICE currently
2013-06-08 09:34:25 +02:00
bors
88517f9874
auto merge of #7000 : Blei/rust/fix-6155, r=catamorphism
2013-06-07 22:46:25 -07:00
Tim Chevalier
aac1298122
testsuite: Add test cases that pass
2013-06-07 19:37:29 -07:00
Philipp Brüschweiler
320995198c
Add test for #6155
2013-06-07 22:08:54 +02:00
bors
4abd83b18d
auto merge of #6985 : Aatch/rust/fixed-vec-6977, r=thestinger
...
This fixes #6977 . Negative counts don't make sense anyway.
2013-06-06 20:34:32 -07:00
James Miller
de27064d84
Disallow negative counts in repeat expressions
2013-06-07 12:30:44 +12:00
Ramkumar Ramachandra
c2cb238075
test/compile-fail: clarify bad-for-loop
...
There are two distinct kinds of bad-for-loops to check for with two
distinct error messages. The current bad-for-loop.rs does not make this
clear, so rewrite it into bad-for-loop{,-2}.rs. The two failing
prototypes are:
fn quux(_: &fn(&int) -> int) -> bool { true }
fn quux(_: &fn(&int) -> bool) -> () { }
Note that the second one runs fine in rust-0.6 (the latest release), and
only fails with a rust built from `incoming`.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
2013-06-06 19:23:52 +05:30
Huon Wilson
848dbc93ee
std: add an external iterator for mutating vec elements
2013-06-06 15:16:07 +10:00
Patrick Walton
8114d0e950
librustc: Disallow multiple patterns from appearing in a "let" declaration.
...
You can still initialize multiple variables at once with "let (x, y) = (1, 2)".
2013-06-04 21:45:42 -07:00
Philipp Brüschweiler
34ee63e93b
std::cell: Modernize constructors
...
Part of #3853
2013-06-04 12:03:58 +02:00
Philipp Brüschweiler
45441e046b
Add test for issue #6698
2013-06-03 13:09:26 +02:00
Patrick Walton
5fb254695b
Remove all uses of pub impl
. rs=style
2013-06-01 09:18:27 -07:00
bors
2bf053c0a3
auto merge of #6851 : alexcrichton/rust/bugfixes, r=pcwalton
...
Closes #5090 by using the excellent new generic deriving code
Promotes the unreachable code attribute to a lint attribute (instead of always being a warning)
Fixes some edge cases when creating hashmaps/hashsets and also when consuming them. (fixes #5998 )
2013-05-31 23:10:36 -07:00
bors
5028ac7396
auto merge of #6863 : huonw/rust/error-span, r=thestinger
2013-05-31 07:43:49 -07:00
Huon Wilson
4f92d3a11c
rustc: adjust span for error message to not trim last letter
2013-06-01 00:39:02 +10:00
bors
030f471f26
auto merge of #6853 : bblum/rust/sized, r=pcwalton
...
r? @nikomatsakis @pcwalton
2013-05-31 02:01:44 -07:00
bors
3869f7a99c
auto merge of #6818 : nikomatsakis/rust/irrefut-patterns-refactoring, r=graydon
...
Various bug fixes and simplifications I did as part of a patch to fix `let` patterns.
r? @catamorphism
2013-05-30 19:04:52 -07:00
Alex Crichton
aed53f9bf0
Promote unreachable code to being a lint attribute
2013-05-30 20:45:13 -05:00
Ben Blum
5113f68a86
Add simple tests for Sized
2013-05-30 21:41:41 -04:00
Niko Matsakis
ce5fd30270
Fix parser test
2013-05-30 21:01:25 -04:00
Graydon Hoare
2bed5dc528
rustc: change 'use' to 'add' in error message, fix #2994
2013-05-30 13:45:53 -07:00
Alex Crichton
4a5d887b58
Allow doc(hidden) and --test to disable doc linting
2013-05-30 01:02:55 -05:00
Alex Crichton
af995ce1e7
Make missing documentation linting more robust
...
Add some more cases for warning about missing documentation, and also add a test
to make sure it doesn't die in the future.
2013-05-30 01:02:55 -05:00
Patrick Walton
206ab89629
librustc: Stop reexporting the standard modules from prelude.
2013-05-29 19:04:53 -07:00
Patrick Walton
aeda178011
librustc: Redo the unsafe checker and make unsafe methods not callable from safe code
2013-05-29 19:04:50 -07:00
Niko Matsakis
bf1647c92a
Reconcile docs and code, adding examples and adding RESTR_CLAIM
2013-05-28 20:22:15 -04:00
Niko Matsakis
5851d3242c
Move checking for moves and initialization of local variables and patterns into
...
borrow checker and generalize what moves are allowed. Fixes a nasty
bug or two in the pattern move checking code. Unifies dataflow code
used for initialization and other things. First step towards
once fns. Everybody wins.
Fixes #4384 . Fixes #4715 . cc once fns (#2202 ), optimizing local moves (#5016 ).
2013-05-28 20:22:14 -04:00
bors
9a06ff0590
auto merge of #6707 : catamorphism/rust/issue-5543, r=catamorphism
2013-05-28 14:35:00 -07:00
bors
c33258bee1
auto merge of #6773 : lkuper/rust/alt-to-match, r=thestinger
...
RIP `alt`.
2013-05-28 05:07:59 -07:00
Tim Chevalier
403aee1082
testsuite: Test cases, one xfailed, one not
2013-05-27 17:32:32 -07:00
Lindsey Kuper
32c6199161
Change alt
to match
in filenames.
2013-05-27 17:28:39 -04:00
Lindsey Kuper
c9c4d92889
Add xfail'd test for #6762 .
2013-05-27 15:21:45 -04:00
Olivier Saut
f2125434d8
Remove the get function
...
Rust is now preferring methods over functions and there is no legacy with ARC
2013-05-24 22:51:24 +02:00
Patrick Walton
1be40be613
test: Update tests to use the new syntax.
2013-05-22 21:57:10 -07:00
Patrick Walton
ebfc2b8e56
librustc: Rename core injection to std injection
2013-05-22 21:57:05 -07:00
Patrick Walton
565942b145
librustc: Fix privacy checking for cross-crate variants
2013-05-22 21:57:03 -07:00
Patrick Walton
ca9bb2d9ac
librustc: Disallow use
from reaching into impls or traits.
...
This can perhaps be restored in the future. For now this is a precursor to
making typedefs work as expected.
2013-05-22 21:57:02 -07:00
bors
1d3e84c5d6
auto merge of #6669 : yjh0502/rust/fix_6209, r=graydon
...
Fix issue #6209 , and some related issues about constant expression
- unmatched type between arms
- unmatched type in range
2013-05-22 18:01:36 -07:00
bors
f517ed0b08
auto merge of #6686 : cmr/rust/fix-6596, r=catamorphism
...
The error message is extremely unideal.
2013-05-22 16:22:35 -07:00
Corey Richardson
5118d2f84a
Add test
2013-05-22 19:19:00 -04:00
bors
4bbbae625d
auto merge of #6672 : yjh0502/rust/fix_6342, r=graydon
...
Fix #6342
2013-05-22 11:43:35 -07:00
Corey Richardson
e64339645b
Implement static_assert attribute
...
This verifies that a static item evaluates to true, at compile time.
2013-05-22 13:13:24 -04:00
Jihyun Yu
6c33f5044b
Fix #6342
2013-05-22 16:11:48 +09:00
Jihyun Yu
f8af2b50ee
fix issue #6209
2013-05-22 14:06:25 +09:00
Tim Chevalier
1fadb97b68
testsuite: Update test for #2478 . Still xfailed
2013-05-21 12:58:27 -07:00
bors
329d8e2622
auto merge of #6648 : alexcrichton/rust/issue-6633, r=graydon
...
Resolves #6633 and removes an unnecessary import in libcore
2013-05-21 01:04:16 -07:00
bors
5a3e320514
auto merge of #6647 : alexcrichton/rust/unnecessary-alloc, r=graydon
...
This adds a lint mode for detecting unnecessary allocations on the heap. This isn't super fancy, currently it only has two rules
1. For a function's arguments, if you allocate a `[~|@]str` literal, when the type of the argument is a `&str`, emit a warning.
2. For the same case, emit warnings for boxed vectors when slices are required.
After adding the lint, I rampaged through the libraries and removed all the unnecessary allocations I could find.
2013-05-20 23:55:20 -07:00
bors
32e30aaa00
auto merge of #6576 : nikomatsakis/rust/issue-5362-tuple-indices, r=graydon
...
r? @pcwalton
2013-05-20 18:04:39 -07:00
Alex Crichton
82fa0018c8
Remove all unnecessary allocations (as flagged by lint)
2013-05-20 16:10:40 -05:00
John Clements
b621820dc4
detect unused attrs in one more place, allow parsing to continue for all
...
changed a bunch of fatal()'s into err()'s, to allow parsing to proceed.
2013-05-20 11:49:20 -07:00
Alex Crichton
15f97acdc8
Correctly track the source of imports with the same name
2013-05-20 13:02:08 -05:00
Corey Richardson
cc57ca012a
Use assert_eq! rather than assert! where possible
2013-05-19 08:16:02 -04:00
Daniel Micay
1789174541
minor automated whitespace fixes
2013-05-18 22:40:12 -04:00
Niko Matsakis
5ca383b777
Distinguish tuple elements by index in mem_categorization. Fixes #5362 .
2013-05-17 21:12:50 -04:00
Marvin Löbel
7a2afb7288
Made bytes!() accept a list of string, integer or char literals
2013-05-18 00:26:04 +02:00
Alex Crichton
030c666cc1
Re-implement lint with less emphasis on item ids
...
This way it's much easier to add lints throughout compilation correctly, and
functions on impls can alter the way lints are emitted.
2013-05-17 00:49:16 -04:00
bors
c8159b3e35
auto merge of #6473 : nikomatsakis/rust/issue-5967-rvalue-immutability, r=pcwalton
...
Simpler version of PR #5974 based on new borrowck.
2013-05-16 12:34:40 -07:00
Niko Matsakis
e665fdfc8e
Add two tests for rvalue mutability
2013-05-16 15:10:50 -04:00
Niko Matsakis
035c01af93
Add BuiltinBounds to closure type: parse and handle subtyping,
...
but do not integrate with kindck etc (requires a snapshot first)
2013-05-16 14:21:02 -04:00
bors
8257528b6c
auto merge of #6502 : huonw/rust/no-auto-code, r=graydon
...
Replace all instances of #[auto_*code] with the appropriate #[deriving] attribute
and remove the majority of the actual auto_* code, leaving stubs to refer the user to
the new syntax.
Also, moves the useful contents of auto_encode.rs to more appropriate spots: tests and comments to deriving/encodable.rs, and the ExtCtxtMethods trait to build.rs (unused so far, but the method syntax might be nicer than using the mk_* fns in many instances).
2013-05-15 18:16:51 -07:00
bors
7012c42c41
auto merge of #6500 : kud1ing/rust/cleanup, r=bstrie
...
Fixes #6445
2013-05-15 16:07:44 -07:00
Huon Wilson
5dc5efefd4
syntax: deprecate #[auto_{en,de}code] in favour of #[deriving({En,De}codable)].
...
Replace all instances of #[auto_*code] with the appropriate #[deriving] attribute
and remove the majority of the actual code, leaving stubs to refer the user to
the new syntax.
2013-05-16 08:55:57 +10:00
bors
62c7027a32
auto merge of #6485 : cmr/rust/local_rename_import_error, r=catamorphism
2013-05-15 05:43:58 -07:00
Lenny222
017df987b8
remove deriving_eq, deriving_iter_bytes, deriving_clone (deprecated in 0.6)
2013-05-15 10:51:40 +02:00
Corey Richardson
68863153bb
Fix resolution tests
2013-05-14 20:34:12 -04:00
Corey Richardson
62cbea1ca1
Add span to some import resolution errors
2013-05-14 18:52:31 -04:00
Corey Richardson
52f8b22d4f
Add test for resolution errors
2013-05-14 18:51:37 -04:00
Tim Chevalier
be062db808
testsuite: Update and un-xfail unsafe-fn-autoderef
2013-05-14 12:49:21 -07:00
Björn Steinbrink
bdc182cc41
Use static string with fail!() and remove fail!(fmt!())
...
fail!() used to require owned strings but can handle static strings
now. Also, it can pass its arguments to fmt!() on its own, no need for
the caller to call fmt!() itself.
2013-05-14 16:36:23 +02:00
Alex Crichton
66e1e51701
Remove re-exports from libcore/core.rc
...
Also fix up all the fallout elsewhere throughout core. It's really nice being
able to have the prelude.
2013-05-13 18:51:40 -04:00