diff options
| author | bors <bors@rust-lang.org> | 2020-04-19 19:53:42 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-04-19 19:53:42 +0000 |
| commit | dbf8b6bf116c7bece2987ff4bd2792f008a6ee77 (patch) | |
| tree | e11bb9180eb09e7685232b2459586803c2ef78d8 | |
| parent | ad48d52a74e3e20fb1ecefaece7312cca90ab950 (diff) | |
| parent | 9fc24430e205a7176ee63d9b5bd3d2832398b109 (diff) | |
| download | rust-dbf8b6bf116c7bece2987ff4bd2792f008a6ee77.tar.gz rust-dbf8b6bf116c7bece2987ff4bd2792f008a6ee77.zip | |
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
| -rw-r--r-- | src/librustc_middle/ty/print/pretty.rs | 8 | ||||
| -rw-r--r-- | src/librustc_passes/dead.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/async-await/issues/issue-67893.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/async-await/issues/issue-67893.stderr | 24 | ||||
| -rw-r--r-- | src/test/ui/consts/array-literal-index-oob.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/consts/const-eval/promoted_errors.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/consts/miri_unleashed/inline_asm.rs | 14 | ||||
| -rw-r--r-- | src/test/ui/consts/miri_unleashed/inline_asm.stderr | 11 | ||||
| -rw-r--r-- | src/test/ui/lint/dead-code/lint-dead-code-5.rs | 20 | ||||
| -rw-r--r-- | src/test/ui/lint/dead-code/lint-dead-code-5.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/lint/lint-exceeding-bitshifts.rs | 2 |
11 files changed, 78 insertions, 13 deletions
diff --git a/src/librustc_middle/ty/print/pretty.rs b/src/librustc_middle/ty/print/pretty.rs index 84360b90470..3bf067ebf1f 100644 --- a/src/librustc_middle/ty/print/pretty.rs +++ b/src/librustc_middle/ty/print/pretty.rs @@ -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(); diff --git a/src/librustc_passes/dead.rs b/src/librustc_passes/dead.rs index e3dd4ddee06..c07087db607 100644 --- a/src/librustc_passes/dead.rs +++ b/src/librustc_passes/dead.rs @@ -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); } diff --git a/src/test/ui/async-await/issues/issue-67893.rs b/src/test/ui/async-await/issues/issue-67893.rs index d52303ac1ce..9679e3807b6 100644 --- a/src/test/ui/async-await/issues/issue-67893.rs +++ b/src/test/ui/async-await/issues/issue-67893.rs @@ -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; diff --git a/src/test/ui/async-await/issues/issue-67893.stderr b/src/test/ui/async-await/issues/issue-67893.stderr new file mode 100644 index 00000000000..343a35a1663 --- /dev/null +++ b/src/test/ui/async-await/issues/issue-67893.stderr @@ -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`. diff --git a/src/test/ui/consts/array-literal-index-oob.rs b/src/test/ui/consts/array-literal-index-oob.rs index 492afa9372c..f36ebf38db4 100644 --- a/src/test/ui/consts/array-literal-index-oob.rs +++ b/src/test/ui/consts/array-literal-index-oob.rs @@ -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)] diff --git a/src/test/ui/consts/const-eval/promoted_errors.rs b/src/test/ui/consts/const-eval/promoted_errors.rs index 3ab6ce28478..142ce75eebc 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.rs +++ b/src/test/ui/consts/const-eval/promoted_errors.rs @@ -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)] diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.rs b/src/test/ui/consts/miri_unleashed/inline_asm.rs new file mode 100644 index 00000000000..f5613102562 --- /dev/null +++ b/src/test/ui/consts/miri_unleashed/inline_asm.rs @@ -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 +}; diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.stderr b/src/test/ui/consts/miri_unleashed/inline_asm.stderr new file mode 100644 index 00000000000..3cbdd326c82 --- /dev/null +++ b/src/test/ui/consts/miri_unleashed/inline_asm.stderr @@ -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`. diff --git a/src/test/ui/lint/dead-code/lint-dead-code-5.rs b/src/test/ui/lint/dead-code/lint-dead-code-5.rs index 764a23e4e49..b477c97c545 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-5.rs +++ b/src/test/ui/lint/dead-code/lint-dead-code-5.rs @@ -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(); } diff --git a/src/test/ui/lint/dead-code/lint-dead-code-5.stderr b/src/test/ui/lint/dead-code/lint-dead-code-5.stderr index c0de4691020..519add82627 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-5.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-5.stderr @@ -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 { | ^^^^^ diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.rs b/src/test/ui/lint/lint-exceeding-bitshifts.rs index 5d0cfd3ab78..47e934baf25 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.rs +++ b/src/test/ui/lint/lint-exceeding-bitshifts.rs @@ -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)] |
