Skip to content

Commit 37c4c9f

Browse files
committed
---
yaml --- r: 227910 b: refs/heads/try c: f9b6929 h: refs/heads/master v: v3
1 parent 3641203 commit 37c4c9f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1380
-722
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: d6159b7fe0ce668b6875d4551019d3946ed8388c
4+
refs/heads/try: f9b6929f4603950dafafa66c67df4cd37ed0b364
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*.exe
2020
*.fn
2121
*.html
22+
*.kdev4
2223
*.ky
2324
*.ll
2425
*.llvm

branches/try/Makefile.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
# * tidy-basic - show file / line stats
6363
# * tidy-errors - show the highest rustc error code
6464
# * tidy-features - show the status of language and lib features
65+
# * rustc-stage$(stage) - Only build up to a specific stage
6566
#
6667
# Then mix in some of these environment variables to harness the
6768
# ultimate power of The Rust Build System.
@@ -90,7 +91,7 @@
9091
#
9192
# # Rust recipes for build system success
9293
#
93-
# // Modifying libstd? Use this comment to run unit tests just on your change
94+
# // Modifying libstd? Use this command to run unit tests just on your change
9495
# make check-stage1-std NO_REBUILD=1 NO_BENCH=1
9596
#
9697
# // Added a run-pass test? Use this to test running your test

branches/try/configure

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ do
11141114
fi
11151115
;;
11161116

1117-
x86_64-*-msvc)
1117+
*-msvc)
11181118
# Currently the build system is not configured to build jemalloc
11191119
# with MSVC, so we omit this optional dependency.
11201120
step_msg "targeting MSVC, disabling jemalloc"
@@ -1154,22 +1154,45 @@ do
11541154
CFG_MSVC_ROOT=$(echo "$install" | grep InstallDir | sed 's/.*REG_SZ[ ]*//')
11551155
CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT")
11561156
CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT")
1157-
CFG_MSVC_CL="${CFG_MSVC_ROOT}/VC/bin/amd64/cl.exe"
1158-
CFG_MSVC_LIB="${CFG_MSVC_ROOT}/VC/bin/amd64/lib.exe"
1159-
CFG_MSVC_LINK="${CFG_MSVC_ROOT}/VC/bin/amd64/link.exe"
1157+
putvar CFG_MSVC_ROOT
1158+
1159+
case $i in
1160+
x86_64-*)
1161+
bits=x86_64
1162+
msvc_part=amd64
1163+
;;
1164+
i686-*)
1165+
bits=i386
1166+
msvc_part=
1167+
;;
1168+
*)
1169+
err "can only target x86 targets for MSVC"
1170+
;;
1171+
esac
1172+
bindir="${CFG_MSVC_ROOT}/VC/bin"
1173+
if [ ! -z "$msvc_part" ]; then
1174+
bindir="$bindir/$msvc_part"
1175+
fi
1176+
eval CFG_MSVC_BINDIR_$bits="\"$bindir\""
1177+
eval CFG_MSVC_CL_$bits="\"$bindir/cl.exe\""
1178+
eval CFG_MSVC_LIB_$bits="\"$bindir/lib.exe\""
1179+
eval CFG_MSVC_LINK_$bits="\"$bindir/link.exe\""
11601180

11611181
vcvarsall="${CFG_MSVC_ROOT}/VC/vcvarsall.bat"
1162-
CFG_MSVC_INCLUDE_PATH=$(cmd /c "\"$vcvarsall\" amd64 && cmd /c echo %INCLUDE%")
1182+
include_path=$(cmd /c "\"$vcvarsall\" $msvc_part && cmd /c echo %INCLUDE%")
11631183
need_ok "failed to learn about MSVC's INCLUDE"
1164-
CFG_MSVC_LIB_PATH=$(cmd /c "\"$vcvarsall\" amd64 && cmd /c echo %LIB%")
1184+
lib_path=$(cmd /c "\"$vcvarsall\" $msvc_part && cmd /c echo %LIB%")
11651185
need_ok "failed to learn about MSVC's LIB"
11661186

