The output for the example in the issue looks like this:
```
~/p/local-rust-dev-testing ❯❯❯ cargo +local-s1 build
Compiling local-rust-dev-testing v0.1.0 (file:///home/cldfire/programming_projects/local-rust-dev-testing)
error[E0252]: the name `ConstructorExtension` is defined multiple times
--> src/main.rs:49:5
|
48 | use extension1::ConstructorExtension;
| -------------------------------- previous import of the trait `ConstructorExtension` here
49 | use extension2::ConstructorExtension;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ConstructorExtension` reimported here
|
= note: `ConstructorExtension` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
|
49 | use extension2::ConstructorExtension as OtherConstructorExtension;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
```
This is my first PR that touches the compiler in any way, so if there's something else I need to do here (e.g. add a test), please let me know :).
kennytm [Wed, 1 Nov 2017 05:32:13 +0000 (13:32 +0800)]
Rollup merge of #45644 - zackmdavis:edit_disallowed_inner_attr_note, r=estebank
edit and fix bad spacing of inner-attribute-not-allowed note
This multiline string literal was missing a backslash, leaving an awkward
newline and 35 spaces in the middle of the message.
But while we're here, the existing message seems kind of long in comparison to
similar notes: to cut it down, we excise the mentions of doc comments, which
seems sensible because we know that this erroneous attribute is not a doc
comment (notice the `is_sugared_doc: false` at the end of the function; if it
had been a doc comment, that error would get set in the `token::DocComment`
match branch of `parse_outer_attributes`).
bors [Wed, 1 Nov 2017 04:32:15 +0000 (04:32 +0000)]
Auto merge of #45267 - oconnor663:rwlock_send, r=alexcrichton
remove the `T: Sync` requirement for `RwLock<T>: Send`
That requirement makes sense for containers like `Arc` that don't
uniquely own their contents, but `RwLock` is not one of those.
This restriction was added in https://github.com/rust-lang/rust/commit/380d23b5d4b9fb8f5f0ebf178590f61528b2483e, but it's not clear why. @hniksic
and I [were discussing this on reddit](https://www.reddit.com/r/rust/comments/763o7r/blog_posts_introducing_lockfree_rust_comparing/dobcvbm/). I might be totally wrong about this change being sound, but I'm super curious to find out :)
bors [Tue, 31 Oct 2017 23:06:37 +0000 (23:06 +0000)]
Auto merge of #44764 - nvzqz:master, r=alexcrichton
Implement TryFrom<&[T]> for &[T; N]
There are many cases where a buffer with a static compile-time size is preferred over a slice with a dynamic size. This allows for performing a checked conversion from `&[T]` to `&[T; N]`. This may also lead to compile-time optimizations involving `[T; N]` such as loop unrolling.
This is my first PR to Rust, so I'm not sure if discussion of this change should happen here or does it need its own RFC? I figured these changes would be a subset of #33417.
bors [Tue, 31 Oct 2017 14:56:06 +0000 (14:56 +0000)]
Auto merge of #45655 - alexcrichton:mips-less-cgus, r=michaelwoerister
rustbuild: Don't build with ThinLTO on MIPS
Discovered in #45529 it looks like cross-module TLS imports aren't quite working
today, especially with `hidden` visibility which mostly comes up with multiple
codegen units. As a result this completely disables compiling with ThinLTO and
multiple codegen units on MIPS when bootstrapping.
Alex Crichton [Tue, 31 Oct 2017 13:56:36 +0000 (06:56 -0700)]
rustbuild: Don't build with ThinLTO on MIPS
Discovered in #45529 it looks like cross-module TLS imports aren't quite working
today, especially with `hidden` visibility which mostly comes up with multiple
codegen units. As a result this completely disables compiling with ThinLTO and
multiple codegen units on MIPS when bootstrapping.
This PR fixes two small problems:
* Overflow checks are always enabled in a constant context, so we need to hash spans of potentially overflowing operations. (Eventually I'd like to handle spans differently so we don't have to make HIR hashing know so much about things like this.)
* The HIR map collector had a bug where it would assign the `DepNode::Hir` instead of the corresponding `DepNode::HirBody` in some nested contexts.
Zack M. Davis [Mon, 30 Oct 2017 23:59:34 +0000 (16:59 -0700)]
edit and fix bad spacing of inner-attribute-not-allowed note
This multiline string literal was missing a backslash, leaving an awkward
newline and 35 spaces in the middle of the message.
But while we're here, the existing message seems kind of long in comparison to
similar notes: to cut it down, we excise the mentions of doc comments, which
seems sensible because we know that this erroneous attribute is not a doc
comment (notice the `is_sugared_doc: false` at the end of the function; if it
had been a doc comment, that error would get set in the `token::DocComment`
match branch of `parse_outer_attributes`).
This PR modifies the return type of [`report_error_if_loan_conflicts_with_restriction`](https://github.com/rust-lang/rust/blob/0f0f5db465de96b6c12e71f0c7d3e475f618b104/src/librustc_borrowck/borrowck/check_loans.rs#L398-L403) so the result can be checked in [`report_error_if_loans_conflict`](https://github.com/rust-lang/rust/blob/0f0f5db465de96b6c12e71f0c7d3e475f618b104/src/librustc_borrowck/borrowck/check_loans.rs#L377-L396). This is done to prevent displaying a duplicate of the error message E0502 which is referenced in #42106.
bors [Sun, 29 Oct 2017 15:22:38 +0000 (15:22 +0000)]
Auto merge of #45611 - Manishearth:lint-generics, r=petrochenkov
Add generics to LateContext
Fixes clippy breakage from https://github.com/rust-lang/rust/pull/44766 as discussed in https://github.com/rust-lang-nursery/rust-clippy/pull/2140#issuecomment-336973875
bors [Sun, 29 Oct 2017 06:24:20 +0000 (06:24 +0000)]
Auto merge of #45295 - Technius:docs/process, r=steveklabnik
Improve std::process module docs
Addresses part of #29370
I've changed the first `cat` example to a "Hello World" example involving echo, and I've also added another example showing how to pipe output. I'm still working on the module-level description.
bors [Sat, 28 Oct 2017 23:40:31 +0000 (23:40 +0000)]
Auto merge of #45580 - kennytm:sdkmanager, r=alexcrichton
ci: Upgrade Android SDK/NDK and refactor to use sdkmanager/avdmanager.
* SDK tools is upgraded to 27.0.0.
* Stopped using the deprecated `android` tool, instead use the recommended `sdkmanager` and `avdmanager`.
* NDK is upgrade to r15c.
The r15 series [dropped support for android-9](https://github.com/android-ndk/ndk/wiki/Changelog-r15) (2.3 / Gingerbread), the minimal supported version is now android-14 (4.0 / Ice Cream Sandwich).
r? @alexcrichton
(WIP, haven't confirmed if the change really works yet)
kennytm [Fri, 27 Oct 2017 19:14:25 +0000 (03:14 +0800)]
ci: Upgrade Android SDK/NDK and refactor to use sdkmanager/avdmanager.
* SDK tools is upgraded to 27.0.0.
- Refactored to use `sdkmanager`/`avdmanager` instead of the deprecated
`android` tool.
* The Java version used by Android SDK is downgraded to OpenJDK-8, in order
to download the SDK through HTTPS.
* NDK is upgrade to r15c.
- Dropped support for android-9 (2.3 / Gingerbread), the minimal
supported version is now android-14 (4.0 / Ice Cream Sandwich).
- Changed the default Android compiler from GCC to clang.
- For details of change introduced by NDK r15, see
https://github.com/android-ndk/ndk/wiki/Changelog-r15.
bors [Sat, 28 Oct 2017 21:01:07 +0000 (21:01 +0000)]
Auto merge of #45540 - virgil-palanciuc:master, r=estebank
Avoid repetition on “use of unstable library feature 'rustc_private'”
This PR fixes the error by only emitting it when the span contains a real file (is not inside a macro) - and making sure it's emitted only once per span.
The first check was needed because spans-within-macros seem to differ a lot and "fixing" them to the real location is not trivial (and the method that does this is private to another module). It also feels like there always will be an error on import, with the real file name, so not sure there's a point to re-emit the same error at macro use.
bors [Sat, 28 Oct 2017 13:34:12 +0000 (13:34 +0000)]
Auto merge of #44295 - plietar:extern-types, r=arielb1
Implement RFC 1861: Extern types
A few notes :
- Type parameters are not supported. This was an unresolved question from the RFC. It is not clear how useful this feature is, and how variance should be treated. This can be added in a future PR.
- `size_of_val` / `align_of_val` can be called with extern types, and respectively return 0 and 1. This differs from the RFC, which specified that they should panic, but after discussion with @eddyb on IRC this seems like a better solution.
If/when a `DynSized` trait is added, this will be disallowed statically.
- Auto traits are not implemented by default, since the contents of extern types is unknown. This means extern types are `!Sync`, `!Send` and `!Freeze`. This seems like the correct behaviour to me.
Manual `unsafe impl Sync for Foo` is still possible.
- This PR allows extern type to be used as the tail of a struct, as described by the RFC :
```rust
extern {
type OpaqueTail;
}
However this is undesirable, as the alignment of `tail` is unknown (the current PR assumes an alignment of 1). Unfortunately we can't prevent it in the general case as the tail could be a type parameter :
```rust
#[repr(C)]
struct FfiStruct<T: ?Sized> {
data: u8,
more_data: u32,
tail: T,
}
```
Adding a `DynSized` trait would solve this as well, by requiring tail fields to be bound by it.
- Despite being unsized, pointers to extern types are thin and can be casted from/to integers. However it is not possible to write a `null<T>() -> *const T` function which works with extern types, as I've explained here : https://github.com/rust-lang/rust/issues/43467#issuecomment-321678621
- Trait objects cannot be built from extern types. I intend to support it eventually, although how this interacts with `DynSized`/`size_of_val` is still unclear.
kennytm [Sat, 28 Oct 2017 07:56:24 +0000 (15:56 +0800)]
Rollup merge of #45574 - nzig:on_unimplemented_example, r=steveklabnik
Fixed rustc_on_unimplemented example in Unstable Book
I saw [this](https://doc.rust-lang.org/beta/unstable-book/language-features/on-unimplemented.html) example and it seemed wrong. This fixes the example to emit an error message that makes more sense.
kennytm [Sat, 28 Oct 2017 07:56:22 +0000 (15:56 +0800)]
Rollup merge of #45535 - topecongiro:bootstrap-exit-code, r=kennytm
Return 0 as an exit status when no subcommand is given to bootstrap
Running `./x.py` emits usage and error messages when no subcommand is given:
```
Usage: x.py <subcommand> [options] [<paths>...]
Subcommands:
build Compile either the compiler or libraries
test Build and run some test suites
bench Build and run some benchmarks
doc Build documentation
clean Clean out build directories
dist Build distribution artifacts
install Install distribution artifacts
To learn more about a subcommand, run `./x.py <subcommand> -h`
failed to run: /home/topecongiro/rust/build/bootstrap/debug/bootstrap
```
IMHO the last line is unnecessary. This PR removes it by changing the return code of `bootstrap` to 0 when no sub command is given.
bors [Sat, 28 Oct 2017 07:08:52 +0000 (07:08 +0000)]
Auto merge of #45566 - cuviper:option-checking, r=alexcrichton
configure.py: fix --disable-option-checking and extra config paths
- indexing 'option-checking' out of `known_args` had a type error
- when option checking is disabled, don't error on duplicate args, just take the last
- add config.toml stubs for datadir, infodir, and localstatedir (which were already accepted, but broken)
---
This fixes a regression from 1.21 to beta, when the configure script was rewritten in python.
bors [Sat, 28 Oct 2017 03:02:17 +0000 (03:02 +0000)]
Auto merge of #45503 - thombles:tk/i44339-v5, r=petrochenkov
Improve diagnostics when list of tokens has incorrect separators
Make `parse_seq_to_before_tokens` more resilient to error conditions. Where possible it is better if it can consume up to the final bracket before returning. This change improves the diagnostics in a couple of situations:
```
struct S(pub () ()); // omitted separator
use std::{foo. bar}; // used a similar but wrong separator
```
bors [Fri, 27 Oct 2017 15:03:47 +0000 (15:03 +0000)]
Auto merge of #45570 - nrc:manifest-no-rls, r=alexcrichton
Don't fail to build a manifest if a tarball is missing
This is guesswork because I can't test build_manifest nor do I know what is actually causing the error to begin with. My hypothesis is that when we try to find the version from the RLS tarball and the tarball is not there, then we panic. I attempt to fix this by making the version string optional, then not adding the RLS package, rename, and extension component if the version is missing.