Commit Graph

42914 Commits

Author SHA1 Message Date
Steve Klabnik
51a0c6a6fa Rollup merge of #25614 - parir:patch-2, r=alexcrichton
r? @steveklabnik
2015-05-19 18:38:54 -04:00
Steve Klabnik
dd1c68e6a1 Rollup merge of #25611 - parir:patch-1, r=steveklabnik
r? @steveklabnik
2015-05-19 18:38:54 -04:00
Steve Klabnik
7f74212906 Rollup merge of #25607 - peferron:doc-macros-assert-fix, r=steveklabnik
"Truth passes, success `panic!`s" seems to be a typo. The closest fix would be something like "Success passes, failure `panic!`s" but to me a "comparison failure" suggests that we couldn't compare the two values at all, not that we could successfully compare them and that the result was non-equality. So I opted to rewrite the paragraph a bit. If there's a better alternative please let me know.

r? @steveklabnik
2015-05-19 18:38:54 -04:00
Steve Klabnik
1d961fde2d Rollup merge of #25604 - skeuomorf:docs-lifetime, r=steveklabnik
r? @steveklabnik
2015-05-19 18:38:53 -04:00
Steve Klabnik
6fc93b85bc Rollup merge of #25602 - parkr:patch-1, r=alexcrichton
Padding and alignment are often not implemented by types and can cause confusion in the user.  Per discussion with @alexcrichton, here is my PR.

/cc https://github.com/rust-lang/time/issues/98
2015-05-19 18:38:53 -04:00
Steve Klabnik
1bcfe5e5ad Rollup merge of #25585 - sferik:change-default-gender, r=steveklabnik
The paper from which this example was taken made the mistake of assuming that all five philosophers are men. This it is a hypothetical example—there are no actual philosophers eating 🍝—so there is no good reason to make this assumption. Since women make up about half of the human population, all things being equal, women should represent about half of the philosophers. However, because this mistake has stood since 1985, I have changed *all* of the pronouns to be female, to make up for lost time. If someone would like to revert this patch or switch to neutral pronouns after 30 years, feel free to set your alarm clock for 2045.

r? @steveklabnik, since this is a documentation change and was created after reading http://words.steveklabnik.com/ouroboros, where I noticed this mistake.
2015-05-19 18:38:53 -04:00
Steve Klabnik
07c25d4ca0 Rollup merge of #25583 - steveklabnik:gh25517, r=alexcrichton
Fixes #25517
2015-05-19 18:38:53 -04:00
bors
c322dbbf8a Auto merge of #24333 - arielb1:implement-rfc401, r=nrc 2015-05-19 20:56:51 +00:00
Erik Michaels-Ober
b748c2e90d Change default gender in the dining philosophers project
The paper from which this example was taken made the mistake of assuming
that all five philosophers are men. This is a hypothetical
example--there are no actual philosophers eating spaghetti--so there is
no good reason to make this assumption. Since women make up about half
of the human population, all things being equal, women should represent
about half of the philosophers. However, because this mistake has stood
since 1985, I have changed *all* of the pronouns to be female, to make
up for lost time. If someone would like to revert this patch or switch
to neutral pronouns after 30 years, feel free to set your alarm clock
for 2045.
2015-05-19 22:38:24 +02:00
Ariel Ben-Yehuda
e7e1fd20de Fix rebase conflicts 2015-05-19 22:54:44 +03:00
bors
f34ff7af73 Auto merge of #25495 - alexcrichton:process-pid, r=aturon
This commits adds a method to the `std::process` module to get the process
identifier of the child as a `u32`. On Windows the underlying identifier is
already a `u32`, and on Unix the type is typically defined as `c_int` (`i32` for
almost all our supported platforms), but the actually pid is normally a small
positive number.