1167-
putvar CFG_MSVC_ROOT
1168-
putvar CFG_MSVC_CL
1169-
putvar CFG_MSVC_LIB
1170-
putvar CFG_MSVC_LINK
1171-
putvar CFG_MSVC_INCLUDE_PATH
1172-
putvar CFG_MSVC_LIB_PATH
1187+
eval CFG_MSVC_INCLUDE_PATH_${bits}="\"$include_path\""
1188+
eval CFG_MSVC_LIB_PATH_${bits}="\"$lib_path\""
1189+
1190+
putvar CFG_MSVC_BINDIR_${bits}
1191+
putvar CFG_MSVC_CL_${bits}
1192+
putvar CFG_MSVC_LIB_${bits}
1193+
putvar CFG_MSVC_LINK_${bits}
1194+
putvar CFG_MSVC_INCLUDE_PATH_${bits}
1195+
putvar CFG_MSVC_LIB_PATH_${bits}
11731196
;;
11741197

11751198
*)
@@ -1408,8 +1431,19 @@ do
14081431

14091432
msg "configuring LLVM with:"
14101433
msg "$CMAKE_ARGS"
1434+
case "$t" in
1435+
x86_64-*)
1436+
generator="Visual Studio 12 2013 Win64"
1437+
;;
1438+
i686-*)
1439+
generator="Visual Studio 12 2013"
1440+
;;
1441+
*)
1442+
err "can only build LLVM for x86 platforms"
1443+
;;
1444+
esac
14111445
(cd $LLVM_BUILD_DIR && "$CFG_CMAKE" $CFG_LLVM_SRC_DIR \
1412-
-G "Visual Studio 12 2013 Win64" \
1446+
-G "$generator" \
14131447
$CMAKE_ARGS)
14141448
need_ok "LLVM cmake configure failed"
14151449
fi
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# i686-pc-windows-msvc configuration
2+
CC_i686-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
3+
LINK_i686-pc-windows-msvc="$(CFG_MSVC_LINK_i386)" -nologo
4+
CXX_i686-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
5+
CPP_i686-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
6+
AR_i686-pc-windows-msvc="$(CFG_MSVC_LIB_i386)" -nologo
7+
CFG_LIB_NAME_i686-pc-windows-msvc=$(1).dll
8+
CFG_STATIC_LIB_NAME_i686-pc-windows-msvc=$(1).lib
9+
CFG_LIB_GLOB_i686-pc-windows-msvc=$(1)-*.{dll,lib}
10+
CFG_LIB_DSYM_GLOB_i686-pc-windows-msvc=$(1)-*.dylib.dSYM
11+
CFG_JEMALLOC_CFLAGS_i686-pc-windows-msvc :=
12+
CFG_GCCISH_CFLAGS_i686-pc-windows-msvc := -MD
13+
CFG_GCCISH_CXXFLAGS_i686-pc-windows-msvc := -MD
14+
CFG_GCCISH_LINK_FLAGS_i686-pc-windows-msvc :=
15+
CFG_GCCISH_DEF_FLAG_i686-pc-windows-msvc :=
16+
CFG_LLC_FLAGS_i686-pc-windows-msvc :=
17+
CFG_INSTALL_NAME_i686-pc-windows-msvc =
18+
CFG_EXE_SUFFIX_i686-pc-windows-msvc := .exe
19+
CFG_WINDOWSY_i686-pc-windows-msvc := 1
20+
CFG_UNIXY_i686-pc-windows-msvc :=
21+
CFG_LDPATH_i686-pc-windows-msvc :=
22+
CFG_RUN_i686-pc-windows-msvc=$(2)
23+
CFG_RUN_TARG_i686-pc-windows-msvc=$(call CFG_RUN_i686-pc-windows-msvc,,$(2))
24+
CFG_GNU_TRIPLE_i686-pc-windows-msvc := i686-pc-win32
25+
26+
# All windows nightiles are currently a GNU triple, so this MSVC triple is not
27+
# bootstrapping from itself. This is relevant during stage0, and other parts of
28+
# the build system take this into account.
29+
BOOTSTRAP_FROM_i686-pc-windows-msvc := i686-pc-windows-gnu

