Commit Graph

38319 Commits

Author SHA1 Message Date
bors
1500df8934 Auto merge of #22169 - gfxmonk:disable-docs, r=steveklabnik
`make docs` fails when (xe)latex is not installed. The output is pretty weird, looks like it's doing some `eval` tricks but something is blank:

    /bin/sh: -output-directory=.: command not found
    /home/tim/dev/rust/rust/mk/docs.mk:220: recipe for target 'doc/reference.pdf' failed

I have neither latex or xelatex installed. It seems like the following snippet is meant for me, but the logic is backwards:

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

I verified with:

    $ make doc/reference.pdf CFG_XELATEX=/bin/foo
    cfg: no xelatex found, disabling LaTeX docs
2015-02-11 08:54:30 +00:00
Simonas Kazlauskas
a941fdb98d Fail nicely when copying artefacts fails
Fixes #22124
2015-02-11 10:00:56 +02:00
Felix S. Klock II
e02b6d1748 destructor checker (dropck).
Largely adapted from pcwalton's original branch, with following
notable modifications:

Use `regionck::type_must_outlive` to generate `SafeDestructor`
constraints.  (this plugged some soundness holes in the analysis).

Avoid exponential time blowup on compile-fail/huge-struct.rs by
keeping the breadcrumbs until end of traversal.

Avoid premature return from regionck::visit_expr.

Factored drop-checking code out into dropck module.

Added `SafeDestructor` to enum `SubregionOrigin` (for error reporting).

----

Since this imposes restrictions on the lifetimes used in types with
destructors, this is a (wait for it)

[breaking-change]
2015-02-11 08:50:27 +01:00
Felix S. Klock II
81383bd869 Added DestructionScope variant to CodeExtent, representing the area
immediately surrounding a node that is a terminating_scope
(e.g. statements, looping forms) during which the destructors run (the
destructors for temporaries from the execution of that node, that is).

Introduced DestructionScopeData newtype wrapper around ast::NodeId, to
preserve invariant that FreeRegion and ScopeChain::BlockScope carry
destruction scopes (rather than arbitrary CodeExtents).

Insert DestructionScope and block Remainder into enclosing CodeExtents
hierarchy.

Add more doc for DestructionScope, complete with ASCII art.

Switch to constructing DestructionScope rather than Misc in a number
of places, mostly related to `ty::ReFree` creation, and use
destruction-scopes of node-ids at various calls to
liberate_late_bound_regions.

middle::resolve_lifetime: Map BlockScope to DestructionScope in `fn resolve_free_lifetime`.

Add the InnermostDeclaringBlock and InnermostEnclosingExpr enums that
are my attempt to clarify the region::Context structure, and that
later commmts build upon.

Improve the debug output for `CodeExtent` attached to `ty::Region::ReScope`.

Loosened an assertion in `rustc_trans::trans::cleanup` to account for
`DestructionScope`.  (Perhaps this should just be switched entirely
over to `DestructionScope`, rather than allowing for either `Misc` or
`DestructionScope`.)

----

Even though the DestructionScope is new, this particular commit should
not actually change the semantics of any current code.
2015-02-11 08:50:27 +01:00
Felix S. Klock II
bdb9f3e266 shift bindings to accommodate new lifetime/dtor rules.
(My fix to for-loops (21984) did not deal with similar problems in
if-let expressions, so those binding shifts stay.)
2015-02-11 08:50:27 +01:00
bors
0047f8bbd8 Auto merge of #22163 - bleibig:grammar-updates, r=sanxiyn
Updates to the bison grammar:

* Fixes to range syntax - allow `expr[..]`, and fix precedence to allow `for _ in i.. { }`
* Allow "extern crate" in stmts
* Add qualified path expressions (`<TYPE as TRAIT_REF>::item`)
2015-02-11 06:45:25 +00:00
Tim Cuthbertson
2a367b9330 docs: disable PDF docs when latex _isn't_ present 2015-02-11 17:16:37 +11:00
Keegan McAllister
d4288717c4 Forbid undefined names in macro use / macro reexport
Fixes #21062.
2015-02-10 19:36:31 -08:00
bors
5936278ed6 Auto merge of #22076 - carols10cents:exp2-calling-exp, r=huonw
I was working on adding examples to the documentation in `std::num::Float`. I got to `exp2`, which says "Returns 2 raised to the power of the number, `2^(self)`."

So I tried running this code:

```
use std::num::Float;

#[test]
fn test_exp2() {
    assert_eq!(32.0, 5.0.exp2());
}
```

and it resulted in a failure of `(left: `32`, right: `148.413159`)`. That 148.413159 is the value for e^5, which is `exp()`, not `exp2()`.

Sure enough, `exp2` is calling `exp` and shouldn't be, looks like a copy-paste error. 

I haven't added any tests for this since it's unlikely to break again, but I will happily do so if people think that would be a good idea. The doc examples are coming :)

I scanned through the other functions in these files for similar sorts of errors and didn't notice any.
2015-02-11 03:15:00 +00:00
Huon Wilson
d8d3761899 Tweak wording of copy_nonoverlapping_memory to remove misleading 'allocated'.
It doesn't have to be a literal memory allocation (ala malloc), e.g. it
can be in static memory, so saying "allocated" is mildly misleading.
2015-02-11 13:58:11 +11:00
Brian Leibig
3bca5f23aa Bison grammar: fix precedence with ranges followed by blocks 2015-02-10 17:59:02 -08:00
Brian Leibig
03cc48c38d Bison grammar: refactor items to allow "extern crate" in stmts 2015-02-10 17:59:01 -08:00
Brian Leibig
41d6513b8f Bison grammar: add qualified path expressions 2015-02-10 17:59:01 -08:00
Brian Leibig
ad6bb17acf Bison grammar: refactor index expressions to use ordinary expressions as indexes, remove index_expr and expr_norange 2015-02-10 17:59:01 -08:00
bors
2067dd2a86 Auto merge of #22160 - dotdash:extern_rust, r=brson
As the function comment already says, the types generated in the
foreign_signture function don't necessarily match the types used for a
corresponding rust function. Therefore we can't just use these types to
guide the translation of the wrapper function that bridges between the
external ABI and the rust ABI. Instead, we can query LLVM about the
types used in the rust function and use those to generate an appropriate
wrapper.

Fixes #21454
2015-02-11 01:04:54 +00:00
Ben S
c324a8ace0 Documentation fix for PathBuf#pop
It returns `false`, not `none`.
2015-02-11 00:45:43 +00:00
Steve Klabnik
07f1d3d5d9 Remove FIXME in librbml
Given that this is entirely internal, this enhancement isn't going to be needed. And if it is, we'll add it.

Closes #2741.
2015-02-10 19:39:25 -05:00
Björn Steinbrink
61db6923e2 Fix ICE when compiling "extern" rust functions
As the function comment already says, the types generated in the
foreign_signture function don't necessarily match the types used for a
corresponding rust function. Therefore we can't just use these types to
guide the translation of the wrapper function that bridges between the
external ABI and the rust ABI. Instead, we can query LLVM about the
types used in the rust function and use those to generate an appropriate
wrapper.