Eventually we may add functions to load information about a process based on its
identifier or the ability to terminate a process based on its identifier, but
for now this function should enable this sort of functionality to exist outside
the standard library.
2015-05-19 19:20:20 +00:00
Brian Anderson
01c93a59e8 mk: Report the prerelease version on beta again. Fixes #25618 2015-05-19 11:34:34 -07:00
Alex Crichton
cb3071b273 mk: Update make dist for MSVC targets
This commit updates the `dist` target for MSVC to not build the mingw components
and to also ensure that the `llvm-ar.exe` binary is ferried along into the right
location for installs.
2015-05-19 10:53:07 -07:00
Alex Crichton
74f4f395ae std: Don't require rust_try as an exported symbol
This commit adds a small non-generic non-inlineable shim function to
`rt::unwind::try` which the compiler can take care of for managing the exported
symbol instead of having to edit `src/rt/rust_try.ll`
2015-05-19 10:53:07 -07:00
Alex Crichton
3d32cf5d9a rustc_trans: Apply dllexport attributes for MSVC
This commit modifies the compiler to emit `dllexport` for all reachable
functions and data on MSVC targets, regardless of whether a dynamic library is
being created or not. More details can be found in the commit itself.
2015-05-19 10:53:07 -07:00
Alex Crichton
9a2415b822 std: Mark rust_get_num_cpus as dllexport
This function is imported across the DLL boundary by the libtest dynamic
library, so it has to be marked as dllexport somehow, and for now this is done
with an attribute on the function specifically.
2015-05-19 10:53:07 -07:00
Alex Crichton
f5222fb892 std: Implement aborting stubs for MSVC unwinding
At this time unwinding support is not implemented for MSVC as
`libgcc_s_seh-1.dll` is not available by default (and this is used on MinGW),
but this should be investigated soon. For now this change is just aimed at
getting the compiler far enough to bootstrap everything instead of successfully
running tests.

This commit refactors the `std::rt::unwind` module a bit to prepare for SEH
support eventually by moving all GCC-specific functionality to its own submodule
and defining the interface needed.
2015-05-19 10:53:07 -07:00
Alex Crichton
847c8520b1 rustc_llvm: Don't export constants across dlls
For imports of constants across DLLs to work on Windows it *requires* that the
import be marked with `dllimport` (unlike functions where the marker is
optional, but strongly recommended). This currently isn't working for importing
FFI constants across boundaries, however, so the one constant exported from
`rustc_llvm.dll` is now a function to be called instead.
2015-05-19 10:53:07 -07:00
Alex Crichton
b538189ba0 mk: Generate a .def file for rustc_llvm on MSVC
Windows needs explicit exports of functions from DLLs but LLVM does not mention
any of its symbols as being export-able from a DLL. The compiler, however,
relies on being able to use LLVM symbols across DLL boundaries so we need to
force many of LLVM's symbols to be exported from `rustc_llvm.dll`. This commit
adds support for generation of a `rustc_llvm.def` file which is passed along to
the linker when generating `rustc_llvm.dll` which should keep all these symbols
exportable and usable.
2015-05-19 10:53:07 -07:00
Alex Crichton
ce8b317558 rustc_trans: Tidy up some style and line lengths
Match the surrounding style in the rest of the `rustc_trans::trans` module.
2015-05-19 10:53:06 -07:00
Alex Crichton
181dbd71d6 rustc_trans: Add MSVC linker support
This commit adds an implementation of the `Linker` trait which is used to drive
MSVC's `link.exe` support. Nothing too surprising here as it's mostly just
filling out the necessary tidbits here and there.
2015-05-19 10:53:06 -07:00
Alex Crichton
eb50ffd234 rustc_trans: Clean up some style in back::link
* Add some logging here and there
* Move some `err` + `abort_if_errors` to just using `fatal`
* Clean up some line-lengths
2015-05-19 10:53:06 -07:00
Alex Crichton
e2854b3893 libc: Add necessary libraries for MSVC
These libs seem to be required by the standard library at least to link
successfully!
2015-05-19 10:53:06 -07:00
Alex Crichton
d97b4af153 mklldeps: Don't link stdc++/c++ on MSVC
These libraries don't exist! The linker for MSVC is highly likely to not pass
`/NODEFAULTLIB` in which case the right standard library will automatically be
selected.
2015-05-19 10:53:06 -07:00
Alex Crichton
af56e2efde rustc_back: Tweak the MSVC target spec
This change primarily changes the default ar utility used by MSVC-targeting
compilers as `llvm-ar`, adding comments along the way as to why.
2015-05-19 10:53:06 -07:00
Alex Crichton
37659a1803 rustc_back: Remove unneeded explicit variable
This value is the default anyway
2015-05-19 10:53:06 -07:00
Alex Crichton
839dcfd5a7 rustc_back: Refactor Archive to better express intent
This commit was initially written to target either `ar` or `lib.exe` for MSVC,
but it ended up not needing `lib.exe` support after all. I would personally like
to refactor this to one day not invoke processes at all (but rather use the
`llvm-ar.cpp` file in LLVM as alibrary) so I chose to preserve this refactoring
to allow it to be easily done in the future.
2015-05-19 10:53:06 -07:00
Alex Crichton
f9846e902d rustc: Shorten MSVC metadata section name
It looks like section names in objects generated by `link.exe` are limited to at
most 8 characters in length, so shorten `.note.rustc` to just `.rustc`
2015-05-19 10:53:06 -07:00
Alex Crichton
a4ef308473 mk: Add the ability to depend on native LLVM tools
The compiler will require that `llvm-ar.exe` be available for MSVC-targeting
builds (more comments on this soon), so this commit adds support for targets to
depend on LLVM tools. The `core` library for MSVC depends on `llvm-ar.exe` which
will be copied into place for the target before the compiler starts to run.

