Merge remote-tracking branch 'origin/master' into gen

This commit is contained in:
Alex Crichton 2017-08-07 22:30:39 -07:00
commit c25ddf21f1
280 changed files with 17756 additions and 2240 deletions

View file

@ -0,0 +1,21 @@
// 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.
#![feature(const_fn)]
const fn foo(x: u32) -> u32 {
x
}
fn main() {
const X: u32 = 0-1;
const Y: u32 = foo(0-1);
println!("{} {}", X, Y);
}

View file

@ -0,0 +1,28 @@
warning: constant evaluation error: attempt to subtract with overflow. This will become a HARD ERROR in the future
--> $DIR/issue-43197.rs:18:20
|
18 | const X: u32 = 0-1;
| ^^^
|
= note: #[warn(const_err)] on by default
warning: constant evaluation error: attempt to subtract with overflow. This will become a HARD ERROR in the future
--> $DIR/issue-43197.rs:19:20
|
19 | const Y: u32 = foo(0-1);
| ^^^^^^^^
error[E0080]: constant evaluation error
--> $DIR/issue-43197.rs:18:20
|
18 | const X: u32 = 0-1;
| ^^^ attempt to subtract with overflow
error[E0080]: constant evaluation error
--> $DIR/issue-43197.rs:19:24
|
19 | const Y: u32 = foo(0-1);
| ^^^ attempt to subtract with overflow
error: aborting due to 2 previous errors

View file

@ -3,6 +3,8 @@ error[E0609]: no field `zz` on type `Foo`
|
17 | f.zz;
| ^^ unknown field
|
= note: available fields are: `bar`
error: aborting due to previous error

View file

@ -0,0 +1,43 @@
// 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.
mod submodule {
#[derive(Default)]
pub struct Demo {
pub favorite_integer: isize,
secret_integer: isize,
pub innocently_misspellable: (),
another_field: bool,
yet_another_field: bool,
always_more_fields: bool,
and_ever: bool,
}
impl Demo {
fn new_with_secret_two() -> Self {
Self { secret_integer: 2, inocently_mispellable: () }
}
fn new_with_secret_three() -> Self {
Self { secret_integer: 3, egregiously_nonexistent_field: () }
}
}
}
fn main() {
use submodule::Demo;
let demo = Demo::default();
let innocent_field_misaccess = demo.inocently_mispellable;
// note shouldn't suggest private fields
let egregious_field_misaccess = demo.egregiously_nonexistent_field;
}

View file

@ -0,0 +1,30 @@
error[E0560]: struct `submodule::Demo` has no field named `inocently_mispellable`
--> $DIR/issue-42599_available_fields_note.rs:26:39
|
26 | Self { secret_integer: 2, inocently_mispellable: () }
| ^^^^^^^^^^^^^^^^^^^^^^ field does not exist - did you mean `innocently_misspellable`?
error[E0560]: struct `submodule::Demo` has no field named `egregiously_nonexistent_field`
--> $DIR/issue-42599_available_fields_note.rs:30:39
|
30 | Self { secret_integer: 3, egregiously_nonexistent_field: () }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `submodule::Demo` does not have this field
|
= note: available fields are: `favorite_integer`, `secret_integer`, `innocently_misspellable`, `another_field`, `yet_another_field` ... and 2 others
error[E0609]: no field `inocently_mispellable` on type `submodule::Demo`
--> $DIR/issue-42599_available_fields_note.rs:40:41
|
40 | let innocent_field_misaccess = demo.inocently_mispellable;
| ^^^^^^^^^^^^^^^^^^^^^ did you mean `innocently_misspellable`?
error[E0609]: no field `egregiously_nonexistent_field` on type `submodule::Demo`
--> $DIR/issue-42599_available_fields_note.rs:42:42
|
42 | let egregious_field_misaccess = demo.egregiously_nonexistent_field;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unknown field
|
= note: available fields are: `favorite_integer`, `innocently_misspellable`
error: aborting due to 4 previous errors

View file

