Commit Graph

27649 Commits

Author SHA1 Message Date
bors
b568efc0cf auto merge of #13020 : alexcrichton/rust/vec, r=brson
The commits have the details.
2014-03-20 09:51:44 -07:00
Brian Anderson
f3fef9a649 std: Make atomics immutable. #11583
In Rust, the strongest guarantee that `&mut` provides is that the memory
pointed to is *not aliased*, whereas `&`'s guarantees are much weaker:
that the value can be aliased, and may be mutated under proper precautions
(interior mutability).

Our atomics though use `&mut` for mutation even while creating multiple
aliases, so this changes them to use 'interior mutability', mutating
through immutable references.
2014-03-20 09:44:29 -07:00
Alex Crichton
da3625161d Removing imports of std::vec_ng::Vec
It's now in the prelude.
2014-03-20 09:30:14 -07:00
Alex Crichton
7a5a8c3c07 rustc: Default the ~[] lint to allow for now
Most of the standard distribution is still using ~[] instead of Vec, so this
lint is essentially useless currently. When the standard distribution has been
ported to not use ~[], then we can turn the lint back on.
2014-03-20 09:13:44 -07:00
Alex Crichton
0305ed5d22 std: Add Vec to the prelude
This is an incredibly common type, and it is expected to be used in many many
places. This type should be in the prelude.
2014-03-20 09:13:44 -07:00
bors
c01e2f05a3 auto merge of #13017 : alexcrichton/rust/issue-13010, r=huonw
Previously, any library of the pattern `lib<name>-<hash>-<version>.so` was
>considered a candidate (rightly so) for loading a crate. Sets are generated for
each unique `<hash>`, and then from these sets a candidate is selected. If a set
contained more than one element, then it immediately generated an error saying
that multiple copies of the same dylib were found.

This is incorrect because each candidate needs to be validated to actually
contain a rust library (valid metadata). This commit alters the logic to filter
each set of candidates for a hash to only libraries which are actually rust
libraries. This means that if multiple false positives are found with the right
name pattern, they're all ignored.

Closes #13010
2014-03-20 08:21:46 -07:00
bors
8cfef59cc0 auto merge of #13015 : tbu-/rust/pr_remove_immut, r=alexcrichton
Remove std::cast::transmute_immut_unsafe.
It can be done in safe code using `as *T`.
2014-03-20 07:06:45 -07:00
bors
8e285208d5 auto merge of #12686 : FlaPer87/rust/shared, r=nikomatsakis
`Share` implies that all *reachable* content is *threadsafe*.

Threadsafe is defined as "exposing no operation that permits a data race if multiple threads have access to a &T pointer simultaneously". (NB: the type system should guarantee that if you have access to memory via a &T pointer, the only other way to gain access to that memory is through another &T pointer)...

Fixes #11781
cc #12577 

What this PR will do
================

- [x] Add Share kind and
- [x]  Replace usages of Freeze with Share in bounds.
- [x] Add Unsafe<T> #12577
- [x] Forbid taking the address of a immutable static item with `Unsafe<T>` interior

What's left to do in a separate PR (after the snapshot)?
===========================================

