Auto merge of #54969 - Manishearth:rollup, r=Manishearth

Rollup of 9 pull requests

Successful merges:

 - #54747 (codegen_llvm: verify that inline assembly operands are scalars)
 - #54848 (Better Diagnostic for Trait Object Capture)
 - #54850 (Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls)
 - #54858 (second round of refactorings for universes)
 - #54862 (Implement RFC 2539: cfg_attr with multiple attributes)
 - #54869 (Fix mobile docs)
 - #54870 (Stabilize tool lints)
 - #54893 (Fix internal compiler error on malformed match arm pattern.)
 - #54904 (Stabilize the `Option::replace` method)

Failed merges:

 - #54909 ( Add chalk rules related to associated type defs)

r? @ghost
This commit is contained in:
bors 2018-10-11 06:26:03 +00:00
commit cb6eeddd4d
71 changed files with 599 additions and 242 deletions

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(tool_lints)]
#![deny(unknown_lints)]
#[allow(clippy::almost_swapped)]

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(tool_lints)]
#![feature(rust_2018_preview)]
#![deny(unknown_lints)]

View file

@ -11,8 +11,8 @@
// aux-build:lint_tool_test.rs
// ignore-stage1
// compile-flags: --cfg foo
#![feature(plugin)]
#![feature(tool_lints)]
#![plugin(lint_tool_test)]
#![allow(dead_code)]
#![cfg_attr(foo, warn(test_lint))]

View file

@ -1,13 +0,0 @@
// compile-flags: --cfg TRUE
#[cfg_attr(TRUE, inline,)] // OK
fn f() {}
#[cfg_attr(FALSE, inline,)] // OK
fn g() {}
#[cfg_attr(TRUE, inline,,)] //~ ERROR expected `)`, found `,`
fn h() {}
#[cfg_attr(FALSE, inline,,)] //~ ERROR expected `)`, found `,`
fn i() {}

View file

@ -1,14 +0,0 @@
error: expected `)`, found `,`
--> $DIR/cfg-attr-trailing-comma.rs:9:25
|
LL | #[cfg_attr(TRUE, inline,,)] //~ ERROR expected `)`, found `,`
| ^ expected `)`
error: expected `)`, found `,`
--> $DIR/cfg-attr-trailing-comma.rs:12:26
|
LL | #[cfg_attr(FALSE, inline,,)] //~ ERROR expected `)`, found `,`
| ^ expected `)`
error: aborting due to 2 previous errors

View file

