Commit Graph

42412 Commits

Author SHA1 Message Date
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
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
Alex Crichton
40570eb49e rustc_llvm: Expose setting more DLL storage classes
Currently only `dllexport` is used, but more integration will require using
`dllimport` as well.
2015-05-12 14:50:36 -07:00
Alex Crichton
2d5e5777fd rustc_trans: Abstract linker support behind a trait
This trait will be used to correctly build a command line for link.exe with MSVC
and may perhaps one day be used to generate a command line for `lld`, but this
commit currently just refactors the bindings used to call `ld`.
2015-05-12 14:50:36 -07:00
Alex Crichton
4cc025d83c Scale back changes made 2015-05-12 14:50:36 -07:00
Ricky Taylor
315750ac92 Very hacky MSVC hacks.
Conflicts:
	mk/platform.mk
	src/librustc/session/config.rs
	src/librustc_back/target/aarch64_apple_ios.rs
	src/librustc_back/target/aarch64_linux_android.rs
	src/librustc_back/target/arm_linux_androideabi.rs
	src/librustc_back/target/arm_unknown_linux_gnueabi.rs
	src/librustc_back/target/arm_unknown_linux_gnueabihf.rs
	src/librustc_back/target/armv7_apple_ios.rs
	src/librustc_back/target/armv7s_apple_ios.rs
	src/librustc_back/target/i386_apple_ios.rs
	src/librustc_back/target/i686_apple_darwin.rs
	src/librustc_back/target/i686_pc_windows_gnu.rs
	src/librustc_back/target/i686_unknown_dragonfly.rs
	src/librustc_back/target/i686_unknown_linux_gnu.rs
	src/librustc_back/target/mips_unknown_linux_gnu.rs
	src/librustc_back/target/mipsel_unknown_linux_gnu.rs
	src/librustc_back/target/mod.rs
	src/librustc_back/target/powerpc_unknown_linux_gnu.rs
	src/librustc_back/target/x86_64_apple_darwin.rs
	src/librustc_back/target/x86_64_apple_ios.rs
	src/librustc_back/target/x86_64_pc_windows_gnu.rs
	src/librustc_back/target/x86_64_unknown_dragonfly.rs
	src/librustc_back/target/x86_64_unknown_freebsd.rs
	src/librustc_back/target/x86_64_unknown_linux_gnu.rs
	src/librustc_back/target/x86_64_unknown_openbsd.rs
	src/librustc_llvm/lib.rs
	src/librustc_trans/back/link.rs
	src/librustc_trans/trans/base.rs
	src/libstd/os.rs
	src/rustllvm/RustWrapper.cpp
2015-05-12 14:50:36 -07:00
bors
3ca008dcf1 Auto merge of #25316 - brson:installer, r=alexcrichton
Revert an accidental revert.
2015-05-12 17:27:11 +00:00
bors
2a5a320bab Auto merge of #25300 - kballard:core-slice-overflow, r=Gankro
core::slice was originally written to tolerate overflow (notably, with
slices of zero-sized elements), but it was never updated to use wrapping
arithmetic when overflow traps were added.

Also correctly handle the case of calling .nth() on an Iter with a
zero-sized element type. The iterator was assuming that the pointer
value of the returned reference was meaningful, but that's not true for
zero-sized elements.

Fixes #25016.
2015-05-12 14:39:31 +00:00
bors
0ad202671f Auto merge of #25171 - quantheory:associated_time_long_paths, r=nikomatsakis
It is currently broken to use syntax such as `<T as Foo>::U::static_method()` where `<T as Foo>::U` is an associated type. I was able to fix this and simplify the parser a bit at the same time.

