Auto merge of #55347 - pietroalbini:rollup, r=pietroalbini

Rollup of 22 pull requests

Successful merges:

 - #53507 (Add doc for impl From for Waker)
 - #53931 (Gradually expanding libstd's keyword documentation)
 - #54965 (update tcp stream documentation)
 - #54977 (Accept `Option<Box<$t:ty>>` in macro argument)
 - #55138 (in which unused-parens suggestions heed what the user actually wrote)
 - #55173 (Suggest appropriate syntax on missing lifetime specifier in return type)
 - #55200 (Documents `From` implementations for `Stdio`)
 - #55245 (submodules: update clippy from 5afdf8b7 to b1d03437)
 - #55247 (Clarified code example in char primitive doc)
 - #55251 (Fix a typo in the documentation of RangeInclusive)
 - #55253 (only issue "variant of the expected type" suggestion for enums)
 - #55254 (Correct trailing ellipsis in name_from_pat)
 - #55269 (fix typos in various places)
 - #55282 (Remove redundant clone)
 - #55285 (Do some copy editing on the release notes)
 - #55291 (Update stdsimd submodule)
 - #55296 (Set RUST_BACKTRACE=0 for rustdoc-ui/failed-doctest-output.rs)
 - #55306 (Regression test for #54478.)
 - #55328 (Fix doc for new copysign functions)
 - #55340 (Operands no longer appear in places)
 - #55345 (Remove is_null)
 - #55348 (Update RELEASES.md after destabilization of non_modrs_mods)

Failed merges:

r? @ghost
This commit is contained in:
bors 2018-10-25 14:40:22 +00:00
commit 8ec22e7ec7
87 changed files with 1167 additions and 290 deletions

View file