Note that these targets all depend on `llvm-config.exe` to ensure that they're
built before they're attempted to be copied.
2015-05-19 10:53:04 -07:00
Alex Crichton
6122a5f559 mk: Fix MSVC build for rustllvm.lib
This commit updates the rustllvm.mk file with the necessary flags and such to
build rustllvm.lib with cl.exe instead of gcc. Some comments can be found in the
commit itself.
2015-05-19 10:52:57 -07:00
Alex Crichton
64412a49be mk: Fix building compiler-rt on MSVC
It looks like compiler-rt has a cmake build sytem inside its source, but I have
been unable to figure out how to use it and actually build the right library.
For now this commit hard-wires MSVC-targeting builds of libcompiler-rt to
continue using `make` as the primary bulid system, but some frobbing of the
flags are necessary to ensure that the right compiler is used.
2015-05-19 10:52:57 -07:00
Alex Crichton
ee64bab76c mk: Don't add cross prefixes for MSVC
Currently the MSVC compilers don't have any cross prefixes and we're only able
to make an MSVC compiler with a cross compile, so just avoid this logic on msvc
for now.
2015-05-19 10:52:57 -07:00
Alex Crichton
fcf7ecd1d7 mk: Add build system support for cl.exe
We have a number of support C/C++ files in Rust that we link into the standard
library and other various locations, and these all need to be built with cl.exe
instead of gcc.exe when targeting MSVC. This commit adds helper macros for this
functionality to use different sets of programs/flags/invocations on MSVC than
on GNU-like platforms.
2015-05-19 10:52:57 -07:00
Alex Crichton
b56d47cc80 mk: Enable building LLVM targeting MSVC
This commit modifies the makefiles to enable building LLVM with cmake and Visual
Studio to generate an LLVM that targets MSVC. Rust's configure script requires
cmake to be installed when targeting MSVC and will configure LLVM with cmake
instead of the normal `./configure` script LLVM provides. The build will then
run cmake to execute the build instead of the normal `make`.

Currently `make clean-llvm` isn't supported on MSVC as I can't figure out how to
run a "clean" target for the Visual Studio files.
2015-05-19 10:52:57 -07:00
Alex Crichton
7cf0b1798b configure: Start adding MSVC support
This commit starts to add MSVC support to the ./configure script to enable the
build system to detect and build an MSVC target with the cl.exe compiler and
toolchain. The primary change here is a large sanity check when an MSVC target
is requested (and currently only `x86_64-pc-windows-msvc` is recognized).

