Commit Graph

27914 Commits

Author SHA1 Message Date
bors
739f22f611 auto merge of #13037 : alexcrichton/rust/attr-syntax, r=brson
This will require a snapshot to finish, but these commits update the parser to parse attributes of the form `#![...]`

Thanks to @TheHydroImpulse for all the initial work!

cc #2569
2014-03-20 21:11:47 -07:00
Steven Fackler
1d98fe12a8 Clean up marker types and Unsafe initialization 2014-03-20 20:33:23 -07:00
Alex Crichton
e1ca02ec02 std: Implement Clone/TotalEq for ProcessExit
It's useful for structures which use deriving(Clone, TotalEq), even though it's
implicitly copyable.

Closes #13047
2014-03-20 20:30:12 -07:00
Steven Fackler
181875ca50 Remove RefCell::{with, with_mut}
These are superfluous now that we have fixed rvalue lifetimes and Deref.
2014-03-20 19:55:52 -07:00
Alex Crichton
811257eda5 std: Rename {push,read}_bytes to {push,read}_exact
These methods can be mistaken for general "read some bytes" utilities when
they're actually only meant for reading an exact number of bytes. By renaming
them it's much clearer about what they're doing without having to read the
documentation.

Closes #12892
2014-03-20 19:45:56 -07:00
Alex Crichton
84a91b8603 syntax: Tidy up parsing the new attribute syntax 2014-03-20 18:51:52 -07:00
Daniel Fagnan
4e00cf6134 Added new attribute syntax with backward compatibility.
Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>
2014-03-20 18:06:53 -07:00
Huon Wilson
7785fe1916 syntax: make OptVec immutable.
This is the first step to replacing OptVec with a new representation:
remove all mutability. Any mutations have to go via `Vec` and then make
to `OptVec`.

Many of the uses of OptVec are unnecessary now that Vec has no-alloc
emptiness (and have been converted to Vec): the only ones that really
need it are the AST and sty's (and so on) where there are a *lot* of
instances of them, and they're (mostly) immutable.
2014-03-21 10:52:48 +11:00
Alex Crichton
9e66f2c6b4 std: Update atomic documentation to remove 'mut'
It's all no longer necessary
2014-03-20 15:06:34 -07:00
bors
6eae7df43c auto merge of #13023 : thestinger/rust/deep_clone, r=alexcrichton 2014-03-20 15:01:47 -07:00
Brian Anderson
61622dd20c std: Remove AtomicU64
Support for this is less universal than for word-size things;
it has no users; i'd rather play it safe.
2014-03-20 13:33:43 -07:00
Brian Anderson
8748322c9b std: Make the generic atomics in sync::atomics private
I'm not comfortable exposing public functions that purport to do
atomic operations on arbitrary T.
2014-03-20 13:33:43 -07:00
Brian Anderson
eb25c42fc8 std: Make the generic atomics take unsafe pointers
These mutate values behind references that are Freeze, which is not
allowed.
2014-03-20 13:33:43 -07:00
bors
7334c11b4b auto merge of #13026 : alexcrichton/rust/snapshots, r=huonw 2014-03-20 11:06:42 -07:00
Alex Crichton
11ac4df4d2 Register new snapshots 2014-03-20 11:02:26 -07:00
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