@ -2,10 +2,9 @@ error[E0106]: missing lifetime specifier
--> $DIR/bound-lifetime-in-binding-only.rs:62:23
|
LL | fn elision<T: Fn() -> &i32>() {
| ^ expected lifetime parameter
| ^ help: consider giving it a 'static lifetime: `&'static`
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
= help: consider giving it a 'static lifetime
error: aborting due to previous error

View file

@ -2,10 +2,9 @@ error[E0106]: missing lifetime specifier
--> $DIR/bound-lifetime-in-return-only.rs:44:23
|
LL | fn elision(_: fn() -> &i32) {
| ^ expected lifetime parameter
| ^ help: consider giving it a 'static lifetime: `&'static`
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
= help: consider giving it a 'static lifetime
error: aborting due to previous error

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test that we do some basic error correcton in the tokeniser (and don't spew
// Test that we do some basic error correction in the tokeniser (and don't spew
// too many bogus errors).
fn foo() -> usize {

View file

@ -1,5 +1,5 @@
// Test that cfg_attr doesn't emit any attributes when the
// configuation variable is false. This mirrors `cfg-attr-multi-true.rs`
// configuration variable is false. This mirrors `cfg-attr-multi-true.rs`
// compile-pass

View file

@ -20,4 +20,20 @@ fn main() {
let n: usize = 42;
this_function_expects_a_double_option(n);
//~^ ERROR mismatched types
//~| HELP try using a variant of the expected type
}
// But don't issue the "try using a variant" help if the one-"variant" ADT is
// actually a one-field struct.
struct Payload;
struct Wrapper { payload: Payload }
struct Context { wrapper: Wrapper }
fn overton() {
let _c = Context { wrapper: Payload{} };
//~^ ERROR mismatched types
}

View file

@ -13,6 +13,15 @@ LL | this_function_expects_a_double_option(DoubleOption::FirstSome(n));
LL | this_function_expects_a_double_option(DoubleOption::AlternativeSome(n));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
error[E0308]: mismatched types
--> $DIR/issue-42764.rs:37:33
|
LL | let _c = Context { wrapper: Payload{} };
| ^^^^^^^^^ expected struct `Wrapper`, found struct `Payload`
|
= note: expected type `Wrapper`
found type `Payload`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0308`.

View file

@ -0,0 +1,18 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// run-rustfix
extern "C" {
pub fn g(_: &u8) -> &u8; // OK
pub fn f() -> &'static u8; //~ ERROR missing lifetime specifier
}
fn main() {}

View file

@ -8,9 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// run-rustfix
extern "C" {
fn g(_: &u8) -> &u8; // OK
fn f() -> &u8; //~ ERROR missing lifetime specifier
pub fn g(_: &u8) -> &u8; // OK
pub fn f() -> &u8; //~ ERROR missing lifetime specifier
}
fn main() {}

View file

@ -1,11 +1,10 @@
error[E0106]: missing lifetime specifier
--> $DIR/foreign-fn-return-lifetime.rs:13:15
--> $DIR/foreign-fn-return-lifetime.rs:15:19
|
LL | fn f() -> &u8; //~ ERROR missing lifetime specifier
| ^ expected lifetime parameter
LL | pub fn f() -> &u8; //~ ERROR missing lifetime specifier
| ^ help: consider giving it a 'static lifetime: `&'static`
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
= help: consider giving it a 'static lifetime
error: aborting due to previous error

View file

@ -2,10 +2,9 @@ error[E0106]: missing lifetime specifier
--> $DIR/issue-13497.rs:12:5
|
LL | &str //~ ERROR missing lifetime specifier
| ^ expected lifetime parameter
| ^ help: consider giving it a 'static lifetime: `&'static`
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
= help: consider giving it a 'static lifetime
error: aborting due to previous error

View file

@ -10,19 +10,17 @@ error[E0106]: missing lifetime specifier
--> $DIR/issue-26638.rs:14:40
|
LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() }
| ^ expected lifetime parameter
| ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static`
|
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
= help: consider giving it an explicit bounded or 'static lifetime
error[E0106]: missing lifetime specifier
--> $DIR/issue-26638.rs:17:22
|
LL | fn parse_type_3() -> &str { unimplemented!() }
| ^ expected lifetime parameter
| ^ help: consider giving it a 'static lifetime: `&'static`
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
= help: consider giving it a 'static lifetime
error: aborting due to 3 previous errors

View file

@ -2,10 +2,9 @@ error[E0106]: missing lifetime specifier
--> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:12:11
|
LL | fn f() -> &isize { //~ ERROR missing lifetime specifier
| ^ expected lifetime parameter
| ^ help: consider giving it a 'static lifetime: `&'static`
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
= help: consider giving it a 'static lifetime
error[E0106]: missing lifetime specifier
--> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:17:33
@ -27,28 +26,25 @@ error[E0106]: missing lifetime specifier
--> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:31:20
|
LL | fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier
| ^ expected lifetime parameter
| ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static`
|
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
= help: consider giving it an explicit bounded or 'static lifetime
error[E0106]: missing lifetime specifier
--> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:44:24
|
LL | fn j(_x: StaticStr) -> &isize { //~ ERROR missing lifetime specifier
| ^ expected lifetime parameter
| ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static`
|
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
= help: consider giving it an explicit bounded or 'static lifetime
error[E0106]: missing lifetime specifier
--> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:50:49
|
LL | fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize {
| ^ expected lifetime parameter
| ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static`
|
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
= help: consider giving it an explicit bounded or 'static lifetime
error: aborting due to 6 previous errors

View file

@ -0,0 +1,12 @@
trait Future {
type Item;
type Error;
}
use std::error::Error;
fn foo() -> impl Future<Item=(), Error=Box<Error>> {
Ok(())
}
fn main() {}

View file

@ -0,0 +1,11 @@
error[E0106]: missing lifetime specifier
--> $DIR/lifetime-elision-return-type-trait.rs:8:44
|
LL | fn foo() -> impl Future<Item=(), Error=Box<Error>> {
| ^^^^^ help: consider giving it a 'static lifetime: `Error + 'static`
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
error: aborting due to previous error
For more information about this error, try `rustc --explain E0106`.

View file

@ -56,7 +56,7 @@ fn main() {
while true {
//~^ WARN denote infinite loops
//~| HELP use `loop`
let mut a = (1);
let mut registry_no = (format!("NX-{}", 74205));
//~^ WARN does not need to be mutable
//~| HELP remove this `mut`
//~| WARN unnecessary parentheses
@ -72,6 +72,6 @@ fn main() {
//~^ WARN this pattern is redundant
//~| HELP remove this
}
println!("{} {}", a, b);
println!("{} {}", registry_no, b);
}
}

View file

@ -1,8 +1,8 @@
warning: unnecessary parentheses around assigned value
--> $DIR/suggestions.rs:59:21
--> $DIR/suggestions.rs:59:31
|
LL | let mut a = (1);
| ^^^ help: remove these parentheses
LL | let mut registry_no = (format!("NX-{}", 74205));
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
|
note: lint level defined here
--> $DIR/suggestions.rs:13:21
@ -21,8 +21,8 @@ LL | #[no_debug] // should suggest removal of deprecated attribute
warning: variable does not need to be mutable
--> $DIR/suggestions.rs:59:13
|
LL | let mut a = (1);
| ----^
LL | let mut registry_no = (format!("NX-{}", 74205));
| ----^^^^^^^^^^^
| |
| help: remove this `mut`
|

View file

@ -66,7 +66,7 @@ impl<F> R<F> { fn new(f: F) -> Self { R { w: 0, f } } }
// It got pretty monotonous writing the same code over and over, and I
// feared I would forget details. So I abstracted some desiderata into
// macros. But I left the initialization code inline, because that's
// where the errors for #54986 will be emited.
// where the errors for #54986 will be emitted.
macro_rules! use_fully {
(struct $s:expr) => { {

View file

@ -1,5 +1,5 @@
// rust-lang/rust#52059: Regardless of whether you are moving out of a
// Drop type or just introducing an inadvertant alias via a borrow of
// Drop type or just introducing an inadvertent alias via a borrow of
// one of its fields, it is useful to be reminded of the significance
// of the fact that the type implements Drop.

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test that we do some basic error correcton in the tokeniser (and don't ICE).
// Test that we do some basic error correction in the tokeniser (and don't ICE).
fn main() {
if foo {

View file

@ -10,7 +10,7 @@
// ignore-cloudabi no std::fs support
// Test that we do some basic error correcton in the tokeniser (and don't spew
// Test that we do some basic error correction in the tokeniser (and don't spew
// too many bogus errors).
pub mod raw {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test that we do some basic error correcton in the tokeniser.
// Test that we do some basic error correction in the tokeniser.
fn main() {
foo(bar(;

View file

@ -19,22 +19,22 @@ fn main() {
use std::ops::Range;
if let Range { start: _, end: _ } = true..true && false { }
//~^ ERROR ambigious use of `&&`
//~^ ERROR ambiguous use of `&&`
if let Range { start: _, end: _ } = true..true || false { }
//~^ ERROR ambigious use of `||`
//~^ ERROR ambiguous use of `||`
while let Range { start: _, end: _ } = true..true && false { }
//~^ ERROR ambigious use of `&&`
//~^ ERROR ambiguous use of `&&`
while let Range { start: _, end: _ } = true..true || false { }
//~^ ERROR ambigious use of `||`
//~^ ERROR ambiguous use of `||`
if let true = false && false { }
//~^ ERROR ambigious use of `&&`
//~^ ERROR ambiguous use of `&&`
while let true = (1 == 2) && false { }
//~^ ERROR ambigious use of `&&`
//~^ ERROR ambiguous use of `&&`
// The following cases are not an error as parenthesis are used to
// clarify intent:

View file

@ -1,4 +1,4 @@
error: ambigious use of `&&`
error: ambiguous use of `&&`
--> $DIR/syntax-ambiguity-2015.rs:21:47
|
LL | if let Range { start: _, end: _ } = true..true && false { }
@ -7,7 +7,7 @@ LL | if let Range { start: _, end: _ } = true..true && false { }
= note: this will be a error until the `let_chains` feature is stabilized
= note: see rust-lang/rust#53668 for more information
error: ambigious use of `||`
error: ambiguous use of `||`
--> $DIR/syntax-ambiguity-2015.rs:24:47
|
LL | if let Range { start: _, end: _ } = true..true || false { }
@ -16,7 +16,7 @@ LL | if let Range { start: _, end: _ } = true..true || false { }
= note: this will be a error until the `let_chains` feature is stabilized
= note: see rust-lang/rust#53668 for more information
error: ambigious use of `&&`
error: ambiguous use of `&&`
--> $DIR/syntax-ambiguity-2015.rs:27:50
|
LL | while let Range { start: _, end: _ } = true..true && false { }
@ -25,7 +25,7 @@ LL | while let Range { start: _, end: _ } = true..true && false { }
= note: this will be a error until the `let_chains` feature is stabilized
= note: see rust-lang/rust#53668 for more information
error: ambigious use of `||`
error: ambiguous use of `||`
--> $DIR/syntax-ambiguity-2015.rs:30:50
|
LL | while let Range { start: _, end: _ } = true..true || false { }
@ -34,7 +34,7 @@ LL | while let Range { start: _, end: _ } = true..true || false { }
= note: this will be a error until the `let_chains` feature is stabilized
= note: see rust-lang/rust#53668 for more information
error: ambigious use of `&&`
error: ambiguous use of `&&`
--> $DIR/syntax-ambiguity-2015.rs:33:19
|
LL | if let true = false && false { }
@ -43,7 +43,7 @@ LL | if let true = false && false { }
= note: this will be a error until the `let_chains` feature is stabilized
= note: see rust-lang/rust#53668 for more information
error: ambigious use of `&&`
error: ambiguous use of `&&`
--> $DIR/syntax-ambiguity-2015.rs:36:22
|
LL | while let true = (1 == 2) && false { }

View file

@ -19,22 +19,22 @@ fn main() {
use std::ops::Range;
if let Range { start: _, end: _ } = true..true && false { }
//~^ ERROR ambigious use of `&&`
//~^ ERROR ambiguous use of `&&`
if let Range { start: _, end: _ } = true..true || false { }
//~^ ERROR ambigious use of `||`
//~^ ERROR ambiguous use of `||`
while let Range { start: _, end: _ } = true..true && false { }
//~^ ERROR ambigious use of `&&`
//~^ ERROR ambiguous use of `&&`
while let Range { start: _, end: _ } = true..true || false { }
//~^ ERROR ambigious use of `||`
//~^ ERROR ambiguous use of `||`
if let true = false && false { }
//~^ ERROR ambigious use of `&&`
//~^ ERROR ambiguous use of `&&`
while let true = (1 == 2) && false { }
//~^ ERROR ambigious use of `&&`
//~^ ERROR ambiguous use of `&&`
// The following cases are not an error as parenthesis are used to
// clarify intent:

View file

@ -1,4 +1,4 @@
error: ambigious use of `&&`
error: ambiguous use of `&&`
--> $DIR/syntax-ambiguity-2018.rs:21:47
|
LL | if let Range { start: _, end: _ } = true..true && false { }
@ -7,7 +7,7 @@ LL | if let Range { start: _, end: _ } = true..true && false { }
= note: this will be a error until the `let_chains` feature is stabilized
= note: see rust-lang/rust#53668 for more information
error: ambigious use of `||`
error: ambiguous use of `||`
--> $DIR/syntax-ambiguity-2018.rs:24:47
|
LL | if let Range { start: _, end: _ } = true..true || false { }
@ -16,7 +16,7 @@ LL | if let Range { start: _, end: _ } = true..true || false { }
= note: this will be a error until the `let_chains` feature is stabilized
= note: see rust-lang/rust#53668 for more information
error: ambigious use of `&&`
error: ambiguous use of `&&`
--> $DIR/syntax-ambiguity-2018.rs:27:50
|
LL | while let Range { start: _, end: _ } = true..true && false { }
@ -25,7 +25,7 @@ LL | while let Range { start: _, end: _ } = true..true && false { }
= note: this will be a error until the `let_chains` feature is stabilized
= note: see rust-lang/rust#53668 for more information
error: ambigious use of `||`
error: ambiguous use of `||`
--> $DIR/syntax-ambiguity-2018.rs:30:50
|
LL | while let Range { start: _, end: _ } = true..true || false { }
@ -34,7 +34,7 @@ LL | while let Range { start: _, end: _ } = true..true || false { }
= note: this will be a error until the `let_chains` feature is stabilized
= note: see rust-lang/rust#53668 for more information
error: ambigious use of `&&`
error: ambiguous use of `&&`
--> $DIR/syntax-ambiguity-2018.rs:33:19
|
LL | if let true = false && false { }
@ -43,7 +43,7 @@ LL | if let true = false && false { }
= note: this will be a error until the `let_chains` feature is stabilized
= note: see rust-lang/rust#53668 for more information
error: ambigious use of `&&`
error: ambiguous use of `&&`
--> $DIR/syntax-ambiguity-2018.rs:36:22
|
LL | while let true = (1 == 2) && false { }

View file

@ -24,7 +24,7 @@ use std::fmt::{Debug, Display};
// • one generic parameter (T) bound inline
// • one parameter (T) with a where clause
// • two parameters (T and U), both bound inline
// • two paramters (T and U), one bound inline, one with a where clause
// • two parameters (T and U), one bound inline, one with a where clause
// • two parameters (T and U), both with where clauses
//
// —and for every permutation of 0, 1, or 2 lifetimes to outlive and 0 or 1

View file

@ -24,7 +24,7 @@ use std::fmt::{Debug, Display};
// • one generic parameter (T) bound inline
// • one parameter (T) with a where clause
// • two parameters (T and U), both bound inline
// • two paramters (T and U), one bound inline, one with a where clause
// • two parameters (T and U), one bound inline, one with a where clause
// • two parameters (T and U), both with where clauses
//
// —and for every permutation of 0, 1, or 2 lifetimes to outlive and 0 or 1

View file

@ -12,7 +12,7 @@
// Regression test for #52050: when inserting the blanket impl `I`
// into the tree, we had to replace the child node for `Foo`, which
// led to the struture of the tree being messed up.
// led to the structure of the tree being messed up.
use std::iter::Iterator;

View file

@ -20,10 +20,9 @@ error[E0106]: missing lifetime specifier
--> $DIR/underscore-lifetime-binders.rs:20:29
|
LL | fn meh() -> Box<for<'_> Meh<'_>> //~ ERROR cannot be used here
| ^^ expected lifetime parameter
| ^^ help: consider giving it a 'static lifetime: `'static`
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
= help: consider giving it a 'static lifetime
error[E0106]: missing lifetime specifier
--> $DIR/underscore-lifetime-binders.rs:26:35