When building an MSVC target, the configure script either requires the
`--msvc-root` argument or for `cl.exe` to be in `PATH`. It also requires that if
in the path `cl.exe` is the 64-bit version of the compiler.

Once detected the configure script will run the `vcvarsall.bat` script provided
by Visual Studio to learn about the `INCLUDE` and `LIB` variables needed by the
`cl.exe` compiler to run (the default include/lib paths for the
compiler/linker). These variables are then reexported when running `make` to
ensure that our own compiles are running the same toolchain.

The purpose of this detection and environment variable scraping is to avoid
requiring the build itself to be run inside of a `cmd.exe` shell but rather
allow it to run in the currently expected MinGW/MSYS shell.
2015-05-19 10:52:55 -07:00
Matt Brubeck
d776191d4a Add example code and cross-link to BufReader docs 2015-05-19 10:41:19 -07:00
petrochenkov
9e1f531d53 Fix test run-pass-fulldeps\issue-15149.rs on Windows 2015-05-19 20:37:17 +03:00
parir
3b95cd71fe doc: fix a broken link 2015-05-19 19:36:10 +02:00
Alex Crichton
ee258c548f mk: Fix native LLVM deps for cross-host builds
We use a script called `mklldeps.py` to run `llvm-config` to generate a list
of LLVM libraries and native dependencies needed by LLVM, but all cross-compiled
LLVM builds were using the *host triple's* `llvm-config` instead of the
*target's* `llvm-config`. This commit alters this to require the right
`llvmdeps.rs` to be generated which will run the correct `llvm-config`.
2015-05-19 10:36:00 -07:00
Alex Crichton
150663c3b6 mk: Correct names of installed libs on windows
Previously libmorestack.a and libcompiler-rt.a were installed, but link.exe
looks for morestack.lib and compiler-rt.lib by default, so we need to install
these with the correct name
2015-05-19 10:36:00 -07:00
Alex Crichton
eb5bf151a5 mk: Remove generation of .d files
Looks like cl.exe doesn't support this and we're also barely using them anyway
as we have very few header files and C code in general.
2015-05-19 10:36:00 -07:00
Alex Crichton
cb513c7b46 rt: Clean up to build with cl.exe
* Detect the #define _MSC_VER in addition to __WIN32__
* Don't include valgrind.h for windows
* Remove unused `rust_valgrind_stack_{un,}register` functions
* Add stub definition for `rust_running_on_valgrind` for windows
* Conditionally define `rust_dbg_extern_empty_struct` as empty structures are
  not allowed by cl.exe apparently.
2015-05-19 10:35:58 -07:00
Ms2ger
fb7c0b44bb Return the iterator from reader::docs. 2015-05-19 19:31:54 +02:00
parir
c9c474cb86 doc: add missing fences 2015-05-19 19:19:42 +02:00
bors
aca207a65c Auto merge of #25605 - Manishearth:rollup, r=Manishearth
- Successful merges: #25452, #25512, #25551, #25556, #25562, #25575, #25576, #25580, #25587, #25590, #25591
- Failed merges: #25585
2015-05-19 16:44:52 +00:00
peferron
afbe15d103 Fix description of assert! 2015-05-19 07:56:29 -07:00
Ariel Ben-Yehuda
3afd760bb3 Fix translation of semi-constant if-statements
Thanks @dotdash
2015-05-19 17:42:15 +03:00
Ariel Ben-Yehuda
27d2bd13c3 Make float -> int casts actually work 2015-05-19 17:42:15 +03:00
Ariel Ben-Yehuda
32fe2e3ad4 Address review commets
I think I didn't run tests properly - my second call to
select_all_obligations_or_error has made 3 tests fail. However, this is
just an error message change - integer fallback never worked with casts.
2015-05-19 17:42:14 +03:00
Ariel Ben-Yehuda
de4b0e9961 remove todo 2015-05-19 17:42:14 +03:00