Commit Graph

4156 Commits

Author SHA1 Message Date
Erick Tryzelaar
3961957bd6 std: Remove RefCell::set() 2014-04-03 20:28:59 -07:00
Erick Tryzelaar
7bcfe2ee10 std: Remove RefCell::get()
It's surprising that `RefCell::get()` is implicitly doing a clone
on a value. This patch removes it and replaces all users with
either `.borrow()` when we can autoderef, or `.borrow().clone()`
when we cannot.
2014-04-03 20:28:55 -07:00
bors
2a2d0dce87 auto merge of #13296 : brson/rust/0.11-pre, r=alexcrichton
This also changes some of the download links in the documentation
to 'nightly'.
2014-04-03 19:56:45 -07:00
bors
c2e457686b auto merge of #13237 : alexcrichton/rust/private-tuple-structs, r=brson
This is the final commit need to implement [RFC #4](https://github.com/rust-lang/rfcs/blob/master/active/0004-private-fields.md), it makes all tuple struct fields private by default, overridable with the `pub` keyword.

I'll note one divergence from the original RFC which is outlined in the first commit.
2014-04-03 18:41:45 -07:00
Daniel Micay
7ce2630cef stop asking LLVM to null-terminate strings
This was missed when dropping the null-termination from our string
types. An explicit null byte can still be placed anywhere in a string if
desired, but there's no reason to stick one at the end of every string
constant.
2014-04-03 21:35:21 -04:00
bors
e7fe207229 auto merge of #13290 : alexcrichton/rust/rollup, r=alexcrichton
Closes #13285 (rustc: Stop using LLVMGetSectionName)
Closes #13280 (std: override clone_from for Vec.)
Closes #13277 (serialize: add a few missing pubs to base64)
Closes #13275 (Add and remove some ignore-win32 flags)
Closes #13273 (Removed managed boxes from libarena.)
Closes #13270 (Minor copy-editing for the tutorial)
Closes #13267 (fix Option<~ZeroSizeType>)
Closes #13265 (Update emacs mode to support new `#![inner(attribute)]` syntax.)
Closes #13263 (syntax: Remove AbiSet, use one Abi)
2014-04-03 17:17:02 -07:00
Brian Anderson
0875ffcbff Bump version to 0.11-pre
This also changes some of the download links in the documentation
to 'nightly'.
2014-04-03 16:28:46 -07:00
bors
bb31cb8d2e auto merge of #13286 : alexcrichton/rust/release, r=brson
Merging the 0.10 release into the master branch.
2014-04-03 13:52:03 -07:00
Alex Crichton
57e0908af3 syntax: Remove AbiSet, use one Abi
This change removes the AbiSet from the AST, converting all usage to have just
one Abi value. The current scheme selects a relevant ABI given a list of ABIs
based on the target architecture and how relevant each ABI is to that
architecture.

Instead of this mildly complicated scheme, only one ABI will be allowed in abi
strings, and pseudo-abis will be created for special cases as necessary. For
example the "system" abi exists for stdcall on win32 and C on win64.

Closes #10049
2014-04-03 13:43:45 -07:00
Daniel Micay
898669c4e2 fix Option<~ZeroSizeType>
1778b63616 provided the guarantee of no
`exchange_free` calls for ~ZeroSizeType, so a sentinel can now be used
without overhead.

Closes #11998
2014-04-03 13:43:35 -07:00
Alex Crichton
15e6e8cf3e rustc: Stop using LLVMGetSectionName
The recent pull request to remove libc from libstd has hit a wall in compiling
on windows, and I've been trying to investigate on the try bots as to why (it
compiles locally just fine). To the best of my knowledge, the LLVM section
iterator is behaving badly when iterating over the sections of the libc DLL.