This also fixes the corresponding issue with associated types (#22139), but that's somewhat irrelevant because #22519 is still open, so this syntax still causes an error in type checking.

Similarly, although this fix applies to associated consts, #25046 forbids associated constants from using type parameters or `Self`, while #19559 means that associated types have to always have one of those two. Therefore, I think that you can't use an associated const from an associated type anyway.
2015-05-12 13:04:14 +00:00
bors
67dfc177f3 Auto merge of #25323 - eddyb:coherent-coherence, r=pnkfelix
The loop to load all the known impls from external crates seems to have been used because `ty::populate_implementations_for_trait_if_necessary` wasn't doing its job, and solely relying on it resulted in loading only impls in the same crate as the trait.

Coherence for `librustc` was reduced from 18.310s to 0.610s, from stage1 to stage2.
Interestingly, type checking also went from 46.232s to 42.003s, though that could be noise or unrelated improvements.

On a smaller scale, `fn main() {}` now spends 0.003s in coherence instead of 0.368s, which fixes #22068.
It also peaks at only 1.2MB, instead of 16MB of heap usage.
2015-05-12 10:46:14 +00:00
bors
feac9f1c7b Auto merge of #24818 - tbelaire:double-import, r=nrc
This isn't quite right, but it's interesting.
2015-05-12 08:54:40 +00:00
bors
f2e1a1b50e Auto merge of #23424 - arielb1:ambiguous-project, r=nikomatsakis
r? @nikomatsakis
2015-05-12 07:02:40 +00:00
Eduard Burtescu
75cd8f94e1 rustc_typeck: remove the "preload all impls ever" workaround in coherence. 2015-05-12 07:58:01 +03:00
Eduard Burtescu
592165fb17 Fix ty::populate_implementations_for_trait_if_necessary to load the trait's impls from all the crates. 2015-05-12 07:56:37 +03:00
Eduard Burtescu
aeb92bab5d rustc: rename ty::populate_implementations_for_type_if_necessary to make it clear that it only populates inherent impls. 2015-05-12 07:51:15 +03:00
Eduard Burtescu
8bcb3cb475 rustc::metadata: use u64 for DefId's instead of strings. 2015-05-12 07:49:15 +03:00
bors
a90453a178 Auto merge of #25320 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #25254, #25272, #25278, #25282, #25283, #25288, #25292, #25302, #25304, #25314
- Failed merges:
2015-05-12 04:17:30 +00:00
Steve Klabnik
28b923c477 Rollup merge of #25314 - steveklabnik:static_to_associated, r=alexcrichton 2015-05-11 23:24:20 -04:00
Steve Klabnik
f3849431a9 Rollup merge of #25304 - oli-obk:patch-2, r=steveklabnik 2015-05-11 23:24:20 -04:00
Steve Klabnik
7f79f14959 Rollup merge of #25302 - michaelsproul:error-markdown, r=pnkfelix
A few errors slipped through my filter. Markdown formatting is especially important now that http://doc.rust-lang.org/error-index.html is live!

Speaking of, the error index should probably be linked to from somewhere. It doesn't quite fit under any of the sections in the index, but I could create a new one for it? Or add it under "tools" despite it not exactly being an executable tool.
2015-05-11 23:24:19 -04:00
Steve Klabnik
425455b18e Rollup merge of #25292 - steveklabnik:stack_and_heap, r=nikomatsakis
I think someday I'd like to make these drawings rather than text, but for now, this will have to be good enough.
2015-05-11 23:24:19 -04:00
Steve Klabnik
abb97af508 Rollup merge of #25288 - DrKwint:master, r=alexcrichton
The functions BitSet::{iter,union,symmetric_difference} each had docs that claimed u32s were output when their actual output each end up being usizes.

r? @steveklabnik
2015-05-11 23:24:19 -04:00
Steve Klabnik
adf5b84394 Rollup merge of #25283 - steveklabnik:gh24999, r=alexcrichton
and remove references to the unit type, which no longer exists

Fixes #24999
2015-05-11 23:24:19 -04:00
Steve Klabnik
f8df5ea8a7 Rollup merge of #25282 - badboy:reference-macro-1, r=alexcrichton
As mentioned in https://github.com/rust-lang/rust/issues/16676#issuecomment-100676326 this makes it a little bit more correct.

I'm a bit unsure whether or not it should be explained that the transcriber can be wrapped in parentheses or curly braces if necessary.
2015-05-11 23:24:18 -04:00
Steve Klabnik
f4a79c0915 Rollup merge of #25278 - cpjreynolds:path-doc, r=alexcrichton
Change from "must be used with behind a pointer" to "must be used behind a pointer"
2015-05-11 23:24:18 -04:00
Steve Klabnik
5f2482acf1 Rollup merge of #25272 - nham:copy_long_diag, r=alexcrichton
Adds long diagnostic messages for:

 - E0184
 - E0204
 - E0205
 - E0206
 - E0243
 - E0244
 - E0249
 - E0250

This PR also adds some comments to the error codes in `librustc_typeck/diagnostics.rs`.

cc #24407
2015-05-11 23:24:18 -04:00
Steve Klabnik
30b527156b Rollup merge of #25254 - cgaebel:check-sizes-on-allocate, r=Gankro
They're only enabled in debug builds, but a panic is usually more
welcome than UB in debug builds.

Previous review at https://github.com/rust-lang/rust/pull/22069

r? @Gankro
cc @huon
2015-05-11 23:24:18 -04:00
Steve Klabnik
42240dccb6 static method -> associated function 2015-05-11 18:22:49 -04:00
Brian Anderson
f6119f18d2 Update rust-installer 2015-05-11 15:05:57 -07:00
Steve Klabnik
e66653bee5 TRPL: the stack and the heap 2015-05-11 16:18:12 -04:00
bors
4b88e8f63e Auto merge of #25225 - bluss:doc-search-assoc-items, r=alexcrichton
Rustdoc fixes for associated items

This is related to isssue #22442 and solves it partly.

This solves the search index links of associated types and constants,
so that they link to the trait page.

Also add an Associated Constants section if constants are present.
2015-05-11 20:02:18 +00:00
Kevin Ballard
f2614f5858 Avoid returning a slice with a null pointer from Iter.as_slice()
core::slice::Iter.ptr can be null when iterating a slice of zero-sized
elements, but the pointer value used for the slice itself cannot. Handle
this case by always returning a dummy pointer for slices of zero-sized
elements.
2015-05-11 12:37:31 -07:00
Kevin Ballard
e1e34e9275 Reintroduce non-null assumptions in core::slice iterators
The previous assumptions were not valid for slices of zero-sized
elements.
2015-05-11 11:58:45 -07:00
bors
a90dd32949 Auto merge of #25196 - brson:relnotes, r=alexcrichton
cc @aturon
2015-05-11 18:13:11 +00:00
Brian Anderson
94caeb326c More authors updates 2015-05-11 10:59:23 -07:00
Steve Klabnik
dd7d0f5e9c Fix links in the referece
and remove references to the unit type, which no longer exists

Fixes #24999
2015-05-11 12:49:17 -04:00
bors
0a41c4a33d Auto merge of #25301 - jooert:vec_map_fix_split_off, r=Gankro
We don't need to copy any elements if `at` is behind the last element
in the map. The last element is at index `self.v.len() - 1`, so we
should not copy if `at` is greater **or equals** `self.v.len()`.

r? @Gankro
2015-05-11 16:20:49 +00:00
Oliver Schneider
7dd7bea3ac trpl: item macros must be followed by a semicolon 2015-05-11 16:46:24 +02:00
bors
f697041b37 Auto merge of #25303 - Manishearth:rollup, r=Manishearth
- Successful merges: #25280, #25284, #25286, #25287, #25290, #25291, #25297
- Failed merges:
2015-05-11 14:30:08 +00:00
Manish Goregaokar
2b0191e6d5 Rollup merge of #25297 - carols10cents:grammar-todos, r=steveklabnik
Hiiii, I've got another chunk of updates to the grammar documentation!  🌟 🌠 

Chipping away at #22445, still have some more to go. I'm learning so much!!!
2015-05-11 19:58:58 +05:30
Manish Goregaokar
dec422541b Rollup merge of #25291 - johannhof:let-expressions-example, r=steveklabnik
Maybe it's me, but I really needed an example to understand if let and refutable statements.
Playpen: http://is.gd/mjX3Gf

Let me know if the variable names are too, uh, culinary.
2015-05-11 19:58:57 +05:30
Manish Goregaokar
f2c2736cd8 Rollup merge of #25290 - bluss:docfixes, r=steveklabnik
Several Minor API / Reference Documentation Fixes

- Fix a few small errors in the reference.
- Fix paper cuts in the API docs.

Fixes #24882
Fixes #25233
Fixes #25250
2015-05-11 19:58:57 +05:30
Manish Goregaokar
8f01d8d7c2 Rollup merge of #25287 - petehunt:patch-2, r=steveklabnik 2015-05-11 19:58:57 +05:30
Manish Goregaokar
1b8f52bb69 Rollup merge of #25286 - johannhof:patch-1, r=steveklabnik
The reference was claiming all vectors all bounds-checked at run-time, when constant vectors are usually checked at compile-time.

For the changed example see http://is.gd/28ak9E

Also fixed a minor grammar issue.
2015-05-11 19:58:57 +05:30
Manish Goregaokar
b0b6db6cb3 Rollup merge of #25284 - petehunt:patch-1, r=steveklabnik
Noticed this while perusing the docs
2015-05-11 19:58:56 +05:30
Manish Goregaokar
c891375298 Rollup merge of #25280 - frewsxcv:patch-22, r=steveklabnik 2015-05-11 19:58:56 +05:30