Skip to content

Commit 447414f

Browse files
committed
Establish 'core' library separate from 'std'.
1 parent b513a5a commit 447414f

Some content is hidden

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

76 files changed

+117
-33
lines changed

Makefile.in

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ endif
104104

105105
CFG_RUNTIME :=$(call CFG_LIB_NAME,rustrt)
106106
CFG_RUSTLLVM :=$(call CFG_LIB_NAME,rustllvm)
107+
CFG_CORELIB :=$(call CFG_LIB_NAME,core)
107108
CFG_STDLIB :=$(call CFG_LIB_NAME,ruststd)
108109
CFG_LIBRUSTC :=$(call CFG_LIB_NAME,rustc)
109110

@@ -144,9 +145,9 @@ else
144145
endif
145146

146147
ifeq ($(CFG_NATURALDOCS),)
147-
$(info cfg: no naturaldocs found, omitting doc/std/index.html)
148+
$(info cfg: no naturaldocs found, omitting library doc build)
148149
else
149-
DOCS += doc/std/index.html
150+
DOCS += doc/core/index.html doc/std/index.html
150151
endif
151152

152153
ifdef CFG_DISABLE_DOCS
@@ -183,12 +184,21 @@ GENERATED :=
183184
%:: s.%
184185
%:: SCCS/s.%
185186

