Auto merge of #71331 - Dylan-DPC:rollup-5rn1isc, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #71026 (Fix false "never constructed" warnings for `Self::` variant paths)
 - #71310 (Do not show DefId in diagnostics)
 - #71317 (miri-unleash test for llvm_asm)
 - #71324 (Fix some tests failing in `--pass check` mode)

Failed merges:

r? @ghost
This commit is contained in:
bors 2020-04-19 19:53:42 +00:00
commit dbf8b6bf11
11 changed files with 78 additions and 13 deletions

View file

@ -639,9 +639,7 @@ pub trait PrettyPrinter<'tcx>:
}
}
} else {
// Cross-crate closure types should only be
// visible in codegen bug reports, I imagine.
p!(write("@{:?}", did));
p!(write("@{}", self.tcx().def_path_str(did)));
if substs.as_generator().is_valid() {
let upvar_tys = substs.as_generator().upvar_tys();
@ -689,9 +687,7 @@ pub trait PrettyPrinter<'tcx>:
}
}
} else {
// Cross-crate closure types should only be
// visible in codegen bug reports, I imagine.
p!(write("@{:?}", did));
p!(write("@{}", self.tcx().def_path_str(did)));
if substs.as_closure().is_valid() {
let upvar_tys = substs.as_closure().upvar_tys();

View file

@ -255,7 +255,9 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
hir::ExprKind::Field(ref lhs, ..) => {
self.handle_field_access(&lhs, expr.hir_id);
}
hir::ExprKind::Struct(_, ref fields, _) => {
hir::ExprKind::Struct(ref qpath, ref fields, _) => {
let res = self.tables.qpath_res(qpath, expr.hir_id);
self.handle_res(res);
if let ty::Adt(ref adt, _) = self.tables.expr_ty(expr).kind {
self.mark_as_used_if_union(adt, fields);
}

View file

@ -1,7 +1,5 @@
// aux-build: issue_67893.rs
// edition:2018
// dont-check-compiler-stderr
// FIXME(#71222): Add above flag because of the difference of stderrs on some env.
extern crate issue_67893;

View file

@ -0,0 +1,24 @@
error[E0277]: `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely
--> $DIR/issue-67893.rs:9:5
|
LL | fn g(_: impl Send) {}
| ---- required by this bound in `g`
...
LL | g(issue_67893::run())
| ^ `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely
|
::: $DIR/auxiliary/issue_67893.rs:7:20
|
LL | pub async fn run() {
| - within this `impl std::future::Future`
|
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::sync::MutexGuard<'_, ()>`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3> {std::future::ResumeTy, std::sync::Arc<std::sync::Mutex<()>>, &'r std::sync::Mutex<()>, std::result::Result<std::sync::MutexGuard<'s, ()>, std::sync::PoisonError<std::sync::MutexGuard<'t0, ()>>>, &'t1 std::sync::MutexGuard<'t2, ()>, std::sync::MutexGuard<'t3, ()>, (), impl std::future::Future}`
= note: required because it appears within the type `[static generator@issue_67893::run::{{closure}}#0 for<'r, 's, 't0, 't1, 't2, 't3> {std::future::ResumeTy, std::sync::Arc<std::sync::Mutex<()>>, &'r std::sync::Mutex<()>, std::result::Result<std::sync::MutexGuard<'s, ()>, std::sync::PoisonError<std::sync::MutexGuard<'t0, ()>>>, &'t1 std::sync::MutexGuard<'t2, ()>, std::sync::MutexGuard<'t3, ()>, (), impl std::future::Future}]`
= note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@issue_67893::run::{{closure}}#0 for<'r, 's, 't0, 't1, 't2, 't3> {std::future::ResumeTy, std::sync::Arc<std::sync::Mutex<()>>, &'r std::sync::Mutex<()>, std::result::Result<std::sync::MutexGuard<'s, ()>, std::sync::PoisonError<std::sync::MutexGuard<'t0, ()>>>, &'t1 std::sync::MutexGuard<'t2, ()>, std::sync::MutexGuard<'t3, ()>, (), impl std::future::Future}]>`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `impl std::future::Future`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.

View file

@ -1,5 +1,5 @@
// build-pass
// ignore-pass (emit codegen-time warnings and verify that they are indeed warnings and not errors)
// ignore-pass (test emits codegen-time warnings and verifies that they are not errors)
#![warn(const_err, unconditional_panic)]

View file

@ -4,7 +4,7 @@
//[opt_with_overflow_checks]compile-flags: -C overflow-checks=on -O
// build-pass
// ignore-pass (emit codegen-time warnings and verify that they are indeed warnings and not errors)
// ignore-pass (test emits codegen-time warnings and verifies that they are not errors)
#![warn(const_err, arithmetic_overflow, unconditional_panic)]

View file

@ -0,0 +1,14 @@
// compile-flags: -Zunleash-the-miri-inside-of-you
// only-x86_64
#![feature(llvm_asm)]
#![allow(const_err)]
fn main() {}
// Make sure we catch executing inline assembly.
static TEST_BAD: () = {
unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); }
//~^ ERROR could not evaluate static initializer
//~| NOTE in this expansion of llvm_asm!
//~| NOTE inline assembly is not supported
};

View file

@ -0,0 +1,11 @@
error[E0080]: could not evaluate static initializer
--> $DIR/inline_asm.rs:10:14
|
LL | unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inline assembly is not supported
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.

View file

@ -13,6 +13,23 @@ enum Enum2 {
Variant5 { _x: isize }, //~ ERROR: variant is never constructed: `Variant5`
Variant6(isize), //~ ERROR: variant is never constructed: `Variant6`
_Variant7,
Variant8 { _field: bool },
Variant9,
Variant10(usize)
}
impl Enum2 {
fn new_variant8() -> Enum2 {
Self::Variant8 { _field: true }
}
fn new_variant9() -> Enum2 {
Self::Variant9
}
fn new_variant10() -> Enum2 {
Self::Variant10(10)
}
}
enum Enum3 { //~ ERROR: enum is never used
@ -27,4 +44,7 @@ fn main() {
Enum1::Variant2 => ()
}
let x = Enum2::Variant3(true);
let _ = Enum2::new_variant8();
let _ = Enum2::new_variant9();
let _ = Enum2::new_variant10();
}

View file

@ -23,7 +23,7 @@ LL | Variant6(isize),
| ^^^^^^^^^^^^^^^
error: enum is never used: `Enum3`
--> $DIR/lint-dead-code-5.rs:18:6
--> $DIR/lint-dead-code-5.rs:35:6
|
LL | enum Enum3 {
| ^^^^^

View file

@ -2,8 +2,8 @@
//[noopt]compile-flags: -C opt-level=0
//[opt]compile-flags: -O
//[opt_with_overflow_checks]compile-flags: -C overflow-checks=on -O
// build-pass
// ignore-pass (test emits codegen-time warnings and verifies that they are not errors)
#![crate_type="lib"]
#![warn(arithmetic_overflow, const_err)]