Commit Graph

27040 Commits

Author SHA1 Message Date
Flavio Percoco
ee2f001a42 Forbid certain types for static items
- For each *mutable* static item, check that the **type**:
    - cannot own any value whose type has a dtor
    - cannot own any values whose type is an owned pointer

- For each *immutable* static item, check that the **value**:
    - does not contain any ~ or box expressions
        (including ~[1, 2, 3] sort of things)
    - does not contain a struct literal or call to an enum
        variant / struct constructor where
        - the type of the struct/enum has a dtor
2014-02-27 18:09:33 +01:00
Bruno de Oliveira Abinader
4da6d041c2 Replaced list::push() with unshift() based on List<T> 2014-02-27 08:36:07 -04:00
Bruno de Oliveira Abinader
1c27c90119 Refactored list::append() to be based on List<T> 2014-02-27 08:36:06 -04:00
Bruno de Oliveira Abinader
65f1993230 Refactored list::tail() to be based on List<T> 2014-02-27 08:35:47 -04:00
Bruno de Oliveira Abinader
fed034c402 Refactored list::head() to be based on List<T> 2014-02-27 08:35:47 -04:00
Bruno de Oliveira Abinader
45fd63a8b7 Replaced list::has() with list::contains() 2014-02-27 08:35:47 -04:00
Bruno de Oliveira Abinader
223f309fc3 Removed deprecated list::{iter,each}() functions 2014-02-27 08:35:47 -04:00
Bruno de Oliveira Abinader
a14d72d49e Implemented list::is_empty() based on Container trait 2014-02-27 08:35:47 -04:00
Bruno de Oliveira Abinader
e589fcffcc Implemented list::len() based on Container trait 2014-02-27 08:35:46 -04:00
Bruno de Oliveira Abinader
197116d7ce Removed list::any() in favor of iter().any() 2014-02-27 08:35:46 -04:00
Bruno de Oliveira Abinader
d681907064 Removed list::find() in favor of iter().find() 2014-02-27 08:35:46 -04:00
Bruno de Oliveira Abinader
a09a4b882d Removed list::foldl() in favor of iter().fold() 2014-02-27 08:35:45 -04:00
Bruno de Oliveira Abinader
43bc6fcc62 Replaced list::each with iter() in get_region 2014-02-27 08:35:18 -04:00
Bruno de Oliveira Abinader
0c8731e65c Replaced list::each with iter() in Arenas's Drop impl 2014-02-27 08:35:18 -04:00
Bruno de Oliveira Abinader
52524bfe88 Implemented Items<'a, T> for List<T> 2014-02-27 08:35:18 -04:00
Bruno de Oliveira Abinader
2b362768ff Modified list::from_vec() to return List<T> 2014-02-27 08:35:17 -04:00
Bruno de Oliveira Abinader
8846970bba Implement Eq for Cell<T> 2014-02-27 08:35:17 -04:00
Bruno de Oliveira Abinader
1e6151a770 Renamed variables 2014-02-27 08:35:16 -04:00
Bruno de Oliveira Abinader
4c553af0f8 Replaced @List with ~List in Rust's recursive example 2014-02-27 08:31:50 -04:00
Flavio Percoco
8784d2fa95 Forbid moves out of static items Closes #10577 2014-02-27 09:24:17 +01:00
Flavio Percoco
c75dd78ccb Keep track of Enum's with destructors 2014-02-27 09:24:16 +01:00
Flavio Percoco
a22539b083 Implement has_dtor method in TypeContents 2014-02-27 09:24:16 +01:00
Flavio Percoco
4cb3bd558f Remove unused type_is_pod function 2014-02-27 09:24:16 +01:00
bors
68a92c5ed5 auto merge of #12581 : alexcrichton/rust/older-llvm, r=brson
In doing so, revert travis to not using a 3.5 build because it seems to be changing enough that it's breaking our C++ glue frequently enough.
2014-02-26 21:16:36 -08:00
bors
780adfffc3 auto merge of #12486 : MicahChalmer/rust/emacs-fixes-round-3, r=brson
I've added details in the description of each comment as to what it does, which I won't redundantly repeat here in the PR.  They all relate to indentation in the emacs rust-mode.

