]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoauto merge of #18984 : sheroze1123/rust/fix17574, r=bstrie
bors [Fri, 21 Nov 2014 11:36:45 +0000 (11:36 +0000)]
auto merge of #18984 : sheroze1123/rust/fix17574, r=bstrie

Fix #17574

9 years agoauto merge of #18908 : tbu-/rust/pr_mapinplace_fixzerosized, r=alexcrichton
bors [Fri, 21 Nov 2014 09:01:50 +0000 (09:01 +0000)]
auto merge of #18908 : tbu-/rust/pr_mapinplace_fixzerosized, r=alexcrichton

9 years agoauto merge of #16552 : jauhien/rust/fix-libdir, r=alexcrichton
bors [Fri, 21 Nov 2014 06:21:48 +0000 (06:21 +0000)]
auto merge of #16552 : jauhien/rust/fix-libdir, r=alexcrichton

Fixies #11671

This commit changes default relative libdir 'lib' to a relative libdir calculated using LIBDIR provided by --libdir configuration option. In case if no option was provided behavior does not change.

9 years agoauto merge of #18967 : aturon/rust/remove-runtime, r=alexcrichton
bors [Fri, 21 Nov 2014 03:41:45 +0000 (03:41 +0000)]
auto merge of #18967 : aturon/rust/remove-runtime, r=alexcrichton