187+
######################################################################
188+
# Core library variables
189+
######################################################################
190+
191+
CORELIB_CRATE := $(S)src/libcore/core.rc
192+
CORELIB_INPUTS := $(wildcard $(addprefix $(S)src/libcore/, \
193+
core.rc *.rs */*.rs))
194+
186195
######################################################################
187196
# Standard library variables
188197
######################################################################
189198

190-
STDLIB_CRATE := $(S)src/lib/std.rc
191-
STDLIB_INPUTS := $(wildcard $(addprefix $(S)src/lib/,*.rc *.rs */*.rs))
199+
STDLIB_CRATE := $(S)src/libstd/std.rc
200+
STDLIB_INPUTS := $(wildcard $(addprefix $(S)src/libstd/, \
201+
std.rc *.rs */*.rs))
192202

193203
######################################################################
194204
# rustc crate variables
@@ -268,13 +278,21 @@ TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustc/$(2)
268278
TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin
269279
TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib
270280

271-
# The name of the standard library used by rustc
281+
# The name of the core and standard libraries used by rustc
272282
ifdef CFG_DISABLE_SHAREDSTD
283+
HCORELIB_DEFAULT$(1)_H_$(3) = \
284+
$$(HLIB$(1)_H_$(3))/libcore.rlib
285+
TCORELIB_DEFAULT$(1)_T_$(2)_H_$(3) = \
286+
$$(TLIB$(1)_T_$(2)_H_$(3))/libcore.rlib
273287
HSTDLIB_DEFAULT$(1)_H_$(3) = \
274288
$$(HLIB$(1)_H_$(3))/libstd.rlib
275289
TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3) = \
276290
$$(TLIB$(1)_T_$(2)_H_$(3))/libstd.rlib
277291
else
292+
HCORELIB_DEFAULT$(1)_H_$(3) = \
293+
$$(HLIB$(1)_H_$(3))/$(CFG_CORELIB)
294+
TCORELIB_DEFAULT$(1)_T_$(2)_H_$(3) = \
295+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_CORELIB)
278296
HSTDLIB_DEFAULT$(1)_H_$(3) = \
279297
$$(HLIB$(1)_H_$(3))/$(CFG_STDLIB)
280298
TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3) = \
@@ -286,6 +304,7 @@ HSREQ$(1)_H_$(3) = \
286304
$$(HBIN$(1)_H_$(3))/rustc$$(X) \
287305
$$(HLIB$(1)_H_$(3))/$$(CFG_RUNTIME) \
288306
$$(HLIB$(1)_H_$(3))/$$(CFG_RUSTLLVM) \
307+
$$(HCORELIB_DEFAULT$(1)_H_$(3)) \
289308
$$(HSTDLIB_DEFAULT$(1)_H_$(3)) \
290309
$$(MKFILE_DEPS)
291310

@@ -299,6 +318,7 @@ TSREQ$(1)_T_$(2)_H_$(3) = \
299318
# Prerequisites for complete stageN targets
300319
SREQ$(1)_T_$(2)_H_$(3) = \
301320
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
321+
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB) \
302322
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB)
303323

304324
ifeq ($(1),0)

configure

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ fi
355355
step_msg "making directories"
356356

357357
for i in \
358-
doc doc/std \
359-
nd nd/std \
358+
doc doc/core doc/std \
359+
nd nd/core nd/std \
360360
dl tmp
361361
do
362362
make_dir $i

doc/lib.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
Custom styles for the library docs generated by naturaldocs
3+
*/
4+
5+
p {
6+
text-indent: 0;
7+
margin-bottom: 1em;
8+
}

doc/std.css

Lines changed: 0 additions & 8 deletions
This file was deleted.

mk/dist.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ PKG_FILES = \
4646
$(PKG_3RDPARTY)) \
4747
$(PKG_UV) \
4848
$(COMPILER_INPUTS) \
49+
$(CORELIB_INPUTS) \
4950
$(STDLIB_INPUTS) \
5051
$(ALL_TEST_INPUTS) \
5152
$(FUZZER_CRATE) \

mk/docs.mk

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,25 @@ docsnap: doc/rust.pdf
2929
@$(call E, snap: doc/rust-$(shell date +"%Y-%m-%d")-snap.pdf)
3030
$(Q)mv $< doc/rust-$(shell date +"%Y-%m-%d")-snap.pdf
3131

32-
doc/std/index.html: nd/std/Languages.txt nd/std/Topics.txt nd/std/std.css \
33-
$(STDLIB_CRATE) $(STDLIB_INPUTS)
34-
@$(call E, naturaldocs: $@)
35-
naturaldocs -i $(S)src/lib -o HTML doc/std -p nd/std -r -s Default std
36-
37-
nd/std/Languages.txt: $(S)doc/Languages.txt
38-
@$(call E, cp: $@)
39-
$(Q)cp $< $@
40-
41-
nd/std/Topics.txt: $(S)doc/Topics.txt
42-
@$(call E, cp: $@)
43-
$(Q)cp $< $@
44-
45-
nd/std/std.css: $(S)doc/std.css
46-
@$(call E, cp: $@)
47-
$(Q)cp $< $@
32+
define libdoc
33+
doc/$(1)/index.html: nd/$(1)/Languages.txt nd/$(1)/Topics.txt \
34+
nd/$(1)/lib.css $(2)
35+
@$$(call E, naturaldocs: $$@)
36+
naturaldocs -i $(S)src/lib$(1) -o HTML doc/$(1) -p nd/$(1) -r -s Default lib
37+
38+
nd/$(1)/Languages.txt: $(S)doc/Languages.txt
39+
@$$(call E, cp: $$@)
40+
$(Q)cp $$< $$@
41+
42+
nd/$(1)/Topics.txt: $(S)doc/Topics.txt
43+
@$$(call E, cp: $$@)
44+
$(Q)cp $$< $$@
45+
46+
nd/$(1)/lib.css: $(S)doc/lib.css
47+
@$$(call E, cp: $$@)
48+
$(Q)cp $$< $$@
49+
50+
endef
51+
52+
$(eval $(call libdoc,core,$(CORELIB_CRATE) $(CORELIB_INPUTS)))
53+
$(eval $(call libdoc,std,$(STDLIB_CRATE) $(STDLIB_INPUTS)))

mk/host.mk

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ $$(HBIN$(2)_H_$(4))/rustc$$(X): \
1515
$$(TBIN$(1)_T_$(4)_H_$(3))/rustc$$(X) \
1616
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME) \
1717
$$(HLIB$(2)_H_$(4))/$$(CFG_RUSTLLVM) \
18+
$$(HCORELIB_DEFAULT$(2)_H_$(4)) \
1819
$$(HSTDLIB_DEFAULT$(2)_H_$(4))
1920
@$$(call E, cp: $$@)
2021
$$(Q)cp $$< $$@
@@ -25,6 +26,7 @@ $$(HLIB$(2)_H_$(4))/$$(CFG_LIBRUSTC): \
2526
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTC) \
2627
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME) \
2728
$$(HLIB$(2)_H_$(4))/$$(CFG_RUSTLLVM) \
29+
$$(HCORELIB_DEFAULT$(2)_H_$(3)) \
2830
$$(HSTDLIB_DEFAULT$(2)_H_$(3))
2931
@$$(call E, cp: $$@)
3032
$$(Q)cp $$< $$@
@@ -34,14 +36,28 @@ $$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME): \
3436
@$$(call E, cp: $$@)
3537
$$(Q)cp $$< $$@
3638

