diff options
| author | bors <bors@rust-lang.org> | 2022-02-16 18:52:59 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-02-16 18:52:59 +0000 |
| commit | 75d9a0ae210dcd078b3985e3550b59064e6603bc (patch) | |
| tree | 62ac55d59c1dcbb0a2b71659c738e3d78e751f78 | |
| parent | f90b06d7fb00470177516c5881bcec0432cb4f24 (diff) | |
| parent | be858fa1194ad264d606802606a942c38c2ee7a1 (diff) | |
| download | rust-75d9a0ae210dcd078b3985e3550b59064e6603bc.tar.gz rust-75d9a0ae210dcd078b3985e3550b59064e6603bc.zip | |
Auto merge of #94061 - matthiaskrgr:rollup-oduekp5, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #92366 (Resolve concern of `derive_default_enum`) - #93382 (Add a bit more padding in search box) - #93962 (Make [u8]::cmp implementation branchless) - #94015 (rustdoc --check option documentation) - #94017 (Clarify confusing UB statement in MIR) - #94020 (Support pretty printing of invalid constants) - #94027 (Update browser UI test version) - #94037 (Fix inconsistent symbol mangling with -Zverbose) - #94045 (Update books) - #94054 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
25 files changed, 188 insertions, 85 deletions
diff --git a/compiler/rustc_builtin_macros/src/deriving/default.rs b/compiler/rustc_builtin_macros/src/deriving/default.rs index 8c53094b624..1d1eee88a68 100644 --- a/compiler/rustc_builtin_macros/src/deriving/default.rs +++ b/compiler/rustc_builtin_macros/src/deriving/default.rs @@ -222,9 +222,6 @@ fn validate_default_attribute( "this method must only be called with a variant that has a `#[default]` attribute", ), [first, rest @ ..] => { - // FIXME(jhpratt) Do we want to perform this check? It doesn't exist - // for `#[inline]`, `#[non_exhaustive]`, and presumably others. - let suggestion_text = if rest.len() == 1 { "try removing this" } else { "try removing these" }; diff --git a/compiler/rustc_const_eval/src/const_eval/mod.rs b/compiler/rustc_const_eval/src/const_eval/mod.rs index eaa333fd8a9..ba1d5f45bbb 100644 --- a/compiler/rustc_const_eval/src/const_eval/mod.rs +++ b/compiler/rustc_const_eval/src/const_eval/mod.rs @@ -11,7 +11,8 @@ use rustc_middle::{ use rustc_span::{source_map::DUMMY_SP, symbol::Symbol}; use crate::interpret::{ - intern_const_alloc_recursive, ConstValue, InternKind, InterpCx, MPlaceTy, MemPlaceMeta, Scalar, + intern_const_alloc_recursive, ConstValue, InternKind, InterpCx, InterpResult, MPlaceTy, + MemPlaceMeta, Scalar, }; mod error; @@ -132,42 +133,39 @@ fn const_to_valtree_inner<'tcx>( } } -/// This function uses `unwrap` copiously, because an already validated constant -/// must have valid fields and can thus never fail outside of compiler bugs. However, it is -/// invoked from the pretty printer, where it can receive enums with no variants and e.g. -/// `read_discriminant` needs to be able to handle that. -pub(crate) fn destructure_const<'tcx>( +/// This function should never fail for validated constants. However, it is also invoked from the +/// pretty printer which might attempt to format invalid constants and in that case it might fail. +pub(crate) fn try_destructure_const<'tcx>( tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>, val: ty::Const<'tcx>, -) -> mir::DestructuredConst<'tcx> { +) -> InterpResult<'tcx, mir::DestructuredConst<'tcx>> { trace!("destructure_const: {:?}", val); let ecx = mk_eval_cx(tcx, DUMMY_SP, param_env, false); - let op = ecx.const_to_op(val, None).unwrap(); + let op = ecx.const_to_op(val, None)?; // We go to `usize` as we cannot allocate anything bigger anyway. let (field_count, variant, down) = match val.ty().kind() { ty::Array(_, len) => (usize::try_from(len.eval_usize(tcx, param_env)).unwrap(), None, op), - ty::Adt(def, _) if def.variants.is_empty() => { - return mir::DestructuredConst { variant: None, fields: &[] }; - } ty::Adt(def, _) => { - let variant = ecx.read_discriminant(&op).unwrap().1; - let down = ecx.operand_downcast(&op, variant).unwrap(); + let variant = ecx.read_discriminant(&op)?.1; + let down = ecx.operand_downcast(&op, variant)?; (def.variants[variant].fields.len(), Some(variant), down) } ty::Tuple(substs) => (substs.len(), None, op), _ => bug!("cannot destructure constant {:?}", val), }; - let fields_iter = (0..field_count).map(|i| { - let field_op = ecx.operand_field(&down, i).unwrap(); - let val = op_to_const(&ecx, &field_op); - ty::Const::from_value(tcx, val, field_op.layout.ty) - }); - let fields = tcx.arena.alloc_from_iter(fields_iter); + let fields = (0..field_count) + .map(|i| { + let field_op = ecx.operand_field(&down, i)?; + let val = op_to_const(&ecx, &field_op); + Ok(ty::Const::from_value(tcx, val, field_op.layout.ty)) + }) + .collect::<InterpResult<'tcx, Vec<_>>>()?; + let fields = tcx.arena.alloc_from_iter(fields); - mir::DestructuredConst { variant, fields } + Ok(mir::DestructuredConst { variant, fields }) } pub(crate) fn deref_const<'tcx>( diff --git a/compiler/rustc_const_eval/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs index 838484876c7..77d312f5851 100644 --- a/compiler/rustc_const_eval/src/lib.rs +++ b/compiler/rustc_const_eval/src/lib.rs @@ -41,9 +41,9 @@ pub fn provide(providers: &mut Providers) { providers.eval_to_const_value_raw = const_eval::eval_to_const_value_raw_provider; providers.eval_to_allocation_raw = const_eval::eval_to_allocation_raw_provider; providers.const_caller_location = const_eval::const_caller_location; - providers.destructure_const = |tcx, param_env_and_value| { + providers.try_destructure_const = |tcx, param_env_and_value| { let (param_env, value) = param_env_and_value.into_parts(); - const_eval::destructure_const(tcx, param_env, value) + const_eval::try_destructure_const(tcx, param_env, value).ok() }; providers.const_to_valtree = |tcx, param_env_and_value| { let (param_env, raw) = param_env_and_value.into_parts(); diff --git a/compiler/rustc_middle/src/mir/interpret/queries.rs b/compiler/rustc_middle/src/mir/interpret/queries.rs index ec0f5b7d059..4a57f483c70 100644 --- a/compiler/rustc_middle/src/mir/interpret/queries.rs +++ b/compiler/rustc_middle/src/mir/interpret/queries.rs @@ -98,4 +98,12 @@ impl<'tcx> TyCtxt<'tcx> { let raw_const = self.eval_to_allocation_raw(param_env.and(gid))?; Ok(self.global_alloc(raw_const.alloc_id).unwrap_memory()) } + + /// Destructure a constant ADT or array into its variant index and its field values. + pub fn destructure_const( + self, + param_env_and_val: ty::ParamEnvAnd<'tcx, ty::Const<'tcx>>, + ) -> mir::DestructuredConst<'tcx> { + self.try_destructure_const(param_env_and_val).unwrap() + } } diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 24b08be4074..7e5f8018dfc 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -2270,11 +2270,13 @@ pub enum BinOp { Mul, /// The `/` operator (division) /// - /// Division by zero is UB. + /// Division by zero is UB, because the compiler should have inserted checks + /// prior to this. Div, /// The `%` operator (modulus) /// - /// Using zero as the modulus (second operand) is UB. + /// Using zero as the modulus (second operand) is UB, because the compiler + /// should have inserted checks prior to this. Rem, /// The `^` operator (bitwise xor) BitXor, diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 77eda70bcd1..43cfe6f3b8a 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -924,10 +924,12 @@ rustc_queries! { } /// Destructure a constant ADT or array into its variant index and its - /// field values. - query destructure_const( + /// field values or return `None` if constant is invalid. + /// + /// Use infallible `TyCtxt::destructure_const` when you know that constant is valid. + query try_destructure_const( key: ty::ParamEnvAnd<'tcx, ty::Const<'tcx>> - ) -> mir::DestructuredConst<'tcx> { + ) -> Option<mir::DestructuredConst<'tcx>> { desc { "destructure constant" } remap_env_constness } diff --git a/compiler/rustc_middle/src/ty/print/mod.rs b/compiler/rustc_middle/src/ty/print/mod.rs index 086bb950f1a..94cea505c32 100644 --- a/compiler/rustc_middle/src/ty/print/mod.rs +++ b/compiler/rustc_middle/src/ty/print/mod.rs @@ -188,11 +188,6 @@ pub trait Printer<'tcx>: Sized { own_params.start = 1; } - // If we're in verbose mode, then print default-equal args too - if self.tcx().sess.verbose() { - return &substs[own_params]; - } - // Don't print args that are the defaults of their respective parameters. own_params.end -= generics .params diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 893df1a009c..ae838a46157 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -1459,10 +1459,18 @@ pub trait PrettyPrinter<'tcx>: // FIXME(eddyb) for `--emit=mir`/`-Z dump-mir`, we should provide the // correct `ty::ParamEnv` to allow printing *all* constant values. (_, ty::Array(..) | ty::Tuple(..) | ty::Adt(..)) if !ty.has_param_types_or_consts() => { - let contents = - self.tcx().destructure_const(ty::ParamEnv::reveal_all().and( - self.tcx().mk_const(ty::ConstS { val: ty::ConstKind::Value(ct), ty }), - )); + let Some(contents) = self.tcx().try_destructure_const( + ty::ParamEnv::reveal_all() + .and(self.tcx().mk_const(ty::ConstS { val: ty::ConstKind::Value(ct), ty })), + ) else { + // Fall back to debug pretty printing for invalid constants. + p!(write("{:?}", ct)); + if print_ty { + p!(": ", print(ty)); + } + return Ok(self); + }; + let fields = contents.fields.iter().copied(); match *ty.kind() { diff --git a/library/core/src/slice/cmp.rs b/library/core/src/slice/cmp.rs index 72af47c71dd..27c6b6f5bc0 100644 --- a/library/core/src/slice/cmp.rs +++ b/library/core/src/slice/cmp.rs @@ -1,7 +1,6 @@ //! Comparison traits for `[T]`. -use crate::cmp; -use crate::cmp::Ordering::{self, Greater, Less}; +use crate::cmp::{self, Ordering}; use crate::mem; use super::from_raw_parts; @@ -189,18 +188,18 @@ impl<A: Ord> SliceOrd for A { impl SliceOrd for u8 { #[inline] fn compare(left: &[Self], right: &[Self]) -> Ordering { - let order = - // SAFETY: `left` and `right` are references and are thus guaranteed to be valid. - // We use the minimum of both lengths which guarantees that both regions are - // valid for reads in that interval. - unsafe { memcmp(left.as_ptr(), right.as_ptr(), cmp::min(left.len(), right.len())) }; + // Since the length of a slice is always less than or equal to isize::MAX, this never underflows. + let diff = left.len() as isize - right.len() as isize; + // This comparison gets optimized away (on x86_64 and ARM) because the subtraction updates flags. + let len = if left.len() < right.len() { left.len() } else { right.len() }; + // SAFETY: `left` and `right` are references and are thus guaranteed to be valid. + // We use the minimum of both lengths which guarantees that both regions are + // valid for reads in that interval. + let mut order = unsafe { memcmp(left.as_ptr(), right.as_ptr(), len) as isize }; if order == 0 { - left.len().cmp(&right.len()) - } else if order < 0 { - Less - } else { - Greater + order = diff; } + order.cmp(&0) } } diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile index 52c73fd3bd1..f1c42b248f4 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile @@ -72,7 +72,7 @@ ENV PATH="/node-v14.4.0-linux-x64/bin:${PATH}" # https://github.com/puppeteer/puppeteer/issues/375 # # We also specify the version in case we need to update it to go around cache limitations. -RUN npm install -g browser-ui-test@0.7.1 --unsafe-perm=true +RUN npm install -g browser-ui-test@0.7.2 --unsafe-perm=true ENV RUST_CONFIGURE_ARGS \ --build=x86_64-unknown-linux-gnu \ diff --git a/src/doc/book b/src/doc/book -Subproject 98904efaa4fc968db8ff59cf2744d9f7ed15816 +Subproject 67b768c0b660a069a45f0e5d8ae2f679df1022a diff --git a/src/doc/nomicon b/src/doc/nomicon -Subproject 9493715a6280a1f74be759c7e1ef9999b5d13e6 +Subproject 90993eeac93dbf9388992de92965f99cf6f29a0 diff --git a/src/doc/reference b/src/doc/reference -Subproject 411c2f0d5cebf48453ae2d136ad0c5e611d39ae +Subproject 70fc73a6b908e08e66aa0306856c5211312f6c0 diff --git a/src/doc/rustc-dev-guide b/src/doc/rustc-dev-guide -Subproject 8763adb62c712df69b1d39ea3e692b6d696cc4d +Subproject 62f58394ba7b203f55ac35ddcc4c0b79578f570 diff --git a/src/doc/rustdoc/src/command-line-arguments.md b/src/doc/rustdoc/src/command-line-arguments.md index 9de2e733de7..3ce57f88938 100644 --- a/src/doc/rustdoc/src/command-line-arguments.md +++ b/src/doc/rustdoc/src/command-line-arguments.md @@ -381,7 +381,7 @@ the same CSS rules as the official `light` theme. `--check-theme` flag, it discards all other flags and only performs the CSS rule comparison operation. -### `--crate-version`: control the crate version +## `--crate-version`: control the crate version Using this flag looks like this: @@ -418,9 +418,22 @@ Rustdoc only supports Rust source code and Markdown input formats. If the file ends in `.md` or `.markdown`, `rustdoc` treats it as a Markdown file. Otherwise, it assumes that the input file is Rust. +# Unstable command line arguments + ## `--nocapture` When this flag is used with `--test`, the output (stdout and stderr) of your tests won't be captured by rustdoc. Instead, the output will be directed to your terminal, as if you had run the test executable manually. This is especially useful for debugging your tests! + +## `--check` + +When this flag is supplied, rustdoc will type check and lint your code, but will not generate any +documentation or run your doctests. + +Using this flag looks like: + +```bash +rustdoc -Z unstable-options --check src/lib.rs +``` diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 4327a554fc6..662221ae773 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -933,7 +933,7 @@ table, outline: none; border: 1px solid; border-radius: 2px; - padding: 5px 8px; + padding: 8px; font-size: 1rem; transition: border-color 300ms ease; width: 100%; 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 new file mode 100644 index 00000000000..ee6c3b5f36f --- /dev/null +++ b/src/test/mir-opt/const_prop/invalid_constant.main.ConstProp.diff @@ -0,0 +1,55 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + 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<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 + } + } + + 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 + } + + 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 + } + + 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 ++ // 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 ++ // 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)) } + goto -> bb1; // scope 0 at $DIR/invalid_constant.rs:10:20: 10:21 + } + + bb3: { + discriminant(_1) = 0; // scope 1 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 new file mode 100644 index 00000000000..1eb6f37df59 --- /dev/null +++ b/src/test/mir-opt/const_prop/invalid_constant.rs @@ -0,0 +1,17 @@ +// Verify that we can pretty print invalid constant introduced +// by constant propagation. Regression test for issue #93688. +// +// compile-flags: -Copt-level=0 -Zinline-mir + +#[inline(always)] +pub fn f(x: Option<Option<()>>) -> Option<()> { + match x { + None => None, + Some(y) => y, + } +} + +// EMIT_MIR invalid_constant.main.ConstProp.diff +fn main() { + f(None); +} diff --git a/src/test/rustdoc-gui/item-info-width.goml b/src/test/rustdoc-gui/item-info-width.goml index 82fcca94a18..7a32d902910 100644 --- a/src/test/rustdoc-gui/item-info-width.goml +++ b/src/test/rustdoc-gui/item-info-width.goml @@ -4,5 +4,5 @@ goto: file://|DOC_PATH|/lib2/struct.Foo.html size: (1100, 800) // We check that ".item-info" is bigger than its content. assert-css: (".item-info", {"width": "790px"}) -assert-css: (".item-info .stab", {"width": "339.562px"}) +assert-css: (".item-info .stab", {"width": "340px"}) assert-position: (".item-info .stab", {"x": 295}) diff --git a/src/test/ui/associated-types/substs-ppaux.rs b/src/test/ui/associated-types/substs-ppaux.rs index 974a1d961a0..66cd94d7a1b 100644 --- a/src/test/ui/associated-types/substs-ppaux.rs +++ b/src/test/ui/associated-types/substs-ppaux.rs @@ -25,7 +25,7 @@ fn foo<'z>() where &'z (): Sized { let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>; //[verbose]~^ ERROR mismatched types //[verbose]~| expected unit type `()` - //[verbose]~| found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u32>>::bar::<ReStatic, char>}` + //[verbose]~| found fn item `fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>}` //[normal]~^^^^ ERROR mismatched types //[normal]~| expected unit type `()` //[normal]~| found fn item `fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>}` diff --git a/src/test/ui/associated-types/substs-ppaux.verbose.stderr b/src/test/ui/associated-types/substs-ppaux.verbose.stderr index cf480223da2..b831f3b7a76 100644 --- a/src/test/ui/associated-types/substs-ppaux.verbose.stderr +++ b/src/test/ui/associated-types/substs-ppaux.verbose.stderr @@ -20,7 +20,7 @@ error[E0308]: mismatched types --> $DIR/substs-ppaux.rs:25:17 | LL | fn bar<'a, T>() where T: 'a {} - | --------------------------- fn() {<i8 as Foo<ReStatic, ReStatic, u32>>::bar::<ReStatic, char>} defined here + | --------------------------- fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>} defined here ... LL | let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>; | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item @@ -28,7 +28,7 @@ LL | let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>; | expected due to this | = note: expected unit type `()` - found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u32>>::bar::<ReStatic, char>}` + found fn item `fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>}` help: use parentheses to call this function | LL | let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>(); diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr index 459198eec5a..983d6a06afa 100644 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -6,7 +6,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | = note: defining type: no_region::<'_#1r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box<T, std::alloc::Global>,)) -> std::boxed::Box<(dyn Anything + '_#2r), std::alloc::Global>, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#2r)>, (), ] = note: number of external vids: 3 @@ -42,7 +42,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | = note: defining type: correct_region::<'_#1r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box<T, std::alloc::Global>,)) -> std::boxed::Box<(dyn Anything + '_#2r), std::alloc::Global>, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#2r)>, (), ] = note: number of external vids: 3 @@ -69,7 +69,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | = note: defining type: wrong_region::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box<T, std::alloc::Global>,)) -> std::boxed::Box<(dyn Anything + '_#3r), std::alloc::Global>, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#3r)>, (), ] = note: number of external vids: 4 @@ -105,7 +105,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | = note: defining type: outlives_region::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box<T, std::alloc::Global>,)) -> std::boxed::Box<(dyn Anything + '_#3r), std::alloc::Global>, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#3r)>, (), ] = note: number of external vids: 4 diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr index 6e8b3021d33..88d73e7a729 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr @@ -6,7 +6,7 @@ LL | with_signature(x, |y| y) | = note: defining type: no_region::<'_#1r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box<T, std::alloc::Global>,)) -> std::boxed::Box<(dyn std::fmt::Debug + '_#2r), std::alloc::Global>, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn std::fmt::Debug + '_#2r)>, (), ] = note: number of external vids: 3 diff --git a/src/test/ui/symbol-names/verbose.rs b/src/test/ui/symbol-names/verbose.rs new file mode 100644 index 00000000000..e00c592b6d2 --- /dev/null +++ b/src/test/ui/symbol-names/verbose.rs @@ -0,0 +1,15 @@ +// Regression test for issue #57596, where -Zverbose flag unintentionally +// affected produced symbols making it impossible to link between crates +// with a different value of the flag (for symbols involving generic +// arguments equal to defaults of their respective parameters). +// +// build-pass +// compile-flags: -Zverbose + +pub fn error(msg: String) -> Box<dyn std::error::Error> { + msg.into() +} + +fn main() { + error(String::new()); +} diff --git a/src/tools/rust-analyzer b/src/tools/rust-analyzer -Subproject ba330548023607717295f0dfd61b72eda41aa9d +Subproject 02904e99acc3daf39b56ed18aa07e62aeb9492c |