Fixes #21454
2015-02-10 23:43:38 +01:00
bors
a954663db6 Auto merge of #22089 - dotdash:llvm_20150207, r=alexcrichton
Fixes #21996
2015-02-10 22:08:30 +00:00
bors
bc87efef2c Auto merge of #22153 - alexcrichton:rollup, r=alexcrichton 2015-02-10 19:52:04 +00:00
Alex Crichton
3e10785e21 Test fixes and rebase conflicts 2015-02-10 11:51:38 -08:00
Alexis
b24c6fde47 fix and macro-ify map benches, fixes #22134 2015-02-10 13:41:35 -05:00
Leo Testard
73201fd675 Make the live code analysis visit method declarations.
The live code analysis only visited the function's body when visiting a
method, and not the FnDecl and the generics, resulting in code to be
incorrectly marked as unused when it only appeared in the generics, the
arguments, or the return type, whereas the same code in non-method
functions was correctly detected as used. Fixes #20343.
2015-02-10 18:27:05 +01:00
Alex Crichton
1138f88f82 rollup merge of #22144: pnkfelix/fru-privacy-rfc-736 2015-02-10 09:05:17 -08:00
Alex Crichton
08cbb4a5af rollup merge of #22147: dotdash/llvm_version
When trying to build against a newer, local LLVM version it might be
preferable to have a flag to disable the LLVM version check instead of
having to modify the configure script.

Fixes #21998

r? @alexcrichton
2015-02-10 08:43:20 -08:00
Alex Crichton
df55acf1d0 rollup merge of #22143: pnkfelix/fix-issue-20801
Add error message (i.e. do not ICE) when moving out of unsafe pointers.

Fix #20801.
2015-02-10 08:43:18 -08:00
Alex Crichton
ba7b79008b rollup merge of #22142: Kimundi/unsized_unique
This is to allow for use cases like sending a raw pointer slice across thread boundaries.
2015-02-10 08:43:16 -08:00
Alex Crichton
8b44cf2a40 rollup merge of #22135: apasel422/issue-22131
fixes #22131
2015-02-10 08:43:14 -08:00
Alex Crichton
3161cb096f rollup merge of #22130: steveklabnik/gh20172
Fixes #20172
2015-02-10 08:43:12 -08:00
Alex Crichton
e630ed6983 rollup merge of #22129: steveklabnik/gh22032
Fixes #22032
2015-02-10 08:43:09 -08:00
Alex Crichton
b0b373dce2 rollup merge of #22128: steveklabnik/gh22085
Fixes #22085

/cc @tomjakubowski
2015-02-10 08:43:07 -08:00
Alex Crichton
d3dd389224 rollup merge of #22125: alexcrichton/into-iter-stability
* Remove type parameters from `IteratorExt::cloned`
* Rename `IntoIterator::Iter` to `IntoIterator::IntoIter`
* Mark `IntoIterator::into_iter` as stable (but not the trait, only the method).
2015-02-10 08:43:04 -08:00
Alex Crichton
637a89bdf6 rollup merge of #22120: lukesteensen/closures_guide
Based off https://github.com/rust-lang/rust/pull/21843, it looks like the syntax in the Closures guide is outdated.
2015-02-10 08:43:03 -08:00
Alex Crichton
bbc8a54c63 rollup merge of #22116: kmcallister/cfg_attr
Fixes #22070.
Fixes #19372.

r? @sfackler
2015-02-10 08:43:01 -08:00
Alex Crichton
c33acf658a rollup merge of #22115: nagisa/dedupe-cratetypes
Crate types from multiple sources appear to be deduplicated properly, but not
deduplicated if they come from the command line arguments. At worst, this used
to cause compiler failures when `--crate-type=lib,rlib` (the same as
`--crate-type=rlib,rlib`, at least at the time of this commit) is provided and
generate the output multiple times otherwise.

r? @alexcrichton
2015-02-10 08:42:57 -08:00
Alex Crichton
b6e5f1bfe8 rollup merge of #22112: mbudde/std-cell-doc-fix
Replace links to `../index.html` with `index.html` as they are linking to the `std` module and not `std::cell` as intended.