What I will note here is that this closes #8787.  It addresses the last remaining case (not in the original issue description but in a comment), of indenting `match` statements.  With the changes here, I believe every problem described in the issue description or comments of #8787 is addressed.
2014-02-26 20:01:42 -08:00
bors
fd02f908be auto merge of #12586 : chris-morgan/rust/fix-pretty-print-slash-star-star-star-crash, r=alexcrichton
The pretty printer was treating block comments with more than two
asterisks after the first slash (e.g. `/***`) as doc comments (which are
attributes), whereas in actual fact they are just regular comments.
2014-02-26 17:26:37 -08:00
Chris Morgan
e6b032a9ef Fix a pretty printer crash on /***.
The pretty printer was treating block comments with more than two
asterisks after the first slash (e.g. `/***`) as doc comments (which are
attributes), whereas in actual fact they are just regular comments.
2014-02-27 12:16:18 +11:00
Alex Crichton
4cdc6ce337 rustc: Don't deduplicate libraries linked to
Linker argument order with respect to libraries is important enough that we
shouldn't be attempting to filter out libraries getting passed through to the
linker. When linking with a native library that has multiple dependant native
libraries, it's useful to have control over the link argument order.
2014-02-26 16:58:37 -08:00
Alex Crichton
bbdaf01a5a travis: Use LLVM 3.3 from the official repos
We can be certain that this version of LLVM will not be changing, so we don't
have to worry about API drift over time.
2014-02-26 15:22:50 -08:00
Alex Crichton
1ac5e84e91 rustc: Get rustc compiling with LLVM 3.{3,4} again
The travis builds have been breaking recently because LLVM 3.5 upstream is
changing. This looks like it's likely to continue, so it would be more useful
for us if we could lock ourselves to a system LLVM version that is not changing.

This commit has the support to bring our C++ glue to LLVM back in line with what
was possible back in LLVM 3.{3,4}. I don't think we're going to be able to
reasonably protect against regressions in the future, but this kind of code is a
good sign that we can continue to use the system LLVM for simple-ish things.
Codegen for ARM won't work and it won't have some of the perf improvements we
have, but using the system LLVM should work well enough for development.
2014-02-26 15:01:15 -08:00
bors
b4d923852e auto merge of #12572 : lifthrasiir/rust/owned-ptr-static-bound, r=alexcrichton
This is inspired by the [question](http://www.reddit.com/r/rust/comments/1yy57k/unsolved_question_from_irc/) (re-)posted to /r/rust. The error message in this question correctly states that one should add `'static` to the trait bounds, but does not state which trait bounds. This PR makes that explicit by appending two words.

This also renames `check_durable` to `check_static` and removes the outdated comment as a cleanup.
2014-02-26 12:16:43 -08:00
bors
5737d1f704 auto merge of #12490 : zslayton/rust/doc-fix-12386, r=alexcrichton
Attn: @huonw 

Addresses #12386.
2014-02-26 10:46:36 -08:00
Kang Seonghoon
9083cb24b2 rustc: Explicitly mention type params with missing 'static bounds
Also renames `check_durable` to `check_static` and removes the outdated
comment.
2014-02-27 02:14:46 +09:00
bors
86177dbbcf auto merge of #12570 : kyrias/rust/master, r=cmr
Adds a missing tilde to the end and the start of two .notrust blocks.
2014-02-26 08:36:36 -08:00
bors
05a2d32acd auto merge of #12571 : eddyb/rust/kill-callee-id, r=nikomatsakis
Every method call and overloaded operator had a `callee_id` that was be used to store the method type and type substitutions, that information is now stored in the `method_map`, alongside the method's origin.
2014-02-26 07:16:39 -08:00
Eduard Burtescu
05e4d944a9 Replace callee_id with information stored in method_map. 2014-02-26 16:06:45 +02:00
Eduard Burtescu
7a588ceff2 Rename a few typeck method-related structures to UpperCamelCase. 2014-02-26 16:01:36 +02:00
Johannes Löthberg
3d3dae8fa5 tutorial: Missing tildes around .notrust block
Adds a missing tilde to the end and the start of two .notrust blocks.
2014-02-26 14:48:40 +01:00
Florian Hahn
5d825def29 Mark top level module as a crate in rustdoc, closes #12507 2014-02-26 14:00:00 +01:00
bors
6c41f993d3 auto merge of #12547 : jagtalon/rust/jag/rust/tutorial-freezing, r=pnkfelix
- "Lending an immutable pointer" might be confusing. It was not discussed why borrowed pointers are immutable in the first place.
- Make it clear that the borrowed pointers are immutable even if the variable was declared with `mut`.
- Make it clear that we cannot even assign anything to the variable while its value is being borrowed.

tutorial: change "--" to an em-dash.

tutorial: change instances of "--" to em-dash.
2014-02-25 23:31:35 -08:00
bors
eb86913dcf auto merge of #12505 : alexcrichton/rust/fix-stack-overflow, r=brson
The printing of the error message on stack overflow had two sometimes false
assumptions previously. The first is that a local task was always available (it
called Local::take) and the second is that it used `println!` instead of
manually writing.

The first assumption isn't necessarily true because while stack overflow will
likely only be detected in situations that a local task is available, it's not
guaranteed to always be in TLS. For example, during a `println!` call a task
may be blocking, causing it to be unavailable. By using Local::try_take(), we
can be resilient against these occurrences.

The second assumption could lead to odd behavior because the stdout logger can
be overwritten to run arbitrary code. Currently this should be possible, but the
utility is much diminished because a stack overflow translates to an abort()
instead of a failure.
2014-02-25 19:21:32 -08:00
bors
2e1cfae943 auto merge of #12548 : alexcrichton/rust/up-llvm, r=huonw,brson
Upstream LLVM has changed slightly such that our PassWrapper.cpp no longer
comiles (travis errors). This updates the bundled LLVM to the latest nightly
which will hopefully fix the travis errors we're seeing.
2014-02-25 17:41:32 -08:00
Alex Crichton
4f4d43bf6c std: Tweak stack overflow printing for robustness
The printing of the error message on stack overflow had two sometimes false
assumptions previously. The first is that a local task was always available (it
called Local::take) and the second is that it used println! instead of
manually writing.

The first assumption isn't necessarily true because while stack overflow will
likely only be detected in situations that a local task is available, it's not
guaranteed to always be in TLS. For example, during a println! call a task
may be blocking, causing it to be unavailable. By using Local::try_take(), we
can be resilient against these occurrences.

The second assumption could lead to odd behavior because the stdout logger can
be overwritten to run arbitrary code. Currently this should be possible, but the
utility is much diminished because a stack overflow translates to an abort()
instead of a failure.
2014-02-25 16:51:52 -08:00
bors
3b09469a62 auto merge of #12539 : gmjosack/rust/master, r=alexcrichton
std::condition was removed in 454882dcb7
but there are still links to the guide. Removing them.
2014-02-25 16:26:30 -08:00
bors
c24946e9c6 auto merge of #12493 : eddyb/rust/saner-overloads, r=nikomatsakis
Fixes #12402.
2014-02-25 13:01:42 -08:00
bors
fc1c06d7b1 auto merge of #12457 : alexcrichton/rust/fix-some-tests, r=brson
This updates a number of ignore-test tests, and removes a few completely
outdated tests due to the feature being tested no longer being supported.

This brings a number of bench/shootout tests up to date so they're compiling
again. I make no claims to the performance of these benchmarks, it's just nice
to not have bitrotted code.

Closes #2604
Closes #9407
2014-02-25 11:41:36 -08:00
bors
fd83b2be26 auto merge of #12408 : alexcrichton/rust/manual-crate-map, r=brson
Apparently weak linkage and dlopen aren't quite working out for applications
like servo on android. There appears to be a bug or two in how android loads
dynamic libraries and for some reason libservo.so isn't being found.

As a temporary solution, add an extern "C" function to libstd which can be
called if you have a handle to the crate map manually. When crawling the crate
map, we then check this manual symbol before falling back to the old solutions.

cc #11731
2014-02-25 10:26:37 -08:00
Alex Crichton
294b27d806 Update LLVM
Upstream LLVM has changed slightly such that our PassWrapper.cpp no longer
comiles (travis errors). This updates the bundled LLVM to the latest nightly
which will hopefully fix the travis errors we're seeing.
2014-02-25 09:37:30 -08:00
Jag Talon
82747ed93e tutorial: clearer explanation of freezing.
- "Lending an immutable pointer" might be confusing. It was not discussed why borrowed pointers are immutable in the first place.
- Make it clear that the borrowed pointers are immutable even if the variable was declared with `mut`.
- Make it clear that we cannot even assign anything to the variable while its value is being borrowed.

tutorial: change "--" to an em-dash.

tutorial: change instances of "--" to em-dash.
2014-02-25 12:32:09 -05:00
Alex Crichton
1b3b273f80 Add a method of manually specifying the crate map
Apparently weak linkage and dlopen aren't quite working out for applications
like servo on android. There appears to be a bug or two in how android loads
dynamic libraries and for some reason libservo.so isn't being found.

As a temporary solution, add an extern "C" function to libstd which can be
called if you have a handle to the crate map manually. When crawling the crate
map, we then check this manual symbol before falling back to the old solutions.

cc #11731
2014-02-25 09:22:24 -08:00