]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoremove unnecessary PaX detection
Daniel Micay [Thu, 12 Jun 2014 20:11:21 +0000 (16:11 -0400)]
remove unnecessary PaX detection

Rust no longer has support for JIT compilation, so it doesn't currently
require a PaX MPROTECT exception. The extended attributes are preferred
over modifying the binaries so it's not actually going to work on most
systems like this anyway.

If JIT compilation ends up being supported again, it should handle this
by *always* applying the exception via an extended attribute without
performing auto-detection of PaX on the host. The `paxctl` tool is only
necessary with the older method involving modifying the ELF binary.

10 years agoAudit usage of NativeMutex
Alex Crichton [Thu, 12 Jun 2014 18:40:13 +0000 (11:40 -0700)]
Audit usage of NativeMutex

Once a native mutex has been used once, it is never allowed to be moved again.
This is because some pthreads implementations take pointers inside the mutex
itself.

This commit adds stern wording around the methods on native mutexes, and fixes
one use case in the codebase. The Mutex type in libsync was susceptible to
movement, so the inner static mutex is now boxed to ensure that the address of
the native mutex is constant.

10 years agorustc: [T, ..N] and [T, ..N+1] are not the same
Alex Crichton [Thu, 12 Jun 2014 17:27:44 +0000 (10:27 -0700)]
rustc: [T, ..N] and [T, ..N+1] are not the same

This commit fixes a bug in the calculation of the hash of a type which didn't
factor in the length of a constant-sized vector. As a result of this, a type
placed into an Any of a fixed length could be peeled out with any other fixed
length in a safe manner.

10 years agoClarify `Any` docs
P1start [Thu, 12 Jun 2014 07:54:03 +0000 (19:54 +1200)]
Clarify `Any` docs

The `Any` docs previously did not state that only `'static` types implement it.

10 years agoFix the unused struct field lint for struct variants
Jakub Wieczorek [Thu, 12 Jun 2014 06:38:30 +0000 (08:38 +0200)]
Fix the unused struct field lint for struct variants

Fixes #14837.

10 years agoRemove typo on collections::treemap::UnionItems
Renato Riccieri Santos Zannon [Thu, 12 Jun 2014 06:36:46 +0000 (03:36 -0300)]
Remove typo on collections::treemap::UnionItems

The docstring stated it was a intersection iterator, when in fact it is the union iterator

10 years agoconfigure: Don't sync unused submodules
Alex Crichton [Thu, 12 Jun 2014 01:54:14 +0000 (18:54 -0700)]
configure: Don't sync unused submodules

If the compiler is built with --{llvm,jemalloc,libuv}-root, then the configure
script can skip updating these submodules.

Closes #14822

10 years agolibsyntax: Allow `+` to separate trait bounds from objects.
Patrick Walton [Wed, 11 Jun 2014 19:14:38 +0000 (12:14 -0700)]
libsyntax: Allow `+` to separate trait bounds from objects.

RFC #27.

After a snapshot, the old syntax will be removed.

This can break some code that looked like `foo as &Trait:Send`. Now you
will need to write `foo as (&Trait+Send)`.

Closes #12778.

[breaking-change]

10 years agostd: Rebase better errors on master
Alex Crichton [Wed, 11 Jun 2014 17:24:04 +0000 (10:24 -0700)]
std: Rebase better errors on master

10 years agoImprove error messages for io::fs
Yehuda Katz [Tue, 3 Jun 2014 19:33:18 +0000 (12:33 -0700)]
Improve error messages for io::fs

10 years agolibrustc: Fix the issue with labels shadowing variable names by making
Patrick Walton [Tue, 10 Jun 2014 20:54:13 +0000 (13:54 -0700)]
librustc: Fix the issue with labels shadowing variable names by making
the leading quote part of the identifier for the purposes of hygiene.

This adopts @jbclements' solution to #14539.

I'm not sure if this is a breaking change or not.

Closes #12512.

[breaking-change]

10 years agoauto merge of #14604 : nikomatsakis/rust/issue-5527-namespace-substs, r=pcwalton
bors [Fri, 13 Jun 2014 19:02:11 +0000 (19:02 +0000)]
auto merge of #14604 : nikomatsakis/rust/issue-5527-namespace-substs, r=pcwalton

The current setup is to have a single vector of type parameters in
scope at any one time. We then have to concatenate the parameters from
the impl/trait with those of the method. This makes a lot of things
awkward, most notably associated fns ("static fns"). This branch
restructures the substitutions into three distinct namespaces (type,
self, fn). This makes most of the "type parameter management"
trivial. This also sets us up to support UFCS (though I haven't made
any particular changes in that direction in this patch).

Along the way, this patch fixes a few miscellaneous bits of code cleanup:

