From 77e6c56ab6f108fdbb8acbd176497be9f074af9a Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Thu, 1 Oct 2020 11:03:16 -0700 Subject: [PATCH 01/22] Unify `&mut` and `&raw mut` const-checking errors --- .../src/transform/check_consts/ops.rs | 38 ++++++------------- .../src/transform/check_consts/validation.rs | 6 ++- 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/compiler/rustc_mir/src/transform/check_consts/ops.rs b/compiler/rustc_mir/src/transform/check_consts/ops.rs index 25ed7859d2187..8eaa8fb7e1db0 100644 --- a/compiler/rustc_mir/src/transform/check_consts/ops.rs +++ b/compiler/rustc_mir/src/transform/check_consts/ops.rs @@ -235,7 +235,8 @@ impl NonConstOp for CellBorrow { } #[derive(Debug)] -pub struct MutBorrow; +pub struct MutBorrow(pub hir::BorrowKind); + impl NonConstOp for MutBorrow { fn status_in_item(&self, ccx: &ConstCx<'_, '_>) -> Status { // Forbid everywhere except in const fn with a feature gate @@ -247,22 +248,28 @@ impl NonConstOp for MutBorrow { } fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> { + let raw = match self.0 { + hir::BorrowKind::Raw => "raw ", + hir::BorrowKind::Ref => "", + }; + let mut err = if ccx.const_kind() == hir::ConstContext::ConstFn { feature_err( &ccx.tcx.sess.parse_sess, sym::const_mut_refs, span, - &format!("mutable references are not allowed in {}s", ccx.const_kind()), + &format!("{}mutable references are not allowed in {}s", raw, ccx.const_kind()), ) } else { let mut err = struct_span_err!( ccx.tcx.sess, span, E0764, - "mutable references are not allowed in {}s", + "{}mutable references are not allowed in {}s", + raw, ccx.const_kind(), ); - err.span_label(span, format!("`&mut` is only allowed in `const fn`")); + err.span_label(span, format!("`&{}mut` is only allowed in `const fn`", raw)); err }; if ccx.tcx.sess.teach(&err.get_code().unwrap()) { @@ -281,29 +288,6 @@ impl NonConstOp for MutBorrow { } } -// FIXME(ecstaticmorse): Unify this with `MutBorrow`. It has basically the same issues. -#[derive(Debug)] -pub struct MutAddressOf; -impl NonConstOp for MutAddressOf { - fn status_in_item(&self, ccx: &ConstCx<'_, '_>) -> Status { - // Forbid everywhere except in const fn with a feature gate - if ccx.const_kind() == hir::ConstContext::ConstFn { - Status::Unstable(sym::const_mut_refs) - } else { - Status::Forbidden - } - } - - fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> { - feature_err( - &ccx.tcx.sess.parse_sess, - sym::const_mut_refs, - span, - &format!("`&raw mut` is not allowed in {}s", ccx.const_kind()), - ) - } -} - #[derive(Debug)] pub struct MutDeref; impl NonConstOp for MutDeref { diff --git a/compiler/rustc_mir/src/transform/check_consts/validation.rs b/compiler/rustc_mir/src/transform/check_consts/validation.rs index ab63fd03a336e..462fafcf1b58c 100644 --- a/compiler/rustc_mir/src/transform/check_consts/validation.rs +++ b/compiler/rustc_mir/src/transform/check_consts/validation.rs @@ -522,14 +522,16 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> { if !is_allowed { if let BorrowKind::Mut { .. } = kind { - self.check_op(ops::MutBorrow); + self.check_op(ops::MutBorrow(hir::BorrowKind::Ref)); } else { self.check_op(ops::CellBorrow); } } } - Rvalue::AddressOf(Mutability::Mut, _) => self.check_op(ops::MutAddressOf), + Rvalue::AddressOf(Mutability::Mut, _) => { + self.check_op(ops::MutBorrow(hir::BorrowKind::Raw)) + } Rvalue::Ref(_, BorrowKind::Shared | BorrowKind::Shallow, ref place) | Rvalue::AddressOf(Mutability::Not, ref place) => { From c1494d60dbad39c218e7b0825bfe590cc22bf2fa Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Thu, 1 Oct 2020 11:03:52 -0700 Subject: [PATCH 02/22] Bless tests --- src/test/ui/consts/const-address-of-mut.rs | 8 +++--- .../ui/consts/const-address-of-mut.stderr | 26 +++++++------------ src/test/ui/consts/min_const_fn/address_of.rs | 4 +-- .../ui/consts/min_const_fn/address_of.stderr | 4 +-- 4 files changed, 17 insertions(+), 25 deletions(-) diff --git a/src/test/ui/consts/const-address-of-mut.rs b/src/test/ui/consts/const-address-of-mut.rs index fe9188cb4904c..3788088b810b9 100644 --- a/src/test/ui/consts/const-address-of-mut.rs +++ b/src/test/ui/consts/const-address-of-mut.rs @@ -1,14 +1,14 @@ #![feature(raw_ref_op)] -const A: () = { let mut x = 2; &raw mut x; }; //~ ERROR `&raw mut` is not allowed +const A: () = { let mut x = 2; &raw mut x; }; //~ mutable reference -static B: () = { let mut x = 2; &raw mut x; }; //~ ERROR `&raw mut` is not allowed +static B: () = { let mut x = 2; &raw mut x; }; //~ mutable reference -static mut C: () = { let mut x = 2; &raw mut x; }; //~ ERROR `&raw mut` is not allowed +static mut C: () = { let mut x = 2; &raw mut x; }; //~ mutable reference const fn foo() { let mut x = 0; - let y = &raw mut x; //~ ERROR `&raw mut` is not allowed + let y = &raw mut x; //~ mutable reference } fn main() {} diff --git a/src/test/ui/consts/const-address-of-mut.stderr b/src/test/ui/consts/const-address-of-mut.stderr index 1d9a325b0c2a0..ec2dac5a7d16f 100644 --- a/src/test/ui/consts/const-address-of-mut.stderr +++ b/src/test/ui/consts/const-address-of-mut.stderr @@ -1,31 +1,22 @@ -error[E0658]: `&raw mut` is not allowed in constants +error[E0764]: raw mutable references are not allowed in constants --> $DIR/const-address-of-mut.rs:3:32 | LL | const A: () = { let mut x = 2; &raw mut x; }; - | ^^^^^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + | ^^^^^^^^^^ `&raw mut` is only allowed in `const fn` -error[E0658]: `&raw mut` is not allowed in statics +error[E0764]: raw mutable references are not allowed in statics --> $DIR/const-address-of-mut.rs:5:33 | LL | static B: () = { let mut x = 2; &raw mut x; }; - | ^^^^^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + | ^^^^^^^^^^ `&raw mut` is only allowed in `const fn` -error[E0658]: `&raw mut` is not allowed in statics +error[E0764]: raw mutable references are not allowed in statics --> $DIR/const-address-of-mut.rs:7:37 | LL | static mut C: () = { let mut x = 2; &raw mut x; }; - | ^^^^^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + | ^^^^^^^^^^ `&raw mut` is only allowed in `const fn` -error[E0658]: `&raw mut` is not allowed in constant functions +error[E0658]: raw mutable references are not allowed in constant functions --> $DIR/const-address-of-mut.rs:11:13 | LL | let y = &raw mut x; @@ -36,4 +27,5 @@ LL | let y = &raw mut x; error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors have detailed explanations: E0658, E0764. +For more information about an error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/min_const_fn/address_of.rs b/src/test/ui/consts/min_const_fn/address_of.rs index f8506d70b2498..40d1882d7d2ad 100644 --- a/src/test/ui/consts/min_const_fn/address_of.rs +++ b/src/test/ui/consts/min_const_fn/address_of.rs @@ -2,7 +2,7 @@ const fn mutable_address_of_in_const() { let mut a = 0; - let b = &raw mut a; //~ ERROR `&raw mut` is not allowed + let b = &raw mut a; //~ ERROR mutable reference } struct X; @@ -10,7 +10,7 @@ struct X; impl X { const fn inherent_mutable_address_of_in_const() { let mut a = 0; - let b = &raw mut a; //~ ERROR `&raw mut` is not allowed + let b = &raw mut a; //~ ERROR mutable reference } } diff --git a/src/test/ui/consts/min_const_fn/address_of.stderr b/src/test/ui/consts/min_const_fn/address_of.stderr index 4d9d1d79284a8..facc566513c28 100644 --- a/src/test/ui/consts/min_const_fn/address_of.stderr +++ b/src/test/ui/consts/min_const_fn/address_of.stderr @@ -1,4 +1,4 @@ -error[E0658]: `&raw mut` is not allowed in constant functions +error[E0658]: raw mutable references are not allowed in constant functions --> $DIR/address_of.rs:5:13 | LL | let b = &raw mut a; @@ -7,7 +7,7 @@ LL | let b = &raw mut a; = note: see issue #57349 for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable -error[E0658]: `&raw mut` is not allowed in constant functions +error[E0658]: raw mutable references are not allowed in constant functions --> $DIR/address_of.rs:13:17 | LL | let b = &raw mut a; From 7b652d341e9a476658af8a9186972ce73ec38c3c Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Sat, 19 Sep 2020 09:17:53 +0100 Subject: [PATCH 03/22] Haiku: explicitly set CMAKE_SYSTEM_NAME when cross-compiling This resolves issues where the cross-build of LLVM fails because it tries to link to the host's system libraries instead of the target's system libraries. --- src/bootstrap/native.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 6bba00ee85e14..37d6fab070b8e 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -378,6 +378,8 @@ fn configure_cmake( cfg.define("CMAKE_SYSTEM_NAME", "FreeBSD"); } else if target.contains("windows") { cfg.define("CMAKE_SYSTEM_NAME", "Windows"); + } else if target.contains("haiku") { + cfg.define("CMAKE_SYSTEM_NAME", "Haiku"); } // When cross-compiling we should also set CMAKE_SYSTEM_VERSION, but in // that case like CMake we cannot easily determine system version either. From cc0b718aaa35bfb2a9ca5dd59078ae7e54dbc4bb Mon Sep 17 00:00:00 2001 From: Olivia Crain Date: Thu, 15 Oct 2020 08:40:40 -0500 Subject: [PATCH 04/22] Mark inout asm! operands as used in liveness pass --- compiler/rustc_passes/src/liveness.rs | 2 +- src/test/ui/liveness/liveness-issue-77915.rs | 36 ++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/liveness/liveness-issue-77915.rs diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs index ae810b9e79a5f..7288015e17029 100644 --- a/compiler/rustc_passes/src/liveness.rs +++ b/compiler/rustc_passes/src/liveness.rs @@ -1174,7 +1174,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } } hir::InlineAsmOperand::InOut { expr, .. } => { - succ = self.write_place(expr, succ, ACC_READ | ACC_WRITE); + succ = self.write_place(expr, succ, ACC_READ | ACC_WRITE | ACC_USE); } hir::InlineAsmOperand::SplitInOut { out_expr, .. } => { if let Some(expr) = out_expr { diff --git a/src/test/ui/liveness/liveness-issue-77915.rs b/src/test/ui/liveness/liveness-issue-77915.rs new file mode 100644 index 0000000000000..300e4ad8b0106 --- /dev/null +++ b/src/test/ui/liveness/liveness-issue-77915.rs @@ -0,0 +1,36 @@ +// Ensure inout asm! operands are marked as used by the liveness pass + +// only-x86_64 +// check-pass + +#![feature(asm)] +#![allow(dead_code)] +#![deny(unused_variables)] + +// Tests the single variable inout case +unsafe fn rep_movsb(mut dest: *mut u8, mut src: *const u8, mut n: usize) -> *mut u8 { + while n != 0 { + asm!( + "rep movsb", + inout("rcx") n, + inout("rsi") src, + inout("rdi") dest, + ); + } + dest +} + +// Tests the split inout case +unsafe fn rep_movsb2(mut dest: *mut u8, mut src: *const u8, mut n: usize) -> *mut u8 { + while n != 0 { + asm!( + "rep movsb", + inout("rcx") n, + inout("rsi") src => src, + inout("rdi") dest, + ); + } + dest +} + +fn main() {} From fd193f2d7f7ebed086de9977951cac76211533b0 Mon Sep 17 00:00:00 2001 From: Olivia Crain Date: Sat, 17 Oct 2020 16:36:58 -0500 Subject: [PATCH 05/22] Treat InOut variables like other input variables --- compiler/rustc_passes/src/liveness.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs index 7288015e17029..e88b6cb11e5cf 100644 --- a/compiler/rustc_passes/src/liveness.rs +++ b/compiler/rustc_passes/src/liveness.rs @@ -1174,7 +1174,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } } hir::InlineAsmOperand::InOut { expr, .. } => { - succ = self.write_place(expr, succ, ACC_READ | ACC_WRITE | ACC_USE); + succ = self.write_place(expr, succ, ACC_READ | ACC_WRITE); } hir::InlineAsmOperand::SplitInOut { out_expr, .. } => { if let Some(expr) = out_expr { @@ -1199,7 +1199,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } } hir::InlineAsmOperand::InOut { expr, .. } => { - succ = self.propagate_through_place_components(expr, succ); + succ = self.propagate_through_expr(expr, succ); } hir::InlineAsmOperand::SplitInOut { in_expr, out_expr, .. } => { if let Some(expr) = out_expr { From 4e2c59a970695b2809a0f68f2ffe415ebdb04913 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 18 Oct 2020 21:54:59 +0200 Subject: [PATCH 06/22] Greatly improve display for small mobile devices screens --- src/librustdoc/html/static/rustdoc.css | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 8c8a00d47bc07..0ab97ab3f6384 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -1560,6 +1560,41 @@ h4 > .notable-traits { #titles, #titles > div { height: 73px; } + + #main > table:not(.table-display) td { + word-break: break-word; + min-width: 10%; + } + + .search-container > div { + display: block; + width: calc(100% - 37px); + } + + #crate-search { + width: 100%; + border-radius: 4px; + border: 0; + } + + #crate-search + .search-input { + width: calc(100% + 71px); + margin-left: -36px; + } + + #theme-picker, #settings-menu { + padding: 5px; + width: 31px; + height: 31px; + } + + #theme-picker { + margin-top: -2px; + } + + #settings-menu { + top: 7px; + } } h3.notable { From 17c6c5932c8de780fcd1d06aff230e8cc6bca9f8 Mon Sep 17 00:00:00 2001 From: Olivia Crain Date: Sun, 18 Oct 2020 23:51:10 -0500 Subject: [PATCH 07/22] Mark InOut operands as used in RWU table with write_place --- compiler/rustc_passes/src/liveness.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs index e88b6cb11e5cf..7288015e17029 100644 --- a/compiler/rustc_passes/src/liveness.rs +++ b/compiler/rustc_passes/src/liveness.rs @@ -1174,7 +1174,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } } hir::InlineAsmOperand::InOut { expr, .. } => { - succ = self.write_place(expr, succ, ACC_READ | ACC_WRITE); + succ = self.write_place(expr, succ, ACC_READ | ACC_WRITE | ACC_USE); } hir::InlineAsmOperand::SplitInOut { out_expr, .. } => { if let Some(expr) = out_expr { @@ -1199,7 +1199,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } } hir::InlineAsmOperand::InOut { expr, .. } => { - succ = self.propagate_through_expr(expr, succ); + succ = self.propagate_through_place_components(expr, succ); } hir::InlineAsmOperand::SplitInOut { in_expr, out_expr, .. } => { if let Some(expr) = out_expr { From 8f0bceda13ac871dd452841d3b6aa049f9f649a1 Mon Sep 17 00:00:00 2001 From: Olivia Crain Date: Sun, 18 Oct 2020 23:52:15 -0500 Subject: [PATCH 08/22] Refactor liveness-issue-77915 to liveness-asm and improve tests --- src/test/ui/liveness/liveness-asm.rs | 43 ++++++++++++++++++++ src/test/ui/liveness/liveness-asm.stderr | 23 +++++++++++ src/test/ui/liveness/liveness-issue-77915.rs | 36 ---------------- 3 files changed, 66 insertions(+), 36 deletions(-) create mode 100644 src/test/ui/liveness/liveness-asm.rs create mode 100644 src/test/ui/liveness/liveness-asm.stderr delete mode 100644 src/test/ui/liveness/liveness-issue-77915.rs diff --git a/src/test/ui/liveness/liveness-asm.rs b/src/test/ui/liveness/liveness-asm.rs new file mode 100644 index 0000000000000..e64335a8cc589 --- /dev/null +++ b/src/test/ui/liveness/liveness-asm.rs @@ -0,0 +1,43 @@ +// Ensure inout asm! operands are marked as used by the liveness pass + +// check-pass + +#![feature(asm)] +#![allow(dead_code)] +#![warn(unused_assignments)] +#![warn(unused_variables)] + +// Test the single inout case +unsafe fn f1(mut src: *const u8) { + asm!("/*{0}*/", inout(reg) src); //~ WARN value assigned to `src` is never read +} + +unsafe fn f2(mut src: *const u8) -> *const u8 { + asm!("/*{0}*/", inout(reg) src); + src +} + +// Test the split inout case +unsafe fn f3(mut src: *const u8) { + asm!("/*{0}*/", inout(reg) src => src); //~ WARN value assigned to `src` is never read +} + +unsafe fn f4(mut src: *const u8) -> *const u8 { + asm!("/*{0}*/", inout(reg) src => src); + src +} + +// Tests the use of field projections +struct S { + field: *mut u8, +} + +unsafe fn f5(src: &mut S) { + asm!("/*{0}*/", inout(reg) src.field); +} + +unsafe fn f6(src: &mut S) { + asm!("/*{0}*/", inout(reg) src.field => src.field); +} + +fn main() {} diff --git a/src/test/ui/liveness/liveness-asm.stderr b/src/test/ui/liveness/liveness-asm.stderr new file mode 100644 index 0000000000000..b8c04b5c4429e --- /dev/null +++ b/src/test/ui/liveness/liveness-asm.stderr @@ -0,0 +1,23 @@ +warning: value assigned to `src` is never read + --> $DIR/liveness-asm.rs:12:32 + | +LL | asm!("/*{0}*/", inout(reg) src); + | ^^^ + | +note: the lint level is defined here + --> $DIR/liveness-asm.rs:7:9 + | +LL | #![warn(unused_assignments)] + | ^^^^^^^^^^^^^^^^^^ + = help: maybe it is overwritten before being read? + +warning: value assigned to `src` is never read + --> $DIR/liveness-asm.rs:22:39 + | +LL | asm!("/*{0}*/", inout(reg) src => src); + | ^^^ + | + = help: maybe it is overwritten before being read? + +warning: 2 warnings emitted + diff --git a/src/test/ui/liveness/liveness-issue-77915.rs b/src/test/ui/liveness/liveness-issue-77915.rs deleted file mode 100644 index 300e4ad8b0106..0000000000000 --- a/src/test/ui/liveness/liveness-issue-77915.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Ensure inout asm! operands are marked as used by the liveness pass - -// only-x86_64 -// check-pass - -#![feature(asm)] -#![allow(dead_code)] -#![deny(unused_variables)] - -// Tests the single variable inout case -unsafe fn rep_movsb(mut dest: *mut u8, mut src: *const u8, mut n: usize) -> *mut u8 { - while n != 0 { - asm!( - "rep movsb", - inout("rcx") n, - inout("rsi") src, - inout("rdi") dest, - ); - } - dest -} - -// Tests the split inout case -unsafe fn rep_movsb2(mut dest: *mut u8, mut src: *const u8, mut n: usize) -> *mut u8 { - while n != 0 { - asm!( - "rep movsb", - inout("rcx") n, - inout("rsi") src => src, - inout("rdi") dest, - ); - } - dest -} - -fn main() {} From c647735f40c402f674917aff0361d4f3be7a24d8 Mon Sep 17 00:00:00 2001 From: est31 Date: Tue, 20 Oct 2020 19:09:50 +0200 Subject: [PATCH 09/22] rustc_lint: remove unused to_string In this instance, we can just pass a &str slice and save an allocation. --- compiler/rustc_lint/src/types.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index af14f28ff9f46..9da40dd10f823 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -145,9 +145,9 @@ fn lint_overflowing_range_endpoint<'tcx>( // We need to preserve the literal's suffix, // as it may determine typing information. let suffix = match lit.node { - LitKind::Int(_, LitIntType::Signed(s)) => s.name_str().to_string(), - LitKind::Int(_, LitIntType::Unsigned(s)) => s.name_str().to_string(), - LitKind::Int(_, LitIntType::Unsuffixed) => "".to_string(), + LitKind::Int(_, LitIntType::Signed(s)) => s.name_str(), + LitKind::Int(_, LitIntType::Unsigned(s)) => s.name_str(), + LitKind::Int(_, LitIntType::Unsuffixed) => "", _ => bug!(), }; let suggestion = format!("{}..={}{}", start, lit_val - 1, suffix); From 00d23cf220a46adad99291a33557ce53fbb173ef Mon Sep 17 00:00:00 2001 From: est31 Date: Tue, 20 Oct 2020 19:36:44 +0200 Subject: [PATCH 10/22] Make {u,}int_range functions a bit nicer .into() guarantees safety of the conversion. Furthermore, the minimum value of all uints is known to be 0. --- compiler/rustc_lint/src/types.rs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 9da40dd10f823..b502bd7f7a1bd 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -170,24 +170,25 @@ fn lint_overflowing_range_endpoint<'tcx>( // warnings are consistent between 32- and 64-bit platforms. fn int_ty_range(int_ty: ast::IntTy) -> (i128, i128) { match int_ty { - ast::IntTy::Isize => (i64::MIN as i128, i64::MAX as i128), - ast::IntTy::I8 => (i8::MIN as i64 as i128, i8::MAX as i128), - ast::IntTy::I16 => (i16::MIN as i64 as i128, i16::MAX as i128), - ast::IntTy::I32 => (i32::MIN as i64 as i128, i32::MAX as i128), - ast::IntTy::I64 => (i64::MIN as i128, i64::MAX as i128), - ast::IntTy::I128 => (i128::MIN as i128, i128::MAX), + ast::IntTy::Isize => (i64::MIN.into(), i64::MAX.into()), + ast::IntTy::I8 => (i8::MIN.into(), i8::MAX.into()), + ast::IntTy::I16 => (i16::MIN.into(), i16::MAX.into()), + ast::IntTy::I32 => (i32::MIN.into(), i32::MAX.into()), + ast::IntTy::I64 => (i64::MIN.into(), i64::MAX.into()), + ast::IntTy::I128 => (i128::MIN, i128::MAX), } } fn uint_ty_range(uint_ty: ast::UintTy) -> (u128, u128) { - match uint_ty { - ast::UintTy::Usize => (u64::MIN as u128, u64::MAX as u128), - ast::UintTy::U8 => (u8::MIN as u128, u8::MAX as u128), - ast::UintTy::U16 => (u16::MIN as u128, u16::MAX as u128), - ast::UintTy::U32 => (u32::MIN as u128, u32::MAX as u128), - ast::UintTy::U64 => (u64::MIN as u128, u64::MAX as u128), - ast::UintTy::U128 => (u128::MIN, u128::MAX), - } + let max = match uint_ty { + ast::UintTy::Usize => u64::MAX.into(), + ast::UintTy::U8 => u8::MAX.into(), + ast::UintTy::U16 => u16::MAX.into(), + ast::UintTy::U32 => u32::MAX.into(), + ast::UintTy::U64 => u64::MAX.into(), + ast::UintTy::U128 => u128::MAX, + }; + (0, max) } fn get_bin_hex_repr(cx: &LateContext<'_>, lit: &hir::Lit) -> Option { From fa094044a98dade4ac2dffe1f1e4383b34bb03ff Mon Sep 17 00:00:00 2001 From: bishtpawan Date: Tue, 20 Oct 2020 23:13:21 +0530 Subject: [PATCH 11/22] Fix build failure of rustfmt --- compiler/rustc_mir_build/src/lints.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_mir_build/src/lints.rs b/compiler/rustc_mir_build/src/lints.rs index bdef02a011bac..b588bc1ad837e 100644 --- a/compiler/rustc_mir_build/src/lints.rs +++ b/compiler/rustc_mir_build/src/lints.rs @@ -71,11 +71,12 @@ impl<'mir, 'tcx> Search<'mir, 'tcx> { let func_ty = func.ty(body, tcx); if let ty::FnDef(callee, substs) = *func_ty.kind() { + let normalized_substs = tcx.normalize_erasing_regions(param_env, substs); let (callee, call_substs) = - if let Ok(Some(instance)) = Instance::resolve(tcx, param_env, callee, substs) { + if let Ok(Some(instance)) = Instance::resolve(tcx, param_env, callee, normalized_substs) { (instance.def_id(), instance.substs) } else { - (callee, substs) + (callee, normalized_substs) }; // FIXME(#57965): Make this work across function boundaries From 3adac0391b543b8563298242aeeba6ade8f72944 Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Tue, 20 Oct 2020 20:55:37 -0400 Subject: [PATCH 12/22] Add test case for #77062 Closes #77062 --- src/test/ui/consts/issue-77062-large-zst-array.rs | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/test/ui/consts/issue-77062-large-zst-array.rs diff --git a/src/test/ui/consts/issue-77062-large-zst-array.rs b/src/test/ui/consts/issue-77062-large-zst-array.rs new file mode 100644 index 0000000000000..0566b802e75b6 --- /dev/null +++ b/src/test/ui/consts/issue-77062-large-zst-array.rs @@ -0,0 +1,5 @@ +// build-pass + +fn main() { + let _ = &[(); usize::MAX]; +} From 2720b2da18ef9a0cd0b5ec9ebafc09b68e3cfb7a Mon Sep 17 00:00:00 2001 From: Olivia Crain Date: Wed, 21 Oct 2020 00:34:01 -0500 Subject: [PATCH 13/22] Limit liveness-asm tests to x86_64 --- src/test/ui/liveness/liveness-asm.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/ui/liveness/liveness-asm.rs b/src/test/ui/liveness/liveness-asm.rs index e64335a8cc589..b51da0e0d8cdd 100644 --- a/src/test/ui/liveness/liveness-asm.rs +++ b/src/test/ui/liveness/liveness-asm.rs @@ -1,5 +1,6 @@ // Ensure inout asm! operands are marked as used by the liveness pass +// only-x86_64 // check-pass #![feature(asm)] From dc29c7a72f63dcad65e5ec3899a0eb114798bdfd Mon Sep 17 00:00:00 2001 From: Olivia Crain Date: Wed, 21 Oct 2020 00:56:22 -0500 Subject: [PATCH 14/22] Bless liveness-asm output --- src/test/ui/liveness/liveness-asm.stderr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/ui/liveness/liveness-asm.stderr b/src/test/ui/liveness/liveness-asm.stderr index b8c04b5c4429e..f385d7a8065b6 100644 --- a/src/test/ui/liveness/liveness-asm.stderr +++ b/src/test/ui/liveness/liveness-asm.stderr @@ -1,18 +1,18 @@ warning: value assigned to `src` is never read - --> $DIR/liveness-asm.rs:12:32 + --> $DIR/liveness-asm.rs:13:32 | LL | asm!("/*{0}*/", inout(reg) src); | ^^^ | note: the lint level is defined here - --> $DIR/liveness-asm.rs:7:9 + --> $DIR/liveness-asm.rs:8:9 | LL | #![warn(unused_assignments)] | ^^^^^^^^^^^^^^^^^^ = help: maybe it is overwritten before being read? warning: value assigned to `src` is never read - --> $DIR/liveness-asm.rs:22:39 + --> $DIR/liveness-asm.rs:23:39 | LL | asm!("/*{0}*/", inout(reg) src => src); | ^^^ From 7f5847735a85b474d0ce8627665e2015fb2c7b56 Mon Sep 17 00:00:00 2001 From: bishtpawan Date: Wed, 21 Oct 2020 11:42:52 +0530 Subject: [PATCH 15/22] Fix formatting --- compiler/rustc_mir_build/src/lints.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_mir_build/src/lints.rs b/compiler/rustc_mir_build/src/lints.rs index b588bc1ad837e..a9620b83124e0 100644 --- a/compiler/rustc_mir_build/src/lints.rs +++ b/compiler/rustc_mir_build/src/lints.rs @@ -72,12 +72,13 @@ impl<'mir, 'tcx> Search<'mir, 'tcx> { let func_ty = func.ty(body, tcx); if let ty::FnDef(callee, substs) = *func_ty.kind() { let normalized_substs = tcx.normalize_erasing_regions(param_env, substs); - let (callee, call_substs) = - if let Ok(Some(instance)) = Instance::resolve(tcx, param_env, callee, normalized_substs) { - (instance.def_id(), instance.substs) - } else { - (callee, normalized_substs) - }; + let (callee, call_substs) = if let Ok(Some(instance)) = + Instance::resolve(tcx, param_env, callee, normalized_substs) + { + (instance.def_id(), instance.substs) + } else { + (callee, normalized_substs) + }; // FIXME(#57965): Make this work across function boundaries From 51de5908c94056f54cd54a1b03c84efea2b40b19 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 21 Oct 2020 16:30:41 +0200 Subject: [PATCH 16/22] Add tracking issue number for pin_static_ref. --- library/core/src/pin.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/pin.rs b/library/core/src/pin.rs index b73cd046e5a65..0b9c733f7fead 100644 --- a/library/core/src/pin.rs +++ b/library/core/src/pin.rs @@ -786,7 +786,7 @@ impl Pin<&'static T> { /// /// This is safe, because `T` is borrowed for the `'static` lifetime, which /// never ends. - #[unstable(feature = "pin_static_ref", issue = "none")] + #[unstable(feature = "pin_static_ref", issue = "78186")] #[rustc_const_unstable(feature = "const_pin", issue = "76654")] pub const fn static_ref(r: &'static T) -> Pin<&'static T> { // SAFETY: The 'static borrow guarantees the data will not be @@ -800,7 +800,7 @@ impl Pin<&'static mut T> { /// /// This is safe, because `T` is borrowed for the `'static` lifetime, which /// never ends. - #[unstable(feature = "pin_static_ref", issue = "none")] + #[unstable(feature = "pin_static_ref", issue = "78186")] #[rustc_const_unstable(feature = "const_pin", issue = "76654")] pub const fn static_mut(r: &'static mut T) -> Pin<&'static mut T> { // SAFETY: The 'static borrow guarantees the data will not be From d25c97a3f88979490faa0ae07fa4dd1ba26eb5ff Mon Sep 17 00:00:00 2001 From: LeSeulArtichaut Date: Wed, 21 Oct 2020 21:50:08 +0200 Subject: [PATCH 17/22] Add `ControlFlow::is_{break,continue}` methods --- library/core/src/ops/control_flow.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/library/core/src/ops/control_flow.rs b/library/core/src/ops/control_flow.rs index b0c7dc1a51875..3bca3ff97332b 100644 --- a/library/core/src/ops/control_flow.rs +++ b/library/core/src/ops/control_flow.rs @@ -32,6 +32,20 @@ impl Try for ControlFlow { } impl ControlFlow { + /// Returns `true` if this is a `Break` variant. + #[inline] + #[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")] + pub fn is_break(&self) -> bool { + matches!(*self, ControlFlow::Break(_)) + } + + /// Returns `true` if this is a `Continue` variant. + #[inline] + #[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")] + pub fn is_continue(&self) -> bool { + matches!(*self, ControlFlow::Continue(_)) + } + /// Converts the `ControlFlow` into an `Option` which is `Some` if the /// `ControlFlow` was `Break` and `None` otherwise. #[inline] From 6b52603a49187e8ec1712bab2a7c0b87108fa89c Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 5 Oct 2020 00:28:05 +0100 Subject: [PATCH 18/22] Support signed integers and `char` in v0 mangling --- compiler/rustc_symbol_mangling/src/v0.rs | 26 +++++-- src/test/ui/symbol-names/const-generics.rs | 87 ++++++++++++++++++++++ 2 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 src/test/ui/symbol-names/const-generics.rs diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs index 16d0b86903ea8..8c6ed7bd14071 100644 --- a/compiler/rustc_symbol_mangling/src/v0.rs +++ b/compiler/rustc_symbol_mangling/src/v0.rs @@ -4,6 +4,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId}; use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData}; +use rustc_middle::mir::interpret::sign_extend; use rustc_middle::ty::print::{Print, Printer}; use rustc_middle::ty::subst::{GenericArg, GenericArgKind, Subst}; use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable}; @@ -527,17 +528,30 @@ impl Printer<'tcx> for SymbolMangler<'tcx> { } let start = self.out.len(); - match ct.ty.kind() { - ty::Uint(_) => {} - ty::Bool => {} + let mut neg = false; + let val = match ct.ty.kind() { + ty::Uint(_) | ty::Bool | ty::Char => { + ct.try_eval_bits(self.tcx, ty::ParamEnv::reveal_all(), ct.ty) + } + ty::Int(_) => { + let param_env = ty::ParamEnv::reveal_all(); + ct.try_eval_bits(self.tcx, param_env, ct.ty).and_then(|b| { + let sz = self.tcx.layout_of(param_env.and(ct.ty)).ok()?.size; + let val = sign_extend(b, sz) as i128; + if val < 0 { + neg = true; + } + Some(val.wrapping_abs() as u128) + }) + } _ => { bug!("symbol_names: unsupported constant of type `{}` ({:?})", ct.ty, ct); } - } + }; self = ct.ty.print(self)?; - if let Some(bits) = ct.try_eval_bits(self.tcx, ty::ParamEnv::reveal_all(), ct.ty) { - let _ = write!(self.out, "{:x}_", bits); + if let Some(bits) = val { + let _ = write!(self.out, "{}{:x}_", if neg { "n" } else { "" }, bits); } else { // NOTE(eddyb) despite having the path, we need to // encode a placeholder, as the path could refer diff --git a/src/test/ui/symbol-names/const-generics.rs b/src/test/ui/symbol-names/const-generics.rs new file mode 100644 index 0000000000000..ad87000228d04 --- /dev/null +++ b/src/test/ui/symbol-names/const-generics.rs @@ -0,0 +1,87 @@ +// check-pass +// revisions: legacy v0 +//[legacy]compile-flags: -Z symbol-mangling-version=legacy --crate-type=lib + //[v0]compile-flags: -Z symbol-mangling-version=v0 --crate-type=lib + + #![feature(min_const_generics)] + + // `char` + pub struct Char; + + impl Char<'A'> { + pub fn foo() {} + } + + impl Char { + pub fn bar() {} + } + + // `i8` + pub struct I8; + + impl I8<{std::i8::MIN}> { + pub fn foo() {} + } + + impl I8<{std::i8::MAX}> { + pub fn foo() {} + } + + impl I8 { + pub fn bar() {} + } + + // `i16` + pub struct I16; + + impl I16<{std::i16::MIN}> { + pub fn foo() {} + } + + impl I16 { + pub fn bar() {} + } + + // `i32` + pub struct I32; + + impl I32<{std::i32::MIN}> { + pub fn foo() {} + } + + impl I32 { + pub fn bar() {} + } + + // `i64` + pub struct I64; + + impl I64<{std::i64::MIN}> { + pub fn foo() {} + } + + impl I64 { + pub fn bar() {} + } + + // `i128` + pub struct I128; + + impl I128<{std::i128::MIN}> { + pub fn foo() {} + } + + impl I128 { + pub fn bar() {} + } + + // `isize` + pub struct ISize; + + impl ISize<3> { + pub fn foo() {} + } + + impl ISize { + pub fn bar() {} + } From 37c00c41f82e50c3b3ca43326faa6ccb909fb2b5 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 7 Oct 2020 19:31:23 +0100 Subject: [PATCH 19/22] Do not print type for placeholder values --- compiler/rustc_symbol_mangling/src/v0.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs index 8c6ed7bd14071..7833385cbc996 100644 --- a/compiler/rustc_symbol_mangling/src/v0.rs +++ b/compiler/rustc_symbol_mangling/src/v0.rs @@ -548,9 +548,10 @@ impl Printer<'tcx> for SymbolMangler<'tcx> { bug!("symbol_names: unsupported constant of type `{}` ({:?})", ct.ty, ct); } }; - self = ct.ty.print(self)?; if let Some(bits) = val { + // We only print the type if the const can be evaluated. + self = ct.ty.print(self)?; let _ = write!(self.out, "{}{:x}_", if neg { "n" } else { "" }, bits); } else { // NOTE(eddyb) despite having the path, we need to From 2b9d22d3a9a6fa3c2288450bedb54546dbe59402 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 7 Oct 2020 20:52:02 +0100 Subject: [PATCH 20/22] Update rustc-demangle --- Cargo.lock | 4 ++-- compiler/rustc_codegen_llvm/Cargo.toml | 2 +- compiler/rustc_symbol_mangling/Cargo.toml | 2 +- library/std/Cargo.toml | 2 +- src/tools/rust-demangler/Cargo.toml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0d2170a992747..f6483e7e3dbb6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3276,9 +3276,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +checksum = "b2610b7f643d18c87dff3b489950269617e6601a51f1f05aa5daefee36f64f0b" dependencies = [ "compiler_builtins", "rustc-std-workspace-core", diff --git a/compiler/rustc_codegen_llvm/Cargo.toml b/compiler/rustc_codegen_llvm/Cargo.toml index 04792b334d553..3856582dc34ed 100644 --- a/compiler/rustc_codegen_llvm/Cargo.toml +++ b/compiler/rustc_codegen_llvm/Cargo.toml @@ -15,7 +15,7 @@ measureme = "0.7.1" snap = "1" tracing = "0.1" rustc_middle = { path = "../rustc_middle" } -rustc-demangle = "0.1" +rustc-demangle = "0.1.17" rustc_attr = { path = "../rustc_attr" } rustc_codegen_ssa = { path = "../rustc_codegen_ssa" } rustc_data_structures = { path = "../rustc_data_structures" } diff --git a/compiler/rustc_symbol_mangling/Cargo.toml b/compiler/rustc_symbol_mangling/Cargo.toml index c0dacd24c38e6..8956366a26339 100644 --- a/compiler/rustc_symbol_mangling/Cargo.toml +++ b/compiler/rustc_symbol_mangling/Cargo.toml @@ -10,7 +10,7 @@ doctest = false [dependencies] tracing = "0.1" punycode = "0.4.0" -rustc-demangle = "0.1.16" +rustc-demangle = "0.1.17" rustc_ast = { path = "../rustc_ast" } rustc_span = { path = "../rustc_span" } diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index c08828bc0cde9..edd6c0f2046e7 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -24,7 +24,7 @@ hashbrown = { version = "0.9.0", default-features = false, features = ['rustc-de # Dependencies of the `backtrace` crate addr2line = { version = "0.13.0", optional = true, default-features = false } -rustc-demangle = { version = "0.1.4", features = ['rustc-dep-of-std'] } +rustc-demangle = { version = "0.1.17", features = ['rustc-dep-of-std'] } miniz_oxide = { version = "0.4.0", optional = true, default-features = false } [dependencies.object] version = "0.20" diff --git a/src/tools/rust-demangler/Cargo.toml b/src/tools/rust-demangler/Cargo.toml index c978bbe20e8c7..ac684a3c47e42 100644 --- a/src/tools/rust-demangler/Cargo.toml +++ b/src/tools/rust-demangler/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] regex = "1.0" -rustc-demangle = "0.1" +rustc-demangle = "0.1.17" [[bin]] name = "rust-demangler" From a797801532359d8019eb89e75e509028327b9763 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 7 Oct 2020 21:17:07 +0100 Subject: [PATCH 21/22] Add test for const generics demangling --- .../symbol-names/const-generics-demangling.rs | 38 ++++++++++ .../const-generics-demangling.stderr | 74 +++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 src/test/ui/symbol-names/const-generics-demangling.rs create mode 100644 src/test/ui/symbol-names/const-generics-demangling.stderr diff --git a/src/test/ui/symbol-names/const-generics-demangling.rs b/src/test/ui/symbol-names/const-generics-demangling.rs new file mode 100644 index 0000000000000..e002124059f83 --- /dev/null +++ b/src/test/ui/symbol-names/const-generics-demangling.rs @@ -0,0 +1,38 @@ +// build-fail +// compile-flags: -Z symbol-mangling-version=v0 + +#![feature(min_const_generics, rustc_attrs)] + +pub struct Unsigned; + +#[rustc_symbol_name] +//~^ ERROR symbol-name(_RMCs4fqI2P2rA04_25const_generics_demanglingINtB0_8UnsignedKhb_E) +//~| ERROR demangling(>) +//~| ERROR demangling-alt(>) +impl Unsigned<11> {} + +pub struct Signed; + +#[rustc_symbol_name] +//~^ ERROR symbol-name(_RMs_Cs4fqI2P2rA04_25const_generics_demanglingINtB2_6SignedKsn98_E) +//~| ERROR demangling(>) +//~| ERROR demangling-alt(>) +impl Signed<-152> {} + +pub struct Bool; + +#[rustc_symbol_name] +//~^ ERROR symbol-name(_RMs0_Cs4fqI2P2rA04_25const_generics_demanglingINtB3_4BoolKb1_E) +//~| ERROR demangling(>) +//~| ERROR demangling-alt(>) +impl Bool {} + +pub struct Char; + +#[rustc_symbol_name] +//~^ ERROR symbol-name(_RMs1_Cs4fqI2P2rA04_25const_generics_demanglingINtB3_4CharKc2202_E) +//~| ERROR demangling(>) +//~| ERROR demangling-alt(>) +impl Char<'∂'> {} + +fn main() {} diff --git a/src/test/ui/symbol-names/const-generics-demangling.stderr b/src/test/ui/symbol-names/const-generics-demangling.stderr new file mode 100644 index 0000000000000..022b3188373c9 --- /dev/null +++ b/src/test/ui/symbol-names/const-generics-demangling.stderr @@ -0,0 +1,74 @@ +error: symbol-name(_RMCs4fqI2P2rA04_25const_generics_demanglingINtB0_8UnsignedKhb_E) + --> $DIR/const-generics-demangling.rs:8:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(>) + --> $DIR/const-generics-demangling.rs:8:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(>) + --> $DIR/const-generics-demangling.rs:8:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs_Cs4fqI2P2rA04_25const_generics_demanglingINtB2_6SignedKsn98_E) + --> $DIR/const-generics-demangling.rs:16:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(>) + --> $DIR/const-generics-demangling.rs:16:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(>) + --> $DIR/const-generics-demangling.rs:16:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs0_Cs4fqI2P2rA04_25const_generics_demanglingINtB3_4BoolKb1_E) + --> $DIR/const-generics-demangling.rs:24:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(>) + --> $DIR/const-generics-demangling.rs:24:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(>) + --> $DIR/const-generics-demangling.rs:24:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs1_Cs4fqI2P2rA04_25const_generics_demanglingINtB3_4CharKc2202_E) + --> $DIR/const-generics-demangling.rs:32:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(>) + --> $DIR/const-generics-demangling.rs:32:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(>) + --> $DIR/const-generics-demangling.rs:32:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 12 previous errors + From 878c97e70c01d588c5a96d04f02b1c9298e94ecc Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 21 Oct 2020 21:11:11 +0100 Subject: [PATCH 22/22] Update to rustc-demangle 0.1.18 --- Cargo.lock | 4 ++-- compiler/rustc_codegen_llvm/Cargo.toml | 2 +- compiler/rustc_symbol_mangling/Cargo.toml | 2 +- library/std/Cargo.toml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f6483e7e3dbb6..a3c4d2493ff18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3276,9 +3276,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2610b7f643d18c87dff3b489950269617e6601a51f1f05aa5daefee36f64f0b" +checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" dependencies = [ "compiler_builtins", "rustc-std-workspace-core", diff --git a/compiler/rustc_codegen_llvm/Cargo.toml b/compiler/rustc_codegen_llvm/Cargo.toml index 3856582dc34ed..586b9d0837425 100644 --- a/compiler/rustc_codegen_llvm/Cargo.toml +++ b/compiler/rustc_codegen_llvm/Cargo.toml @@ -15,7 +15,7 @@ measureme = "0.7.1" snap = "1" tracing = "0.1" rustc_middle = { path = "../rustc_middle" } -rustc-demangle = "0.1.17" +rustc-demangle = "0.1.18" rustc_attr = { path = "../rustc_attr" } rustc_codegen_ssa = { path = "../rustc_codegen_ssa" } rustc_data_structures = { path = "../rustc_data_structures" } diff --git a/compiler/rustc_symbol_mangling/Cargo.toml b/compiler/rustc_symbol_mangling/Cargo.toml index 8956366a26339..3df5f16131922 100644 --- a/compiler/rustc_symbol_mangling/Cargo.toml +++ b/compiler/rustc_symbol_mangling/Cargo.toml @@ -10,7 +10,7 @@ doctest = false [dependencies] tracing = "0.1" punycode = "0.4.0" -rustc-demangle = "0.1.17" +rustc-demangle = "0.1.18" rustc_ast = { path = "../rustc_ast" } rustc_span = { path = "../rustc_span" } diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index edd6c0f2046e7..47b59d4a6772c 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -24,7 +24,7 @@ hashbrown = { version = "0.9.0", default-features = false, features = ['rustc-de # Dependencies of the `backtrace` crate addr2line = { version = "0.13.0", optional = true, default-features = false } -rustc-demangle = { version = "0.1.17", features = ['rustc-dep-of-std'] } +rustc-demangle = { version = "0.1.18", features = ['rustc-dep-of-std'] } miniz_oxide = { version = "0.4.0", optional = true, default-features = false } [dependencies.object] version = "0.20"