diff --git a/compiler/rustc_const_eval/src/interpret/call.rs b/compiler/rustc_const_eval/src/interpret/call.rs index c7615a216312e..3658982002e60 100644 --- a/compiler/rustc_const_eval/src/interpret/call.rs +++ b/compiler/rustc_const_eval/src/interpret/call.rs @@ -705,6 +705,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { throw_ub_format!("calling a function with more arguments than it expected"); } + // All function arguments have gotten initialized, call corresponding hook. + M::after_stack_frame_init(self)?; + // Done! self.push_stack_frame_done() } diff --git a/compiler/rustc_const_eval/src/interpret/machine.rs b/compiler/rustc_const_eval/src/interpret/machine.rs index 8d9b26cd18423..9760c8fc2004f 100644 --- a/compiler/rustc_const_eval/src/interpret/machine.rs +++ b/compiler/rustc_const_eval/src/interpret/machine.rs @@ -602,6 +602,11 @@ pub trait Machine<'tcx>: Sized { interp_ok(()) } + /// Called immediately after a stack frame has its function arguments initialized. + fn after_stack_frame_init(_ecx: &mut InterpCx<'tcx, Self>) -> InterpResult<'tcx> { + interp_ok(()) + } + /// Called just before the frame is removed from the stack (followed by return value copy and /// local cleanup). fn before_stack_pop(_ecx: &mut InterpCx<'tcx, Self>) -> InterpResult<'tcx> { diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs index aa170a364b5b8..e8dae9c016fc6 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs @@ -1,3 +1,5 @@ +use std::ops::ControlFlow; + use itertools::Itertools as _; use rustc_data_structures::fx::FxIndexSet; use rustc_hir as hir; @@ -71,8 +73,10 @@ pub(crate) fn check_refining_return_position_impl_trait_in_trait<'tcx>( return; } - let mut collector = ImplTraitInTraitCollector { tcx, types: FxIndexSet::default() }; - trait_m_sig.visit_with(&mut collector); + let mut collector = ImplTraitInTraitCollector { tcx, depth: 0, types: FxIndexSet::default() }; + if trait_m_sig.visit_with(&mut collector).is_break() { + return; + } // Bound that we find on RPITITs in the trait signature. let mut trait_bounds = vec![]; @@ -264,28 +268,43 @@ pub(crate) fn check_refining_return_position_impl_trait_in_trait<'tcx>( struct ImplTraitInTraitCollector<'tcx> { tcx: TyCtxt<'tcx>, + depth: usize, types: FxIndexSet>, } +/// Once depth exceeds `tcx.recursion_limit()`, the visitor immediately breaks +/// the entire traversal using `ControlFlow::Break(())`. impl<'tcx> TypeVisitor> for ImplTraitInTraitCollector<'tcx> { - fn visit_ty(&mut self, ty: Ty<'tcx>) { + type Result = ControlFlow<()>; + + fn visit_ty(&mut self, ty: Ty<'tcx>) -> Self::Result { if let ty::Alias(_, alias) = *ty.kind() && let Some(proj) = alias.try_to_projection() && self.tcx.is_impl_trait_in_trait(proj.kind) { + if !self.tcx.recursion_limit().value_within_limit(self.depth) { + self.tcx.dcx().span_delayed_bug( + self.tcx.def_span(proj.kind), + "recursion limit exceeded while collecting implied RPITIT bounds", + ); + return ControlFlow::Break(()); + } if self.types.insert(proj) { + self.depth += 1; for (pred, _) in self .tcx .explicit_item_bounds(proj.kind) .iter_instantiated_copied(self.tcx, proj.args) .map(Unnormalized::skip_norm_wip) { - pred.visit_with(self); + pred.visit_with(self)?; } + self.depth -= 1; } } else { - ty.super_visit_with(self); + ty.super_visit_with(self)?; } + ControlFlow::Continue(()) } } diff --git a/compiler/rustc_mir_build/src/thir/constant.rs b/compiler/rustc_mir_build/src/thir/constant.rs index 6a78135f22dcf..0d7e2bec20bb9 100644 --- a/compiler/rustc_mir_build/src/thir/constant.rs +++ b/compiler/rustc_mir_build/src/thir/constant.rs @@ -37,11 +37,18 @@ pub(crate) fn lit_to_const<'tcx>( let valtree_ty = Ty::new_imm_ref(tcx, tcx.lifetimes.re_static, tcx.types.str_); (ty::ValTree::from_raw_bytes(tcx, str_bytes), valtree_ty) } - (ast::LitKind::ByteStr(byte_sym, _), Some(ty::Ref(_, inner_ty, _))) + (ast::LitKind::ByteStr(byte_sym, _), Some(ty::Ref(region, inner_ty, mutbl))) if let ty::Slice(ty) | ty::Array(ty, _) = inner_ty.kind() && let ty::Uint(UintTy::U8) = ty.kind() => { - (ty::ValTree::from_raw_bytes(tcx, byte_sym.as_byte_str()), expected_ty.unwrap()) + let valtree_ty = if inner_ty.is_slice() { + expected_ty.unwrap() + } else { + let array_ty = + Ty::new_array(tcx, tcx.types.u8, byte_sym.as_byte_str().len() as u64); + Ty::new_ref(tcx, *region, array_ty, *mutbl) + }; + (ty::ValTree::from_raw_bytes(tcx, byte_sym.as_byte_str()), valtree_ty) } ( ast::LitKind::ByteStr(byte_sym, _), @@ -51,7 +58,12 @@ pub(crate) fn lit_to_const<'tcx>( { // Byte string literal patterns may have type `[u8]` or `[u8; N]` if `deref_patterns` is // enabled, in order to allow, e.g., `deref!(b"..."): Vec`. - (ty::ValTree::from_raw_bytes(tcx, byte_sym.as_byte_str()), expected_ty.unwrap()) + let valtree_ty = if expected_ty.unwrap().is_slice() { + expected_ty.unwrap() + } else { + Ty::new_array(tcx, tcx.types.u8, byte_sym.as_byte_str().len() as u64) + }; + (ty::ValTree::from_raw_bytes(tcx, byte_sym.as_byte_str()), valtree_ty) } (ast::LitKind::ByteStr(byte_sym, _), _) => { let valtree = ty::ValTree::from_raw_bytes(tcx, byte_sym.as_byte_str()); diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index f048fb04af45a..f69efebf5c950 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -250,9 +250,9 @@ bitflags::bitflags! { /// Apply remappings to documentation information const DOCUMENTATION = 1 << 5; - /// An alias for `macro`, `debuginfo` and `coverage`. This ensures all paths in compiled - /// executables, libraries and objects are remapped but not elsewhere. - const OBJECT = Self::MACRO.bits() | Self::DEBUGINFO.bits() | Self::COVERAGE.bits(); + /// An alias for `macro`, `documentation`, `debuginfo` and `coverage`. This ensures all paths in compiled + /// executables, libraries, objects and documentation outputs are remapped but not elsewhere. + const OBJECT = Self::MACRO.bits() | Self::DOCUMENTATION.bits() | Self::DEBUGINFO.bits() | Self::COVERAGE.bits(); } } diff --git a/compiler/rustc_trait_selection/src/solve/delegate.rs b/compiler/rustc_trait_selection/src/solve/delegate.rs index 2335868a17b40..29563c0262621 100644 --- a/compiler/rustc_trait_selection/src/solve/delegate.rs +++ b/compiler/rustc_trait_selection/src/solve/delegate.rs @@ -494,10 +494,6 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate< dst: Ty<'tcx>, assume: ty::Const<'tcx>, ) -> Result, Ty<'tcx>>, NoSolution> { - // Erase regions because we compute layouts in `rustc_transmute`, - // which will ICE for region vars. - let (dst, src) = self.tcx.erase_and_anonymize_regions((dst, src)); - rustc_transmute::Assume::from_const(self.tcx, assume) .map(|assume| TransmuteTypeEnv::new(self.0.tcx).is_transmutable(src, dst, assume)) .ok_or(NoSolution) diff --git a/compiler/rustc_traits/src/codegen.rs b/compiler/rustc_traits/src/codegen.rs index bb174efe1f009..891043c05987c 100644 --- a/compiler/rustc_traits/src/codegen.rs +++ b/compiler/rustc_traits/src/codegen.rs @@ -9,8 +9,8 @@ use rustc_middle::ty::{self, PseudoCanonicalInput, TyCtxt, TypeVisitableExt}; use rustc_span::bug; use rustc_trait_selection::error_reporting::InferCtxtErrorExt; use rustc_trait_selection::traits::{ - ImplSource, Obligation, ObligationCause, ObligationCtxt, ScrubbedTraitError, SelectionContext, - SelectionError, + FulfillmentErrorCode, ImplSource, Obligation, ObligationCause, ObligationCtxt, + SelectionContext, SelectionError, }; use tracing::debug; @@ -51,22 +51,40 @@ pub(crate) fn codegen_select_candidate<'tcx>( // Currently, we use a fulfillment context to completely resolve // all nested obligations. This is because they can inform the // inference of the impl's type parameters. - let ocx = ObligationCtxt::new(&infcx); + let ocx = ObligationCtxt::new_with_diagnostics(&infcx); let impl_source = selection.map(|obligation| { ocx.register_obligation(obligation); }); + let impl_span = match &impl_source { + ImplSource::UserDefined(source) => Some(tcx.def_span(source.impl_def_id)), + _ => None, + }; + // In principle, we only need to do this so long as `impl_source` // contains unbound type parameters. It could be a slight // optimization to stop iterating early. let errors = ocx.evaluate_obligations_error_on_ambiguity(); if !errors.no_errors() { // `rustc_monomorphize::collector` assumes there are no type errors. - // Cycle errors are the only post-monomorphization errors possible; emit them now so - // `rustc_ty_utils::resolve_associated_item` doesn't return `None` post-monomorphization. - for err in errors { - if let ScrubbedTraitError::Cycle(cycle) = err { - infcx.err_ctxt().report_overflow_obligation_cycle(&cycle); + // Report post-monomorphization overflows here so that `Instance::expect_resolve` doesn't ICE later. + for mut err in errors { + match err.code { + FulfillmentErrorCode::Ambiguity { overflow: Some(suggest_increasing_limit) } => { + if err.obligation.cause.span.is_dummy() { + if let Some(span) = impl_span { + err.obligation.cause.span = span; + } + } + + infcx + .err_ctxt() + .report_overflow_obligation(&err.obligation, suggest_increasing_limit); + } + FulfillmentErrorCode::Cycle(cycle) => { + infcx.err_ctxt().report_overflow_obligation_cycle(&cycle); + } + _ => {} } } return Err(CodegenObligationError::Unimplemented); diff --git a/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile index b7d281cc2dbe7..06dc3db645205 100644 --- a/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile @@ -3,11 +3,14 @@ FROM ubuntu:26.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh +RUN curl https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \ + echo 'deb http://apt.llvm.org/resolute/ llvm-toolchain-resolute-23 main' | tee -a /etc/apt/sources.list + RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - clang-22 \ - llvm-22 \ - lld-22 + clang-23 \ + llvm-23 \ + lld-23 COPY scripts/crosstool-ng-git.sh /scripts/ COPY scripts/crosstool-ng-sha256-20260705.diff /scripts/ @@ -24,7 +27,7 @@ RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENV PATH=/usr/lib/llvm-22/bin:$PATH:/x-tools/loongarch64-unknown-linux-gnu/bin +ENV PATH=/usr/lib/llvm-23/bin:$PATH:/x-tools/loongarch64-unknown-linux-gnu/bin # --no-rosegment keeps read-only code in the first LOAD segment, matching the # segment layout produced by GNU ld. This allows Linux to make better use of diff --git a/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile index 582a22231b33c..65406baddc70a 100644 --- a/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile @@ -3,11 +3,14 @@ FROM ubuntu:26.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh +RUN curl https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \ + echo 'deb http://apt.llvm.org/resolute/ llvm-toolchain-resolute-23 main' | tee -a /etc/apt/sources.list + RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - clang-22 \ - llvm-22 \ - lld-22 + clang-23 \ + llvm-23 \ + lld-23 COPY scripts/crosstool-ng-git.sh /scripts/ COPY scripts/crosstool-ng-sha256-20260705.diff /scripts/ @@ -24,7 +27,7 @@ RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENV PATH=/usr/lib/llvm-22/bin:$PATH:/x-tools/loongarch64-unknown-linux-musl/bin +ENV PATH=/usr/lib/llvm-23/bin:$PATH:/x-tools/loongarch64-unknown-linux-musl/bin # --no-rosegment keeps read-only code in the first LOAD segment, matching the # segment layout produced by GNU ld. This allows Linux to make better use of diff --git a/src/tools/cargotest/lockfiles/xsv.lock b/src/tools/cargotest/lockfiles/xsv.lock new file mode 100644 index 0000000000000..718e6529c2f93 --- /dev/null +++ b/src/tools/cargotest/lockfiles/xsv.lock @@ -0,0 +1,517 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1c6d463cbe7ed28720b5b489e7c083eeb8f90d08be2a0d6bb9e1ffea9ce1afa" +dependencies = [ + "memchr", +] + +[[package]] +name = "arrayvec" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" +dependencies = [ + "nodrop", +] + +[[package]] +name = "bitflags" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" + +[[package]] +name = "byteorder" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8389c509ec62b9fe8eca58c502a0acaf017737355615243496cde4994f8fa4f9" + +[[package]] +name = "cfg-if" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3" + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "crossbeam-channel" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c0a94250b0278d7fc5a894c3d276b11ea164edc8bf8feb10ca1ea517b44a649" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", + "parking_lot", + "rand 0.5.5", + "smallvec", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30fecfcac6abfef8771151f8be4abc9e4edc112c2bcb233314cafde2680536e9" +dependencies = [ + "arrayvec", + "cfg-if", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" + +[[package]] +name = "csv" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bbb6d75aae072248e381715437855a69595e5a97d3abbf748fe7a95e65d77fa" +dependencies = [ + "csv-core", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dd8e6d86f7ba48b4276ef1317edc8cc36167546d8972feb4a2b5fec0b374105" +dependencies = [ + "memchr", +] + +[[package]] +name = "csv-index" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b27beef016f9d0d43fd1f6097a469d1ccccd2191888f5dfeb4e7be7dbc8bfc6" +dependencies = [ + "byteorder", + "csv", +] + +[[package]] +name = "docopt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d60c92df70dfaaabecc14b409fd79f55ba0f247780529db1d73bfa601e1d3ac0" +dependencies = [ + "lazy_static", + "regex", + "serde", + "serde_derive", + "strsim", +] + +[[package]] +name = "filetime" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714653f3e34871534de23771ac7b26e999651a0a228f47beb324dfdf1dd4b10f" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", +] + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "lazy_static" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" +dependencies = [ + "version_check", +] + +[[package]] +name = "libc" +version = "0.2.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78" + +[[package]] +name = "lock_api" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "949826a5ccf18c1b3a7c3d57692778d21768b79e46eb9dd07bfc4c2160036c54" +dependencies = [ + "owning_ref", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cba860f648db8e6f269df990180c2217f333472b4a6e901e97446858487971e2" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" + +[[package]] +name = "nodrop" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" + +[[package]] +name = "num-traits" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630de1ef5cc79d0cdd78b7e33b81f083cbfe90de0f4b2b2f07f905867c70e9fe" + +[[package]] +name = "num_cpus" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" +dependencies = [ + "libc", +] + +[[package]] +name = "owning_ref" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "parking_lot" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69376b761943787ebd5cc85a5bc95958651a22609c5c1c2b65de21786baec72b" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" +dependencies = [ + "libc", + "rand 0.4.3", + "smallvec", + "winapi", +] + +[[package]] +name = "proc-macro2" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee5697238f0d893c7f0ecc59c0999f18d2af85e424de441178bcacc9f9e6cf67" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quickcheck" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b70118ab610f395b6c68ee9c7443d27b8da7d6d5145e82dc0be6fbe60029da37" +dependencies = [ + "rand 0.5.5", + "rand_core", +] + +[[package]] +name = "quote" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" +dependencies = [ + "fuchsia-zircon", + "libc", + "winapi", +] + +[[package]] +name = "rand" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" +dependencies = [ + "cloudabi", + "fuchsia-zircon", + "libc", + "rand_core", + "winapi", +] + +[[package]] +name = "rand_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2" + +[[package]] +name = "redox_syscall" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" + +[[package]] +name = "regex" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d8c9f33201f46669484bacc312b00e7541bed6aaf296dffe2bb4e0ac6b8ce2a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", + "utf8-ranges", +] + +[[package]] +name = "regex-syntax" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d" +dependencies = [ + "ucd-util", +] + +[[package]] +name = "scopeguard" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" + +[[package]] +name = "serde" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22d340507cea0b7e6632900a176101fea959c7065d93ba555072da90aaaafc87" + +[[package]] +name = "serde_derive" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234fc8b737737b148ccd625175fc6390f5e4dacfdaa543cb93a3430d984a9119" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "smallvec" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d" +dependencies = [ + "unreachable", +] + +[[package]] +name = "stable_deref_trait" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" + +[[package]] +name = "streaming-stats" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f233aa550ceeb22c47cff12e167f7bc89c03e265e7fcff64b8359bb6799e0f4" +dependencies = [ + "num-traits", +] + +[[package]] +name = "strsim" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" + +[[package]] +name = "syn" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "tabwriter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9128e3a9149e51494cad59712a286e149fcb74e443d2298d69bd6eaa42cc4ebb" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "thread_local" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "threadpool" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "ucd-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" + +[[package]] +name = "unicode-width" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + +[[package]] +name = "unreachable" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +dependencies = [ + "void", +] + +[[package]] +name = "utf8-ranges" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" + +[[package]] +name = "version_check" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7716c242968ee87e5542f8021178248f267f295a5c4803beae8b8b7fd9bc6051" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "winapi" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773ef9dcc5f24b7d850d0ff101e542ff24c3b090a9768e03ff889fdef41f00fd" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "xsv" +version = "0.13.0" +dependencies = [ + "byteorder", + "crossbeam-channel", + "csv", + "csv-index", + "docopt", + "filetime", + "log", + "num_cpus", + "quickcheck", + "rand 0.5.5", + "regex", + "serde", + "serde_derive", + "streaming-stats", + "tabwriter", + "threadpool", +] diff --git a/src/tools/cargotest/main.rs b/src/tools/cargotest/main.rs index a56fe260e3c99..8ae10203b0175 100644 --- a/src/tools/cargotest/main.rs +++ b/src/tools/cargotest/main.rs @@ -49,7 +49,7 @@ const TEST_REPOS: &[Test] = &[ name: "xsv", repo: "https://github.com/BurntSushi/xsv", sha: "3de6c04269a7d315f7e9864b9013451cd9580a08", - lock: None, + lock: Some(include_str!("lockfiles/xsv.lock")), packages: &[], features: None, manifest_path: None, diff --git a/tests/run-make/remap-path-prefix/rmake.rs b/tests/run-make/remap-path-prefix/rmake.rs index 3b866476e9501..0e4d002e2441c 100644 --- a/tests/run-make/remap-path-prefix/rmake.rs +++ b/tests/run-make/remap-path-prefix/rmake.rs @@ -76,7 +76,7 @@ fn main() { rmeta_contains("auxiliary"); out_diagobj.run(); rmeta_contains("/the/aux/lib.rs"); - rmeta_contains("auxiliary"); + rmeta_not_contains("auxiliary"); out_diagdocobj.run(); rmeta_contains("/the/aux/lib.rs"); rmeta_not_contains("auxiliary"); diff --git a/tests/rustdoc-json/remap-path-prefix/object.rs b/tests/rustdoc-json/remap-path-prefix/object.rs index 052ad7651eeab..18d869580883a 100644 --- a/tests/rustdoc-json/remap-path-prefix/object.rs +++ b/tests/rustdoc-json/remap-path-prefix/object.rs @@ -1,5 +1,6 @@ +//@ ignore-windows //@ compile-flags: --remap-path-prefix={{src-base}}=/remapped //@ compile-flags: --remap-path-scope=object -Zunstable-options -//@ is "$.index[?(@.name=='StrLike')].span.filename" $FILE +//@ is "$.index[?(@.name=='StrLike')].span.filename" \"/remapped/remap-path-prefix/object.rs\" pub trait StrLike {} diff --git a/tests/ui/codegen/normalization-overflow/recursion-issue-131342.rs b/tests/ui/codegen/normalization-overflow/recursion-issue-131342.rs index 55a2c0647c2f4..67774216d7de4 100644 --- a/tests/ui/codegen/normalization-overflow/recursion-issue-131342.rs +++ b/tests/ui/codegen/normalization-overflow/recursion-issue-131342.rs @@ -1,4 +1,13 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver=globally -Arecursion_depth_exceeding_limit //@ build-fail +//@ dont-check-compiler-stderr +//@ forbid-output: internal compiler error + +// Recursive Peekable instantiation can overflow during codegen. +// The next solver should report an error instead of ICEing. +//[next]~? ERROR overflow evaluating the requirement fn main() { let mut items = vec![1, 2, 3, 4, 5].into_iter(); @@ -7,7 +16,7 @@ fn main() { fn problem_thingy(items: &mut impl Iterator) { let mut peeker = items.peekable(); - //~^ ERROR: reached the recursion limit while instantiating + //[current]~^ ERROR: reached the recursion limit while instantiating match peeker.peek() { Some(_) => (), None => return (), diff --git a/tests/ui/codegen/normalization-overflow/recursion-issue-92004.rs b/tests/ui/codegen/normalization-overflow/recursion-issue-92004.rs index e23819e50a886..1f52a9e5955fc 100644 --- a/tests/ui/codegen/normalization-overflow/recursion-issue-92004.rs +++ b/tests/ui/codegen/normalization-overflow/recursion-issue-92004.rs @@ -1,6 +1,12 @@ +//@ revisions: current next +//[next]~? ERROR: overflow evaluating the requirement +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver=globally -Arecursion_depth_exceeding_limit //@ build-fail //@ compile-flags: -Copt-level=0 //@ edition:2021 +//@ dont-check-compiler-stderr +//@ forbid-output: internal compiler error // ignore-tidy-file-linelength use std::vec::Vec; @@ -42,7 +48,7 @@ pub fn operator_packet>(version: u64, type_id: u64, itr: version: version, type_id: type_id, packets: decode_packets(&mut itr.take(0).peekable()), - //~^ ERROR: reached the recursion limit while instantiating + //[current]~^ ERROR: reached the recursion limit while instantiating }; return Some(Packet::Operator(p)); diff --git a/tests/ui/codegen/normalization-overflow/recursion-issue-92004.stderr b/tests/ui/codegen/normalization-overflow/recursion-issue-92004.stderr deleted file mode 100644 index e6f14b995a82e..0000000000000 --- a/tests/ui/codegen/normalization-overflow/recursion-issue-92004.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: reached the recursion limit while instantiating `>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> as Iterator>::peekable` - --> $DIR/recursion-issue-92004.rs:44:38 - | -LL | packets: decode_packets(&mut itr.take(0).peekable()), - | ^^^^^^^^^^^^^^^^^^^^^^ - | -note: `peekable` defined here - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - -error: aborting due to 1 previous error - diff --git a/tests/ui/const-generics/mgca/byte-str-len-mismatch-ice-163904.rs b/tests/ui/const-generics/mgca/byte-str-len-mismatch-ice-163904.rs new file mode 100644 index 0000000000000..d71777d84208a --- /dev/null +++ b/tests/ui/const-generics/mgca/byte-str-len-mismatch-ice-163904.rs @@ -0,0 +1,8 @@ +//! Regression test for #163904 (used to ICE) +#![feature(gca_min_const_items, gca_macroless_items)] + +const X4: &[u8; usize::MAX] = b""; +//~^ ERROR the constant `&*b""` is not of type `&'static [u8; usize::MAX]` +static Y4: u8 = X4[0]; + +fn main() {} diff --git a/tests/ui/const-generics/mgca/byte-str-len-mismatch-ice-163904.stderr b/tests/ui/const-generics/mgca/byte-str-len-mismatch-ice-163904.stderr new file mode 100644 index 0000000000000..a5379055493b7 --- /dev/null +++ b/tests/ui/const-generics/mgca/byte-str-len-mismatch-ice-163904.stderr @@ -0,0 +1,8 @@ +error: the constant `&*b""` is not of type `&'static [u8; usize::MAX]` + --> $DIR/byte-str-len-mismatch-ice-163904.rs:4:1 + | +LL | const X4: &[u8; usize::MAX] = b""; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&'static [u8; usize::MAX]`, found `&'static [u8; 0]` + +error: aborting due to 1 previous error + diff --git a/tests/ui/impl-trait/in-trait/refine-self-referential-rtn.rs b/tests/ui/impl-trait/in-trait/refine-self-referential-rtn.rs new file mode 100644 index 0000000000000..0936f6e33635f --- /dev/null +++ b/tests/ui/impl-trait/in-trait/refine-self-referential-rtn.rs @@ -0,0 +1,16 @@ +#![feature(return_type_notation)] + +trait IntFactory { + fn stream(&self) -> impl IntFactory; +} + +struct S; + +impl IntFactory for S { + fn stream(&self) -> impl IntFactory { + //~^ ERROR the trait bound `!: IntFactory` is not satisfied + todo!() + } +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/refine-self-referential-rtn.stderr b/tests/ui/impl-trait/in-trait/refine-self-referential-rtn.stderr new file mode 100644 index 0000000000000..35c9cfd19408c --- /dev/null +++ b/tests/ui/impl-trait/in-trait/refine-self-referential-rtn.stderr @@ -0,0 +1,22 @@ +error[E0277]: the trait bound `!: IntFactory` is not satisfied + --> $DIR/refine-self-referential-rtn.rs:10:25 + | +LL | fn stream(&self) -> impl IntFactory { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntFactory` is not implemented for `!` +LL | +LL | todo!() + | ------- return type was inferred to be `!` here + | +help: the trait `IntFactory` is implemented for `S` + --> $DIR/refine-self-referential-rtn.rs:9:1 + | +LL | impl IntFactory for S { + | ^^^^^^^^^^^^^^^^^^^^^ +help: `!` can be coerced to any type; consider casting it to a concrete type that implements the trait + | +LL | todo!() as /* Type */ + | +++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/next-solver/corecursive-trait-solver-issue-162343.rs b/tests/ui/traits/next-solver/corecursive-trait-solver-issue-162343.rs new file mode 100644 index 0000000000000..19dddd44bbd16 --- /dev/null +++ b/tests/ui/traits/next-solver/corecursive-trait-solver-issue-162343.rs @@ -0,0 +1,27 @@ +//@ build-fail +//@ compile-flags: --crate-type=lib -Znext-solver=globally -Awarnings +// Regression test for #162343. +// Resolving baz during codegen hits the recursive RawMessage bound. +// This used to ICE instead of reporting the overflow at the impl. + +trait RawMessage<'a> { + fn baz() {} +} + +impl<'a> RawMessage<'a> for () //~ ERROR overflow evaluating the requirement +where + (): RawMessage<'a>, +{} + +trait EmptyState2 { + fn bar() {} +} + +impl<'a> EmptyState2 for () +where + (): RawMessage<'a>, +{ + fn bar() { + <() as RawMessage>::baz(); + } +} diff --git a/tests/ui/traits/next-solver/corecursive-trait-solver-issue-162343.stderr b/tests/ui/traits/next-solver/corecursive-trait-solver-issue-162343.stderr new file mode 100644 index 0000000000000..ddb6f8aaddff8 --- /dev/null +++ b/tests/ui/traits/next-solver/corecursive-trait-solver-issue-162343.stderr @@ -0,0 +1,11 @@ +error[E0275]: overflow evaluating the requirement `(): RawMessage<'_>` + --> $DIR/corecursive-trait-solver-issue-162343.rs:11:1 + | +LL | / impl<'a> RawMessage<'a> for () +LL | | where +LL | | (): RawMessage<'a>, + | |_______________________^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/transmutability/references/lifetime-extension.current.stderr b/tests/ui/transmutability/references/lifetime-extension.current.stderr new file mode 100644 index 0000000000000..5aa600441f518 --- /dev/null +++ b/tests/ui/transmutability/references/lifetime-extension.current.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/lifetime-extension.rs:10:14 + | +LL | fn func(n: &i32) -> &'static i32 { + | - let's call the lifetime of this reference `'1` +LL | unsafe { core::mem::TransmuteFrom::<_, { core::mem::Assume::NOTHING }>::transmute(n) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static` + +error: aborting due to 1 previous error + diff --git a/tests/ui/transmutability/references/lifetime-extension.next.stderr b/tests/ui/transmutability/references/lifetime-extension.next.stderr new file mode 100644 index 0000000000000..5aa600441f518 --- /dev/null +++ b/tests/ui/transmutability/references/lifetime-extension.next.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/lifetime-extension.rs:10:14 + | +LL | fn func(n: &i32) -> &'static i32 { + | - let's call the lifetime of this reference `'1` +LL | unsafe { core::mem::TransmuteFrom::<_, { core::mem::Assume::NOTHING }>::transmute(n) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static` + +error: aborting due to 1 previous error + diff --git a/tests/ui/transmutability/references/lifetime-extension.rs b/tests/ui/transmutability/references/lifetime-extension.rs new file mode 100644 index 0000000000000..b5a30312668cc --- /dev/null +++ b/tests/ui/transmutability/references/lifetime-extension.rs @@ -0,0 +1,14 @@ +//! Regression test for . + +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@ [next] compile-flags: -Znext-solver + +#![feature(transmutability)] + +fn func(n: &i32) -> &'static i32 { + unsafe { core::mem::TransmuteFrom::<_, { core::mem::Assume::NOTHING }>::transmute(n) } + //~^ ERROR lifetime may not live long enough +} + +fn main() {} diff --git a/tests/ui/transmutability/references/reject_lifetime_extension.stderr b/tests/ui/transmutability/references/reject_lifetime_extension.next.stderr similarity index 87% rename from tests/ui/transmutability/references/reject_lifetime_extension.stderr rename to tests/ui/transmutability/references/reject_lifetime_extension.next.stderr index 392aec03b3d2c..20d052df1ac02 100644 --- a/tests/ui/transmutability/references/reject_lifetime_extension.stderr +++ b/tests/ui/transmutability/references/reject_lifetime_extension.next.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/reject_lifetime_extension.rs:20:18 + --> $DIR/reject_lifetime_extension.rs:22:18 | LL | fn extend_bare<'a>(src: &'a u8) -> &'static u8 { | -- lifetime `'a` defined here @@ -7,7 +7,7 @@ LL | unsafe { transmute(src) } | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/reject_lifetime_extension.rs:28:18 + --> $DIR/reject_lifetime_extension.rs:30:18 | LL | fn extend_nested<'a>(src: &'a &'a u8) -> &'a &'static u8 { | -- lifetime `'a` defined here @@ -15,7 +15,7 @@ LL | unsafe { transmute(src) } | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/reject_lifetime_extension.rs:36:18 + --> $DIR/reject_lifetime_extension.rs:38:18 | LL | fn extend_unit<'a>(src: (&'a u8,)) -> (&'static u8,) { | -- lifetime `'a` defined here @@ -23,7 +23,7 @@ LL | unsafe { transmute(src) } | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/reject_lifetime_extension.rs:40:18 + --> $DIR/reject_lifetime_extension.rs:42:18 | LL | fn extend_pair<'a>(src: (&'a u8, u8)) -> (&'static u8, u8) { | -- lifetime `'a` defined here @@ -31,7 +31,7 @@ LL | unsafe { transmute(src) } | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/reject_lifetime_extension.rs:50:18 + --> $DIR/reject_lifetime_extension.rs:52:18 | LL | fn extend_struct<'a>(src: Struct<'a>) -> Struct<'static> { | -- lifetime `'a` defined here @@ -39,7 +39,7 @@ LL | unsafe { transmute(src) } | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/reject_lifetime_extension.rs:62:18 + --> $DIR/reject_lifetime_extension.rs:64:18 | LL | fn extend_single<'a>(src: Single<'a>) -> Single<'static> { | -- lifetime `'a` defined here @@ -47,7 +47,7 @@ LL | unsafe { transmute(src) } | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/reject_lifetime_extension.rs:72:18 + --> $DIR/reject_lifetime_extension.rs:74:18 | LL | fn extend_multi<'a>(src: Multi<'a>) -> Multi<'static> { | -- lifetime `'a` defined here @@ -55,7 +55,7 @@ LL | unsafe { transmute(src) } | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error[E0521]: borrowed data escapes outside of function - --> $DIR/reject_lifetime_extension.rs:80:18 + --> $DIR/reject_lifetime_extension.rs:82:18 | LL | fn call_extend_hrtb<'a>(src: &'a u8) -> &'static u8 { | -- --- `src` is only valid in the function body @@ -68,7 +68,7 @@ LL | unsafe { extend_hrtb(src) } | argument requires that `'a` must outlive `'static` | note: due to a current limitation of the type system, this implies a `'static` lifetime - --> $DIR/reject_lifetime_extension.rs:85:9 + --> $DIR/reject_lifetime_extension.rs:87:9 | LL | for<'b> &'b u8: TransmuteFrom<&'a u8>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/transmutability/references/reject_lifetime_extension.old.stderr b/tests/ui/transmutability/references/reject_lifetime_extension.old.stderr new file mode 100644 index 0000000000000..20d052df1ac02 --- /dev/null +++ b/tests/ui/transmutability/references/reject_lifetime_extension.old.stderr @@ -0,0 +1,78 @@ +error: lifetime may not live long enough + --> $DIR/reject_lifetime_extension.rs:22:18 + | +LL | fn extend_bare<'a>(src: &'a u8) -> &'static u8 { + | -- lifetime `'a` defined here +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/reject_lifetime_extension.rs:30:18 + | +LL | fn extend_nested<'a>(src: &'a &'a u8) -> &'a &'static u8 { + | -- lifetime `'a` defined here +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/reject_lifetime_extension.rs:38:18 + | +LL | fn extend_unit<'a>(src: (&'a u8,)) -> (&'static u8,) { + | -- lifetime `'a` defined here +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/reject_lifetime_extension.rs:42:18 + | +LL | fn extend_pair<'a>(src: (&'a u8, u8)) -> (&'static u8, u8) { + | -- lifetime `'a` defined here +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/reject_lifetime_extension.rs:52:18 + | +LL | fn extend_struct<'a>(src: Struct<'a>) -> Struct<'static> { + | -- lifetime `'a` defined here +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/reject_lifetime_extension.rs:64:18 + | +LL | fn extend_single<'a>(src: Single<'a>) -> Single<'static> { + | -- lifetime `'a` defined here +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/reject_lifetime_extension.rs:74:18 + | +LL | fn extend_multi<'a>(src: Multi<'a>) -> Multi<'static> { + | -- lifetime `'a` defined here +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error[E0521]: borrowed data escapes outside of function + --> $DIR/reject_lifetime_extension.rs:82:18 + | +LL | fn call_extend_hrtb<'a>(src: &'a u8) -> &'static u8 { + | -- --- `src` is only valid in the function body + | | + | lifetime `'a` defined here +LL | unsafe { extend_hrtb(src) } + | ^^^^^^^^^^^^^^^^ + | | + | `src` escapes the function body here + | argument requires that `'a` must outlive `'static` + | +note: due to a current limitation of the type system, this implies a `'static` lifetime + --> $DIR/reject_lifetime_extension.rs:87:9 + | +LL | for<'b> &'b u8: TransmuteFrom<&'a u8>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0521`. diff --git a/tests/ui/transmutability/references/reject_lifetime_extension.rs b/tests/ui/transmutability/references/reject_lifetime_extension.rs index ff9290c34af92..c89d98e7cc048 100644 --- a/tests/ui/transmutability/references/reject_lifetime_extension.rs +++ b/tests/ui/transmutability/references/reject_lifetime_extension.rs @@ -1,4 +1,6 @@ -//@ check-fail +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver //! Reject lifetime extensions.