| author | bors <bors@rust-lang.org> 2026-03-26 15:08:36 UTC |
| committer | bors <bors@rust-lang.org> 2026-03-26 15:08:36 UTC |
| log | 23903d01c237d7c7d4fb62b82ca846bc45de4e0c |
| tree | 676b6f3abad0b003a824843bb67f1646d5bdc749 |
| parent | f58bd5cee4ce4a97b03146fa94fc9ba68ddd5f64 |
| parent | 90bebc0fc6bba209b1ab0787c253751abac067a1 |
Rollup of 5 pull requests
Successful merges:
- rust-lang/rust#152757 (Add x86_64-unknown-linux-gnu{m,t}san target which enables {M,T}San by default)
- rust-lang/rust#154354 (Add more tests for the parallel frontend)
- rust-lang/rust#154088 (Reorder inline asm operands in pretty printer to satisfy grammar constraints)
- rust-lang/rust#154407 (Link from `assert_matches` to `debug_assert_matches`)
- rust-lang/rust#154420 (Use extended regex syntax)35 files changed, 1943 insertions(+), 6 deletions(-)
compiler/rustc_ast_pretty/src/pprust/state.rs+82-2| ... | ... | @@ -1649,6 +1649,85 @@ impl<'a> State<'a> { |
| 1649 | 1649 | ); |
| 1650 | 1650 | } |
| 1651 | 1651 | |
| 1652 | fn inline_asm_template_and_operands<'asm>( | |
| 1653 | asm: &'asm ast::InlineAsm, | |
| 1654 | ) -> (String, Vec<&'asm InlineAsmOperand>) { | |
| 1655 | fn is_explicit_reg(op: &InlineAsmOperand) -> bool { | |
| 1656 | match op { | |
| 1657 | InlineAsmOperand::In { reg, .. } | |
| 1658 | | InlineAsmOperand::Out { reg, .. } | |
| 1659 | | InlineAsmOperand::InOut { reg, .. } | |
| 1660 | | InlineAsmOperand::SplitInOut { reg, .. } => { | |
| 1661 | matches!(reg, InlineAsmRegOrRegClass::Reg(_)) | |
| 1662 | } | |
| 1663 | InlineAsmOperand::Const { .. } | |
| 1664 | | InlineAsmOperand::Sym { .. } | |
| 1665 | | InlineAsmOperand::Label { .. } => false, | |
| 1666 | } | |
| 1667 | } | |
| 1668 | ||
| 1669 | // After macro expansion, named operands become positional. The grammar | |
| 1670 | // requires positional operands to precede explicit register operands, | |
| 1671 | // so we must reorder when any non-explicit operand follows an explicit | |
| 1672 | // one. When no reordering is needed, we use the original template | |
| 1673 | // string and operand order to avoid duplicating the Display logic in | |
| 1674 | // InlineAsmTemplatePiece. | |
| 1675 | let needs_reorder = { | |
| 1676 | let mut seen_explicit = false; | |
| 1677 | asm.operands.iter().any(|(op, _)| { | |
| 1678 | if is_explicit_reg(op) { | |
| 1679 | seen_explicit = true; | |
| 1680 | false | |
| 1681 | } else { | |
| 1682 | seen_explicit | |
| 1683 | } | |
| 1684 | }) | |
| 1685 | }; | |
| 1686 | ||
| 1687 | if !needs_reorder { | |
| 1688 | let template = InlineAsmTemplatePiece::to_string(&asm.template); | |
| 1689 | let operands = asm.operands.iter().map(|(op, _)| op).collect(); | |
| 1690 | return (template, operands); | |
| 1691 | } | |
| 1692 | ||
| 1693 | let mut non_explicit = Vec::new(); | |
| 1694 | let mut explicit = Vec::new(); | |
| 1695 | for (i, (op, _)) in asm.operands.iter().enumerate() { | |
| 1696 | if is_explicit_reg(op) { | |
| 1697 | explicit.push(i); | |
| 1698 | } else { | |
| 1699 | non_explicit.push(i); | |
| 1700 | } | |
| 1701 | } | |
| 1702 | let order = non_explicit.into_iter().chain(explicit).collect::<Vec<_>>(); | |
| 1703 | ||
| 1704 | // Build old-index -> new-index mapping for template renumbering. | |
| 1705 | let mut old_to_new = vec![0usize; asm.operands.len()]; | |
| 1706 | for (new_idx, old_idx) in order.iter().copied().enumerate() { | |
| 1707 | old_to_new[old_idx] = new_idx; | |
| 1708 | } | |
| 1709 | ||
| 1710 | // Remap template placeholder indices and reuse the existing Display | |
| 1711 | // impl to build the template string. | |
| 1712 | let remapped = asm | |
| 1713 | .template | |
| 1714 | .iter() | |
| 1715 | .map(|piece| match piece { | |
| 1716 | InlineAsmTemplatePiece::Placeholder { operand_idx, modifier, span } => { | |
| 1717 | InlineAsmTemplatePiece::Placeholder { | |
| 1718 | operand_idx: old_to_new[*operand_idx], | |
| 1719 | modifier: *modifier, | |
| 1720 | span: *span, | |
| 1721 | } | |
| 1722 | } | |
| 1723 | other => other.clone(), | |
| 1724 | }) | |
| 1725 | .collect::<Vec<_>>(); | |
| 1726 | let template = InlineAsmTemplatePiece::to_string(&remapped); | |
| 1727 | let operands = order.iter().map(|&idx| &asm.operands[idx].0).collect(); | |
| 1728 | (template, operands) | |
| 1729 | } | |
| 1730 | ||
| 1652 | 1731 | fn print_inline_asm(&mut self, asm: &ast::InlineAsm) { |
| 1653 | 1732 | enum AsmArg<'a> { |
| 1654 | 1733 | Template(String), |
| ... | ... | @@ -1657,8 +1736,9 @@ impl<'a> State<'a> { |
| 1657 | 1736 | Options(InlineAsmOptions), |
| 1658 | 1737 | } |
| 1659 | 1738 | |
| 1660 | let mut args = vec![AsmArg::Template(InlineAsmTemplatePiece::to_string(&asm.template))]; | |
| 1661 | args.extend(asm.operands.iter().map(|(o, _)| AsmArg::Operand(o))); | |
| 1739 | let (template, operands) = Self::inline_asm_template_and_operands(asm); | |
| 1740 | let mut args = vec![AsmArg::Template(template)]; | |
| 1741 | args.extend(operands.into_iter().map(AsmArg::Operand)); | |
| 1662 | 1742 | for (abi, _) in &asm.clobber_abis { |
| 1663 | 1743 | args.push(AsmArg::ClobberAbi(*abi)); |
| 1664 | 1744 | } |
compiler/rustc_target/src/spec/mod.rs+2| ... | ... | @@ -1826,6 +1826,8 @@ supported_targets! { |
| 1826 | 1826 | ("x86_64-pc-cygwin", x86_64_pc_cygwin), |
| 1827 | 1827 | |
| 1828 | 1828 | ("x86_64-unknown-linux-gnuasan", x86_64_unknown_linux_gnuasan), |
| 1829 | ("x86_64-unknown-linux-gnumsan", x86_64_unknown_linux_gnumsan), | |
| 1830 | ("x86_64-unknown-linux-gnutsan", x86_64_unknown_linux_gnutsan), | |
| 1829 | 1831 | } |
| 1830 | 1832 | |
| 1831 | 1833 | /// Cow-Vec-Str: Cow<'static, [Cow<'static, str>]> |
compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnumsan.rs created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | use crate::spec::{SanitizerSet, Target, TargetMetadata}; | |
| 2 | ||
| 3 | pub(crate) fn target() -> Target { | |
| 4 | let mut base = super::x86_64_unknown_linux_gnu::target(); | |
| 5 | base.metadata = TargetMetadata { | |
| 6 | description: Some( | |
| 7 | "64-bit Linux (kernel 3.2+, glibc 2.17+) with MSAN enabled by default".into(), | |
| 8 | ), | |
| 9 | tier: Some(2), | |
| 10 | host_tools: Some(false), | |
| 11 | std: Some(true), | |
| 12 | }; | |
| 13 | base.supported_sanitizers = SanitizerSet::MEMORY; | |
| 14 | base.default_sanitizers = SanitizerSet::MEMORY; | |
| 15 | base | |
| 16 | } |
compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnutsan.rs created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | use crate::spec::{SanitizerSet, Target, TargetMetadata}; | |
| 2 | ||
| 3 | pub(crate) fn target() -> Target { | |
| 4 | let mut base = super::x86_64_unknown_linux_gnu::target(); | |
| 5 | base.metadata = TargetMetadata { | |
| 6 | description: Some( | |
| 7 | "64-bit Linux (kernel 3.2+, glibc 2.17+) with TSAN enabled by default".into(), | |
| 8 | ), | |
| 9 | tier: Some(2), | |
| 10 | host_tools: Some(false), | |
| 11 | std: Some(true), | |
| 12 | }; | |
| 13 | base.supported_sanitizers = SanitizerSet::THREAD; | |
| 14 | base.default_sanitizers = SanitizerSet::THREAD; | |
| 15 | base | |
| 16 | } |
library/core/src/macros/mod.rs+3-3| ... | ... | @@ -124,8 +124,6 @@ macro_rules! assert_ne { |
| 124 | 124 | }; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | // FIXME add back debug_assert_matches doc link after bootstrap. | |
| 128 | ||
| 129 | 127 | /// Asserts that an expression matches the provided pattern. |
| 130 | 128 | /// |
| 131 | 129 | /// This macro is generally preferable to `assert!(matches!(value, pattern))`, because it can print |
| ... | ... | @@ -137,9 +135,11 @@ macro_rules! assert_ne { |
| 137 | 135 | /// otherwise this macro will panic. |
| 138 | 136 | /// |
| 139 | 137 | /// Assertions are always checked in both debug and release builds, and cannot |
| 140 | /// be disabled. See `debug_assert_matches!` for assertions that are disabled in | |
| 138 | /// be disabled. See [`debug_assert_matches!`] for assertions that are disabled in | |
| 141 | 139 | /// release builds by default. |
| 142 | 140 | /// |
| 141 | /// [`debug_assert_matches!`]: crate::debug_assert_matches | |
| 142 | /// | |
| 143 | 143 | /// On panic, this macro will print the value of the expression with its debug representation. |
| 144 | 144 | /// |
| 145 | 145 | /// Like [`assert!`], this macro has a second form, where a custom panic message can be provided. |
src/bootstrap/src/core/build_steps/llvm.rs+2| ... | ... | @@ -1558,6 +1558,8 @@ fn supported_sanitizers( |
| 1558 | 1558 | &["asan", "dfsan", "lsan", "msan", "safestack", "tsan", "rtsan"], |
| 1559 | 1559 | ), |
| 1560 | 1560 | "x86_64-unknown-linux-gnuasan" => common_libs("linux", "x86_64", &["asan"]), |
| 1561 | "x86_64-unknown-linux-gnumsan" => common_libs("linux", "x86_64", &["msan"]), | |
| 1562 | "x86_64-unknown-linux-gnutsan" => common_libs("linux", "x86_64", &["tsan"]), | |
| 1561 | 1563 | "x86_64-unknown-linux-musl" => { |
| 1562 | 1564 | common_libs("linux", "x86_64", &["asan", "lsan", "msan", "tsan"]) |
| 1563 | 1565 | } |
src/bootstrap/src/core/sanity.rs+2| ... | ... | @@ -37,6 +37,8 @@ pub struct Finder { |
| 37 | 37 | /// when the newly-bumped stage 0 compiler now knows about the formerly-missing targets. |
| 38 | 38 | const STAGE0_MISSING_TARGETS: &[&str] = &[ |
| 39 | 39 | // just a dummy comment so the list doesn't get onelined |
| 40 | "x86_64-unknown-linux-gnumsan", | |
| 41 | "x86_64-unknown-linux-gnutsan", | |
| 40 | 42 | ]; |
| 41 | 43 | |
| 42 | 44 | /// Minimum version threshold for libstdc++ required when using prebuilt LLVM |
src/ci/docker/host-x86_64/dist-various-2/Dockerfile+2| ... | ... | @@ -124,6 +124,8 @@ ENV TARGETS=$TARGETS,x86_64-unknown-uefi |
| 124 | 124 | ENV TARGETS=$TARGETS,riscv64gc-unknown-linux-musl |
| 125 | 125 | |
| 126 | 126 | ENV TARGETS_SANITIZERS=x86_64-unknown-linux-gnuasan |
| 127 | ENV TARGETS_SANITIZERS=$TARGETS_SANITIZERS,x86_64-unknown-linux-gnumsan | |
| 128 | ENV TARGETS_SANITIZERS=$TARGETS_SANITIZERS,x86_64-unknown-linux-gnutsan | |
| 127 | 129 | |
| 128 | 130 | # As per https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1300211 |
| 129 | 131 | # we need asm in the search path for gcc-9 (for gnux32) but not in the search path of the |
src/doc/rustc/src/SUMMARY.md+2| ... | ... | @@ -155,5 +155,7 @@ |
| 155 | 155 | - [x86_64-unknown-linux-none](platform-support/x86_64-unknown-linux-none.md) |
| 156 | 156 | - [x86_64-unknown-none](platform-support/x86_64-unknown-none.md) |
| 157 | 157 | - [x86_64-unknown-linux-gnuasan](platform-support/x86_64-unknown-linux-gnuasan.md) |
| 158 | - [x86_64-unknown-linux-gnumsan](platform-support/x86_64-unknown-linux-gnumsan.md) | |
| 159 | - [x86_64-unknown-linux-gnutsan](platform-support/x86_64-unknown-linux-gnutsan.md) | |
| 158 | 160 | - [xtensa-\*-none-elf](platform-support/xtensa.md) |
| 159 | 161 | - [\*-nuttx-\*](platform-support/nuttx.md) |
src/doc/rustc/src/platform-support.md+2| ... | ... | @@ -216,6 +216,8 @@ target | std | notes |
| 216 | 216 | [`x86_64-fortanix-unknown-sgx`](platform-support/x86_64-fortanix-unknown-sgx.md) | ✓ | [Fortanix ABI] for 64-bit Intel SGX |
| 217 | 217 | [`x86_64-linux-android`](platform-support/android.md) | ✓ | 64-bit x86 Android |
| 218 | 218 | [`x86_64-unknown-linux-gnuasan`](platform-support/x86_64-unknown-linux-gnuasan.md) | ✓ | 64-bit Linux (kernel 3.2+, glibc 2.17+) with ASAN enabled by default |
| 219 | [`x86_64-unknown-linux-gnumsan`](platform-support/x86_64-unknown-linux-gnumsan.md) | ✓ | 64-bit Linux (kernel 3.2+, glibc 2.17+) with MSAN enabled by default | |
| 220 | [`x86_64-unknown-linux-gnutsan`](platform-support/x86_64-unknown-linux-gnutsan.md) | ✓ | 64-bit Linux (kernel 3.2+, glibc 2.17+) with TSAN enabled by default | |
| 219 | 221 | [`x86_64-unknown-fuchsia`](platform-support/fuchsia.md) | ✓ | 64-bit x86 Fuchsia |
| 220 | 222 | `x86_64-unknown-linux-gnux32` | ✓ | 64-bit Linux (x32 ABI) (kernel 4.15+, glibc 2.27) |
| 221 | 223 | [`x86_64-unknown-none`](platform-support/x86_64-unknown-none.md) | * | Freestanding/bare-metal x86_64, softfloat |
src/doc/rustc/src/platform-support/x86_64-unknown-linux-gnumsan.md created+56| ... | ... | @@ -0,0 +1,56 @@ |
| 1 | # `x86_64-unknown-linux-gnumsan` | |
| 2 | ||
| 3 | **Tier: 2** | |
| 4 | ||
| 5 | Target mirroring `x86_64-unknown-linux-gnu` with MemorySanitizer enabled by | |
| 6 | default. | |
| 7 | The goal of this target is to allow shipping MSAN-instrumented standard | |
| 8 | libraries through rustup, enabling a fully instrumented binary without requiring | |
| 9 | nightly features (build-std). | |
| 10 | Once build-std stabilizes, this target is no longer needed and will be removed. | |
| 11 | ||
| 12 | ## Target maintainers | |
| 13 | ||
| 14 | - [@jakos-sec](https://github.com/jakos-sec) | |
| 15 | - [@1c3t3a](https://github.com/1c3t3a) | |
| 16 | - [@rust-lang/project-exploit-mitigations][project-exploit-mitigations] | |
| 17 | ||
| 18 | ## Requirements | |
| 19 | ||
| 20 | The target is for cross-compilation only. Host tools are not supported, since | |
| 21 | there is no need to have the host tools instrumented with MSAN. std is fully | |
| 22 | supported. | |
| 23 | ||
| 24 | In all other aspects the target is equivalent to `x86_64-unknown-linux-gnu`. | |
| 25 | ||
| 26 | ## Building the target | |
| 27 | ||
| 28 | The target can be built by enabling it for a rustc build: | |
| 29 | ||
| 30 | ```toml | |
| 31 | [build] | |
| 32 | target = ["x86_64-unknown-linux-gnumsan"] | |
| 33 | ``` | |
| 34 | ||
| 35 | ## Building Rust programs | |
| 36 | ||
| 37 | Rust programs can be compiled by adding this target via rustup: | |
| 38 | ||
| 39 | ```sh | |
| 40 | $ rustup target add x86_64-unknown-linux-gnumsan | |
| 41 | ``` | |
| 42 | ||
| 43 | and then compiling with the target: | |
| 44 | ||
| 45 | ```sh | |
| 46 | $ rustc foo.rs --target x86_64-unknown-linux-gnumsan | |
| 47 | ``` | |
| 48 | ||
| 49 | ## Testing | |
| 50 | ||
| 51 | Created binaries will run on Linux without any external requirements. | |
| 52 | ||
| 53 | ## Cross-compilation toolchains and C code | |
| 54 | ||
| 55 | The target supports C code and should use the same toolchain target as | |
| 56 | `x86_64-unknown-linux-gnu`. |
src/doc/rustc/src/platform-support/x86_64-unknown-linux-gnutsan.md created+56| ... | ... | @@ -0,0 +1,56 @@ |
| 1 | # `x86_64-unknown-linux-gnutsan` | |
| 2 | ||
| 3 | **Tier: 2** | |
| 4 | ||
| 5 | Target mirroring `x86_64-unknown-linux-gnu` with ThreadSanitizer enabled by | |
| 6 | default. | |
| 7 | The goal of this target is to allow shipping TSAN-instrumented standard | |
| 8 | libraries through rustup, enabling a fully instrumented binary without requiring | |
| 9 | nightly features (build-std). | |
| 10 | Once build-std stabilizes, this target is no longer needed and will be removed. | |
| 11 | ||
| 12 | ## Target maintainers | |
| 13 | ||
| 14 | - [@jakos-sec](https://github.com/jakos-sec) | |
| 15 | - [@1c3t3a](https://github.com/1c3t3a) | |
| 16 | - [@rust-lang/project-exploit-mitigations][project-exploit-mitigations] | |
| 17 | ||
| 18 | ## Requirements | |
| 19 | ||
| 20 | The target is for cross-compilation only. Host tools are not supported, since | |
| 21 | there is no need to have the host tools instrumented with TSAN. std is fully | |
| 22 | supported. | |
| 23 | ||
| 24 | In all other aspects the target is equivalent to `x86_64-unknown-linux-gnu`. | |
| 25 | ||
| 26 | ## Building the target | |
| 27 | ||
| 28 | The target can be built by enabling it for a rustc build: | |
| 29 | ||
| 30 | ```toml | |
| 31 | [build] | |
| 32 | target = ["x86_64-unknown-linux-gnutsan"] | |
| 33 | ``` | |
| 34 | ||
| 35 | ## Building Rust programs | |
| 36 | ||
| 37 | Rust programs can be compiled by adding this target via rustup: | |
| 38 | ||
| 39 | ```sh | |
| 40 | $ rustup target add x86_64-unknown-linux-gnutsan | |
| 41 | ``` | |
| 42 | ||
| 43 | and then compiling with the target: | |
| 44 | ||
| 45 | ```sh | |
| 46 | $ rustc foo.rs --target x86_64-unknown-linux-gnutsan | |
| 47 | ``` | |
| 48 | ||
| 49 | ## Testing | |
| 50 | ||
| 51 | Created binaries will run on Linux without any external requirements. | |
| 52 | ||
| 53 | ## Cross-compilation toolchains and C code | |
| 54 | ||
| 55 | The target supports C code and should use the same toolchain target as | |
| 56 | `x86_64-unknown-linux-gnu`. |
tests/assembly-llvm/targets/targets-elf.rs+6| ... | ... | @@ -709,6 +709,12 @@ |
| 709 | 709 | //@ revisions: x86_64_unknown_linux_gnuasan |
| 710 | 710 | //@ [x86_64_unknown_linux_gnuasan] compile-flags: --target x86_64-unknown-linux-gnuasan |
| 711 | 711 | //@ [x86_64_unknown_linux_gnuasan] needs-llvm-components: x86 |
| 712 | //@ revisions: x86_64_unknown_linux_gnumsan | |
| 713 | //@ [x86_64_unknown_linux_gnumsan] compile-flags: --target x86_64-unknown-linux-gnumsan | |
| 714 | //@ [x86_64_unknown_linux_gnumsan] needs-llvm-components: x86 | |
| 715 | //@ revisions: x86_64_unknown_linux_gnutsan | |
| 716 | //@ [x86_64_unknown_linux_gnutsan] compile-flags: --target x86_64-unknown-linux-gnutsan | |
| 717 | //@ [x86_64_unknown_linux_gnutsan] needs-llvm-components: x86 | |
| 712 | 718 | //@ revisions: x86_64_unknown_linux_musl |
| 713 | 719 | //@ [x86_64_unknown_linux_musl] compile-flags: --target x86_64-unknown-linux-musl |
| 714 | 720 | //@ [x86_64_unknown_linux_musl] needs-llvm-components: x86 |
tests/pretty/asm-operand-order.pp created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | #![feature(prelude_import)] | |
| 2 | #![no_std] | |
| 3 | extern crate std; | |
| 4 | #[prelude_import] | |
| 5 | use ::std::prelude::rust_2015::*; | |
| 6 | //@ pretty-mode:expanded | |
| 7 | //@ pp-exact:asm-operand-order.pp | |
| 8 | //@ only-x86_64 | |
| 9 | ||
| 10 | use std::arch::asm; | |
| 11 | ||
| 12 | pub fn main() { | |
| 13 | unsafe { | |
| 14 | asm!("{0}", in(reg) 4, out("rax") _); | |
| 15 | asm!("{0}", in(reg) 4, out("rax") _, options(nostack)); | |
| 16 | asm!("{0} {1}", in(reg) 4, in(reg) 5, out("rax") _); | |
| 17 | asm!("{0}", const 5, out("rax") _); | |
| 18 | } | |
| 19 | } |
tests/pretty/asm-operand-order.rs created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | //@ pretty-mode:expanded | |
| 2 | //@ pp-exact:asm-operand-order.pp | |
| 3 | //@ only-x86_64 | |
| 4 | ||
| 5 | use std::arch::asm; | |
| 6 | ||
| 7 | pub fn main() { | |
| 8 | unsafe { | |
| 9 | asm!("{val}", out("rax") _, val = in(reg) 4); | |
| 10 | asm!("{val}", out("rax") _, val = in(reg) 4, options(nostack)); | |
| 11 | asm!("{a} {b}", out("rax") _, a = in(reg) 4, b = in(reg) 5); | |
| 12 | asm!("{val}", out("rax") _, val = const 5); | |
| 13 | } | |
| 14 | } |
tests/ui/parallel-rustc/assert-found_cycle-issue-115223.rs created+31| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | // Test for #115223, which causes a deadlock bug without finding the cycle | |
| 2 | //@ build-pass | |
| 3 | #![crate_name = "foo"] | |
| 4 | ||
| 5 | use std::ops; | |
| 6 | ||
| 7 | pub struct Foo; | |
| 8 | ||
| 9 | impl Foo { | |
| 10 | pub fn foo(&mut self) {} | |
| 11 | } | |
| 12 | ||
| 13 | pub struct Bar { | |
| 14 | foo: Foo, | |
| 15 | } | |
| 16 | ||
| 17 | impl ops::Deref for Bar { | |
| 18 | type Target = Foo; | |
| 19 | ||
| 20 | fn deref(&self) -> &Foo { | |
| 21 | &self.foo | |
| 22 | } | |
| 23 | } | |
| 24 | ||
| 25 | impl ops::DerefMut for Bar { | |
| 26 | fn deref_mut(&mut self) -> &mut Foo { | |
| 27 | &mut self.foo | |
| 28 | } | |
| 29 | } | |
| 30 | ||
| 31 | fn main() {} |
tests/ui/parallel-rustc/default-trait-shadow-cycle-issue-151358.rs created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | // Test for #151358, assertion failed: !worker_thread.is_null() | |
| 2 | //~^ ERROR cycle detected when looking up span for `Default` | |
| 3 | // | |
| 4 | //@ compile-flags: -Z threads=2 | |
| 5 | //@ compare-output-by-lines | |
| 6 | ||
| 7 | trait Default {} | |
| 8 | use std::num::NonZero; | |
| 9 | fn main() { | |
| 10 | NonZero(); | |
| 11 | todo!(); | |
| 12 | } |
tests/ui/parallel-rustc/default-trait-shadow-cycle-issue-151358.stderr created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | error[E0391]: cycle detected when looking up span for `Default` | |
| 2 | | | |
| 3 | = note: ...which immediately requires looking up span for `Default` again | |
| 4 | = note: cycle used when perform lints prior to AST lowering | |
| 5 | = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | |
| 6 | ||
| 7 | error: aborting due to 1 previous error | |
| 8 | ||
| 9 | For more information about this error, try `rustc --explain E0391`. |
tests/ui/parallel-rustc/generic-const-exprs-deadlock-issue-120757.rs created+127| ... | ... | @@ -0,0 +1,127 @@ |
| 1 | // Test for #120757, deadlock due to query cycle | |
| 2 | ||
| 3 | #![feature(generic_const_exprs)] | |
| 4 | ||
| 5 | trait TensorDimension { | |
| 6 | const DIM: usize; | |
| 7 | const ISSCALAR: bool = Self::DIM == 0; | |
| 8 | fn is_scalar(&self) -> bool { | |
| 9 | Self::ISSCALAR | |
| 10 | } | |
| 11 | } | |
| 12 | ||
| 13 | trait TensorSize: TensorDimension { | |
| 14 | fn size(&self) -> [usize; Self::DIM]; | |
| 15 | fn inbounds(&self, index: [usize; Self::DIM]) -> bool { | |
| 16 | index.iter().zip(self.size().iter()).all(|(i, s)| i < s) | |
| 17 | } | |
| 18 | } | |
| 19 | ||
| 20 | trait Broadcastable: TensorSize + Sized { | |
| 21 | type Element; | |
| 22 | fn bget(&self, index: [usize; Self::DIM]) -> Option<Self::Element>; | |
| 23 | fn lazy_updim<const NEWDIM: usize>( | |
| 24 | &self, | |
| 25 | size: [usize; NEWDIM], | |
| 26 | ) -> LazyUpdim<Self, { Self::DIM }, NEWDIM> { | |
| 27 | assert!( | |
| 28 | NEWDIM >= Self::DIM, | |
| 29 | "Updimmed tensor cannot have fewer indices than the initial one." | |
| 30 | ); | |
| 31 | LazyUpdim { size, reference: &self } | |
| 32 | } | |
| 33 | fn bmap<T, F: Fn(Self::Element) -> T>(&self, foo: F) -> BMap<T, Self, F, { Self::DIM }> { | |
| 34 | BMap { reference: self, closure: foo } | |
| 35 | } | |
| 36 | } | |
| 37 | ||
| 38 | struct LazyUpdim<'a, T: Broadcastable, const OLDDIM: usize, const DIM: usize> { | |
| 39 | size: [usize; DIM], | |
| 40 | reference: &'a T, | |
| 41 | } | |
| 42 | ||
| 43 | impl<'a, T: Broadcastable, const DIM: usize> TensorDimension for LazyUpdim<'a, T, { T::DIM }, DIM> { | |
| 44 | const DIM: usize = DIM; | |
| 45 | } | |
| 46 | impl<'a, T: Broadcastable, const DIM: usize> TensorSize for LazyUpdim<'a, T, { T::DIM }, DIM> { | |
| 47 | fn size(&self) -> [usize; DIM] { | |
| 48 | //~^ ERROR method not compatible with trait | |
| 49 | self.size | |
| 50 | } | |
| 51 | } | |
| 52 | impl<'a, T: Broadcastable, const DIM: usize> Broadcastable for LazyUpdim<'a, T, { T::DIM }, DIM> { | |
| 53 | type Element = T::Element; | |
| 54 | fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> { | |
| 55 | //~^ ERROR method not compatible with trait | |
| 56 | assert!(DIM >= T::DIM); | |
| 57 | if !self.inbounds(index) { | |
| 58 | //~^ ERROR unconstrained generic constant | |
| 59 | //~| ERROR mismatched types | |
| 60 | return None; | |
| 61 | } | |
| 62 | let size = self.size(); | |
| 63 | //~^ ERROR unconstrained generic constant | |
| 64 | ||
| 65 | let newindex: [usize; T::DIM] = Default::default(); | |
| 66 | //~^ ERROR the trait bound `[usize; T::DIM]: Default` is not satisfied | |
| 67 | self.reference.bget(newindex) | |
| 68 | } | |
| 69 | } | |
| 70 | ||
| 71 | struct BMap<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> { | |
| 72 | reference: &'a T, | |
| 73 | closure: F, | |
| 74 | } | |
| 75 | ||
| 76 | impl<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> TensorDimension | |
| 77 | for BMap<'a, R, T, F, DIM> | |
| 78 | { | |
| 79 | const DIM: usize = DIM; | |
| 80 | } | |
| 81 | impl<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> TensorSize | |
| 82 | for BMap<'a, R, T, F, DIM> | |
| 83 | { | |
| 84 | fn size(&self) -> [usize; DIM] { | |
| 85 | //~^ ERROR method not compatible with trait | |
| 86 | self.reference.size() | |
| 87 | //~^ ERROR unconstrained generic constant | |
| 88 | //~| ERROR mismatched types | |
| 89 | } | |
| 90 | } | |
| 91 | impl<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> Broadcastable | |
| 92 | for BMap<'a, R, T, F, DIM> | |
| 93 | { | |
| 94 | type Element = R; | |
| 95 | fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> { | |
| 96 | //~^ ERROR method not compatible with trait | |
| 97 | self.reference.bget(index).map(ns_window) | |
| 98 | //~^ ERROR unconstrained generic constant | |
| 99 | //~| ERROR mismatched types | |
| 100 | //~| ERROR cannot find value `ns_window` in this scope | |
| 101 | } | |
| 102 | } | |
| 103 | ||
| 104 | impl<T> TensorDimension for Vec<T> { | |
| 105 | const DIM: usize = 1; | |
| 106 | } | |
| 107 | impl<T> TensorSize for Vec<T> { | |
| 108 | fn size(&self) -> [usize; 1] { | |
| 109 | //~^ ERROR method not compatible with trait | |
| 110 | [self.len()] | |
| 111 | } | |
| 112 | } | |
| 113 | impl<T: Clone> Broadcastable for Vec<T> { | |
| 114 | type Element = T; | |
| 115 | fn bget(&self, index: [usize; 1]) -> Option<T> { | |
| 116 | //~^ ERROR method not compatible with trait | |
| 117 | self.get(index[0]).cloned() | |
| 118 | } | |
| 119 | } | |
| 120 | ||
| 121 | fn main() { | |
| 122 | let v = vec![1, 2, 3]; | |
| 123 | let bv = v.lazy_updim([3, 4]); | |
| 124 | let bbv = bv.bmap(|x| x * x); | |
| 125 | ||
| 126 | println!("The size of v is {:?}", bbv.bget([0, 2]).expect("Out of bounds.")); | |
| 127 | } |
tests/ui/parallel-rustc/generic-const-exprs-deadlock-issue-120757.stderr created+166| ... | ... | @@ -0,0 +1,166 @@ |
| 1 | error[E0425]: cannot find value `ns_window` in this scope | |
| 2 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:97:40 | |
| 3 | | | |
| 4 | LL | self.reference.bget(index).map(ns_window) | |
| 5 | | ^^^^^^^^^ not found in this scope | |
| 6 | ||
| 7 | error[E0308]: method not compatible with trait | |
| 8 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:47:5 | |
| 9 | | | |
| 10 | LL | fn size(&self) -> [usize; DIM] { | |
| 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `DIM` | |
| 12 | | | |
| 13 | = note: expected constant `Self::DIM` | |
| 14 | found constant `DIM` | |
| 15 | ||
| 16 | error[E0308]: method not compatible with trait | |
| 17 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:54:5 | |
| 18 | | | |
| 19 | LL | fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> { | |
| 20 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `DIM` | |
| 21 | | | |
| 22 | = note: expected constant `Self::DIM` | |
| 23 | found constant `DIM` | |
| 24 | ||
| 25 | error[E0308]: method not compatible with trait | |
| 26 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:84:5 | |
| 27 | | | |
| 28 | LL | fn size(&self) -> [usize; DIM] { | |
| 29 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `DIM` | |
| 30 | | | |
| 31 | = note: expected constant `Self::DIM` | |
| 32 | found constant `DIM` | |
| 33 | ||
| 34 | error[E0308]: method not compatible with trait | |
| 35 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:95:5 | |
| 36 | | | |
| 37 | LL | fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> { | |
| 38 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `DIM` | |
| 39 | | | |
| 40 | = note: expected constant `Self::DIM` | |
| 41 | found constant `DIM` | |
| 42 | ||
| 43 | error[E0308]: method not compatible with trait | |
| 44 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:108:5 | |
| 45 | | | |
| 46 | LL | fn size(&self) -> [usize; 1] { | |
| 47 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `1` | |
| 48 | | | |
| 49 | = note: expected constant `Self::DIM` | |
| 50 | found constant `1` | |
| 51 | ||
| 52 | error[E0308]: method not compatible with trait | |
| 53 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:115:5 | |
| 54 | | | |
| 55 | LL | fn bget(&self, index: [usize; 1]) -> Option<T> { | |
| 56 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `1` | |
| 57 | | | |
| 58 | = note: expected constant `Self::DIM` | |
| 59 | found constant `1` | |
| 60 | ||
| 61 | error: unconstrained generic constant | |
| 62 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:57:13 | |
| 63 | | | |
| 64 | LL | if !self.inbounds(index) { | |
| 65 | | ^^^^ | |
| 66 | | | |
| 67 | note: required by a bound in `TensorSize::inbounds` | |
| 68 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:15:39 | |
| 69 | | | |
| 70 | LL | fn inbounds(&self, index: [usize; Self::DIM]) -> bool { | |
| 71 | | ^^^^^^^^^ required by this bound in `TensorSize::inbounds` | |
| 72 | help: try adding a `where` bound | |
| 73 | | | |
| 74 | LL | fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> where [(); Self::DIM]: { | |
| 75 | | ++++++++++++++++++++++ | |
| 76 | ||
| 77 | error[E0308]: mismatched types | |
| 78 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:57:27 | |
| 79 | | | |
| 80 | LL | if !self.inbounds(index) { | |
| 81 | | ^^^^^ expected `Self::DIM`, found `DIM` | |
| 82 | | | |
| 83 | = note: expected constant `Self::DIM` | |
| 84 | found constant `DIM` | |
| 85 | ||
| 86 | error: unconstrained generic constant | |
| 87 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:62:25 | |
| 88 | | | |
| 89 | LL | let size = self.size(); | |
| 90 | | ^^^^ | |
| 91 | | | |
| 92 | note: required by a bound in `TensorSize::size` | |
| 93 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:14:31 | |
| 94 | | | |
| 95 | LL | fn size(&self) -> [usize; Self::DIM]; | |
| 96 | | ^^^^^^^^^ required by this bound in `TensorSize::size` | |
| 97 | help: try adding a `where` bound | |
| 98 | | | |
| 99 | LL | fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> where [(); Self::DIM]: { | |
| 100 | | ++++++++++++++++++++++ | |
| 101 | ||
| 102 | error[E0277]: the trait bound `[usize; T::DIM]: Default` is not satisfied | |
| 103 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:65:41 | |
| 104 | | | |
| 105 | LL | let newindex: [usize; T::DIM] = Default::default(); | |
| 106 | | ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `[usize; T::DIM]` | |
| 107 | | | |
| 108 | help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | |
| 109 | | | |
| 110 | LL | impl<'a, T: Broadcastable, const DIM: usize> Broadcastable for LazyUpdim<'a, T, { T::DIM }, DIM> where [usize; T::DIM]: Default { | |
| 111 | | ++++++++++++++++++++++++++++++ | |
| 112 | ||
| 113 | error: unconstrained generic constant | |
| 114 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:86:24 | |
| 115 | | | |
| 116 | LL | self.reference.size() | |
| 117 | | ^^^^ | |
| 118 | | | |
| 119 | note: required by a bound in `TensorSize::size` | |
| 120 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:14:31 | |
| 121 | | | |
| 122 | LL | fn size(&self) -> [usize; Self::DIM]; | |
| 123 | | ^^^^^^^^^ required by this bound in `TensorSize::size` | |
| 124 | help: try adding a `where` bound | |
| 125 | | | |
| 126 | LL | fn size(&self) -> [usize; DIM] where [(); Self::DIM]: { | |
| 127 | | ++++++++++++++++++++++ | |
| 128 | ||
| 129 | error[E0308]: mismatched types | |
| 130 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:86:9 | |
| 131 | | | |
| 132 | LL | self.reference.size() | |
| 133 | | ^^^^^^^^^^^^^^^^^^^^^ expected `DIM`, found `Self::DIM` | |
| 134 | | | |
| 135 | = note: expected constant `DIM` | |
| 136 | found constant `Self::DIM` | |
| 137 | ||
| 138 | error: unconstrained generic constant | |
| 139 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:97:9 | |
| 140 | | | |
| 141 | LL | self.reference.bget(index).map(ns_window) | |
| 142 | | ^^^^^^^^^^^^^^ | |
| 143 | | | |
| 144 | note: required by a bound in `Broadcastable::bget` | |
| 145 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:22:35 | |
| 146 | | | |
| 147 | LL | fn bget(&self, index: [usize; Self::DIM]) -> Option<Self::Element>; | |
| 148 | | ^^^^^^^^^ required by this bound in `Broadcastable::bget` | |
| 149 | help: try adding a `where` bound | |
| 150 | | | |
| 151 | LL | fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> where [(); Self::DIM]: { | |
| 152 | | ++++++++++++++++++++++ | |
| 153 | ||
| 154 | error[E0308]: mismatched types | |
| 155 | --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:97:29 | |
| 156 | | | |
| 157 | LL | self.reference.bget(index).map(ns_window) | |
| 158 | | ^^^^^ expected `Self::DIM`, found `DIM` | |
| 159 | | | |
| 160 | = note: expected constant `Self::DIM` | |
| 161 | found constant `DIM` | |
| 162 | ||
| 163 | error: aborting due to 15 previous errors | |
| 164 | ||
| 165 | Some errors have detailed explanations: E0277, E0308, E0425. | |
| 166 | For more information about an error, try `rustc --explain E0277`. |
tests/ui/parallel-rustc/generic-const-exprs-deadlock-issue-134978.rs created+20| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | // Test for #134978, deadlock detected as we're unable to find a query cycle to break | |
| 2 | ||
| 3 | #![feature(generic_const_exprs)] | |
| 4 | ||
| 5 | pub struct Struct<const N: usize>; | |
| 6 | ||
| 7 | impl<const N: usize> Struct<N> { | |
| 8 | pub const OK: usize = 0; | |
| 9 | } | |
| 10 | ||
| 11 | fn main() { | |
| 12 | function::<0>(); | |
| 13 | } | |
| 14 | ||
| 15 | fn function<const NUM_CARDS: usize>() | |
| 16 | where | |
| 17 | [(); Struct::<{ NUM_CARDS + 0 }>::OK]:, | |
| 18 | //~^ ERROR cycle detected when building an abstract representation | |
| 19 | { | |
| 20 | } |
tests/ui/parallel-rustc/generic-const-exprs-deadlock-issue-134978.stderr created+29| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | error[E0391]: cycle detected when building an abstract representation for `function::{constant#0}` | |
| 2 | --> $DIR/generic-const-exprs-deadlock-issue-134978.rs:17:10 | |
| 3 | | | |
| 4 | LL | [(); Struct::<{ NUM_CARDS + 0 }>::OK]:, | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | note: ...which requires building THIR for `function::{constant#0}`... | |
| 8 | --> $DIR/generic-const-exprs-deadlock-issue-134978.rs:17:10 | |
| 9 | | | |
| 10 | LL | [(); Struct::<{ NUM_CARDS + 0 }>::OK]:, | |
| 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 12 | note: ...which requires type-checking `function::{constant#0}`... | |
| 13 | --> $DIR/generic-const-exprs-deadlock-issue-134978.rs:17:10 | |
| 14 | | | |
| 15 | LL | [(); Struct::<{ NUM_CARDS + 0 }>::OK]:, | |
| 16 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 17 | = note: ...which again requires building an abstract representation for `function::{constant#0}`, completing the cycle | |
| 18 | note: cycle used when checking that `function` is well-formed | |
| 19 | --> $DIR/generic-const-exprs-deadlock-issue-134978.rs:15:1 | |
| 20 | | | |
| 21 | LL | / fn function<const NUM_CARDS: usize>() | |
| 22 | LL | | where | |
| 23 | LL | | [(); Struct::<{ NUM_CARDS + 0 }>::OK]:, | |
| 24 | | |___________________________________________^ | |
| 25 | = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | |
| 26 | ||
| 27 | error: aborting due to 1 previous error | |
| 28 | ||
| 29 | For more information about this error, try `rustc --explain E0391`. |
tests/ui/parallel-rustc/infer-unwrap-none-issue-120786.rs created+82| ... | ... | @@ -0,0 +1,82 @@ |
| 1 | // Test for #120786, which causes an ice bug: infer: `None` | |
| 2 | ||
| 3 | fn no_err() { | |
| 4 | |x: u32, y| x; | |
| 5 | //~^ ERROR type annotations needed | |
| 6 | let _ = String::from("x"); | |
| 7 | } | |
| 8 | ||
| 9 | fn err() { | |
| 10 | String::from("x".as_ref()); | |
| 11 | //~^ ERROR type annotations needed | |
| 12 | //~| ERROR type annotations needed | |
| 13 | } | |
| 14 | ||
| 15 | fn arg_pat_closure_err() { | |
| 16 | |x| String::from("x".as_ref()); | |
| 17 | //~^ ERROR type annotations needed | |
| 18 | //~| ERROR type annotations needed | |
| 19 | } | |
| 20 | ||
| 21 | fn local_pat_closure_err() { | |
| 22 | let _ = "x".as_ref(); | |
| 23 | //~^ ERROR type annotations needed | |
| 24 | } | |
| 25 | ||
| 26 | fn err_first_arg_pat() { | |
| 27 | String::from("x".as_ref()); | |
| 28 | //~^ ERROR type annotations needed | |
| 29 | //~| ERROR type annotations needed | |
| 30 | |x: String| x; | |
| 31 | } | |
| 32 | ||
| 33 | fn err_second_arg_pat() { | |
| 34 | |x: String| x; | |
| 35 | String::from("x".as_ref()); | |
| 36 | //~^ ERROR type annotations needed | |
| 37 | //~| ERROR type annotations needed | |
| 38 | } | |
| 39 | ||
| 40 | fn err_mid_arg_pat() { | |
| 41 | |x: String| x; | |
| 42 | |x: String| x; | |
| 43 | |x: String| x; | |
| 44 | |x: String| x; | |
| 45 | String::from("x".as_ref()); | |
| 46 | //~^ ERROR type annotations needed | |
| 47 | //~| ERROR type annotations needed | |
| 48 | |x: String| x; | |
| 49 | |x: String| x; | |
| 50 | |x: String| x; | |
| 51 | |x: String| x; | |
| 52 | } | |
| 53 | ||
| 54 | fn err_first_local_pat() { | |
| 55 | String::from("x".as_ref()); | |
| 56 | //~^ ERROR type annotations needed | |
| 57 | //~| ERROR type annotations needed | |
| 58 | let _ = String::from("x"); | |
| 59 | } | |
| 60 | ||
| 61 | fn err_second_local_pat() { | |
| 62 | let _ = String::from("x"); | |
| 63 | String::from("x".as_ref()); | |
| 64 | //~^ ERROR type annotations needed | |
| 65 | //~| ERROR type annotations needed | |
| 66 | } | |
| 67 | ||
| 68 | fn err_mid_local_pat() { | |
| 69 | let _ = String::from("x"); | |
| 70 | let _ = String::from("x"); | |
| 71 | let _ = String::from("x"); | |
| 72 | let _ = String::from("x"); | |
| 73 | String::from("x".as_ref()); | |
| 74 | //~^ ERROR type annotations needed | |
| 75 | //~| ERROR type annotations needed | |
| 76 | let _ = String::from("x"); | |
| 77 | let _ = String::from("x"); | |
| 78 | let _ = String::from("x"); | |
| 79 | let _ = String::from("x"); | |
| 80 | } | |
| 81 | ||
| 82 | fn main() {} |
tests/ui/parallel-rustc/infer-unwrap-none-issue-120786.stderr created+256| ... | ... | @@ -0,0 +1,256 @@ |
| 1 | error[E0282]: type annotations needed | |
| 2 | --> $DIR/infer-unwrap-none-issue-120786.rs:4:14 | |
| 3 | | | |
| 4 | LL | |x: u32, y| x; | |
| 5 | | ^ | |
| 6 | | | |
| 7 | help: consider giving this closure parameter an explicit type | |
| 8 | | | |
| 9 | LL | |x: u32, y: /* Type */| x; | |
| 10 | | ++++++++++++ | |
| 11 | ||
| 12 | error[E0283]: type annotations needed | |
| 13 | --> $DIR/infer-unwrap-none-issue-120786.rs:10:5 | |
| 14 | | | |
| 15 | LL | String::from("x".as_ref()); | |
| 16 | | ^^^^^^ cannot infer type for reference `&_` | |
| 17 | | | |
| 18 | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: | |
| 19 | - impl From<&String> for String; | |
| 20 | - impl From<&str> for String; | |
| 21 | ||
| 22 | error[E0283]: type annotations needed | |
| 23 | --> $DIR/infer-unwrap-none-issue-120786.rs:10:22 | |
| 24 | | | |
| 25 | LL | String::from("x".as_ref()); | |
| 26 | | ^^^^^^ | |
| 27 | | | |
| 28 | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: | |
| 29 | - impl AsRef<ByteStr> for str; | |
| 30 | - impl AsRef<OsStr> for str; | |
| 31 | - impl AsRef<Path> for str; | |
| 32 | - impl AsRef<[u8]> for str; | |
| 33 | - impl AsRef<str> for str; | |
| 34 | help: try using a fully qualified path to specify the expected types | |
| 35 | | | |
| 36 | LL - String::from("x".as_ref()); | |
| 37 | LL + String::from(<str as AsRef<T>>::as_ref("x")); | |
| 38 | | | |
| 39 | ||
| 40 | error[E0283]: type annotations needed | |
| 41 | --> $DIR/infer-unwrap-none-issue-120786.rs:16:9 | |
| 42 | | | |
| 43 | LL | |x| String::from("x".as_ref()); | |
| 44 | | ^^^^^^ cannot infer type for reference `&_` | |
| 45 | | | |
| 46 | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: | |
| 47 | - impl From<&String> for String; | |
| 48 | - impl From<&str> for String; | |
| 49 | ||
| 50 | error[E0283]: type annotations needed | |
| 51 | --> $DIR/infer-unwrap-none-issue-120786.rs:16:26 | |
| 52 | | | |
| 53 | LL | |x| String::from("x".as_ref()); | |
| 54 | | ^^^^^^ | |
| 55 | | | |
| 56 | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: | |
| 57 | - impl AsRef<ByteStr> for str; | |
| 58 | - impl AsRef<OsStr> for str; | |
| 59 | - impl AsRef<Path> for str; | |
| 60 | - impl AsRef<[u8]> for str; | |
| 61 | - impl AsRef<str> for str; | |
| 62 | help: try using a fully qualified path to specify the expected types | |
| 63 | | | |
| 64 | LL - |x| String::from("x".as_ref()); | |
| 65 | LL + |x| String::from(<str as AsRef<T>>::as_ref("x")); | |
| 66 | | | |
| 67 | ||
| 68 | error[E0283]: type annotations needed for `&_` | |
| 69 | --> $DIR/infer-unwrap-none-issue-120786.rs:22:9 | |
| 70 | | | |
| 71 | LL | let _ = "x".as_ref(); | |
| 72 | | ^ ------ type must be known at this point | |
| 73 | | | |
| 74 | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: | |
| 75 | - impl AsRef<ByteStr> for str; | |
| 76 | - impl AsRef<OsStr> for str; | |
| 77 | - impl AsRef<Path> for str; | |
| 78 | - impl AsRef<[u8]> for str; | |
| 79 | - impl AsRef<str> for str; | |
| 80 | help: consider giving this pattern a type, where the type for type parameter `T` is specified | |
| 81 | | | |
| 82 | LL | let _: &T = "x".as_ref(); | |
| 83 | | ++++ | |
| 84 | ||
| 85 | error[E0283]: type annotations needed | |
| 86 | --> $DIR/infer-unwrap-none-issue-120786.rs:27:5 | |
| 87 | | | |
| 88 | LL | String::from("x".as_ref()); | |
| 89 | | ^^^^^^ cannot infer type for reference `&_` | |
| 90 | | | |
| 91 | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: | |
| 92 | - impl From<&String> for String; | |
| 93 | - impl From<&str> for String; | |
| 94 | ||
| 95 | error[E0283]: type annotations needed | |
| 96 | --> $DIR/infer-unwrap-none-issue-120786.rs:27:22 | |
| 97 | | | |
| 98 | LL | String::from("x".as_ref()); | |
| 99 | | ^^^^^^ | |
| 100 | | | |
| 101 | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: | |
| 102 | - impl AsRef<ByteStr> for str; | |
| 103 | - impl AsRef<OsStr> for str; | |
| 104 | - impl AsRef<Path> for str; | |
| 105 | - impl AsRef<[u8]> for str; | |
| 106 | - impl AsRef<str> for str; | |
| 107 | help: try using a fully qualified path to specify the expected types | |
| 108 | | | |
| 109 | LL - String::from("x".as_ref()); | |
| 110 | LL + String::from(<str as AsRef<T>>::as_ref("x")); | |
| 111 | | | |
| 112 | ||
| 113 | error[E0283]: type annotations needed | |
| 114 | --> $DIR/infer-unwrap-none-issue-120786.rs:35:5 | |
| 115 | | | |
| 116 | LL | String::from("x".as_ref()); | |
| 117 | | ^^^^^^ cannot infer type for reference `&_` | |
| 118 | | | |
| 119 | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: | |
| 120 | - impl From<&String> for String; | |
| 121 | - impl From<&str> for String; | |
| 122 | ||
| 123 | error[E0283]: type annotations needed | |
| 124 | --> $DIR/infer-unwrap-none-issue-120786.rs:35:22 | |
| 125 | | | |
| 126 | LL | String::from("x".as_ref()); | |
| 127 | | ^^^^^^ | |
| 128 | | | |
| 129 | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: | |
| 130 | - impl AsRef<ByteStr> for str; | |
| 131 | - impl AsRef<OsStr> for str; | |
| 132 | - impl AsRef<Path> for str; | |
| 133 | - impl AsRef<[u8]> for str; | |
| 134 | - impl AsRef<str> for str; | |
| 135 | help: try using a fully qualified path to specify the expected types | |
| 136 | | | |
| 137 | LL - String::from("x".as_ref()); | |
| 138 | LL + String::from(<str as AsRef<T>>::as_ref("x")); | |
| 139 | | | |
| 140 | ||
| 141 | error[E0283]: type annotations needed | |
| 142 | --> $DIR/infer-unwrap-none-issue-120786.rs:45:5 | |
| 143 | | | |
| 144 | LL | String::from("x".as_ref()); | |
| 145 | | ^^^^^^ cannot infer type for reference `&_` | |
| 146 | | | |
| 147 | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: | |
| 148 | - impl From<&String> for String; | |
| 149 | - impl From<&str> for String; | |
| 150 | ||
| 151 | error[E0283]: type annotations needed | |
| 152 | --> $DIR/infer-unwrap-none-issue-120786.rs:45:22 | |
| 153 | | | |
| 154 | LL | String::from("x".as_ref()); | |
| 155 | | ^^^^^^ | |
| 156 | | | |
| 157 | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: | |
| 158 | - impl AsRef<ByteStr> for str; | |
| 159 | - impl AsRef<OsStr> for str; | |
| 160 | - impl AsRef<Path> for str; | |
| 161 | - impl AsRef<[u8]> for str; | |
| 162 | - impl AsRef<str> for str; | |
| 163 | help: try using a fully qualified path to specify the expected types | |
| 164 | | | |
| 165 | LL - String::from("x".as_ref()); | |
| 166 | LL + String::from(<str as AsRef<T>>::as_ref("x")); | |
| 167 | | | |
| 168 | ||
| 169 | error[E0283]: type annotations needed | |
| 170 | --> $DIR/infer-unwrap-none-issue-120786.rs:55:5 | |
| 171 | | | |
| 172 | LL | String::from("x".as_ref()); | |
| 173 | | ^^^^^^ cannot infer type for reference `&_` | |
| 174 | | | |
| 175 | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: | |
| 176 | - impl From<&String> for String; | |
| 177 | - impl From<&str> for String; | |
| 178 | ||
| 179 | error[E0283]: type annotations needed | |
| 180 | --> $DIR/infer-unwrap-none-issue-120786.rs:55:22 | |
| 181 | | | |
| 182 | LL | String::from("x".as_ref()); | |
| 183 | | ^^^^^^ | |
| 184 | | | |
| 185 | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: | |
| 186 | - impl AsRef<ByteStr> for str; | |
| 187 | - impl AsRef<OsStr> for str; | |
| 188 | - impl AsRef<Path> for str; | |
| 189 | - impl AsRef<[u8]> for str; | |
| 190 | - impl AsRef<str> for str; | |
| 191 | help: try using a fully qualified path to specify the expected types | |
| 192 | | | |
| 193 | LL - String::from("x".as_ref()); | |
| 194 | LL + String::from(<str as AsRef<T>>::as_ref("x")); | |
| 195 | | | |
| 196 | ||
| 197 | error[E0283]: type annotations needed | |
| 198 | --> $DIR/infer-unwrap-none-issue-120786.rs:63:5 | |
| 199 | | | |
| 200 | LL | String::from("x".as_ref()); | |
| 201 | | ^^^^^^ cannot infer type for reference `&_` | |
| 202 | | | |
| 203 | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: | |
| 204 | - impl From<&String> for String; | |
| 205 | - impl From<&str> for String; | |
| 206 | ||
| 207 | error[E0283]: type annotations needed | |
| 208 | --> $DIR/infer-unwrap-none-issue-120786.rs:63:22 | |
| 209 | | | |
| 210 | LL | String::from("x".as_ref()); | |
| 211 | | ^^^^^^ | |
| 212 | | | |
| 213 | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: | |
| 214 | - impl AsRef<ByteStr> for str; | |
| 215 | - impl AsRef<OsStr> for str; | |
| 216 | - impl AsRef<Path> for str; | |
| 217 | - impl AsRef<[u8]> for str; | |
| 218 | - impl AsRef<str> for str; | |
| 219 | help: try using a fully qualified path to specify the expected types | |
| 220 | | | |
| 221 | LL - String::from("x".as_ref()); | |
| 222 | LL + String::from(<str as AsRef<T>>::as_ref("x")); | |
| 223 | | | |
| 224 | ||
| 225 | error[E0283]: type annotations needed | |
| 226 | --> $DIR/infer-unwrap-none-issue-120786.rs:73:5 | |
| 227 | | | |
| 228 | LL | String::from("x".as_ref()); | |
| 229 | | ^^^^^^ cannot infer type for reference `&_` | |
| 230 | | | |
| 231 | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: | |
| 232 | - impl From<&String> for String; | |
| 233 | - impl From<&str> for String; | |
| 234 | ||
| 235 | error[E0283]: type annotations needed | |
| 236 | --> $DIR/infer-unwrap-none-issue-120786.rs:73:22 | |
| 237 | | | |
| 238 | LL | String::from("x".as_ref()); | |
| 239 | | ^^^^^^ | |
| 240 | | | |
| 241 | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: | |
| 242 | - impl AsRef<ByteStr> for str; | |
| 243 | - impl AsRef<OsStr> for str; | |
| 244 | - impl AsRef<Path> for str; | |
| 245 | - impl AsRef<[u8]> for str; | |
| 246 | - impl AsRef<str> for str; | |
| 247 | help: try using a fully qualified path to specify the expected types | |
| 248 | | | |
| 249 | LL - String::from("x".as_ref()); | |
| 250 | LL + String::from(<str as AsRef<T>>::as_ref("x")); | |
| 251 | | | |
| 252 | ||
| 253 | error: aborting due to 18 previous errors | |
| 254 | ||
| 255 | Some errors have detailed explanations: E0282, E0283. | |
| 256 | For more information about an error, try `rustc --explain E0282`. |
tests/ui/parallel-rustc/nested-type-alias-cycle-issue-129911.rs created+89| ... | ... | @@ -0,0 +1,89 @@ |
| 1 | // Test for #129911, deadlock detected as we're unable to find a query cycle to break | |
| 2 | ||
| 3 | fn main() { | |
| 4 | type KooArc = Frc< | |
| 5 | //~^ ERROR cannot find type `Frc` in this scope | |
| 6 | { | |
| 7 | { | |
| 8 | { | |
| 9 | {}; | |
| 10 | } | |
| 11 | type Frc = Frc<{}>::Arc;; | |
| 12 | //~^ ERROR type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 13 | //~| ERROR cycle detected when expanding type alias | |
| 14 | } | |
| 15 | type Frc = Frc< | |
| 16 | //~^ ERROR type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 17 | //~| ERROR cycle detected when expanding type alias | |
| 18 | { | |
| 19 | { | |
| 20 | { | |
| 21 | {}; | |
| 22 | } | |
| 23 | type Frc = Frc<{}>::Arc;; | |
| 24 | //~^ ERROR type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 25 | //~| ERROR cycle detected when expanding type alias | |
| 26 | } | |
| 27 | type Frc = Frc< | |
| 28 | //~^ ERROR type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 29 | //~| ERROR cycle detected when expanding type alias | |
| 30 | { | |
| 31 | { | |
| 32 | { | |
| 33 | {}; | |
| 34 | } | |
| 35 | type Frc = Frc<{}>::Arc;; | |
| 36 | //~^ ERROR type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 37 | //~| ERROR cycle detected when expanding type alias | |
| 38 | } | |
| 39 | type Frc = Frc< | |
| 40 | //~^ ERROR type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 41 | //~| ERROR cycle detected when expanding type alias | |
| 42 | { | |
| 43 | { | |
| 44 | { | |
| 45 | {}; | |
| 46 | } | |
| 47 | type Frc = Frc<{}>::Arc;; | |
| 48 | //~^ ERROR type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 49 | //~| ERROR cycle detected when expanding type alias | |
| 50 | } | |
| 51 | type Frc = Frc< | |
| 52 | //~^ ERROR type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 53 | //~| ERROR cycle detected when expanding type alias | |
| 54 | { | |
| 55 | { | |
| 56 | { | |
| 57 | { | |
| 58 | {}; | |
| 59 | } | |
| 60 | type Frc = Frc<{}>::Arc;; | |
| 61 | //~^ ERROR type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 62 | //~| ERROR cycle detected when expanding type alias | |
| 63 | }; | |
| 64 | } | |
| 65 | type Frc = Frc< | |
| 66 | //~^ ERROR type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 67 | //~| ERROR cycle detected when expanding type alias | |
| 68 | { | |
| 69 | { | |
| 70 | { | |
| 71 | {}; | |
| 72 | }; | |
| 73 | } | |
| 74 | type Frc = Frc<{}>::Arc;; | |
| 75 | //~^ ERROR type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 76 | //~| ERROR cycle detected when expanding type alias | |
| 77 | }, | |
| 78 | >::Arc;; | |
| 79 | }, | |
| 80 | >::Arc;; | |
| 81 | }, | |
| 82 | >::Arc;; | |
| 83 | }, | |
| 84 | >::Arc;; | |
| 85 | }, | |
| 86 | >::Arc;; | |
| 87 | }, | |
| 88 | >::Arc; | |
| 89 | } |
tests/ui/parallel-rustc/nested-type-alias-cycle-issue-129911.stderr created+391| ... | ... | @@ -0,0 +1,391 @@ |
| 1 | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 2 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:11:28 | |
| 3 | | | |
| 4 | LL | type Frc = Frc<{}>::Arc;; | |
| 5 | | ^^^---- help: remove the unnecessary generics | |
| 6 | | | | |
| 7 | | expected 0 generic arguments | |
| 8 | | | |
| 9 | note: type alias defined here, with 0 generic parameters | |
| 10 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:11:22 | |
| 11 | | | |
| 12 | LL | type Frc = Frc<{}>::Arc;; | |
| 13 | | ^^^ | |
| 14 | ||
| 15 | error[E0391]: cycle detected when expanding type alias `main::KooArc::{constant#0}::Frc` | |
| 16 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:11:28 | |
| 17 | | | |
| 18 | LL | type Frc = Frc<{}>::Arc;; | |
| 19 | | ^^^^^^^ | |
| 20 | | | |
| 21 | = note: ...which immediately requires expanding type alias `main::KooArc::{constant#0}::Frc` again | |
| 22 | = note: type aliases cannot be recursive | |
| 23 | = help: consider using a struct, enum, or union instead to break the cycle | |
| 24 | = help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information | |
| 25 | note: cycle used when checking that `main::KooArc::{constant#0}::Frc` is well-formed | |
| 26 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:11:17 | |
| 27 | | | |
| 28 | LL | type Frc = Frc<{}>::Arc;; | |
| 29 | | ^^^^^^^^ | |
| 30 | = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | |
| 31 | ||
| 32 | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 33 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:15:24 | |
| 34 | | | |
| 35 | LL | type Frc = Frc< | |
| 36 | | ________________________^^^- | |
| 37 | | | | | |
| 38 | | | expected 0 generic arguments | |
| 39 | ... | | |
| 40 | LL | | }, | |
| 41 | LL | | >::Arc;; | |
| 42 | | |_____________- help: remove the unnecessary generics | |
| 43 | | | |
| 44 | note: type alias defined here, with 0 generic parameters | |
| 45 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:15:18 | |
| 46 | | | |
| 47 | LL | type Frc = Frc< | |
| 48 | | ^^^ | |
| 49 | ||
| 50 | error[E0391]: cycle detected when expanding type alias `main::KooArc::{constant#0}::Frc` | |
| 51 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:15:24 | |
| 52 | | | |
| 53 | LL | type Frc = Frc< | |
| 54 | | ________________________^ | |
| 55 | ... | | |
| 56 | LL | | }, | |
| 57 | LL | | >::Arc;; | |
| 58 | | |_____________^ | |
| 59 | | | |
| 60 | = note: ...which immediately requires expanding type alias `main::KooArc::{constant#0}::Frc` again | |
| 61 | = note: type aliases cannot be recursive | |
| 62 | = help: consider using a struct, enum, or union instead to break the cycle | |
| 63 | = help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information | |
| 64 | note: cycle used when checking that `main::KooArc::{constant#0}::Frc` is well-formed | |
| 65 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:15:13 | |
| 66 | | | |
| 67 | LL | type Frc = Frc< | |
| 68 | | ^^^^^^^^ | |
| 69 | = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | |
| 70 | ||
| 71 | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 72 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:23:36 | |
| 73 | | | |
| 74 | LL | type Frc = Frc<{}>::Arc;; | |
| 75 | | ^^^---- help: remove the unnecessary generics | |
| 76 | | | | |
| 77 | | expected 0 generic arguments | |
| 78 | | | |
| 79 | note: type alias defined here, with 0 generic parameters | |
| 80 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:23:30 | |
| 81 | | | |
| 82 | LL | type Frc = Frc<{}>::Arc;; | |
| 83 | | ^^^ | |
| 84 | ||
| 85 | error[E0391]: cycle detected when expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc` | |
| 86 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:23:36 | |
| 87 | | | |
| 88 | LL | type Frc = Frc<{}>::Arc;; | |
| 89 | | ^^^^^^^ | |
| 90 | | | |
| 91 | = note: ...which immediately requires expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc` again | |
| 92 | = note: type aliases cannot be recursive | |
| 93 | = help: consider using a struct, enum, or union instead to break the cycle | |
| 94 | = help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information | |
| 95 | note: cycle used when checking that `main::KooArc::{constant#0}::Frc::{constant#0}::Frc` is well-formed | |
| 96 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:23:25 | |
| 97 | | | |
| 98 | LL | type Frc = Frc<{}>::Arc;; | |
| 99 | | ^^^^^^^^ | |
| 100 | = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | |
| 101 | ||
| 102 | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 103 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:27:32 | |
| 104 | | | |
| 105 | LL | type Frc = Frc< | |
| 106 | | ________________________________^^^- | |
| 107 | | | | | |
| 108 | | | expected 0 generic arguments | |
| 109 | ... | | |
| 110 | LL | | }, | |
| 111 | LL | | >::Arc;; | |
| 112 | | |_____________________- help: remove the unnecessary generics | |
| 113 | | | |
| 114 | note: type alias defined here, with 0 generic parameters | |
| 115 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:27:26 | |
| 116 | | | |
| 117 | LL | type Frc = Frc< | |
| 118 | | ^^^ | |
| 119 | ||
| 120 | error[E0391]: cycle detected when expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc` | |
| 121 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:27:32 | |
| 122 | | | |
| 123 | LL | type Frc = Frc< | |
| 124 | | ________________________________^ | |
| 125 | ... | | |
| 126 | LL | | }, | |
| 127 | LL | | >::Arc;; | |
| 128 | | |_____________________^ | |
| 129 | | | |
| 130 | = note: ...which immediately requires expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc` again | |
| 131 | = note: type aliases cannot be recursive | |
| 132 | = help: consider using a struct, enum, or union instead to break the cycle | |
| 133 | = help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information | |
| 134 | note: cycle used when checking that `main::KooArc::{constant#0}::Frc::{constant#0}::Frc` is well-formed | |
| 135 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:27:21 | |
| 136 | | | |
| 137 | LL | type Frc = Frc< | |
| 138 | | ^^^^^^^^ | |
| 139 | = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | |
| 140 | ||
| 141 | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 142 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:35:44 | |
| 143 | | | |
| 144 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 145 | | ^^^---- help: remove the unnecessary generics | |
| 146 | | | | |
| 147 | | expected 0 generic arguments | |
| 148 | | | |
| 149 | note: type alias defined here, with 0 generic parameters | |
| 150 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:35:38 | |
| 151 | | | |
| 152 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 153 | | ^^^ | |
| 154 | ||
| 155 | error[E0391]: cycle detected when expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` | |
| 156 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:35:44 | |
| 157 | | | |
| 158 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 159 | | ^^^^^^^ | |
| 160 | | | |
| 161 | = note: ...which immediately requires expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` again | |
| 162 | = note: type aliases cannot be recursive | |
| 163 | = help: consider using a struct, enum, or union instead to break the cycle | |
| 164 | = help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information | |
| 165 | note: cycle used when checking that `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` is well-formed | |
| 166 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:35:33 | |
| 167 | | | |
| 168 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 169 | | ^^^^^^^^ | |
| 170 | = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | |
| 171 | ||
| 172 | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 173 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:39:40 | |
| 174 | | | |
| 175 | LL | ... type Frc = Frc< | |
| 176 | | __________________________________^^^- | |
| 177 | | | | | |
| 178 | | | expected 0 generic arguments | |
| 179 | ... | | |
| 180 | LL | | ... }, | |
| 181 | LL | | ... >::Arc;; | |
| 182 | | |_______________________- help: remove the unnecessary generics | |
| 183 | | | |
| 184 | note: type alias defined here, with 0 generic parameters | |
| 185 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:39:34 | |
| 186 | | | |
| 187 | LL | ... type Frc = Frc< | |
| 188 | | ^^^ | |
| 189 | ||
| 190 | error[E0391]: cycle detected when expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` | |
| 191 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:39:40 | |
| 192 | | | |
| 193 | LL | ... type Frc = Frc< | |
| 194 | | __________________________________^ | |
| 195 | ... | | |
| 196 | LL | | ... }, | |
| 197 | LL | | ... >::Arc;; | |
| 198 | | |_______________________^ | |
| 199 | | | |
| 200 | = note: ...which immediately requires expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` again | |
| 201 | = note: type aliases cannot be recursive | |
| 202 | = help: consider using a struct, enum, or union instead to break the cycle | |
| 203 | = help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information | |
| 204 | note: cycle used when checking that `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` is well-formed | |
| 205 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:39:29 | |
| 206 | | | |
| 207 | LL | ... type Frc = Frc< | |
| 208 | | ^^^^^^^^ | |
| 209 | = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | |
| 210 | ||
| 211 | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 212 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:47:52 | |
| 213 | | | |
| 214 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 215 | | ^^^---- help: remove the unnecessary generics | |
| 216 | | | | |
| 217 | | expected 0 generic arguments | |
| 218 | | | |
| 219 | note: type alias defined here, with 0 generic parameters | |
| 220 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:47:46 | |
| 221 | | | |
| 222 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 223 | | ^^^ | |
| 224 | ||
| 225 | error[E0391]: cycle detected when expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` | |
| 226 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:47:52 | |
| 227 | | | |
| 228 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 229 | | ^^^^^^^ | |
| 230 | | | |
| 231 | = note: ...which immediately requires expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` again | |
| 232 | = note: type aliases cannot be recursive | |
| 233 | = help: consider using a struct, enum, or union instead to break the cycle | |
| 234 | = help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information | |
| 235 | note: cycle used when checking that `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` is well-formed | |
| 236 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:47:41 | |
| 237 | | | |
| 238 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 239 | | ^^^^^^^^ | |
| 240 | = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | |
| 241 | ||
| 242 | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 243 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:51:48 | |
| 244 | | | |
| 245 | LL | ... type Frc = Frc< | |
| 246 | | __________________________________^^^- | |
| 247 | | | | | |
| 248 | | | expected 0 generic arguments | |
| 249 | ... | | |
| 250 | LL | | ... }, | |
| 251 | LL | | ... >::Arc;; | |
| 252 | | |_______________________- help: remove the unnecessary generics | |
| 253 | | | |
| 254 | note: type alias defined here, with 0 generic parameters | |
| 255 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:51:42 | |
| 256 | | | |
| 257 | LL | ... type Frc = Frc< | |
| 258 | | ^^^ | |
| 259 | ||
| 260 | error[E0391]: cycle detected when expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` | |
| 261 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:51:48 | |
| 262 | | | |
| 263 | LL | ... type Frc = Frc< | |
| 264 | | __________________________________^ | |
| 265 | ... | | |
| 266 | LL | | ... }, | |
| 267 | LL | | ... >::Arc;; | |
| 268 | | |_______________________^ | |
| 269 | | | |
| 270 | = note: ...which immediately requires expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` again | |
| 271 | = note: type aliases cannot be recursive | |
| 272 | = help: consider using a struct, enum, or union instead to break the cycle | |
| 273 | = help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information | |
| 274 | note: cycle used when checking that `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` is well-formed | |
| 275 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:51:37 | |
| 276 | | | |
| 277 | LL | ... type Frc = Frc< | |
| 278 | | ^^^^^^^^ | |
| 279 | = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | |
| 280 | ||
| 281 | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 282 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:60:64 | |
| 283 | | | |
| 284 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 285 | | ^^^---- help: remove the unnecessary generics | |
| 286 | | | | |
| 287 | | expected 0 generic arguments | |
| 288 | | | |
| 289 | note: type alias defined here, with 0 generic parameters | |
| 290 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:60:58 | |
| 291 | | | |
| 292 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 293 | | ^^^ | |
| 294 | ||
| 295 | error[E0391]: cycle detected when expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` | |
| 296 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:60:64 | |
| 297 | | | |
| 298 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 299 | | ^^^^^^^ | |
| 300 | | | |
| 301 | = note: ...which immediately requires expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` again | |
| 302 | = note: type aliases cannot be recursive | |
| 303 | = help: consider using a struct, enum, or union instead to break the cycle | |
| 304 | = help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information | |
| 305 | note: cycle used when checking that `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` is well-formed | |
| 306 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:60:53 | |
| 307 | | | |
| 308 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 309 | | ^^^^^^^^ | |
| 310 | = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | |
| 311 | ||
| 312 | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 313 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:65:56 | |
| 314 | | | |
| 315 | LL | ... type Frc = Frc< | |
| 316 | | __________________________________^^^- | |
| 317 | | | | | |
| 318 | | | expected 0 generic arguments | |
| 319 | ... | | |
| 320 | LL | | ... }, | |
| 321 | LL | | ... >::Arc;; | |
| 322 | | |_______________________- help: remove the unnecessary generics | |
| 323 | | | |
| 324 | note: type alias defined here, with 0 generic parameters | |
| 325 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:65:50 | |
| 326 | | | |
| 327 | LL | ... type Frc = Frc< | |
| 328 | | ^^^ | |
| 329 | ||
| 330 | error[E0391]: cycle detected when expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` | |
| 331 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:65:56 | |
| 332 | | | |
| 333 | LL | ... type Frc = Frc< | |
| 334 | | __________________________________^ | |
| 335 | ... | | |
| 336 | LL | | ... }, | |
| 337 | LL | | ... >::Arc;; | |
| 338 | | |_______________________^ | |
| 339 | | | |
| 340 | = note: ...which immediately requires expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` again | |
| 341 | = note: type aliases cannot be recursive | |
| 342 | = help: consider using a struct, enum, or union instead to break the cycle | |
| 343 | = help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information | |
| 344 | note: cycle used when checking that `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` is well-formed | |
| 345 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:65:45 | |
| 346 | | | |
| 347 | LL | ... type Frc = Frc< | |
| 348 | | ^^^^^^^^ | |
| 349 | = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | |
| 350 | ||
| 351 | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied | |
| 352 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:74:64 | |
| 353 | | | |
| 354 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 355 | | ^^^---- help: remove the unnecessary generics | |
| 356 | | | | |
| 357 | | expected 0 generic arguments | |
| 358 | | | |
| 359 | note: type alias defined here, with 0 generic parameters | |
| 360 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:74:58 | |
| 361 | | | |
| 362 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 363 | | ^^^ | |
| 364 | ||
| 365 | error[E0391]: cycle detected when expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` | |
| 366 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:74:64 | |
| 367 | | | |
| 368 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 369 | | ^^^^^^^ | |
| 370 | | | |
| 371 | = note: ...which immediately requires expanding type alias `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` again | |
| 372 | = note: type aliases cannot be recursive | |
| 373 | = help: consider using a struct, enum, or union instead to break the cycle | |
| 374 | = help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information | |
| 375 | note: cycle used when checking that `main::KooArc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc::{constant#0}::Frc` is well-formed | |
| 376 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:74:53 | |
| 377 | | | |
| 378 | LL | ... type Frc = Frc<{}>::Arc;; | |
| 379 | | ^^^^^^^^ | |
| 380 | = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | |
| 381 | ||
| 382 | error[E0433]: cannot find type `Frc` in this scope | |
| 383 | --> $DIR/nested-type-alias-cycle-issue-129911.rs:4:19 | |
| 384 | | | |
| 385 | LL | type KooArc = Frc< | |
| 386 | | ^^^ use of undeclared type `Frc` | |
| 387 | ||
| 388 | error: aborting due to 23 previous errors | |
| 389 | ||
| 390 | Some errors have detailed explanations: E0107, E0391, E0433. | |
| 391 | For more information about an error, try `rustc --explain E0107`. |
tests/ui/parallel-rustc/recursive-impl-trait-deadlock-issue-129912.rs created+97| ... | ... | @@ -0,0 +1,97 @@ |
| 1 | // Test for #129912, which causes a deadlock bug without finding a cycle | |
| 2 | ||
| 3 | #![feature(generators)] | |
| 4 | //~^ ERROR feature has been removed | |
| 5 | #![allow(unconditional_recursion)] | |
| 6 | ||
| 7 | fn option(i: i32) -> impl Sync { | |
| 8 | if generator_sig() < 0 { None } else { Sized((option(i - Sized), i)) } | |
| 9 | //~^ ERROR expected value, found trait `Sized` | |
| 10 | //~| ERROR expected function, tuple struct or tuple variant, found trait `Sized` | |
| 11 | } | |
| 12 | ||
| 13 | fn tuple() -> impl Sized { | |
| 14 | (tuple(),) | |
| 15 | } | |
| 16 | ||
| 17 | fn array() -> _ { | |
| 18 | //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types | |
| 19 | [array()] | |
| 20 | } | |
| 21 | ||
| 22 | fn ptr() -> _ { | |
| 23 | //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types | |
| 24 | &ptr() as *const impl Sized | |
| 25 | //~^ ERROR `impl Trait` is not allowed in cast expression types | |
| 26 | } | |
| 27 | ||
| 28 | fn fn_ptr() -> impl Sized { | |
| 29 | fn_ptr as fn() -> _ | |
| 30 | } | |
| 31 | ||
| 32 | fn closure_capture() -> impl Sized { | |
| 33 | let x = closure_capture(); | |
| 34 | move || { | |
| 35 | x; | |
| 36 | } | |
| 37 | } | |
| 38 | ||
| 39 | fn closure_ref_capture() -> impl Sized { | |
| 40 | let x = closure_ref_capture(); | |
| 41 | move || { | |
| 42 | &x; | |
| 43 | } | |
| 44 | } | |
| 45 | ||
| 46 | fn closure_sig() -> _ { | |
| 47 | //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types | |
| 48 | || closure_sig() | |
| 49 | } | |
| 50 | ||
| 51 | fn generator_sig() -> impl Sized { | |
| 52 | || i | |
| 53 | //~^ ERROR cannot find value `i` in this scope | |
| 54 | } | |
| 55 | ||
| 56 | fn generator_capture() -> impl i32 { | |
| 57 | //~^ ERROR expected trait, found builtin type `i32` | |
| 58 | let x = 1(); | |
| 59 | move || { | |
| 60 | yield; | |
| 61 | //~^ ERROR yield syntax is experimental | |
| 62 | //~| ERROR yield syntax is experimental | |
| 63 | //~| ERROR `yield` can only be used in `#[coroutine]` closures, or `gen` blocks | |
| 64 | x; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| 68 | fn substs_change<T: 'static>() -> impl Sized { | |
| 69 | (substs_change::<&T>(),) | |
| 70 | } | |
| 71 | ||
| 72 | fn generator_hold() -> impl generator_capture { | |
| 73 | //~^ ERROR expected trait, found function `generator_capture` | |
| 74 | move || { | |
| 75 | let x = (); | |
| 76 | yield; | |
| 77 | //~^ ERROR yield syntax is experimental | |
| 78 | //~| ERROR yield syntax is experimental | |
| 79 | //~| ERROR `yield` can only be used in `#[coroutine]` closures, or `gen` blocks | |
| 80 | x virtual ; | |
| 81 | //~^ ERROR expected one of | |
| 82 | } | |
| 83 | } | |
| 84 | ||
| 85 | fn use_fn_ptr() -> impl Sized { | |
| 86 | fn_ptr() | |
| 87 | } | |
| 88 | ||
| 89 | fn mutual_recursion() -> impl Sync { | |
| 90 | mutual_recursion_b() | |
| 91 | } | |
| 92 | ||
| 93 | fn mutual_recursion_b() -> impl Sized { | |
| 94 | mutual_recursion() | |
| 95 | } | |
| 96 | ||
| 97 | fn main() {} |
tests/ui/parallel-rustc/recursive-impl-trait-deadlock-issue-129912.stderr created+137| ... | ... | @@ -0,0 +1,137 @@ |
| 1 | error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found reserved keyword `virtual` | |
| 2 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:80:11 | |
| 3 | | | |
| 4 | LL | x virtual ; | |
| 5 | | ^^^^^^^ expected one of 8 possible tokens | |
| 6 | ||
| 7 | error[E0557]: feature has been removed | |
| 8 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:3:12 | |
| 9 | | | |
| 10 | LL | #![feature(generators)] | |
| 11 | | ^^^^^^^^^^ feature has been removed | |
| 12 | | | |
| 13 | = note: removed in 1.75.0; see <https://github.com/rust-lang/rust/pull/116958> for more information | |
| 14 | = note: renamed to `coroutines` | |
| 15 | ||
| 16 | error[E0423]: expected value, found trait `Sized` | |
| 17 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:8:62 | |
| 18 | | | |
| 19 | LL | if generator_sig() < 0 { None } else { Sized((option(i - Sized), i)) } | |
| 20 | | ^^^^^ not a value | |
| 21 | ||
| 22 | error[E0425]: cannot find value `i` in this scope | |
| 23 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:52:8 | |
| 24 | | | |
| 25 | LL | || i | |
| 26 | | ^ not found in this scope | |
| 27 | ||
| 28 | error[E0404]: expected trait, found builtin type `i32` | |
| 29 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:56:32 | |
| 30 | | | |
| 31 | LL | fn generator_capture() -> impl i32 { | |
| 32 | | ^^^ not a trait | |
| 33 | ||
| 34 | error[E0404]: expected trait, found function `generator_capture` | |
| 35 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:72:29 | |
| 36 | | | |
| 37 | LL | fn generator_hold() -> impl generator_capture { | |
| 38 | | ^^^^^^^^^^^^^^^^^ not a trait | |
| 39 | ||
| 40 | error[E0658]: yield syntax is experimental | |
| 41 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:60:9 | |
| 42 | | | |
| 43 | LL | yield; | |
| 44 | | ^^^^^ | |
| 45 | | | |
| 46 | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information | |
| 47 | = help: add `#![feature(yield_expr)]` to the crate attributes to enable | |
| 48 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | |
| 49 | ||
| 50 | error[E0658]: yield syntax is experimental | |
| 51 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:76:9 | |
| 52 | | | |
| 53 | LL | yield; | |
| 54 | | ^^^^^ | |
| 55 | | | |
| 56 | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information | |
| 57 | = help: add `#![feature(yield_expr)]` to the crate attributes to enable | |
| 58 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | |
| 59 | ||
| 60 | error[E0562]: `impl Trait` is not allowed in cast expression types | |
| 61 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:24:22 | |
| 62 | | | |
| 63 | LL | &ptr() as *const impl Sized | |
| 64 | | ^^^^^^^^^^ | |
| 65 | | | |
| 66 | = note: `impl Trait` is only allowed in arguments and return types of functions and methods | |
| 67 | ||
| 68 | error[E0658]: yield syntax is experimental | |
| 69 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:60:9 | |
| 70 | | | |
| 71 | LL | yield; | |
| 72 | | ^^^^^ | |
| 73 | | | |
| 74 | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information | |
| 75 | = help: add `#![feature(yield_expr)]` to the crate attributes to enable | |
| 76 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | |
| 77 | ||
| 78 | error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks | |
| 79 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:60:9 | |
| 80 | | | |
| 81 | LL | yield; | |
| 82 | | ^^^^^ | |
| 83 | | | |
| 84 | help: use `#[coroutine]` to make this closure a coroutine | |
| 85 | | | |
| 86 | LL | #[coroutine] move || { | |
| 87 | | ++++++++++++ | |
| 88 | ||
| 89 | error[E0658]: yield syntax is experimental | |
| 90 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:76:9 | |
| 91 | | | |
| 92 | LL | yield; | |
| 93 | | ^^^^^ | |
| 94 | | | |
| 95 | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information | |
| 96 | = help: add `#![feature(yield_expr)]` to the crate attributes to enable | |
| 97 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | |
| 98 | ||
| 99 | error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks | |
| 100 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:76:9 | |
| 101 | | | |
| 102 | LL | yield; | |
| 103 | | ^^^^^ | |
| 104 | | | |
| 105 | help: use `#[coroutine]` to make this closure a coroutine | |
| 106 | | | |
| 107 | LL | #[coroutine] move || { | |
| 108 | | ++++++++++++ | |
| 109 | ||
| 110 | error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types | |
| 111 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:17:15 | |
| 112 | | | |
| 113 | LL | fn array() -> _ { | |
| 114 | | ^ not allowed in type signatures | |
| 115 | ||
| 116 | error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types | |
| 117 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:22:13 | |
| 118 | | | |
| 119 | LL | fn ptr() -> _ { | |
| 120 | | ^ not allowed in type signatures | |
| 121 | ||
| 122 | error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types | |
| 123 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:46:21 | |
| 124 | | | |
| 125 | LL | fn closure_sig() -> _ { | |
| 126 | | ^ not allowed in type signatures | |
| 127 | ||
| 128 | error[E0423]: expected function, tuple struct or tuple variant, found trait `Sized` | |
| 129 | --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:8:44 | |
| 130 | | | |
| 131 | LL | if generator_sig() < 0 { None } else { Sized((option(i - Sized), i)) } | |
| 132 | | ^^^^^ not a function, tuple struct or tuple variant | |
| 133 | ||
| 134 | error: aborting due to 17 previous errors | |
| 135 | ||
| 136 | Some errors have detailed explanations: E0121, E0404, E0423, E0425, E0557, E0562, E0658. | |
| 137 | For more information about an error, try `rustc --explain E0121`. |
tests/ui/parallel-rustc/recursive-struct-oncelock-issue-151226.rs created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | // Test for #151226, Unable to verify registry association | |
| 2 | // | |
| 3 | //@ compile-flags: -Z threads=2 | |
| 4 | //@ compare-output-by-lines | |
| 5 | ||
| 6 | struct A<T>(std::sync::OnceLock<Self>); | |
| 7 | //~^ ERROR recursive type `A` has infinite size | |
| 8 | static B: A<()> = todo!(); | |
| 9 | fn main() {} |
tests/ui/parallel-rustc/recursive-struct-oncelock-issue-151226.stderr created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | error[E0072]: recursive type `A` has infinite size | |
| 2 | --> $DIR/recursive-struct-oncelock-issue-151226.rs:6:1 | |
| 3 | | | |
| 4 | LL | struct A<T>(std::sync::OnceLock<Self>); | |
| 5 | | ^^^^^^^^^^^ ------------------------- recursive without indirection | |
| 6 | | | |
| 7 | help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle | |
| 8 | | | |
| 9 | LL | struct A<T>(Box<std::sync::OnceLock<Self>>); | |
| 10 | | ++++ + | |
| 11 | ||
| 12 | error: aborting due to 1 previous error | |
| 13 | ||
| 14 | For more information about this error, try `rustc --explain E0072`. |
tests/ui/parallel-rustc/recursive-trait-fn-sig-issue-142064.rs created+18| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | // Test for #142064, internal error: entered unreachable code | |
| 2 | // | |
| 3 | //@ compile-flags: -Zthreads=2 | |
| 4 | //@ compare-output-by-lines | |
| 5 | ||
| 6 | #![crate_type = "rlib"] | |
| 7 | trait A { fn foo() -> A; } | |
| 8 | //~^ WARN trait objects without an explicit `dyn` are deprecated | |
| 9 | //~| WARN this is accepted in the current edition | |
| 10 | //~| WARN trait objects without an explicit `dyn` are deprecated | |
| 11 | //~| WARN this is accepted in the current edition | |
| 12 | //~| ERROR the trait `A` is not dyn compatible | |
| 13 | trait B { fn foo() -> A; } | |
| 14 | //~^ WARN trait objects without an explicit `dyn` are deprecated | |
| 15 | //~| WARN this is accepted in the current edition | |
| 16 | //~| WARN trait objects without an explicit `dyn` are deprecated | |
| 17 | //~| WARN this is accepted in the current edition | |
| 18 | //~| ERROR the trait `A` is not dyn compatible |
tests/ui/parallel-rustc/recursive-trait-fn-sig-issue-142064.stderr created+114| ... | ... | @@ -0,0 +1,114 @@ |
| 1 | warning: trait objects without an explicit `dyn` are deprecated | |
| 2 | --> $DIR/recursive-trait-fn-sig-issue-142064.rs:7:23 | |
| 3 | | | |
| 4 | LL | trait A { fn foo() -> A; } | |
| 5 | | ^ | |
| 6 | | | |
| 7 | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! | |
| 8 | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> | |
| 9 | = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default | |
| 10 | help: if this is a dyn-compatible trait, use `dyn` | |
| 11 | | | |
| 12 | LL | trait A { fn foo() -> dyn A; } | |
| 13 | | +++ | |
| 14 | ||
| 15 | warning: trait objects without an explicit `dyn` are deprecated | |
| 16 | --> $DIR/recursive-trait-fn-sig-issue-142064.rs:13:23 | |
| 17 | | | |
| 18 | LL | trait B { fn foo() -> A; } | |
| 19 | | ^ | |
| 20 | | | |
| 21 | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! | |
| 22 | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> | |
| 23 | help: if this is a dyn-compatible trait, use `dyn` | |
| 24 | | | |
| 25 | LL | trait B { fn foo() -> dyn A; } | |
| 26 | | +++ | |
| 27 | ||
| 28 | warning: trait objects without an explicit `dyn` are deprecated | |
| 29 | --> $DIR/recursive-trait-fn-sig-issue-142064.rs:7:23 | |
| 30 | | | |
| 31 | LL | trait A { fn foo() -> A; } | |
| 32 | | ^ | |
| 33 | | | |
| 34 | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! | |
| 35 | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> | |
| 36 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | |
| 37 | help: if this is a dyn-compatible trait, use `dyn` | |
| 38 | | | |
| 39 | LL | trait A { fn foo() -> dyn A; } | |
| 40 | | +++ | |
| 41 | ||
| 42 | warning: trait objects without an explicit `dyn` are deprecated | |
| 43 | --> $DIR/recursive-trait-fn-sig-issue-142064.rs:13:23 | |
| 44 | | | |
| 45 | LL | trait B { fn foo() -> A; } | |
| 46 | | ^ | |
| 47 | | | |
| 48 | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! | |
| 49 | = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> | |
| 50 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | |
| 51 | help: if this is a dyn-compatible trait, use `dyn` | |
| 52 | | | |
| 53 | LL | trait B { fn foo() -> dyn A; } | |
| 54 | | +++ | |
| 55 | ||
| 56 | error[E0038]: the trait `A` is not dyn compatible | |
| 57 | --> $DIR/recursive-trait-fn-sig-issue-142064.rs:7:23 | |
| 58 | | | |
| 59 | LL | trait A { fn foo() -> A; } | |
| 60 | | ^ `A` is not dyn compatible | |
| 61 | | | |
| 62 | note: for a trait to be dyn compatible it needs to allow building a vtable | |
| 63 | for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> | |
| 64 | --> $DIR/recursive-trait-fn-sig-issue-142064.rs:7:14 | |
| 65 | | | |
| 66 | LL | trait A { fn foo() -> A; } | |
| 67 | | - ^^^ ...because associated function `foo` has no `self` parameter | |
| 68 | | | | |
| 69 | | this trait is not dyn compatible... | |
| 70 | help: consider turning `foo` into a method by giving it a `&self` argument | |
| 71 | | | |
| 72 | LL | trait A { fn foo(&self) -> A; } | |
| 73 | | +++++ | |
| 74 | help: alternatively, consider constraining `foo` so it does not apply to trait objects | |
| 75 | | | |
| 76 | LL | trait A { fn foo() -> A where Self: Sized; } | |
| 77 | | +++++++++++++++++ | |
| 78 | help: you might have meant to use `Self` to refer to the implementing type | |
| 79 | | | |
| 80 | LL - trait A { fn foo() -> A; } | |
| 81 | LL + trait A { fn foo() -> Self; } | |
| 82 | | | |
| 83 | ||
| 84 | error[E0038]: the trait `A` is not dyn compatible | |
| 85 | --> $DIR/recursive-trait-fn-sig-issue-142064.rs:13:23 | |
| 86 | | | |
| 87 | LL | trait B { fn foo() -> A; } | |
| 88 | | ^ `A` is not dyn compatible | |
| 89 | | | |
| 90 | note: for a trait to be dyn compatible it needs to allow building a vtable | |
| 91 | for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> | |
| 92 | --> $DIR/recursive-trait-fn-sig-issue-142064.rs:7:14 | |
| 93 | | | |
| 94 | LL | trait A { fn foo() -> A; } | |
| 95 | | - ^^^ ...because associated function `foo` has no `self` parameter | |
| 96 | | | | |
| 97 | | this trait is not dyn compatible... | |
| 98 | help: consider turning `foo` into a method by giving it a `&self` argument | |
| 99 | | | |
| 100 | LL | trait A { fn foo(&self) -> A; } | |
| 101 | | +++++ | |
| 102 | help: alternatively, consider constraining `foo` so it does not apply to trait objects | |
| 103 | | | |
| 104 | LL | trait A { fn foo() -> A where Self: Sized; } | |
| 105 | | +++++++++++++++++ | |
| 106 | help: you might have meant to use `Self` to refer to the implementing type | |
| 107 | | | |
| 108 | LL - trait B { fn foo() -> A; } | |
| 109 | LL + trait B { fn foo() -> Self; } | |
| 110 | | | |
| 111 | ||
| 112 | error: aborting due to 2 previous errors; 4 warnings emitted | |
| 113 | ||
| 114 | For more information about this error, try `rustc --explain E0038`. |
tests/ui/parallel-rustc/recursive-type-with-transmutability-issue-120759.rs created+26| ... | ... | @@ -0,0 +1,26 @@ |
| 1 | // Test for #120759, deadlock detected without any query | |
| 2 | ||
| 3 | #![crate_type = "lib"] | |
| 4 | #![feature(transmutability)] | |
| 5 | ||
| 6 | mod assert { | |
| 7 | use std::mem::{Assume, BikeshedIntrinsicFrom}; | |
| 8 | //~^ ERROR unresolved import `std::mem::BikeshedIntrinsicFrom` | |
| 9 | pub struct Context; | |
| 10 | ||
| 11 | pub fn is_maybe_transmutable<Src, Dst>(&self, cpu: &mut CPU) | |
| 12 | //~^ ERROR `self` parameter is only allowed in associated functions | |
| 13 | //~| ERROR cannot find type `CPU` in this scope | |
| 14 | where | |
| 15 | Dst: BikeshedIntrinsicFrom<Src, Context>, | |
| 16 | { | |
| 17 | } | |
| 18 | } | |
| 19 | ||
| 20 | fn should_pad_explicitly_packed_field() { | |
| 21 | #[repr(C)] | |
| 22 | struct ExplicitlyPadded(ExplicitlyPadded); | |
| 23 | //~^ ERROR recursive type `ExplicitlyPadded` has infinite size | |
| 24 | ||
| 25 | assert::is_maybe_transmutable::<ExplicitlyPadded, ()>(); | |
| 26 | } |
tests/ui/parallel-rustc/recursive-type-with-transmutability-issue-120759.stderr created+35| ... | ... | @@ -0,0 +1,35 @@ |
| 1 | error: `self` parameter is only allowed in associated functions | |
| 2 | --> $DIR/recursive-type-with-transmutability-issue-120759.rs:11:44 | |
| 3 | | | |
| 4 | LL | pub fn is_maybe_transmutable<Src, Dst>(&self, cpu: &mut CPU) | |
| 5 | | ^^^^^ not semantically valid as function parameter | |
| 6 | | | |
| 7 | = note: associated functions are those in `impl` or `trait` definitions | |
| 8 | ||
| 9 | error[E0432]: unresolved import `std::mem::BikeshedIntrinsicFrom` | |
| 10 | --> $DIR/recursive-type-with-transmutability-issue-120759.rs:7:28 | |
| 11 | | | |
| 12 | LL | use std::mem::{Assume, BikeshedIntrinsicFrom}; | |
| 13 | | ^^^^^^^^^^^^^^^^^^^^^ no `BikeshedIntrinsicFrom` in `mem` | |
| 14 | ||
| 15 | error[E0425]: cannot find type `CPU` in this scope | |
| 16 | --> $DIR/recursive-type-with-transmutability-issue-120759.rs:11:61 | |
| 17 | | | |
| 18 | LL | pub fn is_maybe_transmutable<Src, Dst>(&self, cpu: &mut CPU) | |
| 19 | | ^^^ not found in this scope | |
| 20 | ||
| 21 | error[E0072]: recursive type `ExplicitlyPadded` has infinite size | |
| 22 | --> $DIR/recursive-type-with-transmutability-issue-120759.rs:22:5 | |
| 23 | | | |
| 24 | LL | struct ExplicitlyPadded(ExplicitlyPadded); | |
| 25 | | ^^^^^^^^^^^^^^^^^^^^^^^ ---------------- recursive without indirection | |
| 26 | | | |
| 27 | help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle | |
| 28 | | | |
| 29 | LL | struct ExplicitlyPadded(Box<ExplicitlyPadded>); | |
| 30 | | ++++ + | |
| 31 | ||
| 32 | error: aborting due to 4 previous errors | |
| 33 | ||
| 34 | Some errors have detailed explanations: E0072, E0425, E0432. | |
| 35 | For more information about an error, try `rustc --explain E0072`. |
x+1-1| ... | ... | @@ -46,7 +46,7 @@ for SEARCH_PYTHON in $SEARCH; do |
| 46 | 46 | fi |
| 47 | 47 | done |
| 48 | 48 | |
| 49 | python=$(bash -c "compgen -c python" | grep '^python[2-3]\.[0-9]+$' | head -n1) | |
| 49 | python=$(bash -c "compgen -c python" | grep -E '^python[2-3](\.[0-9]+)?$' | head -n1) | |
| 50 | 50 | if ! [ "$python" = "" ]; then |
| 51 | 51 | exec "$python" "$xpy" "$@" |
| 52 | 52 | fi |