diff --git a/compiler/rustc_mir_build/src/build/expr/stmt.rs b/compiler/rustc_mir_build/src/build/expr/stmt.rs index 7419c5b2f7588..46c616ff36241 100644 --- a/compiler/rustc_mir_build/src/build/expr/stmt.rs +++ b/compiler/rustc_mir_build/src/build/expr/stmt.rs @@ -116,22 +116,20 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { // it is usually better to focus on `the_value` rather // than the entirety of block(s) surrounding it. let adjusted_span = (|| { - if let ExprKind::Block { body } = &expr.kind { - if let Some(tail_expr) = body.expr { - let mut expr = &this.thir[tail_expr]; - while let ExprKind::Block { - body: Block { expr: Some(nested_expr), .. }, - } - | ExprKind::Scope { value: nested_expr, .. } = expr.kind - { - expr = &this.thir[nested_expr]; - } - this.block_context.push(BlockFrame::TailExpr { - tail_result_is_ignored: true, - span: expr.span, - }); - return Some(expr.span); + if let ExprKind::Block { body } = &expr.kind && let Some(tail_ex) = body.expr { + let mut expr = &this.thir[tail_ex]; + while let ExprKind::Block { + body: Block { expr: Some(nested_expr), .. }, } + | ExprKind::Scope { value: nested_expr, .. } = expr.kind + { + expr = &this.thir[nested_expr]; + } + this.block_context.push(BlockFrame::TailExpr { + tail_result_is_ignored: true, + span: expr.span, + }); + return Some(expr.span); } None })(); diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index ec8cb30965d75..44fe93ba3630c 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -1597,13 +1597,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } // Insert a Shallow borrow of any places that is switched on. - if let Some(fb) = fake_borrows { - if let Ok(match_place_resolved) = - match_place.clone().try_upvars_resolved(self.tcx, self.typeck_results) - { - let resolved_place = match_place_resolved.into_place(self.tcx, self.typeck_results); - fb.insert(resolved_place); - } + if let Some(fb) = fake_borrows && let Ok(match_place_resolved) = + match_place.clone().try_upvars_resolved(self.tcx, self.typeck_results) + { + let resolved_place = match_place_resolved.into_place(self.tcx, self.typeck_results); + fb.insert(resolved_place); } // perform the test, branching to one of N blocks. For each of diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs index f2f85043df292..393e67f21bfe2 100644 --- a/compiler/rustc_mir_build/src/build/mod.rs +++ b/compiler/rustc_mir_build/src/build/mod.rs @@ -877,14 +877,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let arg_local = self.local_decls.push(LocalDecl::with_source_info(ty, source_info)); // If this is a simple binding pattern, give debuginfo a nice name. - if let Some(arg) = arg_opt { - if let Some(ident) = arg.pat.simple_ident() { - self.var_debug_info.push(VarDebugInfo { - name: ident.name, - source_info, - value: VarDebugInfoContents::Place(arg_local.into()), - }); - } + if let Some(arg) = arg_opt && let Some(ident) = arg.pat.simple_ident() { + self.var_debug_info.push(VarDebugInfo { + name: ident.name, + source_info, + value: VarDebugInfoContents::Place(arg_local.into()), + }); } } diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index 8ca2449cea9c4..b40d3e453e931 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -416,23 +416,21 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> { } ExprKind::Field { lhs, .. } => { let lhs = &self.thir[lhs]; - if let ty::Adt(adt_def, _) = lhs.ty.kind() { - if adt_def.is_union() { - if let Some((assigned_ty, assignment_span)) = self.assignment_info { - // To avoid semver hazard, we only consider `Copy` and `ManuallyDrop` non-dropping. - if !(assigned_ty - .ty_adt_def() - .map_or(false, |adt| adt.is_manually_drop()) - || assigned_ty - .is_copy_modulo_regions(self.tcx.at(expr.span), self.param_env)) - { - self.requires_unsafe(assignment_span, AssignToDroppingUnionField); - } else { - // write to non-drop union field, safe - } + if let ty::Adt(adt_def, _) = lhs.ty.kind() && adt_def.is_union() { + if let Some((assigned_ty, assignment_span)) = self.assignment_info { + // To avoid semver hazard, we only consider `Copy` and `ManuallyDrop` non-dropping. + if !(assigned_ty + .ty_adt_def() + .map_or(false, |adt| adt.is_manually_drop()) + || assigned_ty + .is_copy_modulo_regions(self.tcx.at(expr.span), self.param_env)) + { + self.requires_unsafe(assignment_span, AssignToDroppingUnionField); } else { - self.requires_unsafe(expr.span, AccessToUnionField); + // write to non-drop union field, safe } + } else { + self.requires_unsafe(expr.span, AccessToUnionField); } } } @@ -476,10 +474,8 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> { } ExprKind::Let { expr: expr_id, .. } => { let let_expr = &self.thir[expr_id]; - if let ty::Adt(adt_def, _) = let_expr.ty.kind() { - if adt_def.is_union() { - self.requires_unsafe(expr.span, AccessToUnionField); - } + if let ty::Adt(adt_def, _) = let_expr.ty.kind() && adt_def.is_union() { + self.requires_unsafe(expr.span, AccessToUnionField); } } _ => {} diff --git a/compiler/rustc_mir_build/src/lib.rs b/compiler/rustc_mir_build/src/lib.rs index 9dea67e176266..6687e1160ede8 100644 --- a/compiler/rustc_mir_build/src/lib.rs +++ b/compiler/rustc_mir_build/src/lib.rs @@ -1,15 +1,16 @@ //! Construction of MIR from HIR. //! //! This crate also contains the match exhaustiveness and usefulness checking. +#![allow(rustc::potential_query_instability)] +#![feature(bool_to_option)] #![feature(box_patterns)] #![feature(control_flow_enum)] #![feature(crate_visibility_modifier)] -#![feature(bool_to_option)] +#![feature(let_chains)] #![feature(let_else)] -#![feature(once_cell)] #![feature(min_specialization)] +#![feature(once_cell)] #![recursion_limit = "256"] -#![allow(rustc::potential_query_instability)] #[macro_use] extern crate tracing; diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index 2663ed9049da9..c6026a6ab4b96 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -315,47 +315,43 @@ fn check_for_bindings_named_same_as_variants( rf: RefutableFlag, ) { pat.walk_always(|p| { - if let hir::PatKind::Binding(_, _, ident, None) = p.kind { - if let Some(ty::BindByValue(hir::Mutability::Not)) = + if let hir::PatKind::Binding(_, _, ident, None) = p.kind + && let Some(ty::BindByValue(hir::Mutability::Not)) = cx.typeck_results.extract_binding_mode(cx.tcx.sess, p.hir_id, p.span) - { - let pat_ty = cx.typeck_results.pat_ty(p).peel_refs(); - if let ty::Adt(edef, _) = pat_ty.kind() { - if edef.is_enum() - && edef.variants.iter().any(|variant| { - variant.ident(cx.tcx) == ident && variant.ctor_kind == CtorKind::Const - }) - { - let variant_count = edef.variants.len(); - cx.tcx.struct_span_lint_hir( - BINDINGS_WITH_VARIANT_NAME, - p.hir_id, + && let pat_ty = cx.typeck_results.pat_ty(p).peel_refs() + && let ty::Adt(edef, _) = pat_ty.kind() + && edef.is_enum() + && edef.variants.iter().any(|variant| { + variant.ident(cx.tcx) == ident && variant.ctor_kind == CtorKind::Const + }) + { + let variant_count = edef.variants.len(); + cx.tcx.struct_span_lint_hir( + BINDINGS_WITH_VARIANT_NAME, + p.hir_id, + p.span, + |lint| { + let ty_path = cx.tcx.def_path_str(edef.did); + let mut err = lint.build(&format!( + "pattern binding `{}` is named the same as one \ + of the variants of the type `{}`", + ident, ty_path + )); + err.code(error_code!(E0170)); + // If this is an irrefutable pattern, and there's > 1 variant, + // then we can't actually match on this. Applying the below + // suggestion would produce code that breaks on `check_irrefutable`. + if rf == Refutable || variant_count == 1 { + err.span_suggestion( p.span, - |lint| { - let ty_path = cx.tcx.def_path_str(edef.did); - let mut err = lint.build(&format!( - "pattern binding `{}` is named the same as one \ - of the variants of the type `{}`", - ident, ty_path - )); - err.code(error_code!(E0170)); - // If this is an irrefutable pattern, and there's > 1 variant, - // then we can't actually match on this. Applying the below - // suggestion would produce code that breaks on `check_irrefutable`. - if rf == Refutable || variant_count == 1 { - err.span_suggestion( - p.span, - "to match on the variant, qualify the path", - format!("{}::{}", ty_path, ident), - Applicability::MachineApplicable, - ); - } - err.emit(); - }, - ) + "to match on the variant, qualify the path", + format!("{}::{}", ty_path, ident), + Applicability::MachineApplicable, + ); } - } - } + err.emit(); + }, + ) } }); } @@ -622,10 +618,8 @@ fn maybe_point_at_variant<'a, 'p: 'a, 'tcx: 'a>( let mut covered = vec![]; for pattern in patterns { if let Variant(variant_index) = pattern.ctor() { - if let ty::Adt(this_def, _) = pattern.ty().kind() { - if this_def.did != def.did { - continue; - } + if let ty::Adt(this_def, _) = pattern.ty().kind() && this_def.did != def.did { + continue; } let sp = def.variants[*variant_index].ident(cx.tcx).span; if covered.contains(&sp) { diff --git a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs index 1c4c668c0f273..002c0b5f7d8ed 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs @@ -680,15 +680,13 @@ impl<'tcx> Constructor<'tcx> { /// /// This means that the variant has a stdlib unstable feature marking it. pub(super) fn is_unstable_variant(&self, pcx: PatCtxt<'_, '_, 'tcx>) -> bool { - if let Constructor::Variant(idx) = self { - if let ty::Adt(adt, _) = pcx.ty.kind() { - let variant_def_id = adt.variants[*idx].def_id; - // Filter variants that depend on a disabled unstable feature. - return matches!( - pcx.cx.tcx.eval_stability(variant_def_id, None, DUMMY_SP, None), - EvalResult::Deny { .. } - ); - } + if let Constructor::Variant(idx) = self && let ty::Adt(adt, _) = pcx.ty.kind() { + let variant_def_id = adt.variants[*idx].def_id; + // Filter variants that depend on a disabled unstable feature. + return matches!( + pcx.cx.tcx.eval_stability(variant_def_id, None, DUMMY_SP, None), + EvalResult::Deny { .. } + ); } false } @@ -696,11 +694,9 @@ impl<'tcx> Constructor<'tcx> { /// Checks if the `Constructor` is a `Constructor::Variant` with a `#[doc(hidden)]` /// attribute. pub(super) fn is_doc_hidden_variant(&self, pcx: PatCtxt<'_, '_, 'tcx>) -> bool { - if let Constructor::Variant(idx) = self { - if let ty::Adt(adt, _) = pcx.ty.kind() { - let variant_def_id = adt.variants[*idx].def_id; - return pcx.cx.tcx.is_doc_hidden(variant_def_id); - } + if let Constructor::Variant(idx) = self && let ty::Adt(adt, _) = pcx.ty.kind() { + let variant_def_id = adt.variants[*idx].def_id; + return pcx.cx.tcx.is_doc_hidden(variant_def_id); } false } diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs index 0c1daa519ab7c..6282b07e6f086 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs @@ -790,16 +790,14 @@ crate fn compare_const_vals<'tcx>( }; } - if let ty::Str = ty.kind() { - if let ( - ty::ConstKind::Value(a_val @ ConstValue::Slice { .. }), - ty::ConstKind::Value(b_val @ ConstValue::Slice { .. }), - ) = (a.val(), b.val()) - { - let a_bytes = get_slice_bytes(&tcx, a_val); - let b_bytes = get_slice_bytes(&tcx, b_val); - return from_bool(a_bytes == b_bytes); - } + if let ty::Str = ty.kind() && let ( + ty::ConstKind::Value(a_val @ ConstValue::Slice { .. }), + ty::ConstKind::Value(b_val @ ConstValue::Slice { .. }), + ) = (a.val(), b.val()) + { + let a_bytes = get_slice_bytes(&tcx, a_val); + let b_bytes = get_slice_bytes(&tcx, b_val); + return from_bool(a_bytes == b_bytes); } fallback() } diff --git a/compiler/rustc_symbol_mangling/src/legacy.rs b/compiler/rustc_symbol_mangling/src/legacy.rs index 47bf0fe122156..6e526bf8fc77a 100644 --- a/compiler/rustc_symbol_mangling/src/legacy.rs +++ b/compiler/rustc_symbol_mangling/src/legacy.rs @@ -216,7 +216,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> { Ok(self) } - fn print_type(self, ty: Ty<'tcx>) -> Result { + fn print_type(mut self, ty: Ty<'tcx>) -> Result { match *ty.kind() { // Print all nominal types as paths (unlike `pretty_print_type`). ty::FnDef(def_id, substs) @@ -224,6 +224,24 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> { | ty::Projection(ty::ProjectionTy { item_def_id: def_id, substs }) | ty::Closure(def_id, substs) | ty::Generator(def_id, substs, _) => self.print_def_path(def_id, substs), + + // The `pretty_print_type` formatting of array size depends on + // -Zverbose flag, so we cannot reuse it here. + ty::Array(ty, size) => { + self.write_str("[")?; + self = self.print_type(ty)?; + self.write_str("; ")?; + if let Some(size) = size.val().try_to_bits(self.tcx().data_layout.pointer_size) { + write!(self, "{}", size)? + } else if let ty::ConstKind::Param(param) = size.val() { + self = param.print(self)? + } else { + self.write_str("_")? + } + self.write_str("]")?; + Ok(self) + } + _ => self.pretty_print_type(ty), } } @@ -245,12 +263,22 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> { fn print_const(self, ct: ty::Const<'tcx>) -> Result { // only print integers - if let ty::ConstKind::Value(ConstValue::Scalar(Scalar::Int { .. })) = ct.val() { - if ct.ty().is_integral() { - return self.pretty_print_const(ct, true); + match (ct.val(), ct.ty().kind()) { + ( + ty::ConstKind::Value(ConstValue::Scalar(Scalar::Int(scalar))), + ty::Int(_) | ty::Uint(_), + ) => { + // The `pretty_print_const` formatting depends on -Zverbose + // flag, so we cannot reuse it here. + let signed = matches!(ct.ty().kind(), ty::Int(_)); + write!( + self, + "{:#?}", + ty::ConstInt::new(scalar, signed, ct.ty().is_ptr_sized_integral()) + )?; } + _ => self.write_str("_")?, } - self.write_str("_")?; Ok(self) } diff --git a/src/test/ui/symbol-names/const-generics-demangling.legacy.stderr b/src/test/ui/symbol-names/const-generics-demangling.legacy.stderr new file mode 100644 index 0000000000000..bebbb7aac981c --- /dev/null +++ b/src/test/ui/symbol-names/const-generics-demangling.legacy.stderr @@ -0,0 +1,74 @@ +error: symbol-name(_ZN1c21Unsigned$LT$11_u8$GT$1f17h[HASH]E) + --> $DIR/const-generics-demangling.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(c::Unsigned<11_u8>::f::h[HASH]) + --> $DIR/const-generics-demangling.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(c::Unsigned<11_u8>::f) + --> $DIR/const-generics-demangling.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1c22Signed$LT$.152_i16$GT$1f17h[HASH]E) + --> $DIR/const-generics-demangling.rs:26:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(c::Signed<.152_i16>::f::h[HASH]) + --> $DIR/const-generics-demangling.rs:26:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(c::Signed<.152_i16>::f) + --> $DIR/const-generics-demangling.rs:26:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1c13Bool$LT$_$GT$1f17h[HASH]E) + --> $DIR/const-generics-demangling.rs:39:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(c::Bool<_>::f::h[HASH]) + --> $DIR/const-generics-demangling.rs:39:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(c::Bool<_>::f) + --> $DIR/const-generics-demangling.rs:39:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1c13Char$LT$_$GT$1f17h[HASH]E) + --> $DIR/const-generics-demangling.rs:52:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(c::Char<_>::f::h[HASH]) + --> $DIR/const-generics-demangling.rs:52:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(c::Char<_>::f) + --> $DIR/const-generics-demangling.rs:52:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 12 previous errors + diff --git a/src/test/ui/symbol-names/const-generics-demangling.rs b/src/test/ui/symbol-names/const-generics-demangling.rs index 5c40c391a9e0b..4a04eca67fd35 100644 --- a/src/test/ui/symbol-names/const-generics-demangling.rs +++ b/src/test/ui/symbol-names/const-generics-demangling.rs @@ -1,38 +1,62 @@ // build-fail -// compile-flags: -C symbol-mangling-version=v0 --crate-name=c -// normalize-stderr-test: "c\[.*?\]" -> "c[HASH]" +// revisions: legacy v0 +// compile-flags: --crate-name=c +//[legacy]compile-flags: -C symbol-mangling-version=legacy -Z unstable-options +// [v0]compile-flags: -C symbol-mangling-version=v0 +//[legacy]normalize-stderr-test: "h[[:xdigit:]]{16}" -> "h[HASH]" +// [v0]normalize-stderr-test: "c\[.*?\]" -> "c[HASH]" #![feature(rustc_attrs)] pub struct Unsigned; -#[rustc_symbol_name] -//~^ ERROR symbol-name(_RMCs -//~| ERROR demangling(>) -impl Unsigned<11> {} +impl Unsigned<11> { + #[rustc_symbol_name] + //[v0]~^ ERROR symbol-name(_RNvMCs + //[v0]~| ERROR demangling(>::f) + //[legacy]~^^^^ ERROR symbol-name(_ZN1c21Unsigned$LT$11_u8$GT$ + //[legacy]~| ERROR demangling(c::Unsigned<11_u8>::f:: + //[legacy]~| ERROR demangling-alt(c::Unsigned<11_u8>::f) + fn f() {} +} pub struct Signed; -#[rustc_symbol_name] -//~^ ERROR symbol-name(_RMs_Cs -//~| ERROR demangling(>) -impl Signed<-152> {} +impl Signed<-152> { + #[rustc_symbol_name] + //[v0]~^ ERROR symbol-name(_RNvMs_Cs + //[v0]~| ERROR demangling(>::f) + //[legacy]~^^^^ ERROR symbol-name(_ZN1c22Signed$LT$.152_i16$GT$ + //[legacy]~| ERROR demangling(c::Signed<.152_i16>::f:: + //[legacy]~| ERROR demangling-alt(c::Signed<.152_i16>::f) + fn f() {} +} pub struct Bool; -#[rustc_symbol_name] -//~^ ERROR symbol-name(_RMs0_Cs -//~| ERROR demangling(>) -impl Bool {} +impl Bool { + #[rustc_symbol_name] + //[v0]~^ ERROR symbol-name(_RNvMs0_Cs + //[v0]~| ERROR demangling(>::f) + //[legacy]~^^^^ ERROR symbol-name(_ZN1c13Bool$LT$_$GT$ + //[legacy]~| ERROR demangling(c::Bool<_>::f:: + //[legacy]~| ERROR demangling-alt(c::Bool<_>::f) + fn f() {} +} pub struct Char; -#[rustc_symbol_name] -//~^ ERROR symbol-name(_RMs1_Cs -//~| ERROR demangling(>) -impl Char<'∂'> {} +impl Char<'∂'> { + #[rustc_symbol_name] + //[v0]~^ ERROR symbol-name(_RNvMs1_Cs + //[v0]~| ERROR demangling(>::f) + //[legacy]~^^^^ ERROR symbol-name(_ZN1c13Char$LT$_$GT$ + //[legacy]~| ERROR demangling(c::Char<_>::f:: + //[legacy]~| ERROR demangling-alt(c::Char<_>::f) + fn f() {} +} fn main() {} diff --git a/src/test/ui/symbol-names/const-generics-demangling.stderr b/src/test/ui/symbol-names/const-generics-demangling.stderr deleted file mode 100644 index 8aa08b8a22c47..0000000000000 --- a/src/test/ui/symbol-names/const-generics-demangling.stderr +++ /dev/null @@ -1,74 +0,0 @@ -error: symbol-name(_RMCsCRATE_HASH_1cINtB_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_CsCRATE_HASH_1cINtB_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_CsCRATE_HASH_1cINtB_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_CsCRATE_HASH_1cINtB_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 - diff --git a/src/test/ui/symbol-names/const-generics-demangling.v0.stderr b/src/test/ui/symbol-names/const-generics-demangling.v0.stderr new file mode 100644 index 0000000000000..7238a849332ad --- /dev/null +++ b/src/test/ui/symbol-names/const-generics-demangling.v0.stderr @@ -0,0 +1,74 @@ +error: symbol-name(_RNvMCsCRATE_HASH_1cINtB_8UnsignedKhb_E1f) + --> $DIR/const-generics-demangling.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(>::f) + --> $DIR/const-generics-demangling.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(>::f) + --> $DIR/const-generics-demangling.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RNvMs_CsCRATE_HASH_1cINtB_6SignedKsn98_E1f) + --> $DIR/const-generics-demangling.rs:26:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(>::f) + --> $DIR/const-generics-demangling.rs:26:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(>::f) + --> $DIR/const-generics-demangling.rs:26:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RNvMs0_CsCRATE_HASH_1cINtB_4BoolKb1_E1f) + --> $DIR/const-generics-demangling.rs:39:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(>::f) + --> $DIR/const-generics-demangling.rs:39:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(>::f) + --> $DIR/const-generics-demangling.rs:39:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RNvMs1_CsCRATE_HASH_1cINtB_4CharKc2202_E1f) + --> $DIR/const-generics-demangling.rs:52:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(>::f) + --> $DIR/const-generics-demangling.rs:52:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(>::f) + --> $DIR/const-generics-demangling.rs:52:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 12 previous errors + diff --git a/src/test/ui/symbol-names/types.legacy.stderr b/src/test/ui/symbol-names/types.legacy.stderr new file mode 100644 index 0000000000000..a4984d5629f7d --- /dev/null +++ b/src/test/ui/symbol-names/types.legacy.stderr @@ -0,0 +1,470 @@ +error: symbol-name(_ZN1a1b16Type$LT$bool$GT$17h[HASH]E) + --> $DIR/types.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b16Type$LT$char$GT$17h[HASH]E) + --> $DIR/types.rs:19:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:19:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:19:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b14Type$LT$i8$GT$17h[HASH]E) + --> $DIR/types.rs:25:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:25:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:25:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$i16$GT$17h[HASH]E) + --> $DIR/types.rs:31:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:31:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:31:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$i32$GT$17h[HASH]E) + --> $DIR/types.rs:37:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:37:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:37:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$i64$GT$17h[HASH]E) + --> $DIR/types.rs:43:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:43:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:43:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b14Type$LT$u8$GT$17h[HASH]E) + --> $DIR/types.rs:49:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:49:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:49:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$u16$GT$17h[HASH]E) + --> $DIR/types.rs:55:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:55:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:55:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$u32$GT$17h[HASH]E) + --> $DIR/types.rs:61:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:61:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:61:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$u64$GT$17h[HASH]E) + --> $DIR/types.rs:67:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:67:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:67:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$f32$GT$17h[HASH]E) + --> $DIR/types.rs:73:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:73:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:73:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$f64$GT$17h[HASH]E) + --> $DIR/types.rs:79:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:79:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:79:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$str$GT$17h[HASH]E) + --> $DIR/types.rs:85:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:85:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:85:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b17Type$LT$$u21$$GT$17h[HASH]E) + --> $DIR/types.rs:91:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:91:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:91:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b20Type$LT$$LP$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:97:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<()>::h[HASH]) + --> $DIR/types.rs:97:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<()>) + --> $DIR/types.rs:97:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b25Type$LT$$LP$u8$C$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:103:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<(u8,)>::h[HASH]) + --> $DIR/types.rs:103:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<(u8,)>) + --> $DIR/types.rs:103:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b28Type$LT$$LP$u8$C$u16$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:109:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<(u8,u16)>::h[HASH]) + --> $DIR/types.rs:109:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<(u8,u16)>) + --> $DIR/types.rs:109:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b34Type$LT$$LP$u8$C$u16$C$u32$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:115:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<(u8,u16,u32)>::h[HASH]) + --> $DIR/types.rs:115:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<(u8,u16,u32)>) + --> $DIR/types.rs:115:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b28Type$LT$$BP$const$u20$u8$GT$17h[HASH]E) + --> $DIR/types.rs:121:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<*const u8>::h[HASH]) + --> $DIR/types.rs:121:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<*const u8>) + --> $DIR/types.rs:121:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b26Type$LT$$BP$mut$u20$u8$GT$17h[HASH]E) + --> $DIR/types.rs:127:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<*mut u8>::h[HASH]) + --> $DIR/types.rs:127:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<*mut u8>) + --> $DIR/types.rs:127:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b19Type$LT$$RF$str$GT$17h[HASH]E) + --> $DIR/types.rs:133:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<&str>::h[HASH]) + --> $DIR/types.rs:133:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<&str>) + --> $DIR/types.rs:133:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b27Type$LT$$RF$mut$u20$str$GT$17h[HASH]E) + --> $DIR/types.rs:139:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<&mut str>::h[HASH]) + --> $DIR/types.rs:139:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<&mut str>) + --> $DIR/types.rs:139:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b35Type$LT$$u5b$u8$u3b$$u20$0$u5d$$GT$17h[HASH]E) + --> $DIR/types.rs:145:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<[u8; 0]>::h[HASH]) + --> $DIR/types.rs:145:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<[u8; 0]>) + --> $DIR/types.rs:145:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b22Type$LT$fn$LP$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:151:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:151:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:151:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b60Type$LT$unsafe$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:157:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:157:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:157:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b34Type$LT$$u5b$T$u3b$$u20$N$u5d$$GT$17h[HASH]E) + --> $DIR/types.rs:163:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<[T; N]>::h[HASH]) + --> $DIR/types.rs:163:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<[T; N]>) + --> $DIR/types.rs:163:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 78 previous errors + diff --git a/src/test/ui/symbol-names/types.rs b/src/test/ui/symbol-names/types.rs new file mode 100644 index 0000000000000..0ae699c93c2de --- /dev/null +++ b/src/test/ui/symbol-names/types.rs @@ -0,0 +1,170 @@ +// build-fail +// revisions: legacy verbose-legacy +// compile-flags: --crate-name=a -C symbol-mangling-version=legacy -Z unstable-options +//[verbose-legacy]compile-flags: -Zverbose +// normalize-stderr-test: "h[[:xdigit:]]{16}" -> "h[HASH]" + +#![feature(never_type)] +#![feature(rustc_attrs)] + +pub fn b() { + struct Type(T); + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b16Type$LT$bool$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b16Type$LT$char$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b14Type$LT$i8$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$i16$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$i32$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$i64$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b14Type$LT$u8$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$u16$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$u32$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$u64$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$f32$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$f64$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$str$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b17Type$LT$$u21$$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b20Type$LT$$LP$$RP$$GT + //~| ERROR demangling(a::b::Type<()>:: + //~| ERROR demangling-alt(a::b::Type<()>) + impl Type<()> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b25Type$LT$$LP$u8$C$$RP$$GT$ + //~| ERROR demangling(a::b::Type<(u8,)>:: + //~| ERROR demangling-alt(a::b::Type<(u8,)>) + impl Type<(u8,)> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b28Type$LT$$LP$u8$C$u16$RP$$GT$ + //~| ERROR demangling(a::b::Type<(u8,u16)>:: + //~| ERROR demangling-alt(a::b::Type<(u8,u16)>) + impl Type<(u8,u16)> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b34Type$LT$$LP$u8$C$u16$C$u32$RP$$GT$ + //~| ERROR demangling(a::b::Type<(u8,u16,u32)>:: + //~| ERROR demangling-alt(a::b::Type<(u8,u16,u32)>) + impl Type<(u8,u16,u32)> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b28Type$LT$$BP$const$u20$u8$GT$ + //~| ERROR demangling(a::b::Type<*const u8>:: + //~| ERROR demangling-alt(a::b::Type<*const u8>) + impl Type<*const u8> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b26Type$LT$$BP$mut$u20$u8$GT$ + //~| ERROR demangling(a::b::Type<*mut u8>:: + //~| ERROR demangling-alt(a::b::Type<*mut u8>) + impl Type<*mut u8> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b19Type$LT$$RF$str$GT$ + //~| ERROR demangling(a::b::Type<&str>:: + //~| ERROR demangling-alt(a::b::Type<&str>) + impl Type<&str> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b27Type$LT$$RF$mut$u20$str$GT$ + //~| ERROR demangling(a::b::Type<&mut str>:: + //~| ERROR demangling-alt(a::b::Type<&mut str>) + impl Type<&mut str> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b35Type$LT$$u5b$u8$u3b$$u20$0$u5d$$GT$ + //~| ERROR demangling(a::b::Type<[u8; 0]>:: + //~| ERROR demangling-alt(a::b::Type<[u8; 0]>) + impl Type<[u8; 0]> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b22Type$LT$fn$LP$$RP$$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b60Type$LT$unsafe$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RP$$GT$ + //~| ERROR demangling(a::b::Type:: + //~| ERROR demangling-alt(a::b::Type) + impl Type {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b34Type$LT$$u5b$T$u3b$$u20$N$u5d$$GT$ + //~| ERROR demangling(a::b::Type<[T; N]>:: + //~| ERROR demangling-alt(a::b::Type<[T; N]>) + impl Type<[T; N]> {} +} + +fn main() {} diff --git a/src/test/ui/symbol-names/types.verbose-legacy.stderr b/src/test/ui/symbol-names/types.verbose-legacy.stderr new file mode 100644 index 0000000000000..a4984d5629f7d --- /dev/null +++ b/src/test/ui/symbol-names/types.verbose-legacy.stderr @@ -0,0 +1,470 @@ +error: symbol-name(_ZN1a1b16Type$LT$bool$GT$17h[HASH]E) + --> $DIR/types.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b16Type$LT$char$GT$17h[HASH]E) + --> $DIR/types.rs:19:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:19:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:19:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b14Type$LT$i8$GT$17h[HASH]E) + --> $DIR/types.rs:25:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:25:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:25:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$i16$GT$17h[HASH]E) + --> $DIR/types.rs:31:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:31:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:31:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$i32$GT$17h[HASH]E) + --> $DIR/types.rs:37:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:37:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:37:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$i64$GT$17h[HASH]E) + --> $DIR/types.rs:43:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:43:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:43:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b14Type$LT$u8$GT$17h[HASH]E) + --> $DIR/types.rs:49:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:49:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:49:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$u16$GT$17h[HASH]E) + --> $DIR/types.rs:55:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:55:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:55:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$u32$GT$17h[HASH]E) + --> $DIR/types.rs:61:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:61:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:61:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$u64$GT$17h[HASH]E) + --> $DIR/types.rs:67:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:67:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:67:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$f32$GT$17h[HASH]E) + --> $DIR/types.rs:73:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:73:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:73:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$f64$GT$17h[HASH]E) + --> $DIR/types.rs:79:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:79:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:79:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$str$GT$17h[HASH]E) + --> $DIR/types.rs:85:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:85:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:85:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b17Type$LT$$u21$$GT$17h[HASH]E) + --> $DIR/types.rs:91:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:91:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:91:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b20Type$LT$$LP$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:97:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<()>::h[HASH]) + --> $DIR/types.rs:97:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<()>) + --> $DIR/types.rs:97:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b25Type$LT$$LP$u8$C$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:103:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<(u8,)>::h[HASH]) + --> $DIR/types.rs:103:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<(u8,)>) + --> $DIR/types.rs:103:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b28Type$LT$$LP$u8$C$u16$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:109:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<(u8,u16)>::h[HASH]) + --> $DIR/types.rs:109:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<(u8,u16)>) + --> $DIR/types.rs:109:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b34Type$LT$$LP$u8$C$u16$C$u32$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:115:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<(u8,u16,u32)>::h[HASH]) + --> $DIR/types.rs:115:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<(u8,u16,u32)>) + --> $DIR/types.rs:115:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b28Type$LT$$BP$const$u20$u8$GT$17h[HASH]E) + --> $DIR/types.rs:121:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<*const u8>::h[HASH]) + --> $DIR/types.rs:121:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<*const u8>) + --> $DIR/types.rs:121:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b26Type$LT$$BP$mut$u20$u8$GT$17h[HASH]E) + --> $DIR/types.rs:127:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<*mut u8>::h[HASH]) + --> $DIR/types.rs:127:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<*mut u8>) + --> $DIR/types.rs:127:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b19Type$LT$$RF$str$GT$17h[HASH]E) + --> $DIR/types.rs:133:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<&str>::h[HASH]) + --> $DIR/types.rs:133:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<&str>) + --> $DIR/types.rs:133:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b27Type$LT$$RF$mut$u20$str$GT$17h[HASH]E) + --> $DIR/types.rs:139:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<&mut str>::h[HASH]) + --> $DIR/types.rs:139:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<&mut str>) + --> $DIR/types.rs:139:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b35Type$LT$$u5b$u8$u3b$$u20$0$u5d$$GT$17h[HASH]E) + --> $DIR/types.rs:145:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<[u8; 0]>::h[HASH]) + --> $DIR/types.rs:145:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<[u8; 0]>) + --> $DIR/types.rs:145:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b22Type$LT$fn$LP$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:151:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:151:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:151:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b60Type$LT$unsafe$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:157:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type::h[HASH]) + --> $DIR/types.rs:157:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type) + --> $DIR/types.rs:157:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b34Type$LT$$u5b$T$u3b$$u20$N$u5d$$GT$17h[HASH]E) + --> $DIR/types.rs:163:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<[T; N]>::h[HASH]) + --> $DIR/types.rs:163:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<[T; N]>) + --> $DIR/types.rs:163:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 78 previous errors + diff --git a/src/tools/rust-analyzer b/src/tools/rust-analyzer index d6ed146a1caa4..4e72700e38421 160000 --- a/src/tools/rust-analyzer +++ b/src/tools/rust-analyzer @@ -1 +1 @@ -Subproject commit d6ed146a1caa41c65a831efbc80d79067c8f5955 +Subproject commit 4e72700e38421a12993fe5fa5c33d712652bc6c8