bors [Thu, 31 Mar 2016 04:13:43 +0000 (21:13 -0700)]
Auto merge of #32439 - jseyfried:visible_suggestions, r=nrc
diagnostics: make paths to external items more visible
This PR changes the reported path for an external item so that it is visible from at least one local module (i.e. it does not use any inaccessible external modules) if possible. If the external item's crate was declared with an `extern crate`, the path is guarenteed to use the `extern crate`.
Rollup merge of #32494 - pnkfelix:gate-parser-recovery-via-debugflag, r=nrc
Gate parser recovery via debugflag
Gate parser recovery via debugflag
Put in `-Z continue_parse_after_error`
This works by adding a method, `fn abort_if_no_parse_recovery`, to the
diagnostic handler in `syntax::errors`, and calling it after each
error is emitted in the parser.
(We might consider adding a debugflag to do such aborts in other
places where we are currently attempting recovery, such as resolve,
but I think the parser is the really important case to handle in the
face of #31994 and the parser bugs of varying degrees that were
injected by parse error recovery.)
fix compile-fail and parse-fail tests by blindly opting back into
parser recovery (so that expected errors match up)
I'm opting into parser recovery in all these cases out of expediency,
not because the error messages you get with recovery enabled are
actually all that usable in all cases listed.
This works by adding a boolean flag, `continue_after_error`, to
`syntax::errors::Handler` that can be imperatively set to `true` or
`false` via a new `fn set_continue_after_error`.
The flag starts off true (since we generally try to recover from
compiler errors, and `Handler` is shared across all phases).
Then, during the `phase_1_parse_input`, we consult the setting of the
`-Z continue-parse-after-error` debug flag to determine whether we
should leave the flag set to `true` or should change it to `false`.
----
(We might consider adding a debugflag to do such aborts in other
places where we are currently attempting recovery, such as resolve,
but I think the parser is the really important case to handle in the
face of #31994 and the parser bugs of varying degrees that were
injected by parse error recovery.)
Steve Klabnik [Wed, 30 Mar 2016 17:16:54 +0000 (10:16 -0700)]
Rollup merge of #32591 - CryZe:patch-1, r=steveklabnik
Fix panic_fmt in the Book
While implementing panic_fmt for the GameCube I noticed that the parameters given to it were completely broken. Turns out that panic_fmt requires the C ABI to work correctly. This should be fixed in the documentation, so that others don't make the same mistake. Thanks to mbrubeck in the IRC for helping me figure this out.
Not specifying extern for lang_items correctly should potentially also be a compiler error.
bors [Wed, 30 Mar 2016 04:25:52 +0000 (21:25 -0700)]
Auto merge of #32593 - alexcrichton:fix-i586-msvc, r=brson
mk: A few build fixes for i586-pc-windows-msvc
Detect the triple in the configure script for probing MSVC shenanigans and also
be sure to use `llvm-config` from the build host and not the target when
configuring compiler-rt.
bors [Wed, 30 Mar 2016 01:03:35 +0000 (18:03 -0700)]
Auto merge of #32576 - alexcrichton:metadata-for-our-crates, r=brson
mk: Fix cross-host builds
The change in b20e748 had the unintended consequence of breaking cross-host
builds as we apparently relied on the incorrect definition of this variable in
the makefiles. That change, however, was required to get tests passing so we
couldn't just revert it.
This commit fixes the underlying bug by leaving the "more correct" definition of
`LD_LIBRARY_PATH_ENV_TARGETDIR` (also fixing it with a hardcoded reference to
`CFG_BUILD`) and updating the `RPATH_VAR` definition below. Turned out we
already had special-casing logic for passing `--cfg stage1` during the
well-we-print-this-as-stage0 build of a cross-host. That logic was just updated
to pull from a different variable as opposed to relying on the definition of
that variable to accommodate this.
Alex Crichton [Tue, 29 Mar 2016 16:33:08 +0000 (09:33 -0700)]
mk: A few build fixes for i586-pc-windows-msvc
Detect the triple in the configure script for probing MSVC shenanigans and also
be sure to use `llvm-config` from the build host and not the target when
configuring compiler-rt.
Christopher Serr [Tue, 29 Mar 2016 20:28:17 +0000 (22:28 +0200)]
Fix panic_fmt in the Book
While implementing panic_fmt for the GameCube I noticed that the parameters given to it were completely broken. Turns out that panic_fmt requires the C ABI to work correctly. This should be fixed in the documentation, so that others don't make the same mistake. Thanks to mbrubeck in the IRC for helping me figure this out.
Not specifying extern for lang_items correctly should potentially also be a compiler error.
bors [Tue, 29 Mar 2016 18:10:39 +0000 (11:10 -0700)]
Auto merge of #32557 - dotdash:issue-32518, r=nikomatsakis
Use weak_odr linkage when reusing definitions across codegen units
When reuing a definition across codegen units, we obviously cannot use
internal linkage, but using external linkage means that we can end up
with multiple conflicting definitions of a single symbol across
multiple crates. Since the definitions should all be equal
semantically, we can use weak_odr linkage to resolve the situation.
Alex Crichton [Tue, 29 Mar 2016 15:24:02 +0000 (08:24 -0700)]
mk: Fix cross-host builds
The change in b20e748 had the unintended consequence of breaking cross-host
builds as we apparently relied on the incorrect definition of this variable in
the makefiles. That change, however, was required to get tests passing so we
couldn't just revert it.
This commit fixes the underlying bug by leaving the "more correct" definition of
`LD_LIBRARY_PATH_ENV_TARGETDIR` (also fixing it with a hardcoded reference to
`CFG_BUILD`) and updating the `RPATH_VAR` definition below. Turned out we
already had special-casing logic for passing `--cfg stage1` during the
well-we-print-this-as-stage0 build of a cross-host. That logic was just updated
to pull from a different variable as opposed to relying on the definition of
that variable to accommodate this.
Björn Steinbrink [Mon, 28 Mar 2016 15:57:31 +0000 (17:57 +0200)]
Use weak_odr linkage when reusing definitions across codegen units
When reuing a definition across codegen units, we obviously cannot use
internal linkage, but using external linkage means that we can end up
with multiple conflicting definitions of a single symbol across
multiple crates. Since the definitions should all be equal
semantically, we can use weak_odr linkage to resolve the situation.
bors [Tue, 29 Mar 2016 06:06:09 +0000 (23:06 -0700)]
Auto merge of #32438 - kamalmarhubi:intoiterator-example, r=steveklabnik
style: Use `iter` for IntoIterator parameter names
This commit standardizes the codebase on `iter` for parameters with
IntoIterator bounds.
Previously about 40% of IntoIterator parameters were named `iterable`,
with most of the rest being named `iter`. There was a single place where
it was named `iterator`.
bors [Tue, 29 Mar 2016 03:50:42 +0000 (20:50 -0700)]
Auto merge of #32479 - eddyb:eof-not-even-twice, r=nikomatsakis
Prevent bumping the parser past the EOF.
Makes `Parser::bump` after EOF into an ICE, forcing callers to avoid repeated EOF bumps.
This ICE is intended to break infinite loops where EOF wasn't stopping the loop.
For example, the handling of EOF in `parse_trait_items`' recovery loop fixes #32446.
But even without this specific fix, the ICE is triggered, which helps diagnosis and UX.
This is a `[breaking-change]` for plugins authors who eagerly eat multiple EOFs.
See https://github.com/docopt/docopt.rs/pull/171 for such an example and the necessary fix.
Kamal Marhubi [Mon, 28 Mar 2016 17:55:47 +0000 (13:55 -0400)]
style: Use `iter` for IntoIterator parameter names
This commit standardizes the codebase on `iter` for parameters with
IntoIterator bounds.
Previously about 40% of IntoIterator parameters were named `iterable`,
with most of the rest being named `iter`. There was a single place where
it was named `iterator`.
Steve Klabnik [Mon, 28 Mar 2016 17:48:29 +0000 (13:48 -0400)]
Rollup merge of #32509 - tclfs:patch-2, r=steveklabnik
docs: make some text changes on Section `Macros`
(1) In contrast to `that`, `so that` expresses `result` indicated by the sentence, not `reason`;
(2) `block` is an expression, and may be have an expression, so I add `optionally an expression` to make more precise;
~~(3) When I read here, I was confused with what `the child` referred to. After modification, it would be better.~~
Steve Klabnik [Mon, 28 Mar 2016 17:48:28 +0000 (13:48 -0400)]
Rollup merge of #32507 - klingtnet:master, r=steveklabnik
Fix missing console output in `Barrier` example
The `println!` calls in the previous version were never shown (at least
not in the playpen) because the main thread is finished before all the
spawned child threads were synchronized. This commit adds a join for
each thread handle to wait in the main thread until all child threads
are finished.
Steve Klabnik [Mon, 28 Mar 2016 17:48:28 +0000 (13:48 -0400)]
Rollup merge of #32235 - fbergr:trailing_whitespace, r=sanxiyn
Remove trailing whitespace at the end of lines
According the rules of styling Rust code there should not be trailing whitespace at the end of lines or files. I thought that it might be good to remove trailing whitespace from other files also, if it does not break anything.
bors [Mon, 28 Mar 2016 17:37:30 +0000 (10:37 -0700)]
Auto merge of #32560 - alexcrichton:metadata-for-our-crates, r=nikomatsakis
mk: Add `-C metadata` for compiling crates we ship
This should re-enable all external builds of crates with the same name. Right
now Cargo doesn't pass `-C metadata` for the top-level library being compiled,
so if that library is called `libc`, for example, then it won't be able to link
to the standard library which *also* has a `libc` library compiled without `-C
metadata`. This can result in naming conflicts which need to be resolved.
By passing `-C metadata` to the in-tree crates we ship it should add some extra
salt to all symbol names to ensure that they don't collide.
Alex Crichton [Mon, 28 Mar 2016 16:19:25 +0000 (09:19 -0700)]
mk: Add `-C metadata` for compiling crates we ship
This should re-enable all external builds of crates with the same name. Right
now Cargo doesn't pass `-C metadata` for the top-level library being compiled,
so if that library is called `libc`, for example, then it won't be able to link
to the standard library which *also* has a `libc` library compiled without `-C
metadata`. This can result in naming conflicts which need to be resolved.
By passing `-C metadata` to the in-tree crates we ship it should add some extra
salt to all symbol names to ensure that they don't collide.
Alex Burka [Mon, 7 Mar 2016 18:05:12 +0000 (13:05 -0500)]
fix #21714 by using discriminant_value in #[derive(Hash)]
This is the same approach taken in #24270, except that this
should not be a breaking change because it only changes the output
of hash functions, which nobody should be relying on.
bors [Sun, 27 Mar 2016 02:46:24 +0000 (19:46 -0700)]
Auto merge of #32513 - japaric:try-test, r=alexcrichton
add regression test for try!
Our widespread internal use of `try` was like a regression test. Now that most of `try!`s have been converted to `?`, lets add a proper regression test.
bors [Sun, 27 Mar 2016 00:29:59 +0000 (17:29 -0700)]
Auto merge of #32432 - eddyb:dock-service, r=nikomatsakis
Flatten rustc and rustc_trans module hierarchy slightly.
The following moves were made, in the name of sanity/simplicity:
* `rustc::middle::{cfg, infer, traits, ty}` to `rustc::{cfg, infer, traits, ty}`
* `rustc::middle::subst` to `rustc::ty::subst`
* `rustc_trans::trans::*` to `rustc_trans::*`
* `rustc_trans::save` to `rustc_save_analysis` (cc @nrc)
I've rebased a larger WIP branch on top of this and the only conflicts were in imports, but YMMV.
mitaa [Sat, 26 Mar 2016 15:42:38 +0000 (16:42 +0100)]
Don't initialize id-map when rendering md files
Adding these "known" values to the table of used ids is only required
when embedding markdown into a rustdoc html page and may yield
unexpected results when rendering a standalone `*.md` file.
mitaa [Sat, 26 Mar 2016 10:59:30 +0000 (11:59 +0100)]
Extend linkchecker with anchor checking
This adds checks to ensure that:
* link anchors refer to existing id's on the target page
* id's are unique within an html document
* page redirects are valid