@ -10,11 +10,12 @@
#![feature(rustc_attrs)]
trait Bar { }
#[rustc_dump_program_clauses] //~ ERROR program clause dump
trait Foo<S, T, U> {
fn s(_: S) -> S;
fn t(_: T) -> T;
fn u(_: U) -> U;
trait Foo<S, T: ?Sized> {
#[rustc_dump_program_clauses] //~ ERROR program clause dump
type Assoc: Bar + ?Sized;
}
fn main() {

View file

@ -1,14 +1,23 @@
error: program clause dump
--> $DIR/lower_trait.rs:13:1
--> $DIR/lower_trait.rs:15:1
|
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: FromEnv(S: std::marker::Sized) :- FromEnv(Self: Foo<S, T, U>).
= note: FromEnv(T: std::marker::Sized) :- FromEnv(Self: Foo<S, T, U>).
= note: FromEnv(U: std::marker::Sized) :- FromEnv(Self: Foo<S, T, U>).
= note: Implemented(Self: Foo<S, T, U>) :- FromEnv(Self: Foo<S, T, U>).
= note: WellFormed(Self: Foo<S, T, U>) :- Implemented(Self: Foo<S, T, U>), WellFormed(S: std::marker::Sized), WellFormed(T: std::marker::Sized), WellFormed(U: std::marker::Sized).
= note: FromEnv(<Self as Foo<S, T>>::Assoc: Bar) :- FromEnv(Self: Foo<S, T>).
= note: FromEnv(S: std::marker::Sized) :- FromEnv(Self: Foo<S, T>).
= note: Implemented(Self: Foo<S, T>) :- FromEnv(Self: Foo<S, T>).
= note: WellFormed(Self: Foo<S, T>) :- Implemented(Self: Foo<S, T>), WellFormed(S: std::marker::Sized), WellFormed(<Self as Foo<S, T>>::Assoc: Bar).
error: aborting due to previous error
error: program clause dump
--> $DIR/lower_trait.rs:17:5
|
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: FromEnv(Self: Foo<S, T>) :- FromEnv(Unnormalized(<Self as Foo<S, T>>::Assoc)).
= note: ProjectionEq(<Self as Foo<S, T>>::Assoc == Unnormalized(<Self as Foo<S, T>>::Assoc)).
= note: WellFormed(Unnormalized(<Self as Foo<S, T>>::Assoc)) :- Implemented(Self: Foo<S, T>).
error: aborting due to 2 previous errors

View file

@ -2,7 +2,7 @@ error[E0658]: no_core is experimental (see issue #29639)
--> $DIR/cfg-attr-crate-2.rs:15:21
|
LL | #![cfg_attr(broken, no_core)] //~ ERROR no_core is experimental
| ^^^^^^^^
| ^^^^^^^
|
= help: add #![feature(no_core)] to the crate attributes to enable

View file

@ -0,0 +1,20 @@
// Test that cfg_attr doesn't emit any attributes when the
// configuation variable is false. This mirrors `cfg-attr-multi-true.rs`
// compile-pass
#![warn(unused_must_use)]
#![feature(cfg_attr_multi)]
#[cfg_attr(any(), deprecated, must_use)]
struct Struct {}
impl Struct {
fn new() -> Struct {
Struct {}
}
}
fn main() {
Struct::new();
}

View file

@ -1,4 +1,4 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -7,6 +7,10 @@
// <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.
//
// compile-flags: --cfg broken
#[warn(clippy::assign_ops)] //~ ERROR scoped lint `clippy::assign_ops` is experimental
fn main() {}
#![feature(cfg_attr_multi)]
#![cfg_attr(broken, no_core, no_std)] //~ ERROR no_core is experimental
fn main() { }

View file

@ -0,0 +1,11 @@
error[E0658]: no_core is experimental (see issue #29639)
--> $DIR/cfg-attr-multi-invalid-1.rs:14:21
|
LL | #![cfg_attr(broken, no_core, no_std)] //~ ERROR no_core is experimental
| ^^^^^^^
|
= help: add #![feature(no_core)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -0,0 +1,16 @@
// Copyright 2015 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.
//
// compile-flags: --cfg broken
#![feature(cfg_attr_multi)]
#![cfg_attr(broken, no_std, no_core)] //~ ERROR no_core is experimental
fn main() { }

View file

@ -0,0 +1,11 @@
error[E0658]: no_core is experimental (see issue #29639)
--> $DIR/cfg-attr-multi-invalid-2.rs:14:29
|
LL | #![cfg_attr(broken, no_std, no_core)] //~ ERROR no_core is experimental
| ^^^^^^^
|
= help: add #![feature(no_core)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -0,0 +1,22 @@
// Test that cfg_attr with multiple attributes actually emits both attributes.
// This is done by emitting two attributes that cause new warnings, and then
// triggering those warnings.
// compile-pass
#![warn(unused_must_use)]
#![feature(cfg_attr_multi)]
#[cfg_attr(all(), deprecated, must_use)]
struct MustUseDeprecated {}
impl MustUseDeprecated { //~ warning: use of deprecated item
fn new() -> MustUseDeprecated { //~ warning: use of deprecated item
MustUseDeprecated {} //~ warning: use of deprecated item
}
}
fn main() {
MustUseDeprecated::new(); //~ warning: use of deprecated item
//| warning: unused `MustUseDeprecated` which must be used
}

View file

@ -0,0 +1,38 @@
warning: use of deprecated item 'MustUseDeprecated'
--> $DIR/cfg-attr-multi-true.rs:13:6
|
LL | impl MustUseDeprecated { //~ warning: use of deprecated item
| ^^^^^^^^^^^^^^^^^
|
= note: #[warn(deprecated)] on by default
warning: use of deprecated item 'MustUseDeprecated'
--> $DIR/cfg-attr-multi-true.rs:20:5
|
LL | MustUseDeprecated::new(); //~ warning: use of deprecated item
| ^^^^^^^^^^^^^^^^^^^^^^
warning: use of deprecated item 'MustUseDeprecated'
--> $DIR/cfg-attr-multi-true.rs:14:17
|
LL | fn new() -> MustUseDeprecated { //~ warning: use of deprecated item
| ^^^^^^^^^^^^^^^^^
warning: use of deprecated item 'MustUseDeprecated'
--> $DIR/cfg-attr-multi-true.rs:15:9
|
LL | MustUseDeprecated {} //~ warning: use of deprecated item
| ^^^^^^^^^^^^^^^^^
warning: unused `MustUseDeprecated` which must be used
--> $DIR/cfg-attr-multi-true.rs:20:5
|
LL | MustUseDeprecated::new(); //~ warning: use of deprecated item
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/cfg-attr-multi-true.rs:7:9
|
LL | #![warn(unused_must_use)]
| ^^^^^^^^^^^^^^^

View file

@ -0,0 +1,45 @@
// Parse `cfg_attr` with varying numbers of attributes and trailing commas
#![feature(cfg_attr_multi)]
// Completely empty `cfg_attr` input
#[cfg_attr()] //~ error: expected identifier, found `)`
struct NoConfigurationPredicate;
// Zero attributes, zero trailing comma (comma manatory here)
#[cfg_attr(all())] //~ error: expected `,`, found `)`
struct A0C0;
// Zero attributes, one trailing comma
#[cfg_attr(all(),)] // Ok
struct A0C1;
// Zero attributes, two trailing commas
#[cfg_attr(all(),,)] //~ ERROR expected identifier
struct A0C2;
// One attribute, no trailing comma
#[cfg_attr(all(), must_use)] // Ok
struct A1C0;
// One attribute, one trailing comma
#[cfg_attr(all(), must_use,)] // Ok
struct A1C1;
// One attribute, two trailing commas
#[cfg_attr(all(), must_use,,)] //~ ERROR expected identifier
struct A1C2;
// Two attributes, no trailing comma
#[cfg_attr(all(), must_use, deprecated)] // Ok
struct A2C0;
// Two attributes, one trailing comma
#[cfg_attr(all(), must_use, deprecated,)] // Ok
struct A2C1;
// Two attributes, two trailing commas
#[cfg_attr(all(), must_use, deprecated,,)] //~ ERROR expected identifier
struct A2C2;
fn main() {}

View file

@ -0,0 +1,32 @@
error: expected identifier, found `)`
--> $DIR/cfg-attr-parse.rs:6:12
|
LL | #[cfg_attr()] //~ error: expected identifier, found `)`
| ^ expected identifier
error: expected `,`, found `)`
--> $DIR/cfg-attr-parse.rs:10:17
|
LL | #[cfg_attr(all())] //~ error: expected `,`, found `)`
| ^ expected `,`
error: expected identifier, found `,`
--> $DIR/cfg-attr-parse.rs:18:18
|
LL | #[cfg_attr(all(),,)] //~ ERROR expected identifier
| ^ expected identifier
error: expected identifier, found `,`
--> $DIR/cfg-attr-parse.rs:30:28
|
LL | #[cfg_attr(all(), must_use,,)] //~ ERROR expected identifier
| ^ expected identifier
error: expected identifier, found `,`
--> $DIR/cfg-attr-parse.rs:42:40
|
LL | #[cfg_attr(all(), must_use, deprecated,,)] //~ ERROR expected identifier
| ^ expected identifier
error: aborting due to 5 previous errors

View file

@ -0,0 +1,5 @@
// gate-test-cfg_attr_multi
#![cfg_attr(all(), warn(nonstandard_style), allow(unused_attributes))]
//~^ ERROR cfg_attr with zero or more than one attributes is experimental
fn main() {}

View file

@ -0,0 +1,11 @@
error[E0658]: cfg_attr with zero or more than one attributes is experimental (see issue #54881)
--> $DIR/feature-gate-cfg-attr-multi-1.rs:3:1
|
LL | #![cfg_attr(all(), warn(nonstandard_style), allow(unused_attributes))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(cfg_attr_multi)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -0,0 +1,3 @@
#![cfg_attr(all(),)]
//~^ ERROR cfg_attr with zero or more than one attributes is experimental
fn main() {}

View file

@ -0,0 +1,11 @@
error[E0658]: cfg_attr with zero or more than one attributes is experimental (see issue #54881)
--> $DIR/feature-gate-cfg-attr-multi-2.rs:1:1
|
LL | #![cfg_attr(all(),)]
| ^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(cfg_attr_multi)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -0,0 +1,7 @@
// Test that settingt the featute gate while using its functionality doesn't error.
// compile-pass
#![cfg_attr(all(), feature(cfg_attr_multi), crate_type="bin")]
fn main() {}

View file

@ -0,0 +1,9 @@
// Test that settingt the featute gate while using its functionality doesn't error.
// Specifically, if there's a cfg-attr *before* the feature gate.
// compile-pass
#![cfg_attr(all(),)]
#![cfg_attr(all(), feature(cfg_attr_multi), crate_type="bin")]
fn main() {}

View file

@ -1,11 +0,0 @@
error[E0658]: scoped lint `clippy::assign_ops` is experimental (see issue #44690)
--> $DIR/feature-gate-tool_lints-fail.rs:11:8
|
LL | #[warn(clippy::assign_ops)] //~ ERROR scoped lint `clippy::assign_ops` is experimental
| ^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(tool_lints)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,11 +0,0 @@
error[E0658]: scoped lint `clippy::decimal_literal_representation` is experimental (see issue #44690)
--> $DIR/feature-gate-tool_lints.rs:11:8
|
LL | #[warn(clippy::decimal_literal_representation)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(tool_lints)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -7,9 +7,15 @@
// <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.
#[warn(clippy::decimal_literal_representation)]
//~^ ERROR scoped lint `clippy::decimal_literal_representation` is experimental
fn main() {
let a = 65_535;
struct MyStruct {
pub s1: Option<String>,
}
fn main() {
let thing = MyStruct { s1: None };
match thing {
MyStruct { .., Some(_) } => {},
_ => {}
}
}

View file

@ -0,0 +1,24 @@
error: expected `}`, found `,`
--> $DIR/issue-54379.rs:18:22
|
LL | MyStruct { .., Some(_) } => {},
| --^
| | |
| | expected `}`
| `..` must be at the end and cannot have a trailing comma
error: expected `,`
--> $DIR/issue-54379.rs:18:24
|
LL | MyStruct { .., Some(_) } => {},
| ^^^^
error[E0027]: pattern does not mention field `s1`
--> $DIR/issue-54379.rs:18:9
|
LL | MyStruct { .., Some(_) } => {},
| ^^^^^^^^^^^^^^^^^^^^^^^^ missing field `s1`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0027`.

View file

@ -10,7 +10,7 @@
// Don't allow tool_lints, which aren't scoped
#![feature(tool_lints)]
#![deny(unknown_lints)]
#![deny(clippy)] //~ ERROR: unknown lint: `clippy`

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(tool_lints)]
#[warn(foo::bar)]
//~^ ERROR an unknown tool name found in scoped lint: `foo::bar`

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(tool_lints)]
#![deny(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar`