bors [Wed, 15 Mar 2017 04:24:10 +0000 (04:24 +0000)]
Auto merge of #40009 - clarcharr:box_to_buf, r=alexcrichton
Leftovers from #39594; From<Box> impls
These are a few more impls that follow the same reasoning as those from #39594.
What's included:
* `From<Box<str>> for String`
* `From<Box<[T]>> for Vec<T>`
* `From<Box<CStr>> for CString`
* `From<Box<OsStr>> for OsString`
* `From<Box<Path>> for PathBuf`
* `Into<Box<str>> for String`
* `Into<Box<[T]>> for Vec<T>`
* `Into<Box<CStr>> for CString`
* `Into<Box<OsStr>> for OsString`
* `Into<Box<Path>> for PathBuf`
* `<Box<CStr>>::into_c_string`
* `<Box<OsStr>>::into_os_string`
* `<Box<Path>>::into_path_buf`
* Tracking issue for latter three methods + three from previous PR.
Currently, the opposite direction isn't doable with `From` (only `Into`) because of the separation between `liballoc` and `libcollections`. I'm holding off on those for a later PR.
Simon Sapin [Mon, 6 Mar 2017 21:06:30 +0000 (22:06 +0100)]
Replace Utf8Error::resume_from with Utf8Error::error_len
Their relationship is:
* `resume_from = error_len.map(|l| l + valid_up_to)`
* error_len is always one of None, Some(1), Some(2), or Some(3).
When I started using resume_from I almost always ended up subtracting
valid_up_to to obtain error_len.
Therefore the latter is what should be provided in the first place.
bors [Mon, 13 Mar 2017 15:31:51 +0000 (15:31 +0000)]
Auto merge of #40329 - petrochenkov:llreuse, r=alexcrichton
rustbuild: Add option for enabling partial LLVM rebuilds
@alexcrichton , you probably didn't notice my [late comment](https://github.com/rust-lang/rust/pull/40236#issuecomment-284160749) on https://github.com/rust-lang/rust/pull/40236, but here's an implementation of that suggestion, it supersedes https://github.com/rust-lang/rust/pull/40236/commits/c652a4fb566ac4bec1d62c66769dd055ad239df6.
bors [Mon, 13 Mar 2017 02:24:16 +0000 (02:24 +0000)]
Auto merge of #40448 - ollie27:rustbuild_docs_compiler, r=alexcrichton
rustbuild: Fix compiler docs
* Make sure std docs are generated before compiler docs so rustdoc uses
relative links.
* Don't document the rustc and rustdoc binary crates as they overwrite
the real rustc and rustdoc crates.
bors [Sun, 12 Mar 2017 19:24:24 +0000 (19:24 +0000)]
Auto merge of #40450 - alexcrichton:fix-cargo, r=alexcrichton
Update Cargo to fix nightly channel
This commit updates Cargo with rust-lang/cargo#3820 which includes a fix for
rust-lang/cargo#3819. At the same time this also slightly tweaks how rustbuild
builds cargo to ensure that all the build information (including git info and
such) makes its way into the binary.
Alex Crichton [Sun, 12 Mar 2017 02:46:31 +0000 (18:46 -0800)]
Update Cargo to fix nightly channel
This commit updates Cargo with rust-lang/cargo#3820 which includes a fix for
rust-lang/cargo#3819. At the same time this also slightly tweaks how rustbuild
builds cargo to ensure that all the build information (including git info and
such) makes its way into the binary.
Corey Farwell [Sun, 12 Mar 2017 16:48:46 +0000 (12:48 -0400)]
Rollup merge of #40369 - petrochenkov:segspan, r=eddyb
Give spans to individual path segments in AST
And use these spans in path resolution diagnostics.
The spans are spans of identifiers in segments, not whole segments. I'm not sure what spans are more useful in general, but identifier spans are a better fit for resolve errors.
bors [Sun, 12 Mar 2017 08:08:58 +0000 (08:08 +0000)]
Auto merge of #40257 - pftbest:sret_msp430, r=alexcrichton
LLVM: Update submodule to include SRet support patch for MSP430.
This patch is needed to fix #38824 on MSP430.
I know that LLVM 4 is coming soon, but it would be great to have at least one working nightly before the update.
bors [Sun, 12 Mar 2017 05:27:45 +0000 (05:27 +0000)]
Auto merge of #39770 - alexcrichton:configure-clean, r=brson
Delete more swaths of the configure script
This PR deletes more swaths of the `./configure` script which are either no longer necessary or already available in rustbuild (where an implementation is preferred)
Oliver Middleton [Sun, 12 Mar 2017 02:45:20 +0000 (02:45 +0000)]
rustbuild: Fix compiler docs
* Make sure std docs are generated before compiler docs so rustdoc uses
relative links.
* Don't document the rustc and rustdoc binary crates as they overwrite
the real rustc and rustdoc crates.
bors [Sat, 11 Mar 2017 22:48:14 +0000 (22:48 +0000)]
Auto merge of #40220 - jseyfried:ast_macro_def, r=nrc
syntax: add `ast::ItemKind::MacroDef`, simplify hygiene info
This PR
- adds a new variant `MacroDef` to `ast::ItemKind` for `macro_rules!` and eventually `macro` items,
- [breaking-change] forbids macro defs without a name (`macro_rules! { () => {} }` compiles today),
- removes `ast::MacroDef`, and
- no longer uses `Mark` and `Invocation` to identify and characterize macro definitions.
- We used to apply (at least) two `Mark`s to an expanded identifier's `SyntaxContext` -- the definition mark(s) and the expansion mark(s). We now only apply the latter.
Ariel Ben-Yehuda [Sat, 11 Mar 2017 19:57:50 +0000 (21:57 +0200)]
Rollup merge of #40431 - fsasm:master, r=BurntSushi
rustc: Whitelist the FMA target feature
This commit adds the entry `"fma\0"` to the whitelist for the x86
target. LLVM already supports fma but rustc did not directly. Previously
rustc permitted `+fma` in the target-feature argument and enabled the use
of FMA instructions, but it did not list it in the configuration and
attributes.
Ariel Ben-Yehuda [Sat, 11 Mar 2017 19:57:42 +0000 (21:57 +0200)]
Rollup merge of #40319 - eddyb:it's-"unsize"-not-"unsound", r=nikomatsakis
Disallow subtyping between T and U in T: Unsize<U>.
Because `&mut T` can be coerced to `&mut U`, `T` and `U` must be unified invariantly. Fixes #40288.
E.g. coercing `&mut [&'a X; N]` to `&mut [&'b X]` must require `'a` be equal to `'b`, otherwise you can convert between `&'a X` and `&'b X` (in either direction), potentially unsoundly lengthening lifetimes.
Subtyping here was introduced with `Unsize` in #24619 (landed in 1.1, original PR is #23785).
Ariel Ben-Yehuda [Sat, 11 Mar 2017 19:57:41 +0000 (21:57 +0200)]
Rollup merge of #40315 - oli-obk:lint_body, r=eddyb
Allow lints to check Bodys directly
r? @eddyb
babysteps towards fixing https://github.com/Manishearth/rust-clippy/issues/1580 (disable certain lints in const environments, since they make no sense there (yet))
Alex Crichton [Sun, 12 Feb 2017 19:27:39 +0000 (11:27 -0800)]
configure: Remove --build detection
This commit removes detection of CFG_OSTYPE and CFG_CPUTYPE from the configure
script, which means that the default value of `--build` is no longer present in
the configure script. All this logic is now available in rustbuild itself, so
there's no need to duplicate it.
bors [Sat, 11 Mar 2017 15:50:33 +0000 (15:50 +0000)]
Auto merge of #40308 - nikomatsakis:incr-comp-isolate-task, r=mw
first pass at isolating dep-graph tasks
This intentionally leaves `DepGraph::in_task()`, the more common form,
alone. Eventually all uses of `DepGraph::in_task()` should be ported
to `with_task()`, but I wanted to start with a smaller subset.
I also used `AssertDepGraphSafe` on the closures that are found in
trans. This is because the types there are non-trivial and I wanted to
lay down the mechanism and come back to the more subtle cases.
The current approach taken in this PR has a downside: it is necessary
to manually "reify" fn types into fn pointers when starting a task,
like so:
dep_graph.with_task(..., task_fn as fn(_))
this is because `with_task` takes some type `T` that implements
`DepGraphTask` rather than taking a `fn()` type directly. *This* is so
that we can accept closure and also so that we can accept fns with
multiple arities. I am not sure this is the right approach.
Originally I wanted to use closures bound by an auto trait, but that
approach has some limitations:
- the trait cannot have a `read()` method; since the current method
is unused, that may not be a problem.
- more importantly, we would want the auto trait to be "undefined" for all types
*by default* -- that is, this use case doesn't really fit the typical
auto trait scenario. For example, imagine that there is a `u32` loaded
out of a `hir::Node` -- we don't really want to be passing that
`u32` into the task!
bors [Sat, 11 Mar 2017 11:42:09 +0000 (11:42 +0000)]
Auto merge of #40199 - alexcrichton:doc-proc-macro, r=brson
rustbuild: Build documentation for `proc_macro`
This commit fixes #38749 by building documentation for the `proc_macro` crate by
default for configured hosts. Unfortunately did not turn out to be a trivial
fix. Currently rustbuild generates documentation into multiple locations: one
for std, one for test, and one for rustc. The initial fix for this issue simply
actually executed `cargo doc -p proc_macro` which was otherwise completely
elided before.
Unfortunately rustbuild was the left to merge two documentation trees together.
One for the standard library and one for the rustc tree (which only had docs for
the `proc_macro` crate). Rustdoc itself knows how to merge documentation files
(specifically around search indexes, etc) but rustbuild was unaware of this, so
an initial fix ended up destroying the sidebar and the search bar from the
libstd docs.
To solve this issue the method of documentation has been tweaked slightly in
rustbuild. The build system will not use symlinks (or directory junctions on
Windows) to generate all documentation into the same location initially. This'll
rely on rustdoc's logic to weave together all the output and ensure that it ends
up all consistent.
bors [Sat, 11 Mar 2017 08:25:44 +0000 (08:25 +0000)]
Auto merge of #39648 - Aatch:mir-inlining-2, r=eddyb
[MIR] Implement Inlining
Fairly basic implementation of inlining for MIR. Uses conservative
heuristics for inlining.
Doesn't handle a number of cases, but can be extended later. This is basically the same as the previous inlining PR, but without the span-related changes (as the bugs it was dealing with have since been fixed).
bors [Sat, 11 Mar 2017 00:54:09 +0000 (00:54 +0000)]
Auto merge of #40422 - alexcrichton:retry-linker-segfault, r=arielb1
rustc: Support auto-retry linking on a segfault
This is a last-ditch attempt to help our pain with dealing with #38878 on the
bots. A new environment variable is added to the compiler,
`RUSTC_RETRY_LINKER_ON_SEGFAULT`, which will instruct the compiler to
automatically retry the final linker invocation if it looks like the linker
segfaulted (up to 2 extra times).
Unfortunately there have been no successful attempts to debug #38878. The only
information seems to be that the linker (e.g. `ld` on OSX) is segfaulting
somewhere in some thread pool implementation. This appears to be spurious as
failed PRs will later merge.
The hope is that this helps the queue keep moving without clogging and delaying
PRs due to #38878.
Alex Crichton [Fri, 10 Mar 2017 22:51:32 +0000 (16:51 -0600)]
Rollup merge of #40336 - alexcrichton:fast-dep-info, r=nrc
rustc: Exit quickly on only `--emit dep-info`
This commit alters the compiler to exit quickly if the only output being emitted
is `dep-info`, which doesn't need a lot of other information to generate.
Alex Crichton [Fri, 10 Mar 2017 22:51:27 +0000 (16:51 -0600)]
Rollup merge of #40297 - alexcrichton:fix-submodules, r=brson
Don't put Cargo into the rustc workspace
This causes problems when first cloning and bootstrapping the repository
unfortunately, so let's ensure that Cargo sticks around in its own workspace.
Because Cargo is a submodule it's not available by default on the inital clone
of the rust-lang/rust repository. Normally it's the responsibility of the
rustbuild to take care of this, but unfortunately to build rustbuild itself we
need to resolve the workspace conflicts.
To deal with this we'll just have to ensure that all submodules are in their own
workspace, which sort of makes sense anyway as updates to dependencies as
bugfixes to Cargo should go to rust-lang/cargo instead of rust-lang/rust. In any
case this commit removes Cargo from the global workspace which should resolve
the issues that we've been seeing.
To actually perform this the `cargo` submodule has been moved to a new `vendor`
directory to ensure it's outside the scope of `src/Cargo.toml` as a workspace.
Alex Crichton [Fri, 10 Mar 2017 22:51:20 +0000 (16:51 -0600)]
Rollup merge of #40239 - nagisa:death-to-plugins, r=nikomatsakis
Remove ability for plugins to register a MIR pass
In recent months there have been a few different people investigating how to make a plugin that
registers a MIR-pass – one that isn’t intended to be eventually merged into rustc proper.
The interface to register MIR passes was added primarily for miri (& later was
found to make prototyping of rustc-proper MIR passes a tiny bit faster). Since miri does not use
this interface anymore it seems like a good time to remove this "feature".
For prototyping purposes a similar interface can be added by developers themselves in their custom
rustc build.
```
error: cannot index a value of type `({integer},)`
--> <anon>:3:21
|
3 | println!("☃{}", tup[0]);
| ^^^^^^
|
help: to access tuple elements, use tuple indexing syntax as shown
| println!("☃{}"tup.00]);
error: aborting due to previous error
```
`CodeSuggestion::splice_lines` is misusing `Loc.col` (`CharPos`) as a byte offset when slicing source.
Fabjan Sukalia [Fri, 10 Mar 2017 22:32:31 +0000 (23:32 +0100)]
rustc: Whitelist the FMA target feature
This commit adds the entry `"fma\0"` to the whitelist for the x86
target. LLVM already supports fma but rustc did not directly. Previously
rustc permitted `+fma` in the target-feature argument and enabled the use
of FMA instructions, but it did not list it in the configuration and
attributes.
Alex Crichton [Fri, 10 Mar 2017 22:51:14 +0000 (16:51 -0600)]
Rollup merge of #39918 - petrhosek:fuchsia-ci, r=alexcrichton
travis: Fuchsia builder
This change introduces a Dockerfile and script which builds a complete
Fuchsia toolchain which can be used to build Rust distribution for
Fuchsia. We only support cross-compiling at the moment, hence only
setting the target.
Alex Crichton [Fri, 10 Mar 2017 22:51:13 +0000 (16:51 -0600)]
Rollup merge of #39820 - jonasbb:export-attributes, r=nrc
Export attributes in save-analysis data
Since this is my first pull-request to rust, I would like to get some feedback about obvious errors in this implementation.
I would like to change the save-analysis data to include arbitrary attribute data.
A use-case I have in mind for this is identifying functions with `#[test]` annotations such that tools like rls can offer a test-runner feature. I described my idea here [rls#173](https://github.com/rust-lang-nursery/rls/issues/173).
My changes contain:
1. track a vector of attributes in the various `*Data` types in `data.rs` and `external_data.rs`
2. implement lowering for `Attribute` and `MetaItem`
3. adjust `JsonDumper` to print the attributes
In the lowering of `Attribute` I remove the distinction between `MetaItem` and `NestedMetaItem`. I did this because this distinction is somewhat confusing. For example, `NestedMetaItemKind::Literal` has two identical spans, because both `NestedMetaItem` and `Lit` are defined as `Spanned<_>`.
My model is strictly more general, as it allows an `LitKind` instead of a `Symbol` for `MetaItem` and `Symbol`s are converted into a cooked string. As a consumer of the save-analysis data this shouldn't affect you much.