1. Patch resolve to detect references to out-of-scope type parameters,
   rather than checking for "out of bound" indices during substitution
   (fixes #14603).

2. Move def out of libsyntax into librustc where it belongs. I should have
   moved DefId too, but didn't.

3. Permit homogeneous tuples like `(T, T, T)` to be used as fixed-length
   vectors like `[T, ..3]`. This is awfully handy, though public facing.
   I suppose it requires an RFC.

4. Add some missing tests.

cc #5527

r? @pcwalton or @pnkfelix

10 years agoIntroduce VecPerParamSpace and use it to represent sets of types and
Niko Matsakis [Sat, 31 May 2014 22:53:13 +0000 (18:53 -0400)]
Introduce VecPerParamSpace and use it to represent sets of types and
parameters

This involves numerous substeps:

1. Treat Self same as any other parameter.
2. No longer compute offsets for method parameters.
3. Store all generic types (both trait/impl and method) with a method,
   eliminating odd discrepancies.
4. Stop doing unspeakable things to static methods and instead just use
   the natural types, now that we can easily add the type parameters from
   trait into the method's polytype.
5. No doubt some more. It was hard to separate these into distinct commits.

Fixes #13564

10 years agoauto merge of #14831 : alexcrichton/rust/format-intl, r=brson
bors [Fri, 13 Jun 2014 14:42:03 +0000 (14:42 +0000)]
auto merge of #14831 : alexcrichton/rust/format-intl, r=brson

* The select/plural methods from format strings are removed
* The # character no longer needs to be escaped
* The \-based escapes have been removed
* '{{' is now an escape for '{'
* '}}' is now an escape for '}'

Closes #14810
[breaking-change]

10 years agoauto merge of #13222 : nick29581/rust/dxr4, r=brson
bors [Fri, 13 Jun 2014 09:57:06 +0000 (09:57 +0000)]
auto merge of #13222 : nick29581/rust/dxr4, r=brson

Adds a -Z flag `save-analysis` which runs after the analysis phase of the compiler and saves a bunch of info into a CSV file for the crate. This is designed to work with the DXR code browser, but is frontend-independent, that is this info should be useful for all kinds of code browsers, IDEs, or other tools.

I need to squash commits before landing (there will probably be a fair few to come), please ignore them for now and just comment on the changes.

10 years agoDump results of analysis phase as CSV
Nick Cameron [Wed, 5 Feb 2014 04:31:33 +0000 (17:31 +1300)]
Dump results of analysis phase as CSV

Adds the option -Zsave-analysis which will dump the results of syntax and type checking into CSV files. These can be interpreted by tools such as DXR to provide semantic information about Rust programs for code search, cross-reference, etc.

Authored by Nick Cameron and Peter Elmers (@pelmers; including enums, type parameters/generics).

10 years agoauto merge of #14858 : alexcrichton/rust/no-jemalloc-on-travis, r=thestinger
bors [Fri, 13 Jun 2014 04:22:01 +0000 (04:22 +0000)]
auto merge of #14858 : alexcrichton/rust/no-jemalloc-on-travis, r=thestinger

Turns out they don't have the `je_` prefix, so we can't use the system-installed
jemalloc.

10 years agoauto merge of #14819 : michaelwoerister/rust/unique_type_id, r=alexcrichton
bors [Fri, 13 Jun 2014 01:52:02 +0000 (01:52 +0000)]
auto merge of #14819 : michaelwoerister/rust/unique_type_id, r=alexcrichton

With this change, rustc creates a unique type identifier for types in debuginfo. These type identifiers are used by LLVM to correctly handle link-time-optimization scenarios but also help rustc with dealing with inlining from other crates. For more information, see the documentation block at the top of librustc/middle/trans/debuginfo.rs and also [my blog post about the topic](http://michaelwoerister.github.io/2014/06/05/rust-debuginfo-and-unique-type-identifiers.html). This should fix the LTO issues that have been popping up lately.

The changes to the debuginfo module's inner workings are also improved by this. Metadata uniquing of pointer types is not handled explicitly instead of relying on LLVM doing the right thing behind the scenes, and region parameters on types should not lead to metadata duplication anymore.

There are two things that I'd like to get some feedback on:
1. IDs for named items consist of two parts: The [Strict Version Hash](https://github.com/mozilla/rust/blob/0.10/src/librustc/back/svh.rs#L11) of their defining crate and the AST node id of their definition within that crate. My question is: Is the SVH a good choice for identifying the crate? Is it even going to stay? The [crate-id RFC](https://github.com/rust-lang/rfcs/pull/109) got me confused.
2. Unique Type Identifiers can be arbitrary strings and right now the format is rather verbose. For debugging this is nice, because one can infer a lot about a type from the type id alone (it's more or less a signature). For deeply nested generics, id strings could get rather long though. One option to limit the id size would be to use some hashcode instead of the full id (anything that avoids collision as much as possible). Another option would be to use a more compact representation, like ty_encode. This reduces size but also readability.
Since these ID's only show up in LLVM IR, I'm inclined to just leave in the verbose format for now, and only act if sizes of rlibs become a problem.

10 years agoauto merge of #14816 : theptrk/rust/unclear-comment, r=huonw
bors [Fri, 13 Jun 2014 00:07:05 +0000 (00:07 +0000)]
auto merge of #14816 : theptrk/rust/unclear-comment, r=huonw

The old comment left it unclear if this is creating a random value or doing a check as to whether or not the generator is available or some other operation.

See: http://stackoverflow.com/questions/24153311/when-is-rng-gen-not-true

10 years agotravis: Don't use a local jemalloc
Alex Crichton [Thu, 12 Jun 2014 23:12:37 +0000 (16:12 -0700)]
travis: Don't use a local jemalloc

Turns out they don't have the `je_` prefix, so we can't use the system-installed
jemalloc.

10 years agoauto merge of #14813 : cmr/rust/once-docs-unsafe, r=alexcrichton
bors [Thu, 12 Jun 2014 21:22:01 +0000 (21:22 +0000)]
auto merge of #14813 : cmr/rust/once-docs-unsafe, r=alexcrichton

10 years agoauto merge of #14811 : forticulous/rust/refcell-show, r=alexcrichton
bors [Thu, 12 Jun 2014 19:36:53 +0000 (19:36 +0000)]
auto merge of #14811 : forticulous/rust/refcell-show, r=alexcrichton

Show impl for RefCell and friends

10 years agodebuginfo: Fix issue with unique type IDs not being passed to LLVM for LLVM 3.4
Michael Woerister [Thu, 12 Jun 2014 16:06:14 +0000 (18:06 +0200)]
debuginfo: Fix issue with unique type IDs not being passed to LLVM for LLVM 3.4

10 years agodebuginfo: Generate cross-crate unique type identifiers for debuginfo types.
Michael Woerister [Fri, 30 May 2014 15:09:16 +0000 (17:09 +0200)]
debuginfo: Generate cross-crate unique type identifiers for debuginfo types.

With this change, rustc creates a unique type identifier for types in debuginfo. These type identifiers are used by LLVM to correctly handle link-time-optimization scenarios but also help rustc with dealing with inlining from other crates. For more information, see the documentation block at the top of librustc/middle/trans/debuginfo.rs.

Fixes #13681.

10 years agoauto merge of #14809 : zzmp/rust/patch-2, r=alexcrichton
bors [Thu, 12 Jun 2014 16:02:05 +0000 (16:02 +0000)]
auto merge of #14809 : zzmp/rust/patch-2, r=alexcrichton

Previously, the type system's restrictions on borrowing were summarized as

> The previous example showed that the type system forbids any borrowing of owned boxes found in aliasable, mutable memory.

This did not jive with the example, which allowed mutations so long as the borrowed reference had been returned. Also, the language has changed to no longer allow aliasable mutable locations. This changes the summary to read

> The previous example showed that the type system forbids mutations of owned boxed values while they are being borrowed. In general, the type system also forbids borrowing a value as mutable if it is already being borrowed - either as a mutable reference or an immutable one.

This adds more general information for the experienced reader as well, to offer a more complete understanding.

10 years agoauto merge of #14805 : zzmp/rust/patch-1, r=alexcrichton
bors [Thu, 12 Jun 2014 14:17:13 +0000 (14:17 +0000)]
auto merge of #14805 : zzmp/rust/patch-1, r=alexcrichton

The guide previously stated:

> The compiler will automatically convert a box box point to a reference like &point.

This fixes the doubled word `box`, so the statement reads

> The compiler will automatically convert a box point to a reference like &point.

The code it is referring to is `compute_distance(&on_the_stack, on_the_heap);`, so a single `box` is appropriate.

10 years agoauto merge of #14801 : pcwalton/rust/name-shadowing-in-one-pattern, r=alexcrichton
bors [Thu, 12 Jun 2014 12:32:13 +0000 (12:32 +0000)]
auto merge of #14801 : pcwalton/rust/name-shadowing-in-one-pattern, r=alexcrichton

bindings and function arguments.

Issue #14581.

To fix code that this breaks, give the pattern identifiers different names.

[breaking-change]

r? @brson

10 years agoauto merge of #14800 : reem/rust/patch-1, r=alexcrichton
bors [Thu, 12 Jun 2014 10:47:03 +0000 (10:47 +0000)]
auto merge of #14800 : reem/rust/patch-1, r=alexcrichton

According to #14767 and the grammar right above this documentation, nested comments are supported.

10 years agoauto merge of #14792 : alexcrichton/rust/local-jemalloc, r=brson
bors [Thu, 12 Jun 2014 09:02:08 +0000 (02:02 -0700)]
auto merge of #14792 : alexcrichton/rust/local-jemalloc, r=brson

This configures the makefiles to copy a local jemalloc/libuv library into place instead of building the local copy of one. Additionally, this switches our travis builds to using the system-provided jemalloc instead of a custom-built jemalloc to exercise this functionality.

10 years agomk: Allow using a locally compiled libuv.a
Alex Crichton [Tue, 10 Jun 2014 17:01:21 +0000 (10:01 -0700)]
mk: Allow using a locally compiled libuv.a

Closes #5563

10 years agotravis: Use a pre-installed jemalloc
Alex Crichton [Sat, 7 Jun 2014 06:55:05 +0000 (23:55 -0700)]
travis: Use a pre-installed jemalloc

10 years agomk: Allow usage of a local jemalloc install
Alex Crichton [Sat, 7 Jun 2014 06:52:56 +0000 (23:52 -0700)]
mk: Allow usage of a local jemalloc install

This adds a new configure option, --jemalloc-root, which will specify a location
at which libjemalloc_pic.a must live. This library is then used for the build
triple as the jemalloc library to link.

10 years agoauto merge of #14799 : mcreinhard/rust/tilde-fix, r=alexcrichton
bors [Thu, 12 Jun 2014 05:02:00 +0000 (22:02 -0700)]
auto merge of #14799 : mcreinhard/rust/tilde-fix, r=alexcrichton

Replaced `~Drawable` with `Box<Drawable>` in tutorial

10 years agoauto merge of #14713 : darnuria/rust/Improve_std_os_documentation_#2, r=alexcrichton
bors [Thu, 12 Jun 2014 02:06:58 +0000 (19:06 -0700)]
auto merge of #14713 : darnuria/rust/Improve_std_os_documentation_#2, r=alexcrichton

Improving documentation, consistency, removes evils empty lines etc...

10 years agoImprove docs and refactore std::os.
Axel Viala [Wed, 11 Jun 2014 15:52:12 +0000 (17:52 +0200)]
Improve docs and refactore std::os.

10 years agostd: Remove i18n/l10n from format!
Alex Crichton [Wed, 28 May 2014 16:24:28 +0000 (09:24 -0700)]
std: Remove i18n/l10n from format!

* The select/plural methods from format strings are removed
* The # character no longer needs to be escaped
* The \-based escapes have been removed
* '{{' is now an escape for '{'
* '}}' is now an escape for '}'

Closes #14810
[breaking-change]

10 years agoauto merge of #14703 : alexcrichton/rust/no-more-owned-vectors, r=brson
bors [Wed, 11 Jun 2014 22:36:59 +0000 (15:36 -0700)]
auto merge of #14703 : alexcrichton/rust/no-more-owned-vectors, r=brson

The following features have been removed

* `box [a, b, c]`
* `~[a, b, c]`
* `box [a, ..N]`
* `~[a, ..N]`
* `~[T]` (as a type)
* deprecated_owned_vector lint

All users of ~[T] should move to using Vec<T> instead.

10 years agorustc: Remove ~[T] from the language
Alex Crichton [Fri, 6 Jun 2014 17:27:49 +0000 (10:27 -0700)]
rustc: Remove ~[T] from the language

The following features have been removed

* box [a, b, c]
* ~[a, b, c]
* box [a, ..N]
* ~[a, ..N]
* ~[T] (as a type)
* deprecated_owned_vector lint

All users of ~[T] should move to using Vec<T> instead.

10 years agolibrustc: Forbid identifiers that shadow in the same pattern in let
Patrick Walton [Tue, 10 Jun 2014 21:39:10 +0000 (14:39 -0700)]
librustc: Forbid identifiers that shadow in the same pattern in let
bindings and function arguments.

Issue #14581.

To fix code that this breaks, give the pattern identifiers different names.

[breaking-change]

10 years agoauto merge of #14746 : alexcrichton/rust/libsync, r=brson
bors [Wed, 11 Jun 2014 18:47:04 +0000 (11:47 -0700)]
auto merge of #14746 : alexcrichton/rust/libsync, r=brson

This commit is the final step in the libstd facade, #13851. The purpose of this
commit is to move libsync underneath the standard library, behind the facade.
This will allow core primitives like channels, queues, and atomics to all live
in the same location.

There were a few notable changes and a few breaking changes as part of this
movement:

* The `Vec` and `String` types are reexported at the top level of libcollections
* The `unreachable!()` macro was copied to libcore
* The `std::rt::thread` module was moved to librustrt, but it is still
  reexported at the same location.
* The `std::comm` module was moved to libsync
* The `sync::comm` module was moved under `sync::comm`, and renamed to `duplex`.
  It is now a private module with types/functions being reexported under
  `sync::comm`. This is a breaking change for any existing users of duplex
  streams.
* All concurrent queues/deques were moved directly under libsync. They are also
  all marked with #![experimental] for now if they are public.
* The `task_pool` and `future` modules no longer live in libsync, but rather
  live under `std::sync`. They will forever live at this location, but they may
  move to libsync if the `std::task` module moves as well.

[breaking-change]

10 years agoauto merge of #14250 : alexcrichton/rust/gc, r=brson
bors [Wed, 11 Jun 2014 17:02:04 +0000 (10:02 -0700)]
auto merge of #14250 : alexcrichton/rust/gc, r=brson

This commit removes `@T` from the compiler by moving the AST to using `Gc<T>`. This also starts treating `Gc<T>` as `@T` in the same way that `Box<T>` is the same as `~T` in the compiler.

After this hits a snapshot, the `@T` syntax should be able to be removed completely.

10 years agosync: Move underneath libstd
Alex Crichton [Sat, 7 Jun 2014 18:13:26 +0000 (11:13 -0700)]
sync: Move underneath libstd

This commit is the final step in the libstd facade, #13851. The purpose of this
commit is to move libsync underneath the standard library, behind the facade.
This will allow core primitives like channels, queues, and atomics to all live
in the same location.

There were a few notable changes and a few breaking changes as part of this
movement:

* The `Vec` and `String` types are reexported at the top level of libcollections
* The `unreachable!()` macro was copied to libcore
* The `std::rt::thread` module was moved to librustrt, but it is still
  reexported at the same location.
* The `std::comm` module was moved to libsync
* The `sync::comm` module was moved under `sync::comm`, and renamed to `duplex`.
  It is now a private module with types/functions being reexported under
  `sync::comm`. This is a breaking change for any existing users of duplex
  streams.
* All concurrent queues/deques were moved directly under libsync. They are also
  all marked with #![experimental] for now if they are public.
* The `task_pool` and `future` modules no longer live in libsync, but rather
  live under `std::sync`. They will forever live at this location, but they may
  move to libsync if the `std::task` module moves as well.

[breaking-change]

10 years agorustc: Move the AST from @T to Gc<T>
Alex Crichton [Fri, 16 May 2014 17:15:33 +0000 (10:15 -0700)]
rustc: Move the AST from @T to Gc<T>

10 years agosyntax: Move the AST from @T to Gc<T>
Alex Crichton [Fri, 16 May 2014 07:16:13 +0000 (00:16 -0700)]
syntax: Move the AST from @T to Gc<T>

10 years agorustc: Update how Gc<T> is recognized
Alex Crichton [Fri, 16 May 2014 01:18:00 +0000 (18:18 -0700)]
rustc: Update how Gc<T> is recognized

This commit uses the same trick as ~/Box to map Gc<T> to @T internally inside
the compiler. This moves a number of implementations of traits to the `gc`
module in the standard library.

This removes functions such as `Gc::new`, `Gc::borrow`, and `Gc::ptr_eq` in
favor of the more modern equivalents, `box(GC)`, `Deref`, and pointer equality.

The Gc pointer itself should be much more useful now, and subsequent commits
will move the compiler away from @T towards Gc<T>

[breaking-change]

10 years agoauto merge of #14789 : aochagavia/rust/prelude, r=alexcrichton
bors [Wed, 11 Jun 2014 14:42:07 +0000 (07:42 -0700)]
auto merge of #14789 : aochagavia/rust/prelude, r=alexcrichton

10 years agoauto merge of #14788 : Sawyer47/rust/issue-13214, r=huonw
bors [Wed, 11 Jun 2014 13:02:10 +0000 (06:02 -0700)]
auto merge of #14788 : Sawyer47/rust/issue-13214, r=huonw

Closes #13214

10 years agoauto merge of #14787 : alexcrichton/rust/issue-14784, r=pcwalton
bors [Wed, 11 Jun 2014 11:22:02 +0000 (04:22 -0700)]
auto merge of #14787 : alexcrichton/rust/issue-14784, r=pcwalton

This is another case of #13246. The RAII lock wasn't being destroyed until after
the allocation was free'd due to destructor scheduling.

Closes #14784

10 years agoauto merge of #14786 : pcwalton/rust/enum-to-float-casts, r=alexcrichton
bors [Wed, 11 Jun 2014 06:37:06 +0000 (23:37 -0700)]
auto merge of #14786 : pcwalton/rust/enum-to-float-casts, r=alexcrichton

If this breaks your code, take a deep breath, go for a walk, and
consider why you're relying on the sign extension semantics of
enum-to-float casts.

[breaking-change]

Closes #8230.

10 years agoFix unclear wording of comment
theptrk [Wed, 11 Jun 2014 03:29:09 +0000 (20:29 -0700)]
Fix unclear wording of comment

10 years agoauto merge of #14777 : alexcrichton/rust/issue-14747, r=huonw
bors [Wed, 11 Jun 2014 02:52:05 +0000 (19:52 -0700)]
auto merge of #14777 : alexcrichton/rust/issue-14747, r=huonw

When generating documentation, rustdoc has the ability to generate relative
links within the current distribution of crates to one another. To do this, it
must recognize when a crate's documentation is in the same output directory. The
current threshold for "local documentation for crate X being available" is
whether the directory "doc/X" exists.

This change modifies the build system to have new dependencies for each
directory of upstream crates for a rustdoc invocation. This will ensure that
when building documentation that all the crates in the standard distribution are
guaranteed to have relative links to one another.

This change is prompted by guaranteeing that offline docs always work with one
another. Before this change, races could mean that some docs were built before
others, and hence may have http links when relative links would suffice.

Closes #14747

10 years agoShow impl for Ref & RefMut
fort [Tue, 10 Jun 2014 06:09:53 +0000 (23:09 -0700)]
Show impl for Ref & RefMut

10 years agoauto merge of #14768 : riccieri/rust/detransmute-arena, r=alexcrichton
bors [Wed, 11 Jun 2014 01:07:07 +0000 (18:07 -0700)]
auto merge of #14768 : riccieri/rust/detransmute-arena, r=alexcrichton

**Update**

I've reimplemented this using `Cell` and `RefCell`, as suggested by @alexcrichton. By taking care with the duration of the borrows, I was able to maintain the recursive allocation feature (now covered by a test) without the use of `Unsafe`, and without breaking the non-aliasing `&mut` invariant.

**Original**

Changes both `Arena` and `TypedArena` to contain an inner struct wrapped in a `Unsafe`, and change field access to go through those instead of transmuting `&self` to `&mut self`.

Part of #13933

10 years agosync: Once is no longer unsafe, update docs
Corey Richardson [Wed, 11 Jun 2014 00:43:22 +0000 (17:43 -0700)]
sync: Once is no longer unsafe, update docs

10 years agoUpdate description to reflect language changes
Zach Pomerantz [Wed, 11 Jun 2014 00:36:02 +0000 (17:36 -0700)]
Update description to reflect language changes

Previously, the type system's restrictions on borrowing were summarized as

> The previous example showed that the type system forbids any borrowing of owned boxes found in aliasable, mutable memory

This did not jive with the example, which allowed mutations so long as the borrowed reference had been returned. Also, the language has changed to no longer allow aliasable mutable locations. This changes the summary to read

> The previous example showed that the type system forbids mutations of owned boxed values while they are being borrowed. In general, the type system also forbids borrowing a value as mutable if it is already being borrowed - either as a mutable reference or an immutable one.

This adds more general information for the experienced reader as well, to offer a more complete understanding.

10 years agoRemoved doubled wording.
Zach Pomerantz [Tue, 10 Jun 2014 23:53:04 +0000 (16:53 -0700)]
Removed doubled wording.

The guide previously stated:

> The compiler will automatically convert a box box point to a reference like &amp;point.

This fixes the doubled word `box`, so the statement reads

> The compiler will automatically convert a box point to a reference like &amp;point.

The code it is referring to is `compute_distance(&on_the_stack, on_the_heap);`, so a single `box` is appropriate.

10 years agoRemove outdated info about nested block comments. Fixes #14767
Jonathan Reem [Tue, 10 Jun 2014 21:53:07 +0000 (14:53 -0700)]
Remove outdated info about nested block comments. Fixes #14767

10 years agoauto merge of #14764 : jbcrail/rust/fix-more-comments, r=alexcrichton
bors [Tue, 10 Jun 2014 22:17:01 +0000 (15:17 -0700)]
auto merge of #14764 : jbcrail/rust/fix-more-comments, r=alexcrichton

10 years agoFix deprecated use of ~
Michael Reinhard [Tue, 10 Jun 2014 21:44:27 +0000 (14:44 -0700)]
Fix deprecated use of ~

10 years agoauto merge of #14752 : jakub-/rust/issue-11940, r=alexcrichton
bors [Tue, 10 Jun 2014 20:17:10 +0000 (13:17 -0700)]
auto merge of #14752 : jakub-/rust/issue-11940, r=alexcrichton

Fixes #8315
Fixes #11940

10 years agoauto merge of #14696 : jakub-/rust/dead-struct-fields, r=alexcrichton
bors [Tue, 10 Jun 2014 16:49:29 +0000 (09:49 -0700)]
auto merge of #14696 : jakub-/rust/dead-struct-fields, r=alexcrichton

This uncovered some dead code, most notably in middle/liveness.rs, which I think suggests there must be something fishy with that part of the code.

The #[allow(dead_code)] annotations on some of the fields I am not super happy about but as I understand, marker type may disappear at some point.

10 years agoFix more misspelled comments and strings.
Joseph Crail [Mon, 9 Jun 2014 04:00:52 +0000 (00:00 -0400)]
Fix more misspelled comments and strings.

10 years agoPub use CheckedDiv in the prelude
Adolfo Ochagavía [Tue, 10 Jun 2014 07:59:05 +0000 (09:59 +0200)]
Pub use CheckedDiv in the prelude

10 years agoAdd test for issue #13214
Piotr Jawniak [Tue, 10 Jun 2014 06:07:13 +0000 (08:07 +0200)]
Add test for issue #13214

Closes #13214

10 years agoauto merge of #14606 : pcwalton/rust/fn-trait-sugar, r=alexcrichton
bors [Tue, 10 Jun 2014 06:41:53 +0000 (23:41 -0700)]
auto merge of #14606 : pcwalton/rust/fn-trait-sugar, r=alexcrichton

r? @alexcrichton

10 years agoauto merge of #14783 : alexcrichton/rust/rollup, r=alexcrichton
bors [Tue, 10 Jun 2014 04:57:09 +0000 (21:57 -0700)]
auto merge of #14783 : alexcrichton/rust/rollup, r=alexcrichton

Closes #14611 (std: Remove the as_utf16_p functions)
Closes #14694 (Num cleanup)
Closes #14760 (Add --color to test binary options)
Closes #14763 (std: Move dynamic_lib from std::unstable to std)
Closes #14766 (Add test for issue #13446)
Closes #14769 (collections: Add missing Default impls)
Closes #14773 (General nits)
Closes #14776 (rustdoc: Correctly classify enums/typedefs)

10 years agoTest fixes from rollup
Alex Crichton [Tue, 10 Jun 2014 02:55:28 +0000 (19:55 -0700)]
Test fixes from rollup

10 years agorustrt: Fix invalid reads caught by valgrind
Alex Crichton [Tue, 10 Jun 2014 03:57:55 +0000 (20:57 -0700)]
rustrt: Fix invalid reads caught by valgrind

This is another case of #13246. The RAII lock wasn't being destroyed until after
the allocation was free'd due to destructor scheduling.

Closes #14784

10 years agolibrustc: Use *signed* extension when converting enums to floats.
Patrick Walton [Tue, 10 Jun 2014 03:39:20 +0000 (20:39 -0700)]
librustc: Use *signed* extension when converting enums to floats.

Previously, constants used unsigned extension, while non-constants used
signed extension. This unifies both paths to use signed extension.

If this breaks your code, take a deep breath, go for a walk, and
consider why you're relying on the sign extension semantics of
enum-to-float casts.

Closes #8230.

[breaking-change]

10 years agoRemove & -> &mut transmute from TypedArena
Renato Zannon [Tue, 10 Jun 2014 03:41:44 +0000 (00:41 -0300)]
Remove & -> &mut transmute from TypedArena

10 years agoRemove & -> &mut transmute from Arena
Renato Zannon [Tue, 10 Jun 2014 03:29:36 +0000 (00:29 -0300)]
Remove & -> &mut transmute from Arena

10 years agolibrustc: Implement sugar for the `FnMut` trait
Patrick Walton [Mon, 2 Jun 2014 01:41:46 +0000 (18:41 -0700)]
librustc: Implement sugar for the `FnMut` trait

10 years agoAdd a test for nested Arena.alloc
Renato Zannon [Tue, 10 Jun 2014 02:54:52 +0000 (23:54 -0300)]
Add a test for nested Arena.alloc

10 years agoauto merge of #14694 : aochagavia/rust/num-cleanup, r=alexcrichton
bors [Tue, 10 Jun 2014 02:52:08 +0000 (19:52 -0700)]
auto merge of #14694 : aochagavia/rust/num-cleanup, r=alexcrichton

10 years agorustdoc: Correctly classify enums/typedefs
Alex Crichton [Mon, 9 Jun 2014 19:56:37 +0000 (12:56 -0700)]
rustdoc: Correctly classify enums/typedefs

Both of these items are surfaced as a DefTy, so some extra logic was needed in
the decoder module to figure out whether one is actually an enum or whether it's
a typedef.

Closes #14757

10 years agostd: adjust the TCP io doc example to work reliably.
Huon Wilson [Mon, 9 Jun 2014 14:33:04 +0000 (00:33 +1000)]
std: adjust the TCP io doc example to work reliably.

Fixes #11576 by making the code never run (and hence never
pass when the test was marked `should_fail`).

10 years agonative: add more info to the native unimplemented error.
Huon Wilson [Mon, 9 Jun 2014 14:31:31 +0000 (00:31 +1000)]
native: add more info to the native unimplemented error.

This refers to green, which (AFAICT) has everything implemented. In
particular, this will help guide people to get working signal handling
via libgreen.

10 years agocollections: Add missing Default impls
Tom Jakubowski [Mon, 9 Jun 2014 07:30:04 +0000 (00:30 -0700)]
collections: Add missing Default impls

Add Default impls for TreeMap, TreeSet, SmallIntMap, BitvSet, DList,
PriorityQueue, RingBuf, TrieMap, and TrieSet.

10 years agoAdd test for issue #13446
Piotr Jawniak [Mon, 9 Jun 2014 05:44:49 +0000 (07:44 +0200)]
Add test for issue #13446

Closes #13446

10 years agostd: Move dynamic_lib from std::unstable to std
Brian Anderson [Mon, 9 Jun 2014 03:12:10 +0000 (20:12 -0700)]
std: Move dynamic_lib from std::unstable to std

This leaves a deprecated reexport in place temporarily.

Closes #1457.

10 years agoAdd a --color flag to test binaries
Steven Fackler [Mon, 9 Jun 2014 00:10:27 +0000 (17:10 -0700)]
Add a --color flag to test binaries

It uses the same behavior as rustc's.

10 years agoCleanup bigint
Adolfo Ochagavía [Fri, 6 Jun 2014 08:56:03 +0000 (10:56 +0200)]
Cleanup bigint

10 years agoMoved integer trait and functions to submodule
Adolfo Ochagavía [Thu, 5 Jun 2014 19:07:50 +0000 (21:07 +0200)]
Moved integer trait and functions to submodule

10 years agostd: Remove the as_utf16_p functions
Alex Crichton [Mon, 2 Jun 2014 21:51:58 +0000 (14:51 -0700)]
std: Remove the as_utf16_p functions

These functions are all much better expressed via RAII using the to_utf16()
method on strings. This refactoring also takes this opportunity to properly
handle when filenames aren't valid unicode when passed through to the windows
I/O layer by properly returning I/O errors.

All previous users of the `as_utf16_p` or `as_utf16_mut_p` functions will need
to convert their code to using `foo.to_utf16().append_one(0)` to get a
null-terminated utf16 string.

[breaking-change]

10 years agoauto merge of #14590 : pcwalton/rust/overloaded-call, r=nick29581
bors [Tue, 10 Jun 2014 00:37:08 +0000 (17:37 -0700)]
auto merge of #14590 : pcwalton/rust/overloaded-call, r=nick29581

gate.

This is part of unboxed closures.

r? @nick29581

10 years agoauto merge of #14554 : kmcallister/rust/plugin_registrar, r=cmr
bors [Mon, 9 Jun 2014 22:52:07 +0000 (15:52 -0700)]
auto merge of #14554 : kmcallister/rust/plugin_registrar, r=cmr

This implements the design in rust-lang/rfcs#86.  It shouldn't be merged until that RFC is accepted, but it would be great if somebody has time to review the code before then.

10 years agoMacro crates now depend on librustc
Keegan McAllister [Sat, 31 May 2014 00:55:42 +0000 (17:55 -0700)]
Macro crates now depend on librustc

10 years agoDocument rustc::plugin
Keegan McAllister [Mon, 26 May 2014 21:48:54 +0000 (14:48 -0700)]
Document rustc::plugin

10 years agoAdd a test for deprecated phase(syntax)
Keegan McAllister [Sun, 25 May 2014 05:22:24 +0000 (22:22 -0700)]
Add a test for deprecated phase(syntax)

10 years agoConvert tests to use #[plugin_registrar]
Keegan McAllister [Sun, 25 May 2014 04:38:16 +0000 (21:38 -0700)]
Convert tests to use #[plugin_registrar]

10 years agoConvert libraries to use #[plugin_registrar]
Keegan McAllister [Sun, 25 May 2014 04:31:50 +0000 (21:31 -0700)]
Convert libraries to use #[plugin_registrar]

10 years agoUse phase(plugin) in tests
Keegan McAllister [Sun, 25 May 2014 04:24:35 +0000 (21:24 -0700)]
Use phase(plugin) in tests

10 years agoUse phase(plugin) in other crates
Keegan McAllister [Sun, 25 May 2014 04:22:52 +0000 (21:22 -0700)]
Use phase(plugin) in other crates

10 years agoUse phase(plugin) in bootstrap crates
Keegan McAllister [Sun, 25 May 2014 04:15:16 +0000 (21:15 -0700)]
Use phase(plugin) in bootstrap crates

Do this to avoid warnings on post-stage0 builds.

10 years agoImplement #[plugin_registrar]
Keegan McAllister [Sat, 24 May 2014 23:16:10 +0000 (16:16 -0700)]
Implement #[plugin_registrar]

See RFC 22.

[breaking-change]

10 years agoauto merge of #14775 : alexcrichton/rust/fix-master, r=brson
bors [Mon, 9 Jun 2014 21:07:12 +0000 (14:07 -0700)]
auto merge of #14775 : alexcrichton/rust/fix-master, r=brson

Apparently one of the linux bots doesn't have the USER variable defined, and
this fix will likely land more quickly than a fix to the bots.

10 years agoAdd missing repr(C) annotations to mutex.rs
Jakub Wieczorek [Mon, 9 Jun 2014 20:14:51 +0000 (22:14 +0200)]
Add missing repr(C) annotations to mutex.rs

10 years agomk: Ensure docs have relative links to each other
Alex Crichton [Mon, 9 Jun 2014 20:00:18 +0000 (13:00 -0700)]
mk: Ensure docs have relative links to each other

When generating documentation, rustdoc has the ability to generate relative
links within the current distribution of crates to one another. To do this, it
must recognize when a crate's documentation is in the same output directory. The
current threshold for "local documentation for crate X being available" is
whether the directory "doc/X" exists.

This change modifies the build system to have new dependencies for each
directory of upstream crates for a rustdoc invocation. This will ensure that
when building documentation that all the crates in the standard distribution are
guaranteed to have relative links to one another.

This change is prompted by guaranteeing that offline docs always work with one
another. Before this change, races could mean that some docs were built before
others, and hence may have http links when relative links would suffice.

Closes #14747

10 years agostd: Read HOME instead of USER
Alex Crichton [Mon, 9 Jun 2014 19:44:45 +0000 (12:44 -0700)]
std: Read HOME instead of USER

Apparently one of the linux bots doesn't have the USER variable defined, and
this fix will likely land more quickly than a fix to the bots.

10 years agolibrustc: Implement overloading for the call operator behind a feature
Patrick Walton [Sun, 1 Jun 2014 23:35:01 +0000 (16:35 -0700)]
librustc: Implement overloading for the call operator behind a feature
gate.

This is part of unboxed closures.