Skip to content

Commit

Permalink
Auto merge of rust-lang#71331 - Dylan-DPC:rollup-5rn1isc, r=Dylan-DPC
Browse files Browse the repository at this point in the history
Rollup of 4 pull requests

Successful merges:

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

Failed merges:

r? @ghost
  • Loading branch information
bors committed Apr 19, 2020
2 parents ad48d52 + 9fc2443 commit dbf8b6b
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 13 deletions.
8 changes: 2 additions & 6 deletions src/librustc_middle/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_passes/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/async-await/issues/issue-67893.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
24 changes: 24 additions & 0 deletions src/test/ui/async-await/issues/issue-67893.stderr
Original file line number Diff line number Diff line change
@@ -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`.
2 changes: 1 addition & 1 deletion src/test/ui/consts/array-literal-index-oob.rs
Original file line number Diff line number Diff line change
@@ -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)]

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/const-eval/promoted_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]

Expand Down
14 changes: 14 additions & 0 deletions src/test/ui/consts/miri_unleashed/inline_asm.rs
Original file line number Diff line number Diff line change
@@ -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
};
11 changes: 11 additions & 0 deletions src/test/ui/consts/miri_unleashed/inline_asm.stderr
Original file line number Diff line number Diff line change
@@ -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`.
20 changes: 20 additions & 0 deletions src/test/ui/lint/dead-code/lint-dead-code-5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
}
2 changes: 1 addition & 1 deletion src/test/ui/lint/dead-code/lint-dead-code-5.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
| ^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/lint/lint-exceeding-bitshifts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit dbf8b6b

Please sign in to comment.