Upon investigating the LLVMGetSectionName function in LLVM, I discovered that
this function doesn't always return a null-terminated string. It returns the
data pointer of a StringRef instance (LLVM's equivalent of &str essentially),
but it has no method of returning the length of the name of the section.

This commit modifies the section iteration when loading libraries to invoke a
custom LLVMRustGetSectionName which will correctly return both the length and
the data pointer.

I have not yet verified that this will fix landing liblibc, as it will require a
snapshot before doing a full test. Regardless, this is a worrisome situation
regarding the LLVM API, and should likely be fixed anyway.
2014-04-03 10:49:35 -07:00
Felix S. Klock II
3ccbffac40 After a hash mismatch error, emit file-system paths of crates involved.
Fix #13266.

There is a little bit of acrobatics in the definition of `crate_paths`
to avoid calling `clone()` on the dylib/rlib unless we actually are
going to need them.

The other oddity is that I have replaced the `root_ident: Option<&str>`
parameter with a `root: &Option<CratePaths>`, which may surprise one
who was expecting to see something like: `root: Option<&CratePaths>`.
I went with the approach here because I could not come up with code for
the alternative that was acceptable to the borrow checker.
2014-04-03 17:46:22 +02:00
bors
6f1c06d6a1 auto merge of #13244 : cmr/rust/tbaa, r=alexcrichton 2014-04-03 03:42:02 -07:00
Alex Crichton
9a259f4303 Fix fallout of requiring uint indices 2014-04-02 15:56:31 -07:00
Alex Crichton
46abacfdfe rustc: Require that vector indices are uints
This commit tightens up the restriction on types used to index slices to require
exactly `uint` indices. Previously any integral type was accepted, but this
leads to a few subtle problems:

  * 64-bit indices don't make much sense on 32-bit systems
  * Signed indices for slices used as negative indexing isn't implemented

This was discussed at the recent work week, and also has some discussion on
issue #10453.

Closes #10453
2014-04-02 15:56:31 -07:00
Corey Richardson
46790a7d27 util: ppaux: remove dead code 2014-04-02 11:17:24 -04:00
Corey Richardson
841eb1c56f util: common: remove dead code 2014-04-02 11:17:24 -04:00
Corey Richardson
fdcb104517 middle: typeck: rscope: remove dead code 2014-04-02 11:17:24 -04:00
Corey Richardson
3bd0a37c0b middle: typeck: remove dead code 2014-04-02 11:17:24 -04:00
Corey Richardson
009389f051 middle: typeck: infer: resolve: remove dead code 2014-04-02 11:17:23 -04:00
Corey Richardson
167c29ff3f middle: typeck: infer: remove dead code 2014-04-02 11:17:23 -04:00
Corey Richardson
ce47c91bfc middle: typeck: infer: lub: remove dead code 2014-04-02 11:17:23 -04:00
Corey Richardson
1a98ec83c1 middle: typeck: infer: combine: remove dead code 2014-04-02 11:17:23 -04:00
Corey Richardson
dcb01ff573 middle: typeck: check: remove dead code 2014-04-02 11:17:23 -04:00
Corey Richardson
39f839d9ee middle: ty: remove dead code 2014-04-02 11:17:23 -04:00
Corey Richardson
b4653941d6 middle: trans: type_: remove dead code 2014-04-02 11:17:23 -04:00
Corey Richardson
53b70a83c6 middle: trans: tvec: remove dead code 2014-04-02 11:17:23 -04:00
Corey Richardson
4bc2c3b2b4 middle: trans: reflect: remove dead code 2014-04-02 11:17:22 -04:00
Corey Richardson
32753ed811 middle: trans: meth: remove dead code 2014-04-02 11:17:22 -04:00
Corey Richardson
f9973103c5 middle: trans: datum: remove dead code 2014-04-02 11:17:22 -04:00
Corey Richardson
9dd185c255 middle: trans: context: remove dead code 2014-04-02 11:17:22 -04:00
Corey Richardson
e53f48be34 middle: trans: common: remove dead code 2014-04-02 11:17:22 -04:00
Corey Richardson
8f385fc2e0 middle: trans: callee: remove dead code 2014-04-02 11:17:22 -04:00
Corey Richardson
a2290ccbc5 middle: trans: cabi: remove dead code 2014-04-02 11:17:21 -04:00
Corey Richardson
5e2b5221ca middle: trans: builder: ignore dead code 2014-04-02 11:17:21 -04:00
Corey Richardson
8de5eec222 middle: trans: build: remove dead code 2014-04-02 11:17:21 -04:00
Corey Richardson
49dc0193bd middle: trans: base: remove dead code 2014-04-02 11:17:21 -04:00
Corey Richardson
a9bf099000 middle: trans: adt: remove dead code 2014-04-02 11:17:21 -04:00
Corey Richardson
ee82233a1e middle: region: remove dead code 2014-04-02 11:17:20 -04:00
Corey Richardson
39fce48324 middle: pat_util: remove dead code 2014-04-02 11:17:20 -04:00
Corey Richardson
dc59df776a middle: mem_categorization: remove dead code 2014-04-02 11:17:20 -04:00
Corey Richardson
393bc08762 middle: lang_items: allow dead code 2014-04-02 11:17:20 -04:00
Corey Richardson
35c98a8378 middle: kind: remove dead code 2014-04-02 11:17:20 -04:00
Corey Richardson
fb19d680f4 middle: graph: ignore dead code 2014-04-02 11:17:20 -04:00
Corey Richardson
6ed787155d middle: freevars: remove dead code 2014-04-02 11:17:19 -04:00
Corey Richardson
4e5409ba91 middle: dataflow: remove dead code 2014-04-02 11:17:19 -04:00
Corey Richardson
d03e647a0a middle: const_eval: remove dead code 2014-04-02 11:17:19 -04:00
Corey Richardson
2013488bee middle: cfg: allow dead code 2014-04-02 11:17:19 -04:00
Corey Richardson
77d1978f8e middle: borrowck: remove dead code 2014-04-02 11:17:19 -04:00
Corey Richardson
0ce17d941d middle: astencode: remove dead code 2014-04-02 11:17:18 -04:00
Corey Richardson
194242f096 metadata: filesearch: remove dead code 2014-04-02 11:17:18 -04:00
Corey Richardson
0a0ab4031c metadata: decoder: remove dead code 2014-04-02 11:17:15 -04:00
Corey Richardson
3f8d1588e8 metadata: cstore: remove dead code 2014-04-01 10:19:10 -04:00
Corey Richardson
6ce37e8dd7 metadata: csearch: remove dead code 2014-04-01 10:18:53 -04:00
Corey Richardson
86e6a80d8d metadata: common: remove dead code 2014-04-01 10:17:32 -04:00
Corey Richardson
aae9594932 lib: llvm: remove dead code 2014-04-01 10:17:18 -04:00
Corey Richardson
59645c1209 back: link: remove dead code 2014-04-01 10:16:58 -04:00
Corey Richardson
74ddaa27e7 back: archive: remove dead code 2014-04-01 10:16:46 -04:00
Corey Richardson
5a4c8a9c57 back: abi: remove dead code 2014-04-01 10:12:02 -04:00
Corey Richardson
3b4a5174c0 rustc: make comments on CrateContext doc comments 2014-04-01 07:11:23 -04:00
Alex Crichton
922dcfdc69 Switch some tuple structs to pub fields
This commit deals with the fallout of the previous change by making tuples
structs have public fields where necessary (now that the fields are private by
default).
2014-03-31 19:50:51 -07:00
Alex Crichton
683197975c rustc: Switch tuple structs to have private fields
This is a continuation of the work done in #13184 to make struct fields private
by default. This commit finishes RFC 4 by making all tuple structs have private
fields by default. Note that enum variants are not affected.

A tuple struct having a private field means that it cannot be matched on in a
pattern match (both refutable and irrefutable), and it also cannot have a value
specified to be constructed. Similarly to private fields, switching the type of
a private field in a tuple struct should be able to be done in a backwards
compatible way.

The one snag that I ran into which wasn't mentioned in the RFC is that this
commit also forbids taking the value of a tuple struct constructor. For example,
this code now fails to compile:

    mod a {
        pub struct A(int);
    }

    let a: fn(int) -> a::A = a::A; //~ ERROR: first field is private

Although no fields are bound in this example, it exposes implementation details
through the type itself. For this reason, taking the value of a struct
constructor with private fields is forbidden (outside the containing module).

RFC: 0004-private-fields
2014-03-31 18:59:46 -07:00
Alex Crichton
89fa141cd7 rustc: Switch field privacy as necessary 2014-03-31 15:47:36 -07:00
Alex Crichton
a5681d2590 Bump version to 0.10 2014-03-31 14:40:44 -07:00
Alex Crichton
f2a5c7a179 rustc: Switch struct fields to private by default
This commit switches privacy's checking of fields to have *all* fields be
private by default. This does not yet change tuple structs, this only affects
structs with named fields. The fallout of this change will follow shortly.

RFC: 0004-private-fields

cc #8122
Closes #11809
2014-03-31 14:32:18 -07:00
Daniel Micay
cbbc1fc843 vec: convert append and append_one to methods
These were only free functions on `~[T]` because taking self by-value
used to be broken.
2014-03-31 01:13:48 -04:00
Marvin Löbel
c356e3ba6a Removed deprecated functions map and flat_map for vectors and slices. 2014-03-30 03:47:04 +02:00
bors
86890b9e7c auto merge of #13200 : sfackler/rust/test-attr, r=cmr 2014-03-29 16:11:36 -07:00
Steven Fackler
9ed33c00ea Use new inner attribute syntax in test framework 2014-03-29 16:04:45 -07:00
bors
d878df05ad auto merge of #13183 : erickt/rust/remove-list, r=alexcrichton
`collections::list::List` was decided in a [team meeting](https://github.com/mozilla/rust/wiki/Meeting-weekly-2014-03-25) that it was unnecessary, so this PR removes it. Additionally, it removes an old and redundant purity test and fixes some warnings.
2014-03-29 11:41:37 -07:00
bors
3eb3a02c92 auto merge of #13143 : gentlefolk/rust/issue-9227, r=michaelwoerister
Only supports crate level statics. No debug info is generated for function level statics. Closes #9227.

As discussed at the end of the comments for #9227, I took an initial stab at adding support for function level statics and decided it would be enough work to warrant being split into a separate issue.

See #13144 for the new issue describing the need to add support for function level static variables.
2014-03-29 10:21:39 -07:00
bors
df9cf18c10 auto merge of #13188 : FlaPer87/rust/master, r=alexcrichton 2014-03-29 02:56:40 -07:00
bors
6584f3746e auto merge of #13170 : eddyb/rust/syntax-cleanup, r=alexcrichton
Removes all Cell's/RefCell's from lexer::Reader implementations and a couple @.
2014-03-28 20:21:45 -07:00
bors
b334f7c3cc auto merge of #13157 : pnkfelix/rust/fsk-iss13140, r=nikomatsakis
r? @nikomatsakis

Fix #13140

Includes two fixes, and a semi-thorough regression test.

(There is another set of tests that I linked from #5121, but those are sort of all over the place, while the ones I've included here are more directly focused on the issues at hand.)
2014-03-28 19:01:48 -07:00
Flavio Percoco
a9c6061c9a Register new snapshot 2014-03-29 01:12:32 +01:00
Brian Anderson
451e8c1c61 Convert most code to new inner attribute syntax.
Closes #2569
2014-03-28 17:12:21 -07:00
Eduard Burtescu
f65638e669 De-@ IdentInterner. 2014-03-28 18:28:04 +02:00
Erick Tryzelaar
a47d52c2f6 collections: remove List
It was decided in a meeting that this module wasn't needed,
and more thought should be put into a persistent collections
library.
2014-03-28 09:13:09 -07:00
Flavio Percoco
81ec1f3c18 Rename Pod into Copy
Summary:
So far, we've used the term POD "Plain Old Data" to refer to types that
can be safely copied. However, this term is not consistent with the
other built-in bounds that use verbs instead. This patch renames the Pod
kind into Copy.

RFC: 0003-opt-in-builtin-traits

Test Plan: make check

Reviewers: cmr

Differential Revision: http://phabricator.octayn.net/D3
2014-03-28 10:34:02 +01:00
bors
ff64381c8b auto merge of #13107 : seanmonstar/rust/encoder-errors, r=erickt
All of Decoder and Encoder's methods now return a Result.

Encodable.encode() and Decodable.decode() return a Result as well.

fixes #12292
2014-03-28 00:26:52 -07:00
bors
5a68892507 auto merge of #13108 : pongad/rust/lintraw, r=huonw
Fixes #13032
2014-03-27 23:11:54 -07:00
gentlefolk
f4518cdba7 Initial support for emitting DWARF for static vars.
Only supports crate level statics. No debug info is generated for
function level statics. Closes #9227.
2014-03-27 21:03:44 -04:00
Sean McArthur
f1739b14a1 serialize: use Result
All of Decoder and Encoder's methods now return a Result.

Encodable.encode() and Decodable.decode() return a Result as well.

fixes #12292
2014-03-27 17:41:55 -07:00
bors
13dafa09f1 auto merge of #13050 : alexcrichton/rust/no-send-default, r=huonw
See #10296 for the rationale, and commits for the implementation.
2014-03-27 14:32:02 -07:00
bors
8eaada5d39 auto merge of #13151 : brson/rust/dist, r=alexcrichton,brson
A variety of stuff here, mostly aimed at making `make install` work correctly with `--libdir` and `--mandir`. `make install` again goes through `install.sh`.
2014-03-27 13:11:58 -07:00
Alex Crichton
bb9172d7b5 Fix fallout of removing default bounds
This is all purely fallout of getting the previous commit to compile.
2014-03-27 10:14:50 -07:00
Alex Crichton
bdd24b2a56 rustc: Stop adding the Send bound implicitly
This commit removes implicitly adding the Send bound to ~Trait objects and
procedure types. It will now be manually required to specify that a procedure
or trait must be send-able.

Closes #10296
2014-03-27 10:14:50 -07:00
bors
25e523833e auto merge of #13001 : cmr/rust/unnamed-lifetime-nocapture, r=nikomatsakis
Closes #6751
2014-03-27 06:37:00 -07:00
Corey Richardson
b8ed13686a Address review 2014-03-27 02:51:54 -04:00
Corey Richardson
7febdb7b15 rustc: mark references w/anonymous lifetime nocapture
Closes #6751
2014-03-27 02:48:08 -04:00
Edward Wang
4112941202 _match.rs: prune sub-match tree too aggressively
The `_match.rs` takes advantage of passes prior to `trans` and
aggressively prunes the sub-match tree based on exact equality. When it
comes to literal or range, the strategy may lead to wrong result if
there's guard function or multiple patterns inside tuple.

Closes #12582.
Closes #13027.
2014-03-27 14:41:10 +08:00
Michael Darakananda
5744556782 Added lint for #[deriving] structs and enums with unsafe pointers. #13032. 2014-03-27 01:15:14 -04:00
Brian Anderson
6f7ef1e293 rustc: Fix tests for sysroot changes 2014-03-26 20:53:01 -07:00
Brian Anderson
545f012527 rustc: Fix detection of lib64 directory
Instead of just looking for its presence we need to see if it actually
contains rust stuffs.
2014-03-26 19:21:23 -07:00
bors
c83994e0f4 auto merge of #13145 : alexcrichton/rust/flip-some-defaults, r=brson
This change prepares `rustc` to accept private fields by default. These changes will have to go through a snapshot before the rest of the changes can happen.
2014-03-26 16:37:03 -07:00
Kiet Tran
1d99d37f87 Visit type parameter in lifetime suggestion
Previously, Rebuilder did not visit type parameters when rebuilding
generics and path, so in some cases the suggestion turns out to be
erroneous.
2014-03-26 19:13:30 -04:00
bors
2c71cdf64b auto merge of #13071 : ktt3ja/rust/deterministic-lifetime-suggestion, r=cmr
Close #13057
2014-03-26 10:26:55 -07:00
Alex Crichton
7de48419ee syntax: Permit visibility on tuple fields
This change is in preparation for #8122. Nothing is currently done with these
visibility qualifiers, they are just parsed and accepted by the compiler.

RFC: 0004-private-fields
2014-03-26 10:20:15 -07:00
Alex Crichton
104aaa44e8 rustc: Relax restriction on privacy for fields
This is a necessary change in preparation for switching the defaults as part
of #8122.

RFC: 0004-private-fields
2014-03-26 10:20:12 -07:00
Felix S. Klock II
ab8e02616c Fix Repr impl for method::Candidate to include the method_ty. 2014-03-26 17:57:02 +01:00
Felix S. Klock II
6b5ca8b1aa Fix #13140: Early/Late Bound related ICEs.
The problem was that we need to apply the substitution, so that the
formal lifetime parameters get replaced with (unifiable)
free-lifetimes that can actually be fed into the constraint solver.

Also, refactor code os that substitution for `check_item` and
`check_method`, moving both down the control flow into `check_bare_fn`.

----

Finally, there was another (similar) spot where we needed to
substitute early-bound lifetimes when invoking an object method of a
trait.
2014-03-26 17:54:49 +01:00
bors
de85948ac0 auto merge of #13117 : alexcrichton/rust/no-crate-map, r=brson
This can be done now that logging has been moved out and libnative is the default (not libgreen)
2014-03-26 01:41:57 -07:00
Brian Anderson
ce1e48a52b install: Support --libdir and --mandir correctly
This adds a hack to rustc to make it find the library directory
regardless of whether it is named lib/lib64/lib32.
2014-03-25 23:57:39 -07:00
Brian Anderson
d252539990 mk: Rename CFG_COMPILER to CFG_COMPILER_HOST_TRIPLE
Much clearer
2014-03-25 21:35:10 -07:00
Brian Anderson
f772e31d64 rustc: Stop relying on CFG_LIBDIR_RELATIVE
This is not sufficient for finding the library directory for binary
installs, but it does make the build more complex by requiring
env vars be set to build rustc.
2014-03-25 21:35:10 -07:00
Brian Anderson
6f9b30c6c1 configure: Make rustlibdir non-configurable
Trying to reduce the complexity of installation
2014-03-25 21:35:10 -07:00
Marvin Löbel
6200e761f0 Changed iter::Extendable and iter::FromIterator to take a Iterator by value 2014-03-25 21:49:55 +01:00
bors
1f5571abc2 auto merge of #13122 : sstewartgallus/rust/cleanup-10734-workarounds, r=alexcrichton
Cleanup old issue references. One of these workarounds no longer need to be used anymore and the others are out of date.
2014-03-25 06:36:55 -07:00
bors
5d5634ace0 auto merge of #13083 : FlaPer87/rust/issue-13005-borrow-unsafe-static, r=nikomatsakis
It was possible to borrow unsafe static items in static initializers.
This patch implements a small `Visitor` that walks static initializer's
expressions and checks borrows aliasability.

Fixes #13005

cc @nikomatsakis r?
2014-03-25 03:01:48 -07:00
Steven Stewart-Gallus
451160fbfa Cleanup fixed issue #10734 workaround 2014-03-24 16:10:20 -07:00
Kiet Tran
19d913bf25 Prefer lifetime suggestion over generic error 2014-03-24 18:58:37 -04:00
Alex Crichton
3ccad75641 rustc: Remove all crate map support
The crate map is no longer necessary now that logging and event loop factories
have been moved out.

Closes #11617
Closes #11731
2014-03-24 11:19:28 -07:00
Flavio Percoco
9021a3f988 rustc: Completely forbid borrows of unsafe statics
Summary:
It was possible to borrow unsafe static items in static initializers.
This patch implements a small `Visitor` that walks static initializer's
expressions and checks borrows aliasability.

Fixes #13005

Test Plan: make check

Differential Revision: http://phabricator.octayn.net/D2
2014-03-24 18:04:10 +01:00
bors
841f31ecf9 auto merge of #13074 : pczarn/rust/build-rlib, r=alexcrichton
Fixes #12992

I tried to increase the number of deflate's probes. Reduction of 0.5% or 2% is not enough.
2014-03-23 14:01:52 -07:00
bors
cafb7ed6f6 auto merge of #13099 : FlaPer87/rust/master, r=huonw 2014-03-23 07:21:55 -07:00
Piotr Czarnecki
f0f5072566 rustc: Change the filename of compressed bitcode
Fixes #12992
Store compressed bitcode files in rlibs with a different extension. Compression doesn't interfere with --emit=bc.
Regression test compares outputs.
2014-03-23 13:36:49 +01:00
Flavio Percoco
576e36e674 Register new snapshots 2014-03-23 11:37:31 +01:00
bors
11c6817e13 auto merge of #13090 : thestinger/rust/iter, r=Aatch
This has been rendered obsolete by partial type hints. Since the `~[T]`
type is in the process of being removed, it needs to go away.
2014-03-23 02:41:53 -07:00
Daniel Micay
ae429056ff iter: remove to_owned_vec
This needs to be removed as part of removing `~[T]`. Partial type hints
are now allowed, and will remove the need to add a version of this
method for `Vec<T>`. For now, this involves a few workarounds for
partial type hints not completely working.
2014-03-23 05:41:23 -04:00
Daniel Micay
3829ac2a52 use TotalEq for HashMap
Closes #5283
2014-03-23 01:59:11 -04:00
bors
94e4e91724 auto merge of #13087 : eddyb/rust/fix-autoderef, r=cmr
Implements vtable support for generic Deref impls with trait bounds.
Also fixes cross-crate inlining when using autoderef.
2014-03-22 17:21:51 -07:00
Eduard Burtescu
087ec2aa24 Implement cross-crate support for autoderef.
Closes #13044.
2014-03-23 01:11:39 +02:00
bors
e68550e7ac auto merge of #13085 : edwardw/rust/saddest-cell, r=cmr 2014-03-22 16:06:51 -07:00
Eduard Burtescu
75d7d5210a Implement vtable support for autoderef.
Closes #13042.
2014-03-22 23:31:42 +02:00
bors
7e7a5e3d3e auto merge of #13076 : FlaPer87/rust/remove-freeze, r=alexcrichton
This PR removes the `Freeze` kind and the `NoFreeze` marker completely.

Fixes #12577

cc @nikomatsakis r?
2014-03-22 13:01:52 -07:00
Edward Wang
7c3ed86e5a Get rid of @Cell 2014-03-23 02:53:35 +08:00
Alex Crichton
3fb1ed0e04 rustc: Remove all usage of manual deref()
Favor using '*' instead
2014-03-22 08:48:34 -07:00
Alex Crichton
0dbb909bf7 rustc: Fix fallout of removing get() 2014-03-22 08:48:20 -07:00
Flavio Percoco
a1cb2f5d8c doc: Remove Freeze / NoFreeze from docs 2014-03-22 15:47:34 +01:00
Flavio Percoco
aa7519400e rustc: Remove special treatment for Freeze and NoFreeze
Fixes #12577
2014-03-22 15:44:13 +01:00
bors
30165e059c auto merge of #13052 : sfackler/rust/clean-refcell, r=alexcrichton
These are superfluous now that we have fixed rvalue lifetimes and Deref.

I'd also like to kill off `get` and `set`, but that'll be a large change so I want to make sure that we actually want to do that first.
2014-03-22 04:56:49 -07:00
bors
069cede305 auto merge of #13036 : alexcrichton/rust/atomics, r=alexcrichton
Closes #11583, rebasing of #12430 now that we've got `Share` and better analysis with statics.
2014-03-21 21:31:42 -07:00
bors
f5357cf3ce auto merge of #13016 : huonw/rust/new-opt-vec, r=cmr
Replace syntax::opt_vec with syntax::owned_slice

The `owned_slice::OwnedSlice` is  `(*T, uint)` (i.e. a direct equivalent to DSTs `~[T]`).

This shaves two words off the old OptVec type; and also makes substituting in other implementations easy, by removing all the mutation methods. (And also everything that's very rarely/never used.)
2014-03-21 20:06:44 -07:00
Huon Wilson
e33676b793 Migrate all users of opt_vec to owned_slice, delete opt_vec.
syntax::opt_vec is now entirely unused, and so can go.
2014-03-22 09:54:18 +11:00
Alex Crichton
ab1dd09d73 rustc: Switch defaults from libgreen to libnative
The compiler will no longer inject libgreen as the default runtime for rust
programs, this commit switches it over to libnative by default. Now that
libnative has baked for some time, it is ready enough to start getting more
serious usage as the default runtime for rustc generated binaries.

We've found that there isn't really a correct decision in choosing a 1:1 or M:N
runtime as a default for all applications, but it seems that a larger number of
programs today would work more reasonable with a native default rather than a
green default.

With this commit come a number of bugfixes:

* The main native task is now named "<main>"
* The main native task has the stack bounds set up properly
* #[no_uv] was renamed to #[no_start]
* The core-run-destroy test was rewritten for both libnative and libgreen and
  one of the tests was modified to be more robust.
* The process-detach test was locked to libgreen because it uses signal handling
2014-03-21 12:03:13 -07:00
Patrick Walton
af79a5aa7d test: Make manual changes to deal with the fallout from removal of
`~[T]` in test, libgetopts, compiletest, librustdoc, and libnum.
2014-03-21 23:37:21 +11: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
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
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
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
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
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
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
710f13f0ad Add Unsafe<T> type 2014-03-20 10:16:55 +01:00