Commit Graph

43942 Commits

Author SHA1 Message Date
Huon Wilson
b1931e48a0 lint: only consider actual calls as unconditional recursion.
Specifically, just mentioning the function name as a value is fine, as
long as it isn't called, e.g. `fn main() { let _ = main; }`.

Closes #21705.
2015-06-29 15:59:37 -07:00
bors
fe283b4067 Auto merge of #26659 - nagisa:cas-docs, r=alexcrichton
Namely:

* Change parameter `old` to read `current` so it is clearer what the argument refers to (originally
   suggested `expected`, but shot down by Steve);
* Add some formatting and fix some mistakes like referring to the method as `swap` rather than
  `compare_and_swap`.
2015-06-29 20:50:41 +00:00
Simonas Kazlauskas
08b21661c3 Refine Atomic*::compare_and_swap documentation
Namely:

* Change parameter `old` to read `current` so it is clearer what the argument refers to (originally
    suggested `expected`, but shot down by Steve);
* Add some formatting and fix some mistakes like referring to the method as `swap` rather than
  `compare_and_swap`.
2015-06-29 23:18:08 +03:00
bors
f9b6929f46 Auto merge of #26623 - Saser:master, r=steveklabnik
In Chapter 5.9 (References and Borrowing), there is an example [at the very end](https://doc.rust-lang.org/stable/book/references-and-borrowing.html#use-after-free) which shows that declaring a reference before declaring the variable that it points to results in a compilation error. The book does not really mention why this happens though -- in the sections before, it has described how different scopes affects the lifetime of resources, but there is no mention of how resources within the same scope work.

This confused me a little, so I asked on #rust and got the answer that the resources are destroyed in the reverse order that they are declared, but the book makes no mention of it (as far as I can find) -- except in Chapter 5.21 (Drop), where it says:

> When `x` goes out of scope at the end of `main()`, the code for `Drop` will run. `Drop` has one method, which is also called `drop()`. It takes a mutable reference to `self`.
> 
> That’s it! The mechanics of `Drop` are very simple, but there are some subtleties. For example, values are dropped in the opposite order they are declared. [...]

---

I feel like Chapter 5.9 (References and Borrowing) is probably the best place to put this information (as I have done in my additions), since it deals with other types of referencing and borrowing. However, since English is not my native language, the wording of my additions perhaps are a little "off" -- any feedback on them is appreciated.
2015-06-29 19:19:31 +00:00
bors
34f35a535a Auto merge of #26530 - steveklabnik:gh26471, r=alexcrichton
Fixes #26471

r? @alexcrichton
2015-06-29 17:44:56 +00:00
bors
216f6645ef Auto merge of #26462 - brson:stdidx, r=steveklabnik
This is usually the link I want when I come to this page.

r? @steveklabnik
2015-06-29 15:46:35 +00:00
Steve Klabnik
b4f3c5878f Hide the Rand trait from docs
Fixes #26471
2015-06-29 08:08:59 -07:00
bors
40db46c6ba Auto merge of #26649 - Manishearth:rollup, r=Manishearth
- Successful merges: #26593, #26644, #26645
- Failed merges:
2015-06-29 08:29:54 +00:00
Manish Goregaokar
08a8ee19fb Rollup merge of #26645 - richo:makefile-typo, r=sfackler 2015-06-29 13:59:34 +05:30
Manish Goregaokar
1659075b4a Rollup merge of #26644 - pelmers:make_stage_tip, r=sfackler
I keep forgetting the command to do partial stage1 compile, so I think it would be helpful to add it into `make tips`.
2015-06-29 13:59:33 +05:30
Manish Goregaokar
4adcc78e00 Rollup merge of #26593 - GuillaumeGomez:patch-2, r=Manishearth
Part of #24407.
cc @michaelsproul
2015-06-29 13:59:33 +05:30
Guillaume Gomez
7f830a874c The come back of the "a" eaten by the void 2015-06-29 10:21:39 +02:00
Guillaume Gomez
b442530671 Add more details in error explanation 2015-06-29 10:03:02 +02:00
Guillaume Gomez
14e3d26b8a Add E0110 error explanation 2015-06-29 07:36:59 +02:00
Richo Healey
f07b11d07e mk: Fix a typo in the tips 2015-06-28 19:05:09 -07:00
Peter Elmers
9b6fe6ca36 Add tip to do partial compile. 2015-06-28 18:49:22 -07:00
bors
a973e4cda5 Auto merge of #26582 - jroesch:infer-ctxt-refactor, r=nikomatsakis
This branch begins the work of unifying our type checking contexts into a single piece of state. The goal is to eventually have a single context that we can pass around instead of the fractured situation we currently have. There are still several things that must be done before beginning to make tables item local:

- [ ] move FulfillmentContext into InferCtxt
- [ ] modify SelectionContext to only take a single context argument
- [ ] remove remaining typer impls 
- [ ] remove the ClosureTyper + Typer trait
- [ ] do some renaming to make these things more applicable to their new roles

r? @nikomatsakis 

As a side note there are a couple oddities that are temporary refactors that will be quickly cleaned up in a follow-up PR.

cc @eddyb @Aatch @arielb1 @nrc
2015-06-29 00:03:37 +00:00
bors
2671e8cee0 Auto merge of #26642 - remram44:doc-openoptions-missing-write, r=alexcrichton
Setting append without write doesn't give you a writeable file. Showing it as an example in the docs is confusing at best ([reddit](https://www.reddit.com/r/rust/comments/3bbz8w/why_is_writing_a_file_not_working_for_me/))

Using truncate (O_TRUNC) on a read-only file is an error on POSIX systems ("unspecified"). Note however that using create (O_CREAT) with read-only flags is fine.

Related: #26103 (which IMHO is wrong; saying "append is different than write" when should simply be "append needs write". My vote is to make append imply write)
2015-06-28 21:37:07 +00:00
Remi Rampin
78ec055a14 Add .write(true) to append and truncate examples
Setting append without write doesn't give you a writeable file. Showing
it as an example in the docs is confusing at best.

Using truncate on a read-only file is an error on POSIX systems (note
however that using create with read-only flags is fine).
2015-06-28 17:26:31 -04:00
Jared Roesch
5c3753f6b4 Fix librustc_driver/test.rs 2015-06-28 14:08:50 -07:00
bors
c1b8bd2d6f Auto merge of #26631 - richo:comment-updates, r=steveklabnik
I've attempted to lurk these into a few PRs since they're tiny, but those PR's haven't landed so here they are.

r? @steveklabnik
2015-06-28 06:35:30 +00:00
bors
5da0d415b6 Auto merge of #26601 - alexcrichton:xp, r=brson
This series of commits (currently rebased on https://github.com/rust-lang/rust/pull/26569 to avoid conflicts) adds support for the standard library to run on Windows XP. The main motivation behind this PR is that to enable any Rust code in Firefox we need to support Windows XP.

This PR doesn't yet intend to be a move to make Windows XP an officially supported platform, but instead simply get Rust code running on it. APIs like condition variables and RWLocks will immediately panic currently on XP, and it's unclear if that story wants to change much. Additionally, we may bind APIs like IOCP which aren't available on XP and would be *very* difficult to provide a fallback implementation. Essentially this PR enables running Rust on XP, but you still have to be careful to avoid non-XP portions of the standard library.

The major components of this PR are:

* Support for a new `i686-pc-windows-msvc` triple. This primarily involves a lot of build system hackery, but there are also a number of floating point functions which had to get switched up a bit.
* All APIs not available on Windows are now accessed through our dynamic-detection mechanism
* Mutexes on Windows were rewritten to use SRWLOCK as an optimization but can fall back to CRITICAL_SECTION.
2015-06-28 03:57:07 +00:00
Jared Roesch
15bc4a30c3 Address nits 2015-06-27 19:52:25 -07:00
Alex Crichton
10b103af48 std: Fix Windows XP compatibility
This commit enables executables linked against the standard library to run on
Windows XP. There are two main components of this commit:

* APIs not available on XP are shimmed to have a fallback implementation and use
  runtime detection to determine if they are available.
* Mutexes on Windows were reimplemented to use critical sections on XP where
  rwlocks are not available.

The APIs which are not available on XP are:

* SetFileInformationByHandle - this is just used by `File::truncate` and that
  function just returns an error now.
* SetThreadStackGuarantee - this is used by the stack overflow support on
  windows, but if this isn't available then it's just ignored (it seems
  non-critical).
* All condition variable APIs are missing - the shims added for these apis
  simply always panic for now. We may eventually provide a fallback
  implementation, but for now the standard library does not rely on condition
  variables for normal use.
* RWLocks, like condition variables, are missing entirely. The same story for
  condition variables is taken here. These APIs are all now panicking stubs as
  the standard library doesn't rely on RWLocks for normal use.

Currently, as an optimization, we use SRWLOCKs for the standard `sync::Mutex`
implementation on Windows, which is indeed required for normal operation of the
standard library. To allow the standard library to run on XP, this commit
reimplements mutexes on Windows to use SRWLOCK instances *if available* and
otherwise a CriticalSection is used (with some checking for recursive
locking).

With all these changes put together, a 32-bit MSVC-built executable can run on
Windows XP and print "hello world"

Closes #12842
Closes #19992
Closes #24776
2015-06-27 19:45:24 -07:00
Richo Healey
9e58fb85ef rt: Update comment for new location of unwind 2015-06-27 19:25:55 -07:00
Richo Healey
ba7b47eb55 rustc_driver: Fix incorrect comment 2015-06-27 18:27:00 -07:00
Jared Roesch
e5b3684872 Remove ClosureTyper impl for FnCtxt 2015-06-27 14:26:13 -07:00
Jared Roesch
480cd8fe67 Ground work for replacing the ClosureTyper trait 2015-06-27 14:15:49 -07:00
Jared Roesch
79d02895ff Begin refactor type checking state
This first patch starts by moving around pieces of state related to
type checking. The goal is to slowly unify the type checking state
into a single typing context. This initial patch moves the
ParameterEnvironment into the InferCtxt and moves shared tables
from Inherited and ty::ctxt into their own struct Tables. This
is the foundational work to refactoring the type checker to
enable future evolution of the language and tooling.
2015-06-27 13:43:20 -07:00
Alex Crichton
8790958237 std: Avoid missing fns on i686-pc-windows-msvc
It turns out that the 32-bit toolchain for MSVC has many of these functions as
`static inline` functions in header files so there's not actually a symbol for
Rust to call. All of the implementations just cast floats to their 64-bit
variants and then cast back to 32-bit at the end, so the standard library now
takes this strategy.
2015-06-27 13:02:18 -07:00
Alex Crichton
5de665e8b3 rustc_back: Learn about i686-pc-windows-msvc
This commit adds the i686-pc-windows-msvc triple to the compiler's repertoire of
triples to prepare for targeting 32-bit MSVC.
2015-06-27 13:02:18 -07:00
Alex Crichton
ae36d4f72a mk: Add support for i686-pc-windows-msvc
This commit modifies the configure script and our makefiles to support building
32-bit MSVC targets. The MSVC toolchain is now parameterized over whether it can
produce a 32-bit or 64-bit binary. The configure script was updated to export
more variables at configure time, and the makefiles were rejiggered to
selectively reexport the relevant environment variables for the applicable
targets they're going to run for.
2015-06-27 13:02:18 -07:00
bors
8fa2185e0b Auto merge of #26621 - tshepang:missed-removal, r=steveklabnik
Should have happened in 69abc12b00
2015-06-27 17:40:59 +00:00
Christian Persson
d6159b7fe0 Clarifying deallocation order of resources within same scope 2015-06-27 16:58:18 +02:00
bors
2ba46f8bbc Auto merge of #26616 - Manishearth:rollup, r=Manishearth
- Successful merges: #26565, #26584, #26596, #26603
- Failed merges:
2015-06-27 14:53:15 +00:00
Tshepang Lekhonkhobe
ca0601a1c2 std: someone missed removing this doc and the annotations
Should have happened in 69abc12b00
2015-06-27 15:25:20 +02:00
bors
b36ae01946 Auto merge of #26609 - huonw:align, r=alexcrichton
These will first be deprecated in 1.2.0, not 1.1.0.
2015-06-27 13:02:17 +00:00
Guillaume Gomez
d73cc56565 Add E0109 error explanation 2015-06-27 14:23:53 +02:00
bors
04daae77be Auto merge of #26579 - Techern:start-12-doc, r=brson
At the moment, it only mentions the fix to parallel codegen.

I was going to add more, but I have to go for a while - If this isn't reviewed when I get back, I'll remove it and resubmit it after filling in more :)
2015-06-27 09:54:15 +00:00
Manish Goregaokar
6dd33b459b Rollup merge of #26603 - Gankro:ref, r=steveklabnik
Quick poll of basically the entire core team says this is ok.
2015-06-27 14:18:47 +05:30
Manish Goregaokar
0bf0ea3a52 Rollup merge of #26596 - richo:richo-cleanup-macros, r=alexcrichton 2015-06-27 14:18:47 +05:30
Manish Goregaokar
1ce9b5927e Rollup merge of #26584 - omasanori:fix-26537, r=alexcrichton
Fix #26537.
2015-06-27 14:18:47 +05:30
Manish Goregaokar
ec232c8d93 Rollup merge of #26565 - Techern:ignore-kdevelop, r=brson
This is just a simple change to ignore KDevelop 4 (and pre-release versions of KDevelop 5) project files.
2015-06-27 14:18:47 +05:30
bors
650566ef2a Auto merge of #26575 - eddyb:tycx, r=nikomatsakis
Next step towards split local/global type contexts, after #26351.
cc @rust-lang/compiler @jroesch
2015-06-27 07:32:56 +00:00
bors
d3c03d0987 Auto merge of #26569 - alexcrichton:msvc-llvm-update, r=brson
Now that LLVM has been updated, the only remaining roadblock to implementing
unwinding for MSVC is to fill out the runtime support in `std::rt::unwind::seh`.
This commit does precisely that, fixing up some other bits and pieces along the
way:

* The `seh` unwinding module now uses `RaiseException` to initiate a panic.
* The `rust_try.ll` file was rewritten for MSVC (as it's quite different) and is
  located at `rust_try_msvc_64.ll`, only included on MSVC builds for now.
* The personality function for all landing pads generated by LLVM is hard-wired
  to `__C_specific_handler` instead of the standard `rust_eh_personality` lang
  item. This is required to get LLVM to emit SEH unwinding information instead
  of DWARF unwinding information. This also means that on MSVC the
  `rust_eh_personality` function is entirely unused (but is defined as it's a
  lang item).

More details about how panicking works on SEH can be found in the
`rust_try_msvc_64.ll` or `seh.rs` files, but I'm always open to adding more
comments!

A key aspect of this PR is missing, however, which is that **unwinding is still
turned off by default for MSVC**. There is a [bug in llvm][llvm-bug] which
causes optimizations to inline enough landing pads that LLVM chokes. If the
compiler is optimized at `-O1` (where inlining isn't enabled) then it can
bootstrap with unwinding enabled, but when optimized at `-O2` (inlining is
enabled) then it hits a fatal LLVM error.

[llvm-bug]: https://llvm.org/bugs/show_bug.cgi?id=23884
2015-06-27 05:06:22 +00:00
bors
773052a608 Auto merge of #26574 - brson:relnotes-fix, r=alexcrichton
My bad!
2015-06-27 02:43:00 +00:00
Cruz Julian Bishop
1aabbd01c3 Initial documentation for 1.2.0, uploading to test markdown 2015-06-27 09:16:11 +10:00
bors
cb7d062155 Auto merge of #26605 - Ms2ger:raw-doc, r=alexcrichton 2015-06-26 22:44:44 +00:00
Huon Wilson
0f6d4aa786 core: fix deprecation since version of align_of_min.
These will first be deprecated in 1.2.0, not 1.1.0.
2015-06-26 15:00:31 -07:00
Ms2ger
532235be27 Use Box::into_raw rather than the deprecated boxed::into_raw in tests and documentation. 2015-06-26 22:29:40 +02:00