39+
$$(HLIB$(2)_H_$(4))/$$(CFG_CORELIB): \
40+
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_CORELIB) \
41+
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME)
42+
@$$(call E, cp: $$@)
43+
$$(Q)cp $$< $$@
44+
3745
$$(HLIB$(2)_H_$(4))/$$(CFG_STDLIB): \
3846
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB) \
47+
$$(HLIB$(2)_H_$(4))/$$(CFG_CORELIB) \
48+
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME)
49+
@$$(call E, cp: $$@)
50+
$$(Q)cp $$< $$@
51+
52+
$$(HLIB$(2)_H_$(4))/libcore.rlib: \
53+
$$(TLIB$(1)_T_$(4)_H_$(3))/libcore.rlib \
3954
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME)
4055
@$$(call E, cp: $$@)
4156
$$(Q)cp $$< $$@
4257

4358
$$(HLIB$(2)_H_$(4))/libstd.rlib: \
4459
$$(TLIB$(1)_T_$(4)_H_$(3))/libstd.rlib \
60+
$$(HLIB$(2)_H_$(4))/libcore.rlib \
4561
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME)
4662
@$$(call E, cp: $$@)
4763
$$(Q)cp $$< $$@

mk/install.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ PTL$(1)$(2) = $$(PTR$(1)$(2))/lib
3333
install-target-$(1)-host-$(2): $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
3434
$$(Q)mkdir -p $$(PTL$(1)$(2))
3535
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_RUNTIME))
36+
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_CORELIB))
3637
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_STDLIB))
3738
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),intrinsics.bc)
3839
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),libmorestack.a)
@@ -61,6 +62,7 @@ install-host: $(SREQ$(ISTAGE)_T_$(CFG_HOST_TRIPLE)_H_$(CFG_HOST_TRIPLE))
6162
$(Q)mkdir -p $(PREFIX_ROOT)/share/man/man1
6263
$(Q)$(call INSTALL,$(HB),$(PHB),rustc$(X))
6364
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUNTIME))
65+
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_CORELIB))
6466
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_STDLIB))
6567
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM))
6668
$(Q)$(call INSTALL,$(S)/man, \

mk/pp.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
ifdef PPFILES
33
PP_INPUTS_FILTERED := $(wildcard $(PPFILES))
44
else
5-
PP_INPUTS = $(wildcard $(addprefix $(S)src/lib/,*.rs */*.rs)) \
5+
PP_INPUTS = $(wildcard $(addprefix $(S)src/libcore/,*.rs */*.rs)) \
6+
$(wildcard $(addprefix $(S)src/libstd/,*.rs */*.rs)) \
67
$(wildcard $(addprefix $(S)src/comp/,*.rs */*.rs */*/*.rs)) \
78
$(wildcard $(S)src/test/*/*.rs \
89
$(S)src/test/*/*/*.rs) \

mk/stage0.mk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ $(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_RUNTIME): \
1313
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
1414
$(Q)touch $@
1515

16+
$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_CORELIB): \
17+
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
18+
$(Q)touch $@
19+
1620
$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_STDLIB): \
1721
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
1822
$(Q)touch $@
@@ -38,6 +42,11 @@ $$(HLIB0_H_$(1))/$$(CFG_RUNTIME): \
3842
@$$(call E, cp: $$@)
3943
$$(Q)cp $$< $$@
4044