@ -33,11 +33,27 @@ fn should_return_fruit_too() -> Fruit::Apple {
//~| NOTE not found in this scope
}
fn foo() -> Ok {
//~^ ERROR expected type, found variant `Ok`
//~| NOTE not a type
//~| HELP there is an enum variant
//~| HELP there is an enum variant
Ok(())
}
fn bar() -> Variant3 {
//~^ ERROR cannot find type `Variant3` in this scope
//~| NOTE not found in this scope
}
fn qux() -> Some {
//~^ ERROR expected type, found variant `Some`
//~| NOTE not a type
//~| HELP there is an enum variant
//~| HELP there is an enum variant
Some(1)
}
fn main() {}
mod x {

View file

@ -38,14 +38,32 @@ help: possible candidate is found in another module, you can import it into scop
12 | use Fruit::Apple;
|
error[E0412]: cannot find type `Variant3` in this scope
error[E0573]: expected type, found variant `Ok`
--> $DIR/issue-35675.rs:36:13
|
36 | fn bar() -> Variant3 {
36 | fn foo() -> Ok {
| ^^ not a type
|
= help: there is an enum variant `std::prelude::v1::Ok`, try using `std::prelude::v1`?
= help: there is an enum variant `std::result::Result::Ok`, try using `std::result::Result`?
error[E0412]: cannot find type `Variant3` in this scope
--> $DIR/issue-35675.rs:44:13
|
44 | fn bar() -> Variant3 {
| ^^^^^^^^
| |
| not found in this scope
| help: you can try using the variant's enum: `x::Enum`
error: aborting due to 5 previous errors
error[E0573]: expected type, found variant `Some`
--> $DIR/issue-35675.rs:49:13
|
49 | fn qux() -> Some {
| ^^^^ not a type
|
= help: there is an enum variant `std::prelude::v1::Option::Some`, try using `std::prelude::v1::Option`?
= help: there is an enum variant `std::prelude::v1::Some`, try using `std::prelude::v1`?
error: aborting due to 7 previous errors

View file

@ -0,0 +1,31 @@
// Copyright 2016 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.
mod private {
pub trait Future {
fn wait(&self) where Self: Sized;
}
impl Future for Box<Future> {
fn wait(&self) { }
}
}
//use private::Future;
fn bar(arg: Box<private::Future>) {
arg.wait();
//~^ ERROR the `wait` method cannot be invoked on a trait object
//~| another candidate was found in the following trait, perhaps add a `use` for it:
}
fn main() {
}

View file

@ -0,0 +1,11 @@
error: the `wait` method cannot be invoked on a trait object
--> $DIR/issue-35976.rs:24:9
|
24 | arg.wait();
| ^^^^
|
= note: another candidate was found in the following trait, perhaps add a `use` for it:
candidate #1: `use private::Future;`
error: aborting due to previous error

View file

@ -2,9 +2,9 @@ error[E0623]: lifetime mismatch
--> $DIR/ex3-both-anon-regions-2.rs:12:9
|
11 | fn foo((v, w): (&u8, &u8), x: &u8) {
| --- --- these references must have the same lifetime
| --- --- these references are not declared with the same lifetime...
12 | v = x;
| ^ data from `x` flows here
| ^ ...but data from `x` flows here
error: aborting due to previous error

View file

@ -2,9 +2,9 @@ error[E0623]: lifetime mismatch
--> $DIR/ex3-both-anon-regions-3.rs:12:9
|
11 | fn foo((v, w): (&u8, &u8), (x, y): (&u8, &u8)) {
| --- --- these references must have the same lifetime
| --- --- these references are not declared with the same lifetime...
12 | v = x;
| ^ data flows here
| ^ ...but data flows here
error: aborting due to previous error

View file

@ -4,17 +4,17 @@ error[E0623]: lifetime mismatch
--> $DIR/ex3-both-anon-regions-4.rs:12:13
|
11 | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
| --- --- these references must have the same lifetime
| --- --- these references are not declared with the same lifetime...
12 | z.push((x,y));
| ^ data flows into `z` here
| ^ ...but data flows into `z` here
error[E0623]: lifetime mismatch
--> $DIR/ex3-both-anon-regions-4.rs:12:15
|
11 | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
| --- --- these references must have the same lifetime
| --- --- these references are not declared with the same lifetime...
12 | z.push((x,y));
| ^ data flows into `z` here
| ^ ...but data flows into `z` here
error: aborting due to 3 previous errors

View file

@ -2,9 +2,9 @@ error[E0623]: lifetime mismatch
--> $DIR/ex3-both-anon-regions.rs:12:12
|
11 | fn foo(x: &mut Vec<&u8>, y: &u8) {
| --- --- these references must have the same lifetime
| --- --- these references are not declared with the same lifetime...
12 | x.push(y);
| ^ data from `y` flows into `x` here
| ^ ...but data from `y` flows into `x` here
error: aborting due to previous error

View file

@ -6,8 +6,6 @@ error[E0308]: mismatched types
|
= note: expected type `fn(&'cx S) -> &'cx S`
found type `fn(&'a S) -> &S {bar::<'_>}`
= note: lifetime parameter `'b` declared on fn `bar` appears only in the return type, but here is required to be higher-ranked, which means that `'b` must appear in both argument and return types
= note: this error is the result of a recent bug fix; for more information, see issue #33685 <https://github.com/rust-lang/rust/issues/33685>
error: aborting due to previous error

View file

@ -0,0 +1,42 @@
// 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.
#![deny(dead_code)]
union U1 {
a: u8, // should not be reported
b: u8, // should not be reported
c: u8, // should be reported
}
union U2 {
a: u8, // should be reported
b: u8, // should not be reported
c: u8, // should not be reported
}
union NoDropLike { a: u8 } // should be reported as unused
union U {
a: u8, // should not be reported
b: u8, // should not be reported
c: u8, // should be reported
}
type A = U;
fn main() {
let u = U1 { a: 0 };
let _a = unsafe { u.b };
let u = U2 { c: 0 };
let _b = unsafe { u.b };
let _u = NoDropLike { a: 10 };
let u = A { a: 0 };
let _b = unsafe { u.b };
}

View file

@ -0,0 +1,32 @@
error: field is never used: `c`
--> $DIR/union-fields.rs:16:5
|
16 | c: u8, // should be reported
| ^^^^^
|
note: lint level defined here
--> $DIR/union-fields.rs:11:9
|
11 | #![deny(dead_code)]
| ^^^^^^^^^
error: field is never used: `a`
--> $DIR/union-fields.rs:19:5
|
19 | a: u8, // should be reported
| ^^^^^
error: field is never used: `a`
--> $DIR/union-fields.rs:23:20
|
23 | union NoDropLike { a: u8 } // should be reported as unused
| ^^^^^
error: field is never used: `c`
--> $DIR/union-fields.rs:28:5
|
28 | c: u8, // should be reported
| ^^^^^
error: aborting due to 4 previous errors