Skip to content

Rollup of 2 pull requests #27803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Aug 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
09ed80f
mk/docs: remove Pandoc and LaTeX elements.
chriskrycho Aug 12, 2015
31be146
Fix #26803
vadimcn Aug 12, 2015
a016dfb
Fix macro expansion in for loop pattern
jonas-schievink Aug 12, 2015
646eace
Fix ReentrantMutex documentation wrt DerefMut
nagisa Aug 12, 2015
e09f83e
O(1) count,nth,last for slice::Windows,Chunks(Mut)
alex-ozdemir Aug 7, 2015
1dd0c05
stop cross-crate associated types from being imported
Aug 12, 2015
d07d465
Auto merge of #27690 - vadimcn:no-windres, r=alexcrichton
bors Aug 12, 2015
b7e009b
Add long diagnostics for E0366 and E0367
AlisdairO Aug 12, 2015
6a5c4e7
Auto merge of #27691 - jonas-schievink:for-macro, r=alexcrichton
bors Aug 12, 2015
872f8c3
libc: Fix backcompat with crates.io version
alexcrichton Aug 12, 2015
82169af
Auto merge of #27698 - arielb1:foreign-type-import, r=alexcrichton
bors Aug 12, 2015
43f6c2f
Correct debug! documentation
wthrowe Aug 10, 2015
021389f
Auto merge of #27652 - alex-ozdemir:iter, r=bluss
bors Aug 13, 2015
aed55dc
Auto merge of #27763 - wthrowe:debug-docs, r=alexcrichton
bors Aug 13, 2015
75f7a68
doc/readme: replace references to Pandoc with rustdoc.
chriskrycho Aug 12, 2015
b2aef9d
Auto merge of #27789 - chriskrycho:remove_pandoc_references, r=stevek…
bors Aug 13, 2015
2da80ef
Auto merge of #27693 - nagisa:remutex-docs, r=alexcrichton
bors Aug 13, 2015
ea3cd02
Auto merge of #27762 - alexcrichton:fix-libc, r=aturon
bors Aug 13, 2015
9d0bca4
Rollup merge of #27699 - nathankleyn:diagnostics-383, r=Manishearth
Manishearth Aug 13, 2015
0f3fada
Rollup merge of #27757 - AlisdairO:diagnostics366, r=Manishearth
Manishearth Aug 13, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 2 additions & 89 deletions mk/docs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
#
# The DOCS variable is their names (with no file extension).
#
# PDF_DOCS lists the targets for which PDF documentation should be
# build.
#
# RUSTDOC_FLAGS_xyz variables are extra arguments to pass to the
# rustdoc invocation for xyz.
#
Expand All @@ -35,8 +32,6 @@ DOCS += guide-crates guide-error-handling guide-ffi guide-macros guide \
guide-testing


PDF_DOCS := reference

RUSTDOC_DEPS_reference := doc/full-toc.inc
RUSTDOC_FLAGS_reference := --html-in-header=doc/full-toc.inc

Expand All @@ -52,13 +47,6 @@ RUSTDOC_HTML_OPTS_NO_CSS = --html-before-content=doc/version_info.html \

RUSTDOC_HTML_OPTS = $(RUSTDOC_HTML_OPTS_NO_CSS) --markdown-css rust.css

PANDOC_BASE_OPTS := --standalone --toc --number-sections
PANDOC_TEX_OPTS = $(PANDOC_BASE_OPTS) --from=markdown --to=latex \
--include-before-body=doc/version.tex \
--include-before-body=doc/footer.tex \
--include-in-header=doc/uptack.tex
PANDOC_EPUB_OPTS = $(PANDOC_BASE_OPTS) --to=epub

# The rustdoc executable...
RUSTDOC_EXE = $(HBIN2_H_$(CFG_BUILD))/rustdoc$(X_$(CFG_BUILD))
# ...with rpath included in case --disable-rpath was provided to
Expand Down Expand Up @@ -89,30 +77,10 @@ else
HTML_DEPS :=
endif

# Check for xelatex

ifneq ($(CFG_XELATEX),)
CFG_LATEX := $(CFG_XELATEX)
XELATEX = 1
else
$(info cfg: no xelatex found, disabling LaTeX docs)
NO_PDF_DOCS = 1
endif

ifeq ($(CFG_PANDOC),)
$(info cfg: no pandoc found, omitting PDF and EPUB docs)
ONLY_HTML_DOCS = 1
endif