See for example [RefCell documentation](http://doc.rust-lang.org/std/cell/struct.RefCell.html).
2015-02-10 08:42:55 -08:00
Alex Crichton
6ecb011a58 rollup merge of #22109: petrochenkov/intuint1 2015-02-10 08:42:53 -08:00
Alex Crichton
011b77b69c rollup merge of #22106: steveklabnik/doc_trait_objects
I started to write up some docs on this, and then realized I was just repeating http://huonw.github.io/blog/2015/01/peeking-inside-trait-objects/ but worse. @huonw previously said that we can use this content if we wanted, so I made some tweaks and integrated it into the book.

Fixes #21707
2015-02-10 08:42:51 -08:00
Alex Crichton
6d55d3ac45 rollup merge of #22103: pczarn/fix-ice-22091
Fixes #22091

I'm not sure how to write a test for this. An ICE happens with spans that start near (after?) a null character or some other zero-width unicode character.
2015-02-10 08:42:49 -08:00
Alex Crichton
5ad52ca6b3 rollup merge of #22097: cllns/fix-fallback-fonts
The fallback font for a serif font should also be serif, not sans serif.
2015-02-10 08:42:47 -08:00
Alex Crichton
7e378edb39 rollup merge of #22094: alkor/cleanup-show-string
Rename several remaining `Show`s to Debug, `String`s to Display (mostly in comments and docs).
Update reference.md:
 - derive() no longer supports Zero trait
 - derive() now supports Copy trait
2015-02-10 08:42:45 -08:00
Alex Crichton
0568422a27 rollup merge of #22088: semarie/openbsd-rmake
- c-link-to-rust-staticlib: use `EXTRACFLAGS` defined by tools.mk for
  choose the good libraries to link to.

tools.mk define a variable `EXTRACFLAGS` that contains the needed library per target. So it is better to use it, instead of duplicate the code here. I keep the `ifndef IS_WINDOWS` has tools.mk define something for WINDOWS... so I don't change things that I couldn't test.

- no-stack-check: disabled for openbsd (no segmented stacks here)

- symbols-are-reasonable: use portable grep pattern

- target-specs: use POSIX form for options when invoking grep

- use-extern-for-plugins: disable as OpenBSD only support x86_64 for now
2015-02-10 08:41:54 -08:00
Alex Crichton
577c51cdc0 rollup merge of #22072: geofft/doc-byte-string-literal
This was correct in the EBNF, but not in the prose (which seems to have
been copied-and-pasted from regular string literals).
2015-02-10 08:41:52 -08:00
Alex Crichton
cef623e5a6 rollup merge of #22067: Gankro/collections-tests
So many warnings
2015-02-10 08:41:50 -08:00
Alex Crichton
24c92134ea rollup merge of #22065: bluss/range-size-hint
When self.start > self.end, these iterators simply return None,
so we adjust the size_hint to just return zero in this case.

Certain optimizations can be implemented in and outside libstd if we
know we can trust the size_hint for all inputs to for example
Range<usize>.

This corrects the ExactSizeIterator implementations, which IMO were
unsound and incorrect previously, since they allowed a range like (2..1)
to return a size_hint of -1us in when debug assertions are turned off.
2015-02-10 08:41:48 -08:00
Alex Crichton
6e6bea6e07 rollup merge of #22052: octplane/patch-1
- add namespace
- add function parens
2015-02-10 08:41:46 -08:00
Alex Crichton
712874ef11 rollup merge of #22051: nagisa/main-emission
Fixes #21813
2015-02-10 08:41:44 -08:00
Alex Crichton
91fc9f3f0e rollup merge of #22049: caspark/fix-link-to-rustdoc
No point sending people to a page which just says "this is now part of
the Rust book" (that page being http://doc.rust-lang.org/rustdoc.html).
2015-02-10 08:41:43 -08:00
Alex Crichton
c177da6675 rollup merge of #22012: pnkfelix/propagate-container-across-object-cast
Given `<expr> as Box<Trait>`, infer that `Box<_>` is expected type for `<expr>`.

This is useful for addressing fallout from newly proposed box protocol; see #22006 for examples of such fallout, much of which will be unnecessary with this fix.
2015-02-10 08:41:41 -08:00
Alex Crichton
7fcc330ea3 rollup merge of #22007: thiagooak/master
From #21829 clarify equivalency of tuples
2015-02-10 08:41:38 -08:00