- Remove `Freeze` completely
2014-03-20 05:51:48 -07:00
bors
95ee0a04fd auto merge of #12980 : cmr/rust/overhaul-stdio, r=thestinger
this comes from a discussion on IRC where the split between stdin and stdout
seemed unnatural, and the fact that reading on stdin won't flush stdout, which
is unlike every other language (including C's stdio).
2014-03-20 04:36:50 -07:00
bors
4224147bab auto merge of #13028 : thestinger/rust/vec_ng, r=huonw
Closes #12771
2014-03-20 02:46:49 -07:00
Steven Fackler
cdab8a76f4 A couple of fixes to vec_ng docs 2014-03-20 05:44:25 -04:00
Flavio Percoco
7b19574a2c Mention Share in the tutorial 2014-03-20 10:32:53 +01:00
Flavio Percoco
0aebdaced5 Mention share in guide-unsafe instead of freeze 2014-03-20 10:32:44 +01:00
Flavio Percoco
3c4edff9b5 Let travis check docs for stage1 2014-03-20 10:20:08 +01:00
Flavio Percoco
598fc75c4d Make atomics interior Unsafe<T> 2014-03-20 10:17:29 +01:00
Flavio Percoco
68a3ec08b3 Allow static items that don't fulfill Freeze 2014-03-20 10:17:28 +01:00
Flavio Percoco
ff1c49fa54 Forbid borrow of static items with unsafe interior 2014-03-20 10:17:28 +01:00
Flavio Percoco
69ccd807da Gather loans for static items
We currently gather loans for static items that are defined within
functions. This change enables loan gathering on static items declared
globally.
2014-03-20 10:17:28 +01:00
Flavio Percoco
8767c69339 Let ArcData use Unsafe<T> 2014-03-20 10:17:28 +01:00
Flavio Percoco
3848021fae Make Cell and RefCell use Unsafe<T> 2014-03-20 10:16:56 +01:00
Flavio Percoco
710f13f0ad Add Unsafe<T> type 2014-03-20 10:16:55 +01:00
Flavio Percoco
b85d5f1f9a Relax interner's Share bound
The interner uses `RefCell` internally which opted out from Share.
2014-03-20 10:16:55 +01:00
Flavio Percoco
12ecafb31d Replace Freeze bounds with Share bounds 2014-03-20 10:16:55 +01:00
Flavio Percoco
21d23ff25b Make Rc, Cell and RefCell NoShare 2014-03-20 10:16:55 +01:00
Flavio Percoco
37154fb8b9 Add a Share kind
Fixes #11781
2014-03-20 10:16:55 +01:00
Daniel Micay
14f656d1a7 rename std::vec_ng -> std::vec
Closes #12771
2014-03-20 04:25:32 -04:00
bors
a92dcb0828 auto merge of #12854 : nick29581/rust/parse-enum-struct, r=alexcrichton
...where the field and variable are unified
2014-03-20 00:41:54 -07:00
bors
7aded2adb6 auto merge of #12772 : thestinger/rust/slice, r=alexcrichton
Closes #12702
2014-03-19 23:21:49 -07:00
Brian Anderson
9b7751761b mk: Simplify how prepare.mk, install.mk, and dist.mk deal with stages
The only stage that can be installed from is 2 everywhere but windows,
3 on windows.

Closes #12799
2014-03-19 22:51:12 -07:00
Daniel Micay
ce620320a2 rename std::vec -> std::slice
Closes #12702
2014-03-20 01:30:27 -04:00
Daniel Micay
0de6441aa9 rm obsolete references to DeepClone 2014-03-20 01:24:05 -04:00
Corey Richardson
8fee3f6f6e std: io: flush stdout on stdin read from tty 2014-03-19 23:23:32 -04:00
bors
d8590e2c9c auto merge of #13013 : huonw/rust/tytrait, r=cmr
These variants occur rarely but inflate the whole enum for the other variants, leaving a lot of wasted space. In total this reduces `ty::sty` from 160 bytes to 96 (on a 64-bit platform).

After this, `ty_struct` and `ty_enum` are the largest variants, with the 80-byte `substs` being the major contributor.
2014-03-19 20:21:48 -07:00
Nick Cameron
aa5c8ea600 Fix spans for enum-struct match arms
Correct spans for fields in enum struct arms where the field and variable are unified
2014-03-20 12:11:31 +13:00
bors
4ca51aeea7 auto merge of #12770 : eddyb/rust/drop-tld, r=cmr
Sadly, this seems to make memory usage worse (unless `Vec<T>` makes it worse and this PR doesn't change that much, which is entirely possible).
2014-03-19 13:01:49 -07:00
Alex Crichton
068740b343 rustc: Prevent false positives in crate loading
Previously, any library of the pattern `lib<name>-<hash>-<version>.so` was
>considered a candidate (rightly so) for loading a crate. Sets are generated for
each unique `<hash>`, and then from these sets a candidate is selected. If a set
contained more than one element, then it immediately generated an error saying
that multiple copies of the same dylib were found.

This is incorrect because each candidate needs to be validated to actually
contain a rust library (valid metadata). This commit alters the logic to filter
each set of candidates for a hash to only libraries which are actually rust
libraries. This means that if multiple false positives are found with the right
name pattern, they're all ignored.

Closes #13010
2014-03-19 10:47:00 -07:00
bors
7532d20a17 auto merge of #12879 : Aatch/rust/rustdoc-mod-privacy, r=alexcrichton
Modules don't actually inherit privacy, so anything other than Public should be considered private.

Fixes #12801

cc @cmr
2014-03-19 10:11:54 -07:00
bors
61d5bc5d2d auto merge of #12762 : klutzy/rust/win-struct-abi, r=alexcrichton
This fixes struct passing abi on x86 ffi: Structs are now passed
indirectly with byval attribute (as clang does).
Empty structs are also explicitly ignored rather than directly passed.

Fixes #5744
Fixes #11198
Fixes #11343
2014-03-19 08:51:50 -07:00
Tobias Bucher
9b588a9f94 Remove std::cast::transmute_immut_unsafe
It can be done in safe code using `as *T`.
2014-03-19 16:15:22 +01:00
bors
8063450e57 auto merge of #12982 : brson/rust/optiondocs, r=alexcrichton
Various improvements. There's a lot more that can be done.
2014-03-19 06:01:48 -07:00
Huon Wilson
ddc796096b rustc: put ty_closure behind some indirection.
This reduces the size of sty from 112 to 96; like with the ty_trait
variant, this variant of sty occurs rarely (~1%) so the benefits are
large and the costs small.
2014-03-19 22:20:56 +11:00
Huon Wilson
405b5fc1ee rustc: put ty_trait behind some indirection.
This reduces ty::sty from 160 bytes to just 112, and some measurements
eddyb made suggest that the ty_trait variant occurs very
rarely (e.g. ~1% of all sty instances) hence this will result in a large
memory saving, and the cost of the indirection is unlikely to be an
issue.
2014-03-19 22:19:05 +11:00
bors
ff033357bf auto merge of #12955 : sfackler/rust/vec_ng-doc, r=alexcrichton
I also removed a couple of methods that were silly and added sort.
2014-03-19 01:41:43 -07:00
klutzy
2d31bcaf16 rustc: Fix x86 ffi for empty struct arguments 2014-03-19 16:41:51 +09:00
klutzy
7437995b3e rustc: Fix x86 ffi for struct arguments
This fixes struct passing abi on x86 ffi: Structs are now passed
indirectly with byval attribute (as clang does).
2014-03-19 16:41:50 +09:00
Eduard Burtescu
c04d4846f2 Discard MTWT & interner tables from TLD after they stop being useful. 2014-03-19 07:28:18 +02:00
Steven Fackler
0f2d46f396 Docify std::vec_ng
I also removed a couple of methods that were silly and added sort.
2014-03-18 22:03:17 -07:00
bors
a39c294155 auto merge of #12954 : brson/rust/atomicdocs, r=alexcrichton
This adds lots of docs to the atomics module. Two of the examples
are using the future atomics API (relying on `Share`) and are ignored temporarily.
I discovered a bug in the way AtomicBool's fetch_nand method is
implemented and fixed it by using the correct value for `true`.
I also fixed the implementation of AcqRel fences (it was only doing
a release barrier), and made a "relaxed" fence a failure.
2014-03-18 21:16:46 -07:00
Brian Anderson
8fcb8dd065 std: Improve option docs 2014-03-18 18:22:33 -07:00
bors
87e72c3812 auto merge of #13006 : alexcrichton/rust/rollup, r=alexcrichton
Closes #13008 (Made the `clone_from` implementation for `~T` reuse the `T` itself if possible)
Closes #13003 (Make method Vec::remove() public)
Closes #13002 (disallow duplicate methods in trait impls)
Closes #13000 (rustc: test: don't silently ignore bad benches)
Closes #12999 (rustc: buffer the output writer for -Z ast-json[-noexpand].)
Closes #12993 (syntax: Don't parameterize the the pretty printer)
Closes #12990 (`char` reference: s/character/Unicode scalar value/)
Closes #12987 (Move syntax-extension-hexfloat.rs)
Closes #12983 (Fix linkage1 test which fails due to --as-needed)
Closes #12978 (rustc: remove linker_private/linker_private_weak)
Closes #12976 (libsyntax: librustdoc: ignore utf-8 BOM in .rs files)
Closes #12973 (closes #12967 fix [en|de]coding of HashMap<K,V> where K is a numeric type)
Closes #12972 (Add impl IntoStr for ::std::vec_ng::Vec<Ascii>)
Closes #12968 (deny missing docs getopts)
Closes #12965 (Documentation and formatting changes for option.rs.)
Closes #12962 (Relax the memory ordering on the implementation of UnsafeArc)
Closes #12958 (Typo fixes.)
Closes #12950 (Docsprint: Document ops module, primarily Deref.)
Closes #12946 (rustdoc: Implement cross-crate searching)
2014-03-18 18:22:23 -07:00