branches/try/mk/cfg/x86_64-pc-windows-msvc.mk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# x86_64-pc-windows-msvc configuration
2-
CC_x86_64-pc-windows-msvc="$(CFG_MSVC_CL)" -nologo
3-
LINK_x86_64-pc-windows-msvc="$(CFG_MSVC_LINK)" -nologo
4-
CXX_x86_64-pc-windows-msvc="$(CFG_MSVC_CL)" -nologo
5-
CPP_x86_64-pc-windows-msvc="$(CFG_MSVC_CL)" -nologo
6-
AR_x86_64-pc-windows-msvc="$(CFG_MSVC_LIB)" -nologo
2+
CC_x86_64-pc-windows-msvc="$(CFG_MSVC_CL_x86_64)" -nologo
3+
LINK_x86_64-pc-windows-msvc="$(CFG_MSVC_LINK_x86_64)" -nologo
4+
CXX_x86_64-pc-windows-msvc="$(CFG_MSVC_CL_x86_64)" -nologo
5+
CPP_x86_64-pc-windows-msvc="$(CFG_MSVC_CL_x86_64)" -nologo
6+
AR_x86_64-pc-windows-msvc="$(CFG_MSVC_LIB_x86_64)" -nologo
77
CFG_LIB_NAME_x86_64-pc-windows-msvc=$(1).dll
88
CFG_STATIC_LIB_NAME_x86_64-pc-windows-msvc=$(1).lib
99
CFG_LIB_GLOB_x86_64-pc-windows-msvc=$(1)-*.{dll,lib}

branches/try/mk/platform.mk

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -239,23 +239,6 @@ endef
239239
$(foreach target,$(CFG_TARGET), \
240240
$(eval $(call CFG_MAKE_TOOLCHAIN,$(target))))
241241

242-
# These two environment variables are scraped by the `./configure` script and
243-
# are necessary for `cl.exe` to find standard headers (the INCLUDE variable) and
244-
# for `link.exe` to find standard libraries (the LIB variable).
245-
ifdef CFG_MSVC_INCLUDE_PATH
246-
export INCLUDE := $(CFG_MSVC_INCLUDE_PATH)
247-
endif
248-
ifdef CFG_MSVC_LIB_PATH
249-
export LIB := $(CFG_MSVC_LIB_PATH)
250-
endif
251-
252-
# Unfortunately `link.exe` is also a program in `/usr/bin` on MinGW installs,
253-
# but it's not the one that we want. As a result we make sure that our detected
254-
# `link.exe` shows up in PATH first.
255-
ifdef CFG_MSVC_LINK
256-
export PATH := $(CFG_MSVC_ROOT)/VC/bin/amd64:$(PATH)
257-
endif
258-
259242
# There are more comments about this available in the target specification for
260243
# Windows MSVC in the compiler, but the gist of it is that we use `llvm-ar.exe`
261244
# instead of `lib.exe` for assembling archives, so we need to inject this custom
@@ -307,3 +290,4 @@ endef
307290

308291
$(foreach target,$(CFG_TARGET), \
309292
$(eval $(call ADD_RUSTC_LLVM_DEF_TO_MSVC,$(target))))
293+

