Commit Graph

26999 Commits

Author SHA1 Message Date
bors 700fd35fb9 auto merge of #11979 : FlaPer87/rust/static, r=nikomatsakis
This pull request partially addresses the 2 issues listed before. As part of the work required for this PR, `NonCopyable` was completely removed.

This PR also replaces the content of `type_is_pod` with `TypeContents::is_pod`, although `type_is_content` is currently not being used anywhere. I kept it for consistency with the other functions that exist in this module.

cc #10834
cc #10577

Proposed static restrictions
=====================

Taken from [this](https://github.com/mozilla/rust/pull/11979#issuecomment-35768249) comment.

I expect some code that, at a high-level, works like this:

- 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, for now)
      - does not contain a struct literal or call to an enum variant / struct constructor where
          - the type of the struct/enum is freeze
          - the type of the struct/enum has a dtor
2014-02-27 18:51:53 -08:00
bors f01a9a8d02 auto merge of #12584 : alexcrichton/rust/windows-files, r=brson
These commits fix handling of binary files on windows by using the raw `CreateFile` apis directly, also splitting out the windows/unix implementations to their own files because everything was configured between the two platforms.

With this fix in place, this also switches `rustc` to using libnative instead of libgreen. I have confirmed that this PR passes through try on all bots.
2014-02-27 14:56:56 -08:00
Alex Crichton 8c157ed63d native: Recognize EISDIR
This recognizes the EISDIR error code on both windows and unix platforms to
provide a more descriptive error condition.
2014-02-27 12:03:58 -08:00
Alex Crichton 40ab198356 rustc: Use libnative for the compiler
The compiler itself doesn't necessarily need any features of green threading
such as spawning tasks and lots of I/O, so libnative is slightly more
appropriate for rustc to use itself.

This should also help the rusti bot which is currently incompatible with libuv.
2014-02-27 12:03:58 -08:00
Alex Crichton cd9010c77e native: Improve windows file handling
This commit splits the file implementation into file_unix and file_win32. The
two implementations have diverged to the point that they share almost 0 code at
this point, so it's easier to maintain as separate files.

The other major change accompanied with this commit is that file::open is no
longer based on libc's open function on windows, but rather windows's CreateFile
function. This fixes dealing with binary files on windows (test added in
previous commit).

This also changes the read/write functions to use ReadFile and WriteFile instead
of libc's read/write.

Closes #12406
2014-02-27 12:03:57 -08:00
Alex Crichton 843c5e6308 std: Small cleanup and test improvement
This weeds out a bunch of warnings building stdtest on windows, and it also adds
a check! macro to the io::fs tests to help diagnose errors that are cropping up
on windows platforms as well.

cc #12516
2014-02-27 12:03:57 -08:00
Flavio Percoco 59a04f5b12 Immutable static items should be `Freeze` Fixes #12432 2014-02-27 18:09:35 +01:00
Flavio Percoco 0c7a0125b4 Closes #7364 Test case 2014-02-27 18:09:35 +01:00
Flavio Percoco 49d5d70945 Closes #9243 Test case 2014-02-27 18:09:35 +01:00
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