Commit Graph

35026 Commits

Author SHA1 Message Date
Aaron Turon
004db80afe libcore: DST-ify AsSlice
This commit changes `AsSlice` to work on unsized types, and changes the
`impl` for `&[T]` to `[T]`. Aside from making the trait more general,
this also helps some ongoing work with method resolution changes.

This is a breaking change: code that uses generics bounded by `AsSlice`
will have to change. In particular, such code previously often took
arguments of type `V` where `V: AsSlice<T>` by value. These should now
be taken by reference:

```rust
fn foo<Sized? V: AsSlice<T>>(v: &V) { .. }
```

A few std lib functions have been changed accordingly.

[breaking-change]
2014-11-20 00:05:00 -08:00
Davis Silverman
fb67b05506 Removed unneeded conversion to a slice.
Vec<T> can index now so its a useless conversion.
2014-11-20 01:34:14 -05:00
NODA, Kai
102b1a5bf1 test/run-make: some test cases lacked $(EXTRACFLAGS).
Signed-off-by: NODA, Kai <nodakai@gmail.com>
2014-11-20 14:12:57 +08:00
bors
dd5ce5ae2f auto merge of #19105 : alfie/rust/master, r=thestinger
As discussed in pull #19068, trying to make the wording more clear for unsafe code vs undefined behavior.
2014-11-20 06:11:36 +00:00
Davis Silverman
f36ebb0eaa fixed markdown rendering a H1 in comment 2014-11-20 00:15:15 -05:00
bors
793624261a auto merge of #18999 : aturon/rust/stab-floats, r=alexcrichton,alexcrichton
This commit adds stability markers for the APIs that have recently been aligned with [numerics reform](https://github.com/rust-lang/rfcs/pull/369). For APIs that were changed as part of that reform, `#[unstable]` is used to reflect the recency, but the APIs will become `#[stable]` in a follow-up pass.

In addition, a few aspects of the APIs not explicitly covered by the RFC are marked here -- in particular, constants for floats.

This commit does not mark the `uint` or `int` modules as `#[stable]`, given the ongoing debate out the names and roles of these types.

Due to some deprecation (see the RFC for details), this is a:

[breaking-change]

r? @alexcrichton 
cc @bjz
2014-11-20 02:31:31 +00:00
bors
399ff259e1 auto merge of #19118 : jakub-/rust/roll-up, r=jakub- 2014-11-20 00:27:07 +00:00
Chris Morgan
dc0416ebce Update the Vim syntax prelude. 2014-11-20 11:00:45 +11:00
Simon Wollwage
f950e3c495 removed struct_variant feature from tests 2014-11-20 00:56:50 +01:00
Simon Wollwage
4a83726517 removed usage of struct_variant feature as it is no longer gated 2014-11-20 00:21:32 +01:00
Jakub Bukaj
ee66c84165 Fixes to the roll-up 2014-11-19 23:34:01 +01:00
bors
a24b44483a auto merge of #18728 : thestinger/rust/int, r=cmr
This fixes the gap in the language definition causing #18726 by defining
a clear bound on the maximum size for libraries to enforce.

Closes #18069
2014-11-19 22:27:00 +00:00
Jakub Bukaj
2e9f705b93 rollup merge of #19108: steveklabnik/doc_atomic_bool
I don't know enough about the free functions to give them better docs right now.
2014-11-19 22:41:39 +01:00
Jakub Bukaj
1b8ee82b54 rollup merge of #19107: cakebaker/change_an_box_to_a_box 2014-11-19 22:41:24 +01:00
Jakub Bukaj
f71b852d38 rollup merge of #19103: huonw/literal-suffixes
Futureproof Rust for fancier suffixed literals. The Rust compiler tokenises a literal followed immediately (no whitespace) by an identifier as a single token: (for example) the text sequences `"foo"bar`, `1baz` and `1u1024` are now a single token rather than the pairs `"foo"` `bar`, `1` `baz` and `1u` `1024` respectively.

The compiler rejects all such suffixes in the parser, except for the 12 numeric suffixes we have now.

I'm fairly sure this will affect very few programs, since it's not currently legal to have `<literal><identifier>` in a Rust program, except in a macro invocation. Any macro invocation relying on this behaviour can simply separate the two tokens with whitespace: `foo!("bar"baz)` becomes `foo!("bar" baz)`.

This implements [RFC 463](https://github.com/rust-lang/rfcs/blob/master/text/0463-future-proof-literal-suffixes.md), and so closes https://github.com/rust-lang/rust/issues/19088.
2014-11-19 22:41:05 +01:00
Jakub Bukaj
00ffcca016 rollup merge of #19101: vhbit/ios-rng-fix 2014-11-19 22:40:05 +01:00
Jakub Bukaj
c28acd0251 rollup merge of #19090: kmcallister/deriving-non-type
Besides being more helpful, this gives us the flexibility to later define a meaning for something like

```rust
#[deriving(...)]
mod bar { ... }
```
2014-11-19 22:39:49 +01:00
Jakub Bukaj
7884dd9cec rollup merge of #19087: jakub-/issue-19086
Fixes #19086.

Whilst the code that this PR renders invalid was never meant to be valid, this is still a...

[breaking-change]
2014-11-19 22:39:29 +01:00
Jakub Bukaj
9b5ec0e4aa rollup merge of #19076: jxv/master 2014-11-19 22:39:23 +01:00
Jakub Bukaj
1faa09615e rollup merge of #19073: jakub-/issue-19069
Fixes #19069.

These were never intended not to be feature-gated but this PR is nonetheless a...

[breaking-change]
2014-11-19 22:39:12 +01:00
Jakub Bukaj
8997b098d3 rollup merge of #19072: cakebaker/add_missing_dot 2014-11-19 22:39:06 +01:00
Jakub Bukaj
a22f06db19 rollup merge of #19040: alexcrichton/issue-18904
This commit applies the stabilization of std::fmt as outlined in [RFC 380][rfc].
There are a number of breaking changes as a part of this commit which will need
to be handled to migrated old code:

* A number of formatting traits have been removed: String, Bool, Char, Unsigned,
  Signed, and Float. It is recommended to instead use Show wherever possible or
  to use adaptor structs to implement other methods of formatting.

* The format specifier for Boolean has changed from `t` to `b`.

* The enum `FormatError` has been renamed to `Error` as well as becoming a unit
  struct instead of an enum. The `WriteError` variant no longer exists.

* The `format_args_method!` macro has been removed with no replacement. Alter
  code to use the `format_args!` macro instead.

* The public fields of a `Formatter` have become read-only with no replacement.
  Use a new formatting string to alter the formatting flags in combination with
  the `write!` macro. The fields can be accessed through accessor methods on the
  `Formatter` structure.

Other than these breaking changes, the contents of std::fmt should now also all
contain stability markers. Most of them are still #[unstable] or #[experimental]

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0380-stabilize-std-fmt.md
[breaking-change]

Closes #18904
2014-11-19 22:38:26 +01:00
Jakub Bukaj
384f611aa9 rollup merge of #18968: danluu/guide_play
As-is, there's no indication that the code examples pop out into a window that runs on `play.rust-lang.org` until you mouse over them. I managed to get to section 4 of the guide before realizing you could do this since it didn't occur to me to mouse over the example text.

cc @rose since we went through the tutorial together and I think it wasn't obvious to her either.
2014-11-19 22:37:18 +01:00
Jakub Bukaj
f6b4e398b9 rollup merge of #18944: liigo/improve-os-args-doc 2014-11-19 22:37:15 +01:00
Jakub Bukaj
0191b4983e rollup merge of #18940: nikomatsakis/issue-18899
Ensure that the type parameters passed to methods outlive the call expression.

Fixes #18899.

This is yet another case of forgotten to consistently enforce the constraints in every instance where they apply. Might be nice to try and refactor to make this whole thing more DRY, but for now here's a targeted fix.

r? @pcwalton
2014-11-19 22:37:11 +01:00
Jakub Bukaj
cbdaf2ebc7 rollup merge of #18903: steveklabnik/error_handling_guide
Now that we've done `fail` -> `panic`, I feel bringing back the error handling guide is a good idea. We had one long ago, but it was removed when conditions were removed.

This doesn't cover the new FromError stuff, but I feel like it's already useful in this state, so I'm sending this PR now.
2014-11-19 22:37:07 +01:00
Jakub Bukaj
655eb44df3 rollup merge of #18868: nikomatsakis/issue-17388-unbound-path-assoc-type
This fixes #17388.

Note that we don't check type parameters in trait-references and so on, so we accept some nonsense (I opened https://github.com/rust-lang/rust/issues/18865). (It may be easier to just add support for `T::Foo` and deprecate the qpath code until we can implement it more robustly using the trait lookup infrastructure, not sure.)
2014-11-19 22:37:02 +01:00
Jakub Bukaj
fee71bd476 rollup merge of #18728: thestinger/int
This fixes the gap in the language definition causing #18726 by defining
a clear bound on the maximum size for libraries to enforce.

Closes #18069
2014-11-19 22:36:59 +01:00
Cody P Schafer
8581f00249 mk/cfg: add .mk suffix on files to avoid "supprises" when backup files (file~) are in the directory 2014-11-19 16:00:51 -05:00
Jakub Bukaj
1b5cbd0036 Forbid matching struct variants with tuple variant patterns 2014-11-19 21:14:48 +01:00
Corey Farwell
ef5acff0db Fix some English spelling errors 2014-11-19 14:17:10 -05:00
Niko Matsakis
b9c5cd4dc4 Use the expected type to decide whether || is an unboxed or boxed closure. 2014-11-19 13:35:21 -05:00
Niko Matsakis
3e2929d362 Merge the ExprFnBlock and ExprUnboxedClosure into one ExprClosure with an optional unboxed closure kind. 2014-11-19 13:35:20 -05:00
bors
bfaa7bcab3 auto merge of #19082 : alexcrichton/rust/snapshots, r=jakub-,jakub 2014-11-19 18:32:05 +00:00
Corey Farwell
d8a5242195 Rename json::List to json::Array
Fixes #19010
2014-11-19 13:23:05 -05:00
Corey Farwell
01b4c045fe Add myself as an author 2014-11-19 13:18:34 -05:00
Steve Klabnik
40aa833fa3 Document almost all of atomics.
I don't know enough about the free functions to give them better docs right now.
2014-11-19 12:53:23 -05:00
bors
3e9414463e auto merge of #18746 : nikomatsakis/rust/issue-17322-unsized_ty, r=ncr
Pass the unadjusted type into the unsize_info function, which seems to be what it expects. Fixes #17322.

r? @nick29581 

Full disclosure: still running make check locally ;)
2014-11-19 16:22:01 +00:00
Niko Matsakis
ee9a7b60fa Pass the unadjusted type into the unsize_info function, which seems to be what it expects. Fixes #17322. 2014-11-19 10:02:04 -05:00
Daniel Hofstetter
ebe812f0c6 Reference: Change "an box" to "a box" 2014-11-19 15:11:09 +01:00
Huon Wilson
a11078f8c3 Update documentation for literal suffixes.
This changes the stated grammar of literals to move all suffixes into
the generic literal production.
2014-11-20 00:03:21 +11:00
Huon Wilson
7586abf01b Adjust Antlr4 lexer to include suffixes.
This makes the formal lexical grammar (more closely) reflect the one
implemented by the compiler.
2014-11-20 00:02:42 +11:00
Huon Wilson
606a309d4a Switch numeric suffix parsing to use the new system.
This moves errors and all handling of numeric suffixes into the parser
rather than the lexer.
2014-11-20 00:02:42 +11:00
Huon Wilson
6679595853 Parse and store suffixes on literals.
This adds an optional suffix at the end of a literal token:
`"foo"bar`. An actual use of a suffix in a expression (or other literal
that the compiler reads) is rejected in the parser.

This doesn't switch the handling of numbers to this system, and doesn't
outlaw illegal suffixes for them yet.
2014-11-20 00:02:42 +11:00
Alfie John
e0b0c83138 doc: clarifying unsafe code vs undefined behavior 2014-11-19 12:43:13 +00:00
Niko Matsakis
2477bc4451 Update libcollections tests to pass the new type rules. They used to return a pointer to the value they were modifying, but this should not have been legal, since that pointer would have to outlive the closure, and the closure continues to modify the value during the execution. This return value was just passed to black_box so as to convince llvm that the value was live, so rather than returning a pointer, modify to just call black_box directly inside the fn. 2014-11-19 06:20:20 -05:00
Niko Matsakis
0b6ec70197 Ensure that the type parameters passed to methods outlive the call expression. Fixes #18899. 2014-11-19 06:20:20 -05:00
Niko Matsakis
b64c7b83dd Refactor QPath to take an ast::TraitRef 2014-11-19 05:53:40 -05:00
Niko Matsakis
8e44688889 Deduce the argument types based on the expected type, trawling through the fulfillment contect if necessary. 2014-11-19 05:52:59 -05:00
Niko Matsakis
fe2fcb39f4 Move closure checking into its own file. Shrink check/mod.rs! 2014-11-19 05:31:16 -05:00