This PR completes the removal of the runtime system and green-threaded abstractions as part of implementing [RFC 230](https://github.com/rust-lang/rfcs/pull/230).

Specifically:

* It removes the `Runtime` trait, welding the scheduling infrastructure directly to native threads.

* It removes `libgreen` and `libnative` entirely.

* It rewrites `sync::mutex` as a trivial layer on top of native mutexes. Eventually, the two modules will be merged.

* It hides the vast majority of `std::rt`.

This completes the basic task of removing the runtime system (I/O and scheduling) and components that depend on it.

After this lands, a follow-up PR will pull the `rustrt` crate back into `std`, turn `std::task` into `std::thread` (with API changes to go along with it), and completely cut out the remaining startup/teardown sequence. Other changes, including new [TLS](https://github.com/rust-lang/rfcs/pull/461) and synchronization are in the RFC or pre-RFC phase.

Closes #17325
Closes #18687

[breaking-change]

r? @alexcrichton

9 years agoDisable dubious pipe test
Aaron Turon [Thu, 20 Nov 2014 06:57:28 +0000 (22:57 -0800)]
Disable dubious pipe test

9 years agoLoosen possibly bogus constraints in backtrace test
Aaron Turon [Wed, 19 Nov 2014 05:15:13 +0000 (21:15 -0800)]
Loosen possibly bogus constraints in backtrace test

9 years agoFallout from namespaced enums
Aaron Turon [Mon, 17 Nov 2014 23:27:58 +0000 (15:27 -0800)]
Fallout from namespaced enums

9 years agoFallout from new termination semantics
Aaron Turon [Sat, 15 Nov 2014 07:05:37 +0000 (23:05 -0800)]
Fallout from new termination semantics

9 years agoMake most of std::rt private
Aaron Turon [Sat, 15 Nov 2014 00:30:16 +0000 (16:30 -0800)]
Make most of std::rt private

Previously, the entire runtime API surface was publicly exposed, but
that is neither necessary nor desirable. This commit hides most of the
module, using librustrt directly as needed. The arrangement will need to
be revisited when rustrt is pulled into std.

[breaking-change]

9 years agoFallout from libgreen and libnative removal
Aaron Turon [Fri, 14 Nov 2014 22:38:41 +0000 (14:38 -0800)]
Fallout from libgreen and libnative removal

9 years agoRewrite sync::mutex as thin layer over native mutexes
Aaron Turon [Fri, 14 Nov 2014 22:33:51 +0000 (14:33 -0800)]
Rewrite sync::mutex as thin layer over native mutexes

Previously, sync::mutex had to split between green and native runtime
systems and thus could not simply use the native mutex facility.

This commit rewrites sync::mutex to link directly to native mutexes; in
the future, the two will probably be coalesced into a single
module (once librustrt is pulled into libstd wholesale).

9 years agoRemove libgreen
Aaron Turon [Fri, 14 Nov 2014 21:56:15 +0000 (13:56 -0800)]
Remove libgreen

With runtime removal complete, there is no longer any reason to provide
libgreen.

[breaking-change]

9 years agoRemove libnative
Aaron Turon [Fri, 14 Nov 2014 21:55:57 +0000 (13:55 -0800)]
Remove libnative

With runtime removal complete, there's nothing left of libnative. This
commit removes it.

Fixes #18687

[breaking-change]

9 years agoRemove Runtime trait
Aaron Turon [Fri, 14 Nov 2014 21:40:34 +0000 (13:40 -0800)]
Remove Runtime trait

This commit removes most of the remaining runtime infrastructure related
to the green/native split. In particular, it removes the `Runtime` trait
and instead inlines the native implementation.

Closes #17325

[breaking-change]

9 years agoauto merge of #18441 : mdinger/rust/literals, r=steveklabnik
bors [Fri, 21 Nov 2014 01:06:47 +0000 (01:06 +0000)]
auto merge of #18441 : mdinger/rust/literals, r=steveklabnik

Closes #18415

This links [`std::str`](http://doc.rust-lang.org/std/str/index.html) documentation to [literals](http://doc.rust-lang.org/reference.html#literals) in the reference guide and collects examples of literals into one group at the beginning of the section. ~~The new tables are not exhaustive (some escapes were skipped) and so I try to link back to the respective sections where more detail is located.~~ The tables are are mostly exhaustive. I misunderstood some of the whitespace codes.

I don't think the tables actually look that nice if that's important and I'm not sure how it could be improved. I think it does do a good job of collecting available options together. I think listing the escapes together is particularly helpful because they vary with type and are embedded in paragraphs.

[EDIT]
The [ascii table](http://man-ascii.com/) is here and may be useful.

9 years agoauto merge of #18773 : subhashb/rust/convert_remaining_failures_to_panic, r=steveklabnik
bors [Thu, 20 Nov 2014 23:02:01 +0000 (23:02 +0000)]
auto merge of #18773 : subhashb/rust/convert_remaining_failures_to_panic, r=steveklabnik

I have also renamed `fail` to `panic` in some non-documentation comments, where I thought it mattered.
Fixes #18677

cc @steveklabnik

9 years agoAdd examples for all literal types in reference grouped together
mdinger [Thu, 20 Nov 2014 21:05:33 +0000 (16:05 -0500)]
Add examples for all literal types in reference grouped together

9 years agoauto merge of #18750 : nikomatsakis/rust/issue-18333-skolemize-open-existential,...
bors [Thu, 20 Nov 2014 19:26:40 +0000 (19:26 +0000)]
auto merge of #18750 : nikomatsakis/rust/issue-18333-skolemize-open-existential, r=nrc

In the general case, at least, it is not possible to make an object out of an unsized type. This is because the object type would have to store the fat pointer information for the `self` value *and* the vtable -- meaning it'd have to be a fat pointer with three words -- but for the compiler to know that the object requires three words, it would have to know the self-type of the object (is `self` a thin or fat pointer?), which of course it doesn't.

Fixes #18333.

r? @nick29581

9 years agoLink std::str to reference literals section
mdinger [Thu, 20 Nov 2014 19:10:25 +0000 (14:10 -0500)]
Link std::str to reference literals section

9 years agoRename remaining Failures to Panic
Subhash Bhushan [Sat, 8 Nov 2014 15:47:51 +0000 (21:17 +0530)]
Rename remaining Failures to Panic

9 years agoauto merge of #19071 : huonw/rust/col2column, r=nikomatsakis
bors [Thu, 20 Nov 2014 16:02:03 +0000 (16:02 +0000)]
auto merge of #19071 : huonw/rust/col2column, r=nikomatsakis

This macro is very rarely used, so there is no need (and it is better)
for it to avoid the abbreviation.

Closes rust-lang/rfcs#467.

9 years agoRequire that objects can only be made from Sized types. Fixes #18333.
Niko Matsakis [Fri, 7 Nov 2014 21:26:26 +0000 (16:26 -0500)]
Require that objects can only be made from Sized types. Fixes #18333.

9 years agoauto merge of #19033 : pnkfelix/rust/fsk-introduce-scopedata-via-refactor, r=nikomatsakis
bors [Thu, 20 Nov 2014 14:01:51 +0000 (14:01 +0000)]
auto merge of #19033 : pnkfelix/rust/fsk-introduce-scopedata-via-refactor, r=nikomatsakis

(Previously, scopes were solely identified with NodeId's; this
refactoring prepares for a future where that does not hold.)

Ground work for a proper fix to #8861.

9 years agoRefactored new CodeExtent type for improved abstraction.
Felix S. Klock II [Tue, 18 Nov 2014 13:22:59 +0000 (14:22 +0100)]
Refactored new CodeExtent type for improved abstraction.

(Previously, statically identifiable scopes/regions were solely
identified with NodeId's; this refactoring prepares for a future
where that 1:1 correspondence does not hold.)

9 years agoauto merge of #19113 : nikomatsakis/rust/unboxed-boxed-closure-unification, r=acrichto
bors [Thu, 20 Nov 2014 12:01:44 +0000 (12:01 +0000)]
auto merge of #19113 : nikomatsakis/rust/unboxed-boxed-closure-unification, r=acrichto

Use the expected type to infer the argument/return types of unboxed closures. Also, in `||` expressions, use the expected type to decide if the result should be a boxed or unboxed closure (and if an unboxed closure, what kind).

This supercedes PR #19089, which was already reviewed by @pcwalton.

9 years agoauto merge of #18638 : aturon/rust/as_slice_dst, r=japaric
bors [Thu, 20 Nov 2014 10:01:42 +0000 (10:01 +0000)]
auto merge of #18638 : aturon/rust/as_slice_dst, r=japaric

This PR 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.

The PR also relaxes constraints on generics and traits within the
`core::ops` module and for the `Equiv` trait.

[breaking-change]

r? @nikomatsakis
cc @japaric

9 years agoRename `col!` to `column!`.
Huon Wilson [Tue, 18 Nov 2014 12:03:58 +0000 (23:03 +1100)]
Rename `col!` to `column!`.

This macro is very rarely used, so there is no need (and it is better)
for it to avoid the abbreviation.

Closes rust-lang/rfcs#467.

[breaking-change]

9 years agolibcore: DSTify ops traits, Equiv
Aaron Turon [Wed, 5 Nov 2014 15:18:32 +0000 (07:18 -0800)]
libcore: DSTify ops traits, Equiv

This commit relaxes constraints on generics and traits within the
`core::ops` module and for the `Equiv` trait.

9 years agolibcore: DST-ify AsSlice
Aaron Turon [Tue, 4 Nov 2014 23:31:46 +0000 (15:31 -0800)]
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]

9 years agoauto merge of #19105 : alfie/rust/master, r=thestinger
bors [Thu, 20 Nov 2014 06:11:36 +0000 (06:11 +0000)]
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.

9 years agoauto merge of #18999 : aturon/rust/stab-floats, r=alexcrichton,alexcrichton
bors [Thu, 20 Nov 2014 02:31:31 +0000 (02:31 +0000)]
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

9 years agoauto merge of #19118 : jakub-/rust/roll-up, r=jakub-
bors [Thu, 20 Nov 2014 00:27:07 +0000 (00:27 +0000)]
auto merge of #19118 : jakub-/rust/roll-up, r=jakub-

9 years agoFixes to the roll-up
Jakub Bukaj [Wed, 19 Nov 2014 22:06:53 +0000 (23:06 +0100)]
Fixes to the roll-up

9 years agoauto merge of #18728 : thestinger/rust/int, r=cmr
bors [Wed, 19 Nov 2014 22:27:00 +0000 (22:27 +0000)]
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

9 years agorollup merge of #19108: steveklabnik/doc_atomic_bool
Jakub Bukaj [Wed, 19 Nov 2014 21:41:39 +0000 (22:41 +0100)]
rollup merge of #19108: steveklabnik/doc_atomic_bool

I don't know enough about the free functions to give them better docs right now.

9 years agorollup merge of #19107: cakebaker/change_an_box_to_a_box
Jakub Bukaj [Wed, 19 Nov 2014 21:41:24 +0000 (22:41 +0100)]
rollup merge of #19107: cakebaker/change_an_box_to_a_box

9 years agorollup merge of #19103: huonw/literal-suffixes
Jakub Bukaj [Wed, 19 Nov 2014 21:41:05 +0000 (22:41 +0100)]
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.

9 years agorollup merge of #19101: vhbit/ios-rng-fix
Jakub Bukaj [Wed, 19 Nov 2014 21:40:05 +0000 (22:40 +0100)]
rollup merge of #19101: vhbit/ios-rng-fix

9 years agorollup merge of #19090: kmcallister/deriving-non-type
Jakub Bukaj [Wed, 19 Nov 2014 21:39:49 +0000 (22:39 +0100)]
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 { ... }
```

9 years agorollup merge of #19087: jakub-/issue-19086
Jakub Bukaj [Wed, 19 Nov 2014 21:39:29 +0000 (22:39 +0100)]
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]

9 years agorollup merge of #19076: jxv/master
Jakub Bukaj [Wed, 19 Nov 2014 21:39:23 +0000 (22:39 +0100)]
rollup merge of #19076: jxv/master

9 years agorollup merge of #19073: jakub-/issue-19069
Jakub Bukaj [Wed, 19 Nov 2014 21:39:12 +0000 (22:39 +0100)]
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]

9 years agorollup merge of #19072: cakebaker/add_missing_dot
Jakub Bukaj [Wed, 19 Nov 2014 21:39:06 +0000 (22:39 +0100)]
rollup merge of #19072: cakebaker/add_missing_dot

9 years agorollup merge of #19040: alexcrichton/issue-18904
Jakub Bukaj [Wed, 19 Nov 2014 21:38:26 +0000 (22:38 +0100)]
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

9 years agorollup merge of #18968: danluu/guide_play
Jakub Bukaj [Wed, 19 Nov 2014 21:37:18 +0000 (22:37 +0100)]
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.

9 years agorollup merge of #18944: liigo/improve-os-args-doc
Jakub Bukaj [Wed, 19 Nov 2014 21:37:15 +0000 (22:37 +0100)]
rollup merge of #18944: liigo/improve-os-args-doc

9 years agorollup merge of #18940: nikomatsakis/issue-18899
Jakub Bukaj [Wed, 19 Nov 2014 21:37:11 +0000 (22:37 +0100)]
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

9 years agorollup merge of #18903: steveklabnik/error_handling_guide
Jakub Bukaj [Wed, 19 Nov 2014 21:37:07 +0000 (22:37 +0100)]
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.

9 years agorollup merge of #18868: nikomatsakis/issue-17388-unbound-path-assoc-type
Jakub Bukaj [Wed, 19 Nov 2014 21:37:02 +0000 (22:37 +0100)]
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.)

9 years agorollup merge of #18728: thestinger/int
Jakub Bukaj [Wed, 19 Nov 2014 21:36:59 +0000 (22:36 +0100)]
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

9 years agoForbid matching struct variants with tuple variant patterns
Jakub Bukaj [Tue, 18 Nov 2014 21:46:49 +0000 (22:46 +0100)]
Forbid matching struct variants with tuple variant patterns

9 years agoUse the expected type to decide whether `||` is an unboxed or boxed closure.
Niko Matsakis [Wed, 19 Nov 2014 17:39:10 +0000 (12:39 -0500)]
Use the expected type to decide whether `||` is an unboxed or boxed closure.

9 years agoMerge the ExprFnBlock and ExprUnboxedClosure into one ExprClosure with an optional...
Niko Matsakis [Wed, 19 Nov 2014 16:18:17 +0000 (11:18 -0500)]
Merge the ExprFnBlock and ExprUnboxedClosure into one ExprClosure with an optional unboxed closure kind.

9 years agoauto merge of #19082 : alexcrichton/rust/snapshots, r=jakub-,jakub
bors [Wed, 19 Nov 2014 18:32:05 +0000 (18:32 +0000)]
auto merge of #19082 : alexcrichton/rust/snapshots, r=jakub-,jakub

9 years agoDocument almost all of atomics.
Steve Klabnik [Wed, 19 Nov 2014 15:35:47 +0000 (10:35 -0500)]
Document almost all of atomics.

I don't know enough about the free functions to give them better docs right now.

9 years agoauto merge of #18746 : nikomatsakis/rust/issue-17322-unsized_ty, r=ncr
bors [Wed, 19 Nov 2014 16:22:01 +0000 (16:22 +0000)]
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 ;)

9 years agoPass the unadjusted type into the unsize_info function, which seems to be what it...
Niko Matsakis [Fri, 7 Nov 2014 20:18:08 +0000 (15:18 -0500)]
Pass the unadjusted type into the unsize_info function, which seems to be what it expects. Fixes #17322.

9 years agoReference: Change "an box" to "a box"
Daniel Hofstetter [Wed, 19 Nov 2014 14:11:09 +0000 (15:11 +0100)]
Reference: Change "an box" to "a box"

9 years agoUpdate documentation for literal suffixes.
Huon Wilson [Wed, 19 Nov 2014 10:12:40 +0000 (21:12 +1100)]
Update documentation for literal suffixes.

This changes the stated grammar of literals to move all suffixes into
the generic literal production.

9 years agoAdjust Antlr4 lexer to include suffixes.
Huon Wilson [Wed, 19 Nov 2014 09:25:48 +0000 (20:25 +1100)]
Adjust Antlr4 lexer to include suffixes.

This makes the formal lexical grammar (more closely) reflect the one
implemented by the compiler.

9 years agoSwitch numeric suffix parsing to use the new system.
Huon Wilson [Wed, 19 Nov 2014 09:22:54 +0000 (20:22 +1100)]
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.

9 years agoParse and store suffixes on literals.
Huon Wilson [Wed, 19 Nov 2014 04:48:38 +0000 (15:48 +1100)]
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.

9 years agodoc: clarifying unsafe code vs undefined behavior
Alfie John [Wed, 19 Nov 2014 12:43:13 +0000 (12:43 +0000)]
doc: clarifying unsafe code vs undefined behavior

9 years agoUpdate libcollections tests to pass the new type rules. They used to return a pointer...
Niko Matsakis [Fri, 14 Nov 2014 10:55:10 +0000 (05:55 -0500)]
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.

9 years agoEnsure that the type parameters passed to methods outlive the call expression. Fixes...
Niko Matsakis [Fri, 14 Nov 2014 02:20:01 +0000 (21:20 -0500)]
Ensure that the type parameters passed to methods outlive the call expression. Fixes #18899.

9 years agoRefactor QPath to take an ast::TraitRef
Niko Matsakis [Sat, 8 Nov 2014 11:59:10 +0000 (06:59 -0500)]
Refactor QPath to take an ast::TraitRef

9 years agoDeduce the argument types based on the expected type, trawling through the fulfillmen...
Niko Matsakis [Tue, 18 Nov 2014 21:13:24 +0000 (16:13 -0500)]
Deduce the argument types based on the expected type, trawling through the fulfillment contect if necessary.

9 years agoMove closure checking into its own file. Shrink check/mod.rs!
Niko Matsakis [Tue, 18 Nov 2014 20:00:23 +0000 (15:00 -0500)]
Move closure checking into its own file. Shrink check/mod.rs!

9 years agoclearly define `int` and `uint` to fix unsoundness
Daniel Micay [Fri, 7 Nov 2014 02:30:49 +0000 (21:30 -0500)]
clearly define `int` and `uint` to fix unsoundness

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

9 years agoiOS: fixed broken build after disallowed coercions
Valerii Hiora [Wed, 19 Nov 2014 06:54:52 +0000 (08:54 +0200)]
iOS: fixed broken build after disallowed coercions

9 years agoauto merge of #18483 : eddyb/rust/safe-ty, r=nikomatsakis
bors [Wed, 19 Nov 2014 07:21:42 +0000 (07:21 +0000)]
auto merge of #18483 : eddyb/rust/safe-ty, r=nikomatsakis

After more than a month of sitting on this patch, rebasing and tracking down some nasty bugs (there's might be still one out there, but it only manifested in `middle::trans::reflect` which is now gone), I'd like to merge it as it is.

This changeset makes middle::ty safe, linking the lifetime of a type to the type context it was created in.
It's a prerequisite for introducing function-local type contexts to localize types with inference variables, in order to (potentially) free hundreds of MBs from rustc's memory usage peak.

9 years agostd: Stabilize std::fmt
Alex Crichton [Mon, 17 Nov 2014 19:29:38 +0000 (11:29 -0800)]
std: Stabilize std::fmt

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

9 years agorustdoc: fix fallout of ty::t -> Ty<'tcx>.
Eduard Burtescu [Thu, 6 Nov 2014 07:20:16 +0000 (09:20 +0200)]
rustdoc: fix fallout of ty::t -> Ty<'tcx>.

9 years agorustc: middle: simplify primitive type declaration in ty.
Eduard Burtescu [Fri, 31 Oct 2014 10:40:57 +0000 (12:40 +0200)]
rustc: middle: simplify primitive type declaration in ty.

9 years agorustc: middle: remove obsolete ty::get.
Eduard Burtescu [Fri, 31 Oct 2014 08:51:16 +0000 (10:51 +0200)]
rustc: middle: remove obsolete ty::get.

9 years agorustc: middle: avoid clones in ty_fn_{sig,args}.
Eduard Burtescu [Sat, 4 Oct 2014 15:36:06 +0000 (18:36 +0300)]
rustc: middle: avoid clones in ty_fn_{sig,args}.

9 years agorustc: fix fallout of making `Ty` an alias for `&TyS` instead of a wrapper.
Eduard Burtescu [Thu, 6 Nov 2014 07:24:44 +0000 (09:24 +0200)]
rustc: fix fallout of making `Ty` an alias for `&TyS` instead of a wrapper.

9 years agorustc: fix fallout of adding the `'tcx` lifetime to `Ty`.
Eduard Burtescu [Mon, 29 Sep 2014 19:11:30 +0000 (22:11 +0300)]
rustc: fix fallout of adding the `'tcx` lifetime to `Ty`.

9 years agorustc: middle: ty: replace unsafe pointers with references in Ty.
Eduard Burtescu [Sun, 28 Sep 2014 15:31:04 +0000 (18:31 +0300)]
rustc: middle: ty: replace unsafe pointers with references in Ty.

9 years agorustc: middle: rename `ty::t` to `Ty` and use it unqualified everywhere.
Eduard Burtescu [Sat, 13 Sep 2014 18:09:25 +0000 (21:09 +0300)]
rustc: middle: rename `ty::t` to `Ty` and use it unqualified everywhere.

9 years agorustc: avoid `use`-ing `syntax::ast::*`.
Eduard Burtescu [Sat, 13 Sep 2014 17:10:34 +0000 (20:10 +0300)]
rustc: avoid `use`-ing `syntax::ast::*`.

9 years agoFallout from deprecation
Aaron Turon [Wed, 19 Nov 2014 04:22:13 +0000 (20:22 -0800)]
Fallout from deprecation

9 years agolibs: stabilize most numerics after RFC changes
Aaron Turon [Sun, 16 Nov 2014 06:03:34 +0000 (22:03 -0800)]
libs: stabilize most numerics after RFC changes

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]

9 years agoUpdate makefiles to ensure src/grammar/verify.rs is built.
Huon Wilson [Wed, 19 Nov 2014 02:11:24 +0000 (13:11 +1100)]
Update makefiles to ensure src/grammar/verify.rs is built.

It's not run, but this ensures that the code at least doesn't go out of
date.

9 years agoUpdate src/grammar for language changes.
Huon Wilson [Wed, 19 Nov 2014 01:52:44 +0000 (12:52 +1100)]
Update src/grammar for language changes.

9 years agoSwitch to an independent enum for `Lit*` subtokens.
Huon Wilson [Tue, 18 Nov 2014 23:17:40 +0000 (10:17 +1100)]
Switch to an independent enum for `Lit*` subtokens.

9 years agoError handling guide
Steve Klabnik [Wed, 12 Nov 2014 18:43:06 +0000 (13:43 -0500)]
Error handling guide

9 years agoauto merge of #19044 : murarth/rust/libsyntax-view-item, r=alexcrichton
bors [Tue, 18 Nov 2014 23:51:43 +0000 (23:51 +0000)]
auto merge of #19044 : murarth/rust/libsyntax-view-item, r=alexcrichton

Allows parsing view items (`use` and `extern crate`) individually. Does not change behavior of any existing functions.

Closes #19024

9 years agoderiving: error out when used on a non-type
Keegan McAllister [Tue, 18 Nov 2014 22:02:40 +0000 (14:02 -0800)]
deriving: error out when used on a non-type

Besides being more helpful, this gives us the flexibility to later define
a meaning for something like

    #[deriving(...)]
    mod bar { ... }

9 years agoFeature gate non-ASCII lifetime identifiers
Jakub Bukaj [Tue, 18 Nov 2014 16:39:16 +0000 (17:39 +0100)]
Feature gate non-ASCII lifetime identifiers

Fixes #19069.

9 years agoauto merge of #18870 : barosl/rust/os-ioresult, r=alexcrichton
bors [Tue, 18 Nov 2014 21:56:58 +0000 (21:56 +0000)]
auto merge of #18870 : barosl/rust/os-ioresult, r=alexcrichton

Make old-fashioned functions in the `std::os` module utilize `IoResult`.

I'm still investigating the possibility to include more functions in this pull request. Currently, it covers `getcwd()`, `make_absolute()`, and `change_dir()`. The issues covered by this PR are #16946 and #16315.

A few concerns:

- Should we provide `OsError` in distinction from `IoError`? I'm saying this because in Python, those two are distinguished. One advantage that we keep using `IoError` is that we can make the error cascade down other functions whose return type also includes `IoError`. An example of such functions is `std::io::TempDir::new_in()`, which uses `os::make_absolute()` as well as returns `IoResult<TempDir>`.
- `os::getcwd()` uses an internal buffer whose size is 2048 bytes, which is passed to `getcwd(3)`. There is no upper limitation of file paths in the POSIX standard, but typically it is set to 4096 bytes such as in Linux. Should we increase the buffer size? One thing that makes me nervous is that the size of 2048 bytes already seems a bit excessive, thinking that in normal cases, there would be no filenames that even exceeds 512 bytes.

Fixes #16946.
Fixes #16315.

Any ideas are welcomed. Thanks!

9 years agoMake os::setenv() and os::unsetenv() panic if an error occurs
Barosl Lee [Tue, 11 Nov 2014 17:50:44 +0000 (02:50 +0900)]
Make os::setenv() and os::unsetenv() panic if an error occurs

These functions can fail if:

- EINVAL: The name is empty, or contains an '=' character
- ENOMEM: Insufficient memory

9 years agoMake os::change_dir() return IoResult<()>
Barosl Lee [Tue, 11 Nov 2014 08:13:10 +0000 (17:13 +0900)]
Make os::change_dir() return IoResult<()>

os::change_dir() returns bool, without a meaningful error message.
Change it to return IoResult<()> to indicate what IoError caused the
failure.

Fixes #16315.

[breaking-change]

9 years agoMake os::getcwd() return IoResult<Path>
Barosl Lee [Tue, 11 Nov 2014 05:38:20 +0000 (14:38 +0900)]
Make os::getcwd() return IoResult<Path>

os::getcwd() panics if the current directory is not available. According
to getcwd(3), there are three cases:

- EACCES: Permission denied.
- ENOENT: The current working directory has been removed.
- ERANGE: The buffer size is less than the actual absolute path.

This commit makes os::getcwd() return IoResult<Path>, not just Path,
preventing it from panicking.

As os::make_absolute() depends on os::getcwd(), it is also modified to
return IoResult<Path>.

Fixes #16946.

[breaking-change]

9 years agoRegister new snapshots
Alex Crichton [Tue, 18 Nov 2014 19:35:22 +0000 (11:35 -0800)]
Register new snapshots

9 years agoauto merge of #18993 : nikomatsakis/rust/hrtb-5, r=pcwalton
bors [Tue, 18 Nov 2014 19:11:43 +0000 (19:11 +0000)]
auto merge of #18993 : nikomatsakis/rust/hrtb-5, r=pcwalton

Enough said.

Fixes #18639.

r? @pcwalton (or someone else?)

This is a [breaking-change]. In particular, several feature gates related to unboxed closures were consolidated into one (`overloaded_calls`, `unboxed_closure_sugar` => `unboxed_closures`). Otherwise, I think everything that worked before should still work. File a bug and cc @nikomatsakis if you find otherwise. :)

9 years agoFix merge conflict about `[]` coercions in new tests
Niko Matsakis [Tue, 18 Nov 2014 18:20:59 +0000 (13:20 -0500)]
Fix merge conflict about `[]` coercions in new tests

9 years agoNew guide: error handling
Steve Klabnik [Wed, 12 Nov 2014 16:33:28 +0000 (11:33 -0500)]
New guide: error handling

9 years agoUpdate test for equivalency to include region binders in object types, add new tests...
Niko Matsakis [Sun, 16 Nov 2014 00:10:22 +0000 (19:10 -0500)]
Update test for equivalency to include region binders in object types, add new tests relating to HRTB, consolidate the `unboxed_closures` and `overloaded_calls` feature gates.

9 years agoUpdate tests for `()` notation to use traits not structs
Niko Matsakis [Sun, 16 Nov 2014 00:10:08 +0000 (19:10 -0500)]
Update tests for `()` notation to use traits not structs