######################################################################
# Rust version
######################################################################

doc/version.tex: $(MKFILE_DEPS) $(wildcard $(D)/*.*) | doc/
@$(call E, version-stamp: $@)
$(Q)echo "$(CFG_VERSION)" >$@

HTML_DEPS += doc/version_info.html
doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
$(wildcard $(D)/*.*) | doc/
Expand All @@ -121,10 +89,10 @@ doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
s/SHORT_HASH/$(CFG_SHORT_VER_HASH)/; \
s/STAMP/$(CFG_VER_HASH)/;" $< >$@

GENERATED += doc/version.tex doc/version_info.html
GENERATED += doc/version_info.html

######################################################################
# Docs, from rustdoc and sometimes pandoc
# Docs from rustdoc
######################################################################

doc/:
Expand All @@ -150,20 +118,6 @@ doc/footer.inc: $(D)/footer.inc | doc/
$(Q)cp -PRp $< $@ 2> /dev/null

# The (english) documentation for each doc item.

define DEF_SHOULD_BUILD_PDF_DOC
SHOULD_BUILD_PDF_DOC_$(1) = 1
endef
$(foreach docname,$(PDF_DOCS),$(eval $(call DEF_SHOULD_BUILD_PDF_DOC,$(docname))))

doc/footer.tex: $(D)/footer.inc | doc/
@$(call E, pandoc: $@)
$(CFG_PANDOC) --from=html --to=latex $< --output=$@

doc/uptack.tex: $(D)/uptack.tex | doc/
$(Q)cp $< $@

# HTML (rustdoc)
DOC_TARGETS += doc/not_found.html
doc/not_found.html: $(D)/not_found.md $(HTML_DEPS) | doc/
@$(call E, rustdoc: $@)
Expand All @@ -179,47 +133,6 @@ doc/$(1).html: $$(D)/$(1).md $$(HTML_DEPS) $$(RUSTDOC_DEPS_$(1)) | doc/
@$$(call E, rustdoc: $$@)
$$(Q)$$(RUSTDOC) $$(RUSTDOC_HTML_OPTS) $$(RUSTDOC_FLAGS_$(1)) $$<

ifneq ($(ONLY_HTML_DOCS),1)

# EPUB (pandoc directly)
DOC_TARGETS += doc/$(1).epub
doc/$(1).epub: $$(D)/$(1).md | doc/
@$$(call E, pandoc: $$@)
$$(CFG_PANDOC) $$(PANDOC_EPUB_OPTS) $$< --output=$$@

# PDF (md =(pandoc)=> tex =(pdflatex)=> pdf)
DOC_TARGETS += doc/$(1).tex
doc/$(1).tex: $$(D)/$(1).md doc/uptack.tex doc/footer.tex doc/version.tex | doc/
@$$(call E, pandoc: $$@)
$$(CFG_PANDOC) $$(PANDOC_TEX_OPTS) $$< --output=$$@

ifneq ($(NO_PDF_DOCS),1)
ifeq ($$(SHOULD_BUILD_PDF_DOC_$(1)),1)
DOC_TARGETS += doc/$(1).pdf
ifneq ($(XELATEX),1)
doc/$(1).pdf: doc/$(1).tex
@$$(call E, latex compiler: $$@)
$$(Q)$$(CFG_LATEX) \
-interaction=batchmode \
-output-directory=doc \
$$<
else
# The version of xelatex on the snap bots seemingly ingores -output-directory
# So we'll output to . and move to the doc directory manually.
# This will leave some intermediate files in the build directory.
doc/$(1).pdf: doc/$(1).tex
@$$(call E, latex compiler: $$@)
$$(Q)$$(CFG_LATEX) \
-interaction=batchmode \
-output-directory=. \
$$<
$$(Q)mv ./$(1).pdf $$@
endif # XELATEX
endif # SHOULD_BUILD_PDF_DOCS_$(1)
endif # NO_PDF_DOCS

endif # ONLY_HTML_DOCS

endef

$(foreach docname,$(DOCS),$(eval $(call DEF_DOC,$(docname))))
Expand Down
17 changes: 4 additions & 13 deletions src/doc/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# Rust documentations

## Dependencies

[Pandoc](http://johnmacfarlane.net/pandoc/installing.html), a universal
document converter, is required to generate docs as HTML from Rust's
source code.

## Building

To generate all the docs, just run `make docs` from the root of the repository.
Expand All @@ -26,15 +20,12 @@ To generate an HTML version of a doc from Markdown manually, you can do
something like:

~~~~
pandoc --from=markdown --to=html5 --number-sections -o reference.html reference.md
rustdoc reference.md
~~~~

(`reference.md` being the Rust Reference Manual.)

The syntax for pandoc flavored markdown can be found at:

- http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown

A nice quick reference (for non-pandoc markdown) is at:
An overview of how to use the `rustdoc` command is available [in the docs][1].
Further details are available from the command line by with `rustdoc --help`.

- http://kramdown.gettalong.org/quickref.html
[1]: https://github.com/rust-lang/rust/blob/master/src/doc/trpl/documentation.md
2 changes: 1 addition & 1 deletion src/etc/make-win-dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def make_win_dist(rust_root, gcc_root, target_triple):
elif key == "libraries":
lib_path.extend(val.lstrip(' =').split(';'))

target_tools = ["gcc.exe", "ld.exe", "ar.exe", "dlltool.exe", "windres.exe"]
target_tools = ["gcc.exe", "ld.exe", "ar.exe", "dlltool.exe"]

rustc_dlls = ["libstdc++-6.dll"]
if target_triple.startswith("i686-"):
Expand Down
95 changes: 95 additions & 0 deletions src/libcore/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ use ptr;
use mem;
use mem::size_of;
use marker::{Send, Sync, self};
use num::wrapping::OverflowingOps;
use raw::Repr;
// Avoid conflicts with *both* the Slice trait (buggy) and the `slice::raw` module.
use raw::Slice as RawSlice;
Expand Down Expand Up @@ -1180,6 +1181,34 @@ impl<'a, T> Iterator for Windows<'a, T> {
(size, Some(size))
}
}

#[inline]
fn count(self) -> usize {
self.size_hint().0
}

#[inline]
fn nth(&mut self, n: usize) -> Option<Self::Item> {
let (end, overflow) = self.size.overflowing_add(n);
if end > self.v.len() || overflow {
self.v = &[];
None
} else {
let nth = &self.v[n..end];
self.v = &self.v[n+1..];
Some(nth)
}
}

#[inline]
fn last(self) -> Option<Self::Item> {
if self.size > self.v.len() {
None
} else {
let start = self.v.len() - self.size;
Some(&self.v[start..])
}
}
}

#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -1266,6 +1295,38 @@ impl<'a, T> Iterator for Chunks<'a, T> {
(n, Some(n))
}
}

#[inline]
fn count(self) -> usize {
self.size_hint().0
}

#[inline]
fn nth(&mut self, n: usize) -> Option<Self::Item> {
let (start, overflow) = n.overflowing_mul(self.size);
if start >= self.v.len() || overflow {
self.v = &[];
None
} else {
let end = match start.checked_add(self.size) {
Some(sum) => cmp::min(self.v.len(), sum),
None => self.v.len(),
};
let nth = &self.v[start..end];
self.v = &self.v[end..];
Some(nth)
}
}

#[inline]
fn last(self) -> Option<Self::Item> {
if self.v.is_empty() {
None
} else {
let start = (self.v.len() - 1) / self.size * self.size;
Some(&self.v[start..])
}
}
}

#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -1346,6 +1407,40 @@ impl<'a, T> Iterator for ChunksMut<'a, T> {
(n, Some(n))
}
}

#[inline]
fn count(self) -> usize {
self.size_hint().0
}

#[inline]
fn nth(&mut self, n: usize) -> Option<&'a mut [T]> {
let (start, overflow) = n.overflowing_mul(self.chunk_size);
if start >= self.v.len() || overflow {
self.v = &mut [];
None
} else {
let end = match start.checked_add(self.chunk_size) {
Some(sum) => cmp::min(self.v.len(), sum),
None => self.v.len(),
};
let tmp = mem::replace(&mut self.v, &mut []);
let (head, tail) = tmp.split_at_mut(end);
let (_, nth) = head.split_at_mut(start);
self.v = tail;
Some(nth)
}
}

#[inline]
fn last(self) -> Option<Self::Item> {
if self.v.is_empty() {
None
} else {
let start = (self.v.len() - 1) / self.chunk_size * self.chunk_size;
Some(&mut self.v[start..])
}
}
}

#[stable(feature = "rust1", since = "1.0.0")]
Expand Down
Loading