From 5e6be7df942e984d3d5388eb04d2a40d49fb8473 Mon Sep 17 00:00:00 2001 From: Charisee Date: Fri, 4 Feb 2022 17:14:58 +0000 Subject: replace feature expression (cfg_panic) in lib and remove expression from tests Rebase commit --- src/test/ui/cfg/cfg-panic-abort.rs | 2 +- src/test/ui/cfg/cfg-panic.rs | 2 +- src/test/ui/fmt/format-args-capture.rs | 1 - src/test/ui/issues/issue-68696-catch-during-unwind.rs | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/test/ui/cfg/cfg-panic-abort.rs b/src/test/ui/cfg/cfg-panic-abort.rs index 9b88eff12ed..3853b598a7a 100644 --- a/src/test/ui/cfg/cfg-panic-abort.rs +++ b/src/test/ui/cfg/cfg-panic-abort.rs @@ -1,7 +1,7 @@ // build-pass // compile-flags: -C panic=abort // no-prefer-dynamic -#![feature(cfg_panic)] + #[cfg(panic = "unwind")] pub fn bad() -> i32 { } diff --git a/src/test/ui/cfg/cfg-panic.rs b/src/test/ui/cfg/cfg-panic.rs index d2113e4f5ec..fb3e5059c81 100644 --- a/src/test/ui/cfg/cfg-panic.rs +++ b/src/test/ui/cfg/cfg-panic.rs @@ -4,7 +4,7 @@ // ignore-emscripten no panic_unwind implementation // ignore-wasm32 no panic_unwind implementation // ignore-wasm64 no panic_unwind implementation -#![feature(cfg_panic)] + #[cfg(panic = "abort")] pub fn bad() -> i32 { } diff --git a/src/test/ui/fmt/format-args-capture.rs b/src/test/ui/fmt/format-args-capture.rs index d31d2a6c336..560352b5cb9 100644 --- a/src/test/ui/fmt/format-args-capture.rs +++ b/src/test/ui/fmt/format-args-capture.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(cfg_panic)] fn main() { named_argument_takes_precedence_to_captured(); diff --git a/src/test/ui/issues/issue-68696-catch-during-unwind.rs b/src/test/ui/issues/issue-68696-catch-during-unwind.rs index f25a78f59cd..2b12a62d0eb 100644 --- a/src/test/ui/issues/issue-68696-catch-during-unwind.rs +++ b/src/test/ui/issues/issue-68696-catch-during-unwind.rs @@ -4,7 +4,6 @@ // entering the catch_unwind. // // run-pass -#![feature(cfg_panic)] use std::panic::catch_unwind; -- cgit 1.4.1-3-g733a5 From 962094b449df39e22179846e551683f917981448 Mon Sep 17 00:00:00 2001 From: Charisee Date: Fri, 4 Feb 2022 18:34:10 +0000 Subject: Rebase --- src/test/ui/feature-gates/feature-gate-cfg-panic.rs | 11 ----------- .../ui/feature-gates/feature-gate-cfg-panic.stderr | 21 --------------------- 2 files changed, 32 deletions(-) delete mode 100644 src/test/ui/feature-gates/feature-gate-cfg-panic.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-cfg-panic.stderr (limited to 'src') diff --git a/src/test/ui/feature-gates/feature-gate-cfg-panic.rs b/src/test/ui/feature-gates/feature-gate-cfg-panic.rs deleted file mode 100644 index 1508374d942..00000000000 --- a/src/test/ui/feature-gates/feature-gate-cfg-panic.rs +++ /dev/null @@ -1,11 +0,0 @@ -#[cfg(panic = "unwind")] -//~^ ERROR `cfg(panic)` is experimental and subject to change -fn foo() -> bool { true } -#[cfg(not(panic = "unwind"))] -//~^ ERROR `cfg(panic)` is experimental and subject to change -fn foo() -> bool { false } - - -fn main() { - assert!(foo()); -} diff --git a/src/test/ui/feature-gates/feature-gate-cfg-panic.stderr b/src/test/ui/feature-gates/feature-gate-cfg-panic.stderr deleted file mode 100644 index ea5cd54fa90..00000000000 --- a/src/test/ui/feature-gates/feature-gate-cfg-panic.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0658]: `cfg(panic)` is experimental and subject to change - --> $DIR/feature-gate-cfg-panic.rs:1:7 - | -LL | #[cfg(panic = "unwind")] - | ^^^^^^^^^^^^^^^^ - | - = note: see issue #77443 for more information - = help: add `#![feature(cfg_panic)]` to the crate attributes to enable - -error[E0658]: `cfg(panic)` is experimental and subject to change - --> $DIR/feature-gate-cfg-panic.rs:4:11 - | -LL | #[cfg(not(panic = "unwind"))] - | ^^^^^^^^^^^^^^^^ - | - = note: see issue #77443 for more information - = help: add `#![feature(cfg_panic)]` to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. -- cgit 1.4.1-3-g733a5 From 46ec73ac3af3948af873e5157a5d807ff1a7ee73 Mon Sep 17 00:00:00 2001 From: Charisee Date: Fri, 4 Feb 2022 18:36:31 +0000 Subject: remove reference of cfg-panic from the unstable book --- .../src/language-features/cfg-panic.md | 38 ---------------------- 1 file changed, 38 deletions(-) delete mode 100644 src/doc/unstable-book/src/language-features/cfg-panic.md (limited to 'src') diff --git a/src/doc/unstable-book/src/language-features/cfg-panic.md b/src/doc/unstable-book/src/language-features/cfg-panic.md deleted file mode 100644 index f5b73128ad6..00000000000 --- a/src/doc/unstable-book/src/language-features/cfg-panic.md +++ /dev/null @@ -1,38 +0,0 @@ -# `cfg_panic` - -The tracking issue for this feature is: [#77443] - -[#77443]: https://github.com/rust-lang/rust/issues/77443 - ------------------------- - -The `cfg_panic` feature makes it possible to execute different code -depending on the panic strategy. - -Possible values at the moment are `"unwind"` or `"abort"`, although -it is possible that new panic strategies may be added to Rust in the -future. - -## Examples - -```rust -#![feature(cfg_panic)] - -#[cfg(panic = "unwind")] -fn a() { - // ... -} - -#[cfg(not(panic = "unwind"))] -fn a() { - // ... -} - -fn b() { - if cfg!(panic = "abort") { - // ... - } else { - // ... - } -} -``` -- cgit 1.4.1-3-g733a5 From ae158224acb8a85efce18cd358a445d18c6c6389 Mon Sep 17 00:00:00 2001 From: Nixon Enraght-Moony Date: Sun, 13 Feb 2022 01:25:54 +0000 Subject: rustdoc-json: buffer output --- src/librustdoc/json/mod.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs index f9e9fe0d3cf..52980e07b8c 100644 --- a/src/librustdoc/json/mod.rs +++ b/src/librustdoc/json/mod.rs @@ -8,6 +8,7 @@ mod conversions; use std::cell::RefCell; use std::fs::{create_dir_all, File}; +use std::io::{BufWriter, Write}; use std::path::PathBuf; use std::rc::Rc; @@ -213,7 +214,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { let mut index = (*self.index).clone().into_inner(); index.extend(self.get_trait_items()); // This needs to be the default HashMap for compatibility with the public interface for - // rustdoc-json + // rustdoc-json-types #[allow(rustc::default_hash_types)] let output = types::Crate { root: types::Id(String::from("0:0")), @@ -263,8 +264,10 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { let mut p = out_dir; p.push(output.index.get(&output.root).unwrap().name.clone().unwrap()); p.set_extension("json"); - let file = try_err!(File::create(&p), p); - serde_json::ser::to_writer(&file, &output).unwrap(); + let mut file = BufWriter::new(try_err!(File::create(&p), p)); + serde_json::ser::to_writer(&mut file, &output).unwrap(); + try_err!(file.flush(), p); + Ok(()) } -- cgit 1.4.1-3-g733a5 From 1b7c3bcef9dc88e65c4914887071e432436a0b04 Mon Sep 17 00:00:00 2001 From: lcnr Date: Mon, 14 Feb 2022 14:13:02 +0100 Subject: allow special behavior when printing const infer --- .../src/infer/error_reporting/need_type_info.rs | 30 ++++++++++++++++----- compiler/rustc_middle/src/ty/print/pretty.rs | 31 +++++++++++++++++----- .../ui/const-generics/defaults/doesnt_infer.rs | 2 +- .../ui/const-generics/defaults/doesnt_infer.stderr | 2 +- .../generic_arg_infer/issue-91614.rs | 2 +- .../generic_arg_infer/issue-91614.stderr | 2 +- 6 files changed, 51 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs index aba5666b58c..4ea8241072e 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs @@ -497,16 +497,32 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { let ty_to_string = |ty: Ty<'tcx>| -> String { let mut s = String::new(); let mut printer = ty::print::FmtPrinter::new(self.tcx, &mut s, Namespace::TypeNS); - let mut inner = self.inner.borrow_mut(); - let ty_vars = inner.type_variables(); - let getter = move |ty_vid| { - let var_origin = ty_vars.var_origin(ty_vid); - if let TypeVariableOriginKind::TypeParameterDefinition(name, _) = var_origin.kind { + let ty_getter = move |ty_vid| { + if let TypeVariableOriginKind::TypeParameterDefinition(name, _) = + self.inner.borrow_mut().type_variables().var_origin(ty_vid).kind + { + Some(name.to_string()) + } else { + None + } + }; + printer.ty_infer_name_resolver = Some(Box::new(ty_getter)); + let const_getter = move |ct_vid| { + if let ConstVariableOriginKind::ConstParameterDefinition(name, _) = self + .inner + .borrow_mut() + .const_unification_table() + .probe_value(ct_vid) + .origin + .kind + { return Some(name.to_string()); + } else { + None } - None }; - printer.name_resolver = Some(Box::new(&getter)); + printer.const_infer_name_resolver = Some(Box::new(const_getter)); + let _ = if let ty::FnDef(..) = ty.kind() { // We don't want the regular output for `fn`s because it includes its path in // invalid pseudo-syntax, we want the `fn`-pointer output instead. diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 893df1a009c..94bbb711cfe 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -606,7 +606,7 @@ pub trait PrettyPrinter<'tcx>: ty::Infer(infer_ty) => { let verbose = self.tcx().sess.verbose(); if let ty::TyVar(ty_vid) = infer_ty { - if let Some(name) = self.infer_ty_name(ty_vid) { + if let Some(name) = self.ty_infer_name(ty_vid) { p!(write("{}", name)) } else { if verbose { @@ -1015,7 +1015,11 @@ pub trait PrettyPrinter<'tcx>: } } - fn infer_ty_name(&self, _: ty::TyVid) -> Option { + fn ty_infer_name(&self, _: ty::TyVid) -> Option { + None + } + + fn const_infer_name(&self, _: ty::ConstVid<'tcx>) -> Option { None } @@ -1203,7 +1207,14 @@ pub trait PrettyPrinter<'tcx>: } } } - ty::ConstKind::Infer(..) => print_underscore!(), + ty::ConstKind::Infer(infer_ct) => { + match infer_ct { + ty::InferConst::Var(ct_vid) + if let Some(name) = self.const_infer_name(ct_vid) => + p!(write("{}", name)), + _ => print_underscore!(), + } + } ty::ConstKind::Param(ParamConst { name, .. }) => p!(write("{}", name)), ty::ConstKind::Value(value) => { return self.pretty_print_const_value(value, ct.ty(), print_ty); @@ -1551,7 +1562,8 @@ pub struct FmtPrinterData<'a, 'tcx, F> { pub region_highlight_mode: RegionHighlightMode<'tcx>, - pub name_resolver: Option Option>>, + pub ty_infer_name_resolver: Option Option + 'a>>, + pub const_infer_name_resolver: Option) -> Option + 'a>>, } impl<'a, 'tcx, F> Deref for FmtPrinter<'a, 'tcx, F> { @@ -1580,7 +1592,8 @@ impl<'a, 'tcx, F> FmtPrinter<'a, 'tcx, F> { binder_depth: 0, printed_type_count: 0, region_highlight_mode: RegionHighlightMode::new(tcx), - name_resolver: None, + ty_infer_name_resolver: None, + const_infer_name_resolver: None, })) } } @@ -1835,8 +1848,12 @@ impl<'tcx, F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> { } impl<'tcx, F: fmt::Write> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F> { - fn infer_ty_name(&self, id: ty::TyVid) -> Option { - self.0.name_resolver.as_ref().and_then(|func| func(id)) + fn ty_infer_name(&self, id: ty::TyVid) -> Option { + self.0.ty_infer_name_resolver.as_ref().and_then(|func| func(id)) + } + + fn const_infer_name(&self, id: ty::ConstVid<'tcx>) -> Option { + self.0.const_infer_name_resolver.as_ref().and_then(|func| func(id)) } fn print_value_path( diff --git a/src/test/ui/const-generics/defaults/doesnt_infer.rs b/src/test/ui/const-generics/defaults/doesnt_infer.rs index cd533b57bc3..9c59e672d8e 100644 --- a/src/test/ui/const-generics/defaults/doesnt_infer.rs +++ b/src/test/ui/const-generics/defaults/doesnt_infer.rs @@ -9,5 +9,5 @@ impl Foo { fn main() { let foo = Foo::<1>::foo(); let foo = Foo::foo(); - //~^ error: type annotations needed for `Foo<{_: u32}>` + //~^ error: type annotations needed for `Foo` } diff --git a/src/test/ui/const-generics/defaults/doesnt_infer.stderr b/src/test/ui/const-generics/defaults/doesnt_infer.stderr index 1551e81ea75..cccf433e328 100644 --- a/src/test/ui/const-generics/defaults/doesnt_infer.stderr +++ b/src/test/ui/const-generics/defaults/doesnt_infer.stderr @@ -1,4 +1,4 @@ -error[E0282]: type annotations needed for `Foo<{_: u32}>` +error[E0282]: type annotations needed for `Foo` --> $DIR/doesnt_infer.rs:11:15 | LL | let foo = Foo::foo(); diff --git a/src/test/ui/const-generics/generic_arg_infer/issue-91614.rs b/src/test/ui/const-generics/generic_arg_infer/issue-91614.rs index 413cc153924..b45e2cbc737 100644 --- a/src/test/ui/const-generics/generic_arg_infer/issue-91614.rs +++ b/src/test/ui/const-generics/generic_arg_infer/issue-91614.rs @@ -4,5 +4,5 @@ use std::simd::Mask; fn main() { let y = Mask::<_, _>::splat(false); - //~^ error: type annotations needed for `Mask<_, {_: usize}>` + //~^ ERROR: type annotations needed for } diff --git a/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr b/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr index 71a5ff79280..347cd2364b2 100644 --- a/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr +++ b/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr @@ -1,4 +1,4 @@ -error[E0283]: type annotations needed for `Mask<_, {_: usize}>` +error[E0283]: type annotations needed for `Mask<_, LANES>` --> $DIR/issue-91614.rs:6:13 | LL | let y = Mask::<_, _>::splat(false); -- cgit 1.4.1-3-g733a5 From 8cd9dfad1e2f24e52e022bdad52f23286af8c571 Mon Sep 17 00:00:00 2001 From: Tomasz Miąsko Date: Thu, 17 Feb 2022 00:00:00 +0000 Subject: Fix ScalarInt to char conversion to avoid panic for invalid Unicode scalar values --- compiler/rustc_middle/src/ty/consts/int.rs | 18 ++++++-- .../invalid_constant.main.ConstProp.diff | 48 ++++++++++++++-------- src/test/mir-opt/const_prop/invalid_constant.rs | 8 +++- 3 files changed, 52 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/compiler/rustc_middle/src/ty/consts/int.rs b/compiler/rustc_middle/src/ty/consts/int.rs index de45e1bb851..ca1db2fd551 100644 --- a/compiler/rustc_middle/src/ty/consts/int.rs +++ b/compiler/rustc_middle/src/ty/consts/int.rs @@ -294,12 +294,22 @@ impl From for ScalarInt { } } +/// Error returned when a conversion from ScalarInt to char fails. +#[derive(Debug)] +pub struct CharTryFromScalarInt; + impl TryFrom for char { - type Error = Size; + type Error = CharTryFromScalarInt; + #[inline] - fn try_from(int: ScalarInt) -> Result { - int.to_bits(Size::from_bytes(std::mem::size_of::())) - .map(|u| char::from_u32(u.try_into().unwrap()).unwrap()) + fn try_from(int: ScalarInt) -> Result { + let Ok(bits) = int.to_bits(Size::from_bytes(std::mem::size_of::())) else { + return Err(CharTryFromScalarInt); + }; + match char::from_u32(bits.try_into().unwrap()) { + Some(c) => Ok(c), + None => Err(CharTryFromScalarInt), + } } } diff --git a/src/test/mir-opt/const_prop/invalid_constant.main.ConstProp.diff b/src/test/mir-opt/const_prop/invalid_constant.main.ConstProp.diff index ee6c3b5f36f..1b53318806f 100644 --- a/src/test/mir-opt/const_prop/invalid_constant.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/invalid_constant.main.ConstProp.diff @@ -5,39 +5,53 @@ let mut _0: (); // return place in scope 0 at $DIR/invalid_constant.rs:15:11: 15:11 let _1: std::option::Option<()>; // in scope 0 at $DIR/invalid_constant.rs:16:5: 16:12 let mut _2: std::option::Option>; // in scope 0 at $DIR/invalid_constant.rs:16:7: 16:11 - scope 1 (inlined f) { // at $DIR/invalid_constant.rs:16:5: 16:12 - debug x => _2; // in scope 1 at $DIR/invalid_constant.rs:16:5: 16:12 - let mut _3: isize; // in scope 1 at $DIR/invalid_constant.rs:16:5: 16:12 - let _4: std::option::Option<()>; // in scope 1 at $DIR/invalid_constant.rs:16:5: 16:12 - scope 2 { - debug y => _4; // in scope 2 at $DIR/invalid_constant.rs:16:5: 16:12 + let _3: main::Union; // in scope 0 at $DIR/invalid_constant.rs:22:9: 22:22 + scope 1 { + debug _invalid_char => _3; // in scope 1 at $DIR/invalid_constant.rs:22:9: 22:22 + } + scope 2 (inlined f) { // at $DIR/invalid_constant.rs:16:5: 16:12 + debug x => _2; // in scope 2 at $DIR/invalid_constant.rs:16:5: 16:12 + let mut _4: isize; // in scope 2 at $DIR/invalid_constant.rs:16:5: 16:12 + let _5: std::option::Option<()>; // in scope 2 at $DIR/invalid_constant.rs:16:5: 16:12 + scope 3 { + debug y => _5; // in scope 3 at $DIR/invalid_constant.rs:16:5: 16:12 } } bb0: { discriminant(_2) = 0; // scope 0 at $DIR/invalid_constant.rs:16:7: 16:11 -- _3 = discriminant(_2); // scope 1 at $DIR/invalid_constant.rs:16:5: 16:12 -- switchInt(move _3) -> [0_isize: bb3, otherwise: bb2]; // scope 1 at $DIR/invalid_constant.rs:16:5: 16:12 -+ _3 = const 0_isize; // scope 1 at $DIR/invalid_constant.rs:16:5: 16:12 -+ switchInt(const 0_isize) -> [0_isize: bb3, otherwise: bb2]; // scope 1 at $DIR/invalid_constant.rs:16:5: 16:12 +- _4 = discriminant(_2); // scope 2 at $DIR/invalid_constant.rs:16:5: 16:12 +- switchInt(move _4) -> [0_isize: bb3, otherwise: bb2]; // scope 2 at $DIR/invalid_constant.rs:16:5: 16:12 ++ _4 = const 0_isize; // scope 2 at $DIR/invalid_constant.rs:16:5: 16:12 ++ switchInt(const 0_isize) -> [0_isize: bb3, otherwise: bb2]; // scope 2 at $DIR/invalid_constant.rs:16:5: 16:12 } bb1: { - nop; // scope 0 at $DIR/invalid_constant.rs:15:11: 17:2 - return; // scope 0 at $DIR/invalid_constant.rs:17:2: 17:2 +- _3 = const { Union { int: 0x110001 } }; // scope 0 at $DIR/invalid_constant.rs:22:25: 22:58 ++ _3 = const main::Union { int: 1114113_u32, chr: {transmute(0x00110001): char} }; // scope 0 at $DIR/invalid_constant.rs:22:25: 22:58 + // ty::Const + // + ty: main::Union +- // + val: Unevaluated(main::{constant#0}, [main::Union], None) ++ // + val: Value(Scalar(0x00110001)) + // mir::Constant + // + span: $DIR/invalid_constant.rs:22:25: 22:58 +- // + literal: Const { ty: main::Union, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:8 ~ invalid_constant[726d]::main::{constant#0}), const_param_did: None }, substs: [main::Union], promoted: None }) } ++ // + literal: Const { ty: main::Union, val: Value(Scalar(0x00110001)) } + nop; // scope 0 at $DIR/invalid_constant.rs:15:11: 23:2 + return; // scope 0 at $DIR/invalid_constant.rs:23:2: 23:2 } bb2: { -- _4 = ((_2 as Some).0: std::option::Option<()>); // scope 1 at $DIR/invalid_constant.rs:16:5: 16:12 -- _1 = _4; // scope 2 at $DIR/invalid_constant.rs:16:5: 16:12 -+ _4 = const Scalar(0x02): Option::<()>; // scope 1 at $DIR/invalid_constant.rs:16:5: 16:12 +- _5 = ((_2 as Some).0: std::option::Option<()>); // scope 2 at $DIR/invalid_constant.rs:16:5: 16:12 +- _1 = _5; // scope 3 at $DIR/invalid_constant.rs:16:5: 16:12 ++ _5 = const Scalar(0x02): Option::<()>; // scope 2 at $DIR/invalid_constant.rs:16:5: 16:12 + // ty::Const + // + ty: std::option::Option<()> + // + val: Value(Scalar(0x02)) + // mir::Constant + // + span: $DIR/invalid_constant.rs:16:5: 16:12 + // + literal: Const { ty: std::option::Option<()>, val: Value(Scalar(0x02)) } -+ _1 = const Scalar(0x02): Option::<()>; // scope 2 at $DIR/invalid_constant.rs:16:5: 16:12 ++ _1 = const Scalar(0x02): Option::<()>; // scope 3 at $DIR/invalid_constant.rs:16:5: 16:12 + // ty::Const + // + ty: std::option::Option<()> + // + val: Value(Scalar(0x02)) @@ -48,7 +62,7 @@ } bb3: { - discriminant(_1) = 0; // scope 1 at $DIR/invalid_constant.rs:16:5: 16:12 + discriminant(_1) = 0; // scope 2 at $DIR/invalid_constant.rs:16:5: 16:12 goto -> bb1; // scope 0 at $DIR/invalid_constant.rs:9:17: 9:21 } } diff --git a/src/test/mir-opt/const_prop/invalid_constant.rs b/src/test/mir-opt/const_prop/invalid_constant.rs index 1eb6f37df59..4aca9090019 100644 --- a/src/test/mir-opt/const_prop/invalid_constant.rs +++ b/src/test/mir-opt/const_prop/invalid_constant.rs @@ -2,7 +2,7 @@ // by constant propagation. Regression test for issue #93688. // // compile-flags: -Copt-level=0 -Zinline-mir - +#![feature(inline_const)] #[inline(always)] pub fn f(x: Option>) -> Option<()> { match x { @@ -14,4 +14,10 @@ pub fn f(x: Option>) -> Option<()> { // EMIT_MIR invalid_constant.main.ConstProp.diff fn main() { f(None); + + union Union { + int: u32, + chr: char, + } + let _invalid_char = const { Union { int: 0x110001 } }; } -- cgit 1.4.1-3-g733a5