45+
$$(HLIB0_H_$(1))/$(CFG_CORELIB): \
46+
$$(TLIB$(2)_T_$(1)_H_$(3))/$$(CFG_CORELIB)
47+
@$$(call E, cp: $$@)
48+
$$(Q)cp $$< $$@
49+
4150
$$(HLIB0_H_$(1))/$(CFG_STDLIB): \
4251
$$(TLIB$(2)_T_$(1)_H_$(3))/$$(CFG_STDLIB)
4352
@$$(call E, cp: $$@)

mk/target.mk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
2222
@$$(call E, cp: $$@)
2323
$$(Q)cp $$< $$@
2424

25+
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB): \
26+
$$(CORELIB_CRATE) $$(CORELIB_INPUTS) \
27+
$$(TSREQ$(1)_T_$(2)_H_$(3))
28+
@$$(call E, compile_and_link: $$@)
29+
$$(STAGE$(1)_T_$(2)_H_$(3)) --lib -o $$@ $$<
30+
2531
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB): \
2632
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
33+
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB) \
2734
$$(TSREQ$(1)_T_$(2)_H_$(3))
2835
@$$(call E, compile_and_link: $$@)
2936
$$(STAGE$(1)_T_$(2)_H_$(3)) --lib -o $$@ $$<

mk/tests.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ tidy:
8787
$(wildcard $(S)src/etc/*.py) \
8888
$(COMPILER_CRATE) \
8989
$(COMPILER_INPUTS) \
90+
$(CORELIB_CRATE) \
91+
$(CORELIB_INPUTS) \
9092
$(STDLIB_CRATE) \
9193
$(STDLIB_INPUTS) \
9294
$(COMPILETEST_CRATE) \
@@ -475,4 +477,4 @@ endef
475477
$(foreach stage,$(STAGES), \
476478
$(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
477479

478-
check-fast: check-fast-H-$(CFG_HOST_TRIPLE)
480+
check-fast: check-fast-H-$(CFG_HOST_TRIPLE)

mk/tools.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ define TOOLS_STAGE_N
1919
$$(TBIN$(1)_T_$(4)_H_$(3))/fuzzer$$(X): \
2020
$$(FUZZER_CRATE) $$(FUZZER_INPUTS) \
2121
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
22+
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_CORELIB) \
2223
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB) \
2324
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTC)
2425
@$$(call E, compile_and_link: $$@)
@@ -37,6 +38,7 @@ $$(HBIN$(2)_H_$(4))/fuzzer$$(X): \
3738
$$(TBIN$(1)_T_$(4)_H_$(3))/compiletest$$(X): \
3839
$$(COMPILETEST_CRATE) $$(COMPILETEST_INPUTS) \
3940
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
41+
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_CORELIB) \
4042
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB)
4143
@$$(call E, compile_and_link: $$@)
4244
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$<
@@ -50,6 +52,7 @@ $$(HBIN$(2)_H_$(4))/compiletest$$(X): \
5052
$$(TBIN$(1)_T_$(4)_H_$(3))/cargo$$(X): \
5153
$$(CARGO_CRATE) $$(CARGO_INPUTS) \
5254
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
55+
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_CORELIB) \
5356
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB) \
5457
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTC)
5558
@$$(call E, compile_and_link: $$@)

src/libcore/core.rc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#[link(name = "core",
2+
vers = "0.1",
3+
uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8",
4+
url = "http://rust-lang.org/src/core")];
5+
6+
#[comment = "The Rust core library"];
7+
#[license = "BSD"];
8+
9+
10+
// Local Variables:
11+
// mode: rust;
12+
// fill-column: 78;
13+
// indent-tabs-mode: nil
14+
// c-basic-offset: 4
15+
// buffer-file-coding-system: utf-8-unix
16+
// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
17+
// End:
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)