branches/try/mk/rt.mk

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ NATIVE_DEPS_rust_builtin_$(1) := rust_builtin.c \
5555
rust_android_dummy.c
5656
NATIVE_DEPS_rustrt_native_$(1) := arch/$$(HOST_$(1))/record_sp.S
5757
ifeq ($$(findstring msvc,$(1)),msvc)
58+
ifeq ($$(findstring i686,$(1)),i686)
59+
NATIVE_DEPS_rustrt_native_$(1) += rust_try_msvc_32.ll
60+
else
5861
NATIVE_DEPS_rustrt_native_$(1) += rust_try_msvc_64.ll
62+
endif
5963
else
6064
NATIVE_DEPS_rustrt_native_$(1) += rust_try.ll
6165
endif
@@ -93,6 +97,17 @@ $$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.S $$(MKFILE_DEPS) \
9397
@mkdir -p $$(@D)
9498
@$$(call E, compile: $$@)
9599
$$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<)
100+
101+
# On MSVC targets the compiler's default include path (e.g. where to find system
102+
# headers) is specified by the INCLUDE environment variable. This may not be set
103+
# so the ./configure script scraped the relevant values and this is the location
104+
# that we put them into cl.exe's environment.
105+
ifeq ($$(findstring msvc,$(1)),msvc)
106+
$$(RT_OUTPUT_DIR_$(1))/%.o: \
107+
export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(1)))
108+
$(1)/rustllvm/%.o: \
109+
export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(1)))
110+
endif
96111
endef
97112

98113
$(foreach target,$(CFG_TARGET),$(eval $(call NATIVE_LIBRARIES,$(target))))
@@ -240,8 +255,12 @@ COMPRT_CFLAGS_$(1) := $$(CFG_GCCISH_CFLAGS_$(1))
240255
ifeq ($$(findstring msvc,$(1)),msvc)
241256
COMPRT_CC_$(1) := gcc
242257
COMPRT_AR_$(1) := ar
258+
ifeq ($$(findstring i686,$(1)),i686)
259+
COMPRT_CFLAGS_$(1) := $$(CFG_GCCISH_CFLAGS_$(1)) -m32
260+
else
243261
COMPRT_CFLAGS_$(1) := $$(CFG_GCCISH_CFLAGS_$(1)) -m64
244262
endif
263+
endif
245264

246265
$$(COMPRT_LIB_$(1)): $$(COMPRT_DEPS) $$(MKFILE_DEPS)
247266
@$$(call E, make: compiler-rt)

branches/try/mk/target.mk

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,40 @@ $(foreach target,$(CFG_TARGET), \
220220
$(foreach crate,$(CRATES), \
221221
$(foreach tool,$(NATIVE_TOOL_DEPS_$(crate)_T_$(target)), \
222222
$(eval $(call MOVE_TOOLS_TO_SNAPSHOT_HOST_DIR,0,$(target),$(BOOTSTRAP_FROM_$(target)),$(crate),$(tool))))))
223+
224+
# For MSVC targets we need to set up some environment variables for the linker
225+
# to work correctly when building Rust crates. These two variables are:
226+
#
227+
# - LIB tells the linker the default search path for finding system libraries,
228+
# for example kernel32.dll
229+
# - PATH needs to be modified to ensure that MSVC's link.exe is first in the
230+
# path instead of MinGW's /usr/bin/link.exe (entirely unrelated)
231+
#
232+
# The values for these variables are detected by the configure script.
233+
define SETUP_LIB_MSVC_ENV_VARS
234+
ifeq ($$(findstring msvc,$(2)),msvc)
235+
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
236+
export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(2)))
237+
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
238+
export PATH := $$(CFG_MSVC_BINDIR_$$(HOST_$(2))):$$(PATH)
239+
endif
240+
endef
241+
define SETUP_TOOL_MSVC_ENV_VARS
242+
ifeq ($$(findstring msvc,$(2)),msvc)
243+
$$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
244+
export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(2)))
245+
$$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
246+
export PATH := $$(CFG_MSVC_BINDIR_$$(HOST_$(2))):$$(PATH)
247+
endif
248+
endef
249+
250+
$(foreach host,$(CFG_HOST), \
251+
$(foreach target,$(CFG_TARGET), \
252+
$(foreach stage,$(STAGES), \
253+
$(foreach crate,$(CRATES), \
254+
$(eval $(call SETUP_LIB_MSVC_ENV_VARS,$(stage),$(target),$(host),$(crate)))))))
255+
$(foreach host,$(CFG_HOST), \
256+
$(foreach target,$(CFG_TARGET), \
257+
$(foreach stage,$(STAGES), \
258+
$(foreach tool,$(TOOLS), \
259+
$(eval $(call SETUP_TOOL_MSVC_ENV_VARS,$(stage),$(target),$(host),$(tool)))))))

branches/try/src/doc/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ series of small examples.
2020

2121
[rbe]: http://rustbyexample.com/
2222

23+
# The Standard Library
24+
25+
We have [API documentation for the entire standard
26+
library](std/index.html). There's a list of crates on the left with more
27+
specific sections, or you can use the search bar at the top to search for
28+
something if you know its name.
29+
2330
# Community & Getting Help
2431

2532
If you need help with something, or just want to talk about Rust with others,
@@ -75,13 +82,6 @@ There are questions that are asked quite often, so we've made FAQs for them:
7582
* [Project FAQ](complement-project-faq.html)
7683
* [How to submit a bug report](https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports)
7784

78-
# The Standard Library
79-
80-
We have [API documentation for the entire standard
81-
library](std/index.html). There's a list of crates on the left with more
82-
specific sections, or you can use the search bar at the top to search for
83-
something if you know its name.
84-
8585
# The Error Index
8686

8787
If you encounter an error while compiling your code you may be able to look it

branches/try/src/doc/reference.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,11 +1047,8 @@ This is a list of behavior not considered *unsafe* in Rust terms, but that may
10471047
be undesired.
10481048

10491049
* Deadlocks
1050-
* Reading data from private fields (`std::repr`)
10511050
* Leaks of memory and other resources
10521051
* Exiting without calling destructors
1053-
* Sending signals
1054-
* Accessing/modifying the file system
10551052
* Integer overflow
10561053
- Overflow is considered "unexpected" behavior and is always user-error,
10571054
unless the `wrapping` primitives are used. In non-optimized builds, the compiler

branches/try/src/doc/trpl/unsafe.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ two contexts. The first one is to mark a function as unsafe:
1212

1313
```rust
1414
unsafe fn danger_will_robinson() {
15-
// scary stuff
15+
// scary stuff
1616
}
1717
```
1818

@@ -68,11 +68,8 @@ Whew! That’s a bunch of stuff. It’s also important to notice all kinds of
6868
behaviors that are certainly bad, but are expressly _not_ unsafe:
6969

7070
* Deadlocks
71-
* Reading data from private fields
72-
* Leaks due to reference count cycles
71+
* Leaks of memory or other resources
7372
* Exiting without calling destructors
74-
* Sending signals
75-
* Accessing/modifying the file system
7673
* Integer overflow
7774

7875
Rust cannot prevent all kinds of software problems. Buggy code can and will be

branches/try/src/libcore/mem.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ pub fn size_of_val<T: ?Sized>(val: &T) -> usize {
155155
/// ```
156156
#[inline]
157157
#[stable(feature = "rust1", since = "1.0.0")]
158-
#[deprecated(reason = "use `align_of` instead", since = "1.1.0")]
158+
#[deprecated(reason = "use `align_of` instead", since = "1.2.0")]
159159
pub fn min_align_of<T>() -> usize {
160160
unsafe { intrinsics::min_align_of::<T>() }
161161
}
@@ -171,7 +171,7 @@ pub fn min_align_of<T>() -> usize {
171171
/// ```
172172
#[inline]
173173
#[stable(feature = "rust1", since = "1.0.0")]
174-
#[deprecated(reason = "use `align_of_val` instead", since = "1.1.0")]
174+
#[deprecated(reason = "use `align_of_val` instead", since = "1.2.0")]
175175
pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
176176
unsafe { intrinsics::min_align_of_val(val) }
177177
}

0 commit comments

Comments
 (0)