Skip to content
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

Rollup of 11 pull requests #62923

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
962bf69
Take substs into account in `conservative_is_privately_uninhabited`
varkor Jun 30, 2019
5397dfc
Remove obsolete “should not have to exist” reasons
SimonSapin Jul 8, 2019
01d93bf
Split the SliceConcat trait into Concat and Join
SimonSapin Jul 8, 2019
283f676
Take separator by value in `[T]::join`
SimonSapin Jul 8, 2019
b62a77b
Add joining slices of slices with a slice separator, not just a singl…
SimonSapin Jul 8, 2019
d0635ee
Update src/liballoc/slice.rs
SimonSapin Jul 9, 2019
bbc9366
Update src/liballoc/slice.rs
SimonSapin Jul 9, 2019
5f7768a
Update src/liballoc/str.rs
SimonSapin Jul 9, 2019
bb9bf0c
Add riscv32i-unknown-none-elf target
Disasm Jul 18, 2019
21b502b
warn that raw pointers must be aligned when used, and that writes cau…
RalfJung Jul 20, 2019
2e6b13a
references must be aligned; also move up the warning that fn ptrs mus…
RalfJung Jul 20, 2019
f502bf7
sync with nomicon: raw ptr must be non-dangling and aligned every tim…
RalfJung Jul 21, 2019
4081222
apply feedback
RalfJung Jul 21, 2019
a7b9246
weasle, weasle
RalfJung Jul 22, 2019
9196781
account for non-drop-glue types
RalfJung Jul 22, 2019
4b33968
add support for hexagon-unknown-linux-musl
androm3da Aug 10, 2018
e1e0df8
Remove uses of mem::uninitialized in std::sys::cloudabi
nathanwhit Jul 22, 2019
82dd54b
Modify CloudABI ReentrantMutex to use MaybeUninit
nathanwhit Jul 22, 2019
dd5045e
Apply suggestions from code review
RalfJung Jul 23, 2019
65cf10d
word things more like we usually do
RalfJung Jul 23, 2019
6140371
cleanup: Remove `extern crate serialize as rustc_serialize`s
petrochenkov Jul 23, 2019
0ac6afa
Cleanup std::sys::cloudabi
nathanwhit Jul 23, 2019
b70f217
Use raw pointers in std::sys::cloudabi when passing MaybeUninit values
nathanwhit Jul 23, 2019
2083a12
Normalize use of backticks in compiler messages for libsyntax/*
Jul 23, 2019
ca8420c
Normalize use of backticks in compiler messages for doc
Jul 23, 2019
66815c6
normalize use of backticks for compiler messages in remaining modules
Jul 23, 2019
6afb4e8
Rollup merge of #62261 - varkor:conservative_is_privately_uninhabited…
Centril Jul 24, 2019
e4c3883
Rollup merge of #62528 - SimonSapin:concat, r=alexcrichton
Centril Jul 24, 2019
9258ed6
Rollup merge of #62738 - nathanwhit:fix_mem_uninit_cloudabi, r=RalfJung
Centril Jul 24, 2019
3835b13
Rollup merge of #62784 - Disasm:riscv32i, r=estebank
Centril Jul 24, 2019
6d3efb0
Rollup merge of #62814 - androm3da:hexagon_19jul_2019, r=alexcrichton
Centril Jul 24, 2019
b71e579
Rollup merge of #62822 - RalfJung:pointers, r=Centril
Centril Jul 24, 2019
960a4fc
Rollup merge of #62890 - fakenine:normalize_use_of_backticks_compiler…
Centril Jul 24, 2019
2462bd8
Rollup merge of #62901 - petrochenkov:serde, r=Centril
Centril Jul 24, 2019
9dcef0f
Rollup merge of #62905 - fakenine:normalize_use_of_backticks_compiler…
Centril Jul 24, 2019
69bc410
Rollup merge of #62908 - fakenine:normalize_use_of_backticks_compiler…
Centril Jul 24, 2019
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
1 change: 1 addition & 0 deletions src/ci/docker/dist-various-1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ ENV TARGETS=$TARGETS,thumbv7em-none-eabihf
ENV TARGETS=$TARGETS,thumbv8m.base-none-eabi
ENV TARGETS=$TARGETS,thumbv8m.main-none-eabi
ENV TARGETS=$TARGETS,thumbv8m.main-none-eabihf
ENV TARGETS=$TARGETS,riscv32i-unknown-none-elf
ENV TARGETS=$TARGETS,riscv32imc-unknown-none-elf
ENV TARGETS=$TARGETS,riscv32imac-unknown-none-elf
ENV TARGETS=$TARGETS,riscv64imac-unknown-none-elf
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc/src/lints/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ warning: unused variable: `x`
2 | let x = 5;
| ^
|
= note: #[warn(unused_variables)] on by default
= note: `#[warn(unused_variables)]` on by default
= note: to avoid this warning, consider using `_x` instead
```

Expand Down
6 changes: 3 additions & 3 deletions src/doc/rustc/src/lints/levels.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ warning: unused variable: `x`
2 | let x = 5;
| ^
|
= note: #[warn(unused_variables)] on by default
= note: `#[warn(unused_variables)]` on by default
= note: to avoid this warning, consider using `_x` instead
```

Expand All @@ -76,7 +76,7 @@ error: bitshift exceeds the type's number of bits
2 | 100u8 << 10;
| ^^^^^^^^^^^
|
= note: #[deny(exceeding_bitshifts)] on by default
= note: `#[deny(exceeding_bitshifts)]` on by default
```

What's the difference between an error from a lint and a regular old error?
Expand Down Expand Up @@ -236,7 +236,7 @@ warning: bitshift exceeds the type's number of bits
2 | 100u8 << 10;
| ^^^^^^^^^^^
|
= note: #[warn(exceeding_bitshifts)] on by default
= note: `#[warn(exceeding_bitshifts)]` on by default

warning: this expression will panic at run-time
--> lib.rs:2:5
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc/src/lints/listing/allowed-by-default.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub struct Foo;
When set to 'deny', this will produce:

```text
error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation
error: type does not implement `fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation
--> src/main.rs:3:1
|
3 | pub struct Foo;
Expand Down
12 changes: 6 additions & 6 deletions src/doc/rustc/src/lints/listing/deny-by-default.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ error: defaults for type parameters are only allowed in `struct`, `enum`, `type`
4 | fn foo<T=i32>(t: T) {}
| ^
|
= note: #[deny(invalid_type_param_default)] on by default
= note: `#[deny(invalid_type_param_default)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
```
Expand Down Expand Up @@ -74,7 +74,7 @@ error: private struct constructors are not usable through re-exports in outer mo
5 | ::S;
| ^^^
|
= note: #[deny(legacy_constructor_visibility)] on by default
= note: `#[deny(legacy_constructor_visibility)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #39207 <https://github.com/rust-lang/rust/issues/39207>
```
Expand All @@ -84,9 +84,9 @@ error: private struct constructors are not usable through re-exports in outer mo

The legacy_directory_ownership warning is issued when

* There is a non-inline module with a #[path] attribute (e.g. #[path = "foo.rs"] mod bar;),
* There is a non-inline module with a `#[path]` attribute (e.g. `#[path = "foo.rs"] mod bar;`),
* The module's file ("foo.rs" in the above example) is not named "mod.rs", and
* The module's file contains a non-inline child module without a #[path] attribute.
* The module's file contains a non-inline child module without a `#[path]` attribute.

The warning can be fixed by renaming the parent module to "mod.rs" and moving
it into its own directory if appropriate.
Expand Down Expand Up @@ -139,7 +139,7 @@ const FOO: i32 = 5;
This will produce:

```text
error: const items should never be #[no_mangle]
error: const items should never be `#[no_mangle]`
--> src/main.rs:3:1
|
3 | const FOO: i32 = 5;
Expand Down Expand Up @@ -187,7 +187,7 @@ error: parenthesized parameters may only be used with a trait
2 | let x = 5 as usize();
| ^^
|
= note: #[deny(parenthesized_params_in_types_and_modules)] on by default
= note: `#[deny(parenthesized_params_in_types_and_modules)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
```
Expand Down
22 changes: 11 additions & 11 deletions src/doc/rustc/src/lints/listing/warn-by-default.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ warning: floating-point literals cannot be used in patterns
4 | 5.0 => {},
| ^^^
|
= note: #[warn(illegal_floating_point_literal_pattern)] on by default
= note: `#[warn(illegal_floating_point_literal_pattern)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
```
Expand All @@ -109,7 +109,7 @@ extern "C" {
This will produce:

```text
warning: found struct without foreign-function-safe representation annotation in foreign module, consider adding a #[repr(C)] attribute to the type
warning: found struct without foreign-function-safe representation annotation in foreign module, consider adding a `#[repr(C)]` attribute to the type
--> src/main.rs:2:20
|
2 | static STATIC: String;
Expand Down Expand Up @@ -146,7 +146,7 @@ warning: cannot specify lifetime arguments explicitly if late bound lifetime par
8 | S.late::<'static>(&0, &0);
| ^^^^^^^
|
= note: #[warn(late_bound_lifetime_arguments)] on by default
= note: `#[warn(late_bound_lifetime_arguments)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
```
Expand Down Expand Up @@ -327,7 +327,7 @@ warning: patterns aren't allowed in methods without bodies
2 | fn foo(mut arg: u8);
| ^^^^^^^
|
= note: #[warn(patterns_in_fns_without_body)] on by default
= note: `#[warn(patterns_in_fns_without_body)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #35203 <https://github.com/rust-lang/rust/issues/35203>
```
Expand Down Expand Up @@ -406,7 +406,7 @@ fn foo() {}
This will produce:

```text
warning: function is marked #[no_mangle], but not exported
warning: function is marked `#[no_mangle]`, but not exported
--> src/main.rs:2:1
|
2 | fn foo() {}
Expand All @@ -433,7 +433,7 @@ static X: i32 = 4;
This will produce:

```text
warning: static is marked #[no_mangle], but not exported
warning: static is marked `#[no_mangle]`, but not exported
--> src/main.rs:2:1
|
2 | static X: i32 = 4;
Expand Down Expand Up @@ -496,7 +496,7 @@ warning: borrow of packed field requires unsafe function or block (error E0133)
11 | let y = &x.data.0;
| ^^^^^^^^^
|
= note: #[warn(safe_packed_borrows)] on by default
= note: `#[warn(safe_packed_borrows)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
```
Expand Down Expand Up @@ -542,7 +542,7 @@ warning: bounds on generic parameters are not enforced in type aliases
2 | type SendVec<T: Send> = Vec<T>;
| ^^^^
|
= note: #[warn(type_alias_bounds)] on by default
= note: `#[warn(type_alias_bounds)]` on by default
= help: the bound will not be checked when the type alias is used, and should be removed
```

Expand All @@ -567,7 +567,7 @@ warning: type annotations needed
4 | if data.is_null() {}
| ^^^^^^^
|
= note: #[warn(tyvar_behind_raw_pointer)] on by default
= note: `#[warn(tyvar_behind_raw_pointer)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
= note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>
```
Expand Down Expand Up @@ -787,7 +787,7 @@ warning: doc comment not used by rustdoc

## unused-features

This lint detects unused or unknown features found in crate-level #[feature] directives.
This lint detects unused or unknown features found in crate-level `#[feature]` directives.
To fix this, simply remove the feature flag.

## unused-imports
Expand Down Expand Up @@ -839,7 +839,7 @@ warning: unused macro definition

## unused-must-use

This lint detects unused result of a type flagged as #[must_use]. Some
This lint detects unused result of a type flagged as `#[must_use]`. Some
example code that triggers this lint:

```rust
Expand Down
104 changes: 83 additions & 21 deletions src/liballoc/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,10 @@ impl<T> [T] {
/// assert_eq!([[1, 2], [3, 4]].concat(), [1, 2, 3, 4]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn concat<Separator: ?Sized>(&self) -> T::Output
where T: SliceConcat<Separator>
pub fn concat<Item: ?Sized>(&self) -> <Self as Concat<Item>>::Output
where Self: Concat<Item>
{
SliceConcat::concat(self)
Concat::concat(self)
}

/// Flattens a slice of `T` into a single value `Self::Output`, placing a
Expand All @@ -508,12 +508,13 @@ impl<T> [T] {
/// ```
/// assert_eq!(["hello", "world"].join(" "), "hello world");
/// assert_eq!([[1, 2], [3, 4]].join(&0), [1, 2, 0, 3, 4]);
/// assert_eq!([[1, 2], [3, 4]].join(&[0, 0][..]), [1, 2, 0, 0, 3, 4]);
/// ```
#[stable(feature = "rename_connect_to_join", since = "1.3.0")]
pub fn join<Separator: ?Sized>(&self, sep: &Separator) -> T::Output
where T: SliceConcat<Separator>
pub fn join<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output
where Self: Join<Separator>
{
SliceConcat::join(self, sep)
Join::join(self, sep)
}

/// Flattens a slice of `T` into a single value `Self::Output`, placing a
Expand All @@ -528,10 +529,10 @@ impl<T> [T] {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(since = "1.3.0", reason = "renamed to join")]
pub fn connect<Separator: ?Sized>(&self, sep: &Separator) -> T::Output
where T: SliceConcat<Separator>
pub fn connect<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output
where Self: Join<Separator>
{
SliceConcat::join(self, sep)
Join::join(self, sep)
}

}
Expand Down Expand Up @@ -578,45 +579,83 @@ impl [u8] {
// Extension traits for slices over specific kinds of data
////////////////////////////////////////////////////////////////////////////////

/// Helper trait for [`[T]::concat`](../../std/primitive.slice.html#method.concat)
/// and [`[T]::join`](../../std/primitive.slice.html#method.join)
/// Helper trait for [`[T]::concat`](../../std/primitive.slice.html#method.concat).
///
/// Note: the `Item` type parameter is not used in this trait,
/// but it allows impls to be more generic.
/// Without it, we get this error:
///
/// ```error
/// error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predica
/// --> src/liballoc/slice.rs:608:6
/// |
/// 608 | impl<T: Clone, V: Borrow<[T]>> Concat for [V] {
/// | ^ unconstrained type parameter
/// ```
///
/// This is because there could exist `V` types with multiple `Borrow<[_]>` impls,
/// such that multiple `T` types would apply:
///
/// ```
/// # #[allow(dead_code)]
/// pub struct Foo(Vec<u32>, Vec<String>);
///
/// impl std::borrow::Borrow<[u32]> for Foo {
/// fn borrow(&self) -> &[u32] { &self.0 }
/// }
///
/// impl std::borrow::Borrow<[String]> for Foo {
/// fn borrow(&self) -> &[String] { &self.1 }
/// }
/// ```
#[unstable(feature = "slice_concat_trait", issue = "27747")]
pub trait SliceConcat<Separator: ?Sized>: Sized {
pub trait Concat<Item: ?Sized> {
#[unstable(feature = "slice_concat_trait", issue = "27747")]
/// The resulting type after concatenation
type Output;

/// Implementation of [`[T]::concat`](../../std/primitive.slice.html#method.concat)
#[unstable(feature = "slice_concat_trait", issue = "27747")]
fn concat(slice: &[Self]) -> Self::Output;
fn concat(slice: &Self) -> Self::Output;
}

/// Helper trait for [`[T]::join`](../../std/primitive.slice.html#method.join)
#[unstable(feature = "slice_concat_trait", issue = "27747")]
pub trait Join<Separator> {
#[unstable(feature = "slice_concat_trait", issue = "27747")]
/// The resulting type after concatenation
type Output;

/// Implementation of [`[T]::join`](../../std/primitive.slice.html#method.join)
#[unstable(feature = "slice_concat_trait", issue = "27747")]
fn join(slice: &[Self], sep: &Separator) -> Self::Output;
fn join(slice: &Self, sep: Separator) -> Self::Output;
}

#[unstable(feature = "slice_concat_ext",
reason = "trait should not have to exist",
issue = "27747")]
impl<T: Clone, V: Borrow<[T]>> SliceConcat<T> for V {
#[unstable(feature = "slice_concat_ext", issue = "27747")]
impl<T: Clone, V: Borrow<[T]>> Concat<T> for [V] {
type Output = Vec<T>;

fn concat(slice: &[Self]) -> Vec<T> {
fn concat(slice: &Self) -> Vec<T> {
let size = slice.iter().map(|slice| slice.borrow().len()).sum();
let mut result = Vec::with_capacity(size);
for v in slice {
result.extend_from_slice(v.borrow())
}
result
}
}

#[unstable(feature = "slice_concat_ext", issue = "27747")]
impl<T: Clone, V: Borrow<[T]>> Join<&T> for [V] {
type Output = Vec<T>;

fn join(slice: &[Self], sep: &T) -> Vec<T> {
fn join(slice: &Self, sep: &T) -> Vec<T> {
let mut iter = slice.iter();
let first = match iter.next() {
Some(first) => first,
None => return vec![],
};
let size = slice.iter().map(|slice| slice.borrow().len()).sum::<usize>() + slice.len() - 1;
let size = slice.iter().map(|v| v.borrow().len()).sum::<usize>() + slice.len() - 1;
let mut result = Vec::with_capacity(size);
result.extend_from_slice(first.borrow());

Expand All @@ -628,6 +667,29 @@ impl<T: Clone, V: Borrow<[T]>> SliceConcat<T> for V {
}
}

#[unstable(feature = "slice_concat_ext", issue = "27747")]
impl<T: Clone, V: Borrow<[T]>> Join<&[T]> for [V] {
type Output = Vec<T>;

fn join(slice: &Self, sep: &[T]) -> Vec<T> {
let mut iter = slice.iter();
let first = match iter.next() {
Some(first) => first,
None => return vec![],
};
let size = slice.iter().map(|v| v.borrow().len()).sum::<usize>() +
sep.len() * (slice.len() - 1);
let mut result = Vec::with_capacity(size);
result.extend_from_slice(first.borrow());

for v in iter {
result.extend_from_slice(sep);
result.extend_from_slice(v.borrow())
}
result
}
}

////////////////////////////////////////////////////////////////////////////////
// Standard trait implementations for slices
////////////////////////////////////////////////////////////////////////////////
Expand Down
Loading