authorbors <bors@rust-lang.org> 2026-03-26 15:08:36 UTC
committerbors <bors@rust-lang.org> 2026-03-26 15:08:36 UTC
log23903d01c237d7c7d4fb62b82ca846bc45de4e0c
tree676b6f3abad0b003a824843bb67f1646d5bdc749
parentf58bd5cee4ce4a97b03146fa94fc9ba68ddd5f64
parent90bebc0fc6bba209b1ab0787c253751abac067a1

Auto merge of #154423 - JonathanBrouwer:rollup-CxbclzF, r=JonathanBrouwer

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> {
16491649 );
16501650 }
16511651
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
16521731 fn print_inline_asm(&mut self, asm: &ast::InlineAsm) {
16531732 enum AsmArg<'a> {
16541733 Template(String),
......@@ -1657,8 +1736,9 @@ impl<'a> State<'a> {
16571736 Options(InlineAsmOptions),
16581737 }
16591738
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));
16621742 for (abi, _) in &asm.clobber_abis {
16631743 args.push(AsmArg::ClobberAbi(*abi));
16641744 }
compiler/rustc_target/src/spec/mod.rs+2
......@@ -1826,6 +1826,8 @@ supported_targets! {
18261826 ("x86_64-pc-cygwin", x86_64_pc_cygwin),
18271827
18281828 ("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),
18291831}
18301832
18311833/// 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 @@
1use crate::spec::{SanitizerSet, Target, TargetMetadata};
2
3pub(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 @@
1use crate::spec::{SanitizerSet, Target, TargetMetadata};
2
3pub(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 {
124124 };
125125}
126126
127// FIXME add back debug_assert_matches doc link after bootstrap.
128
129127/// Asserts that an expression matches the provided pattern.
130128///
131129/// This macro is generally preferable to `assert!(matches!(value, pattern))`, because it can print
......@@ -137,9 +135,11 @@ macro_rules! assert_ne {
137135/// otherwise this macro will panic.
138136///
139137/// 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
141139/// release builds by default.
142140///
141/// [`debug_assert_matches!`]: crate::debug_assert_matches
142///
143143/// On panic, this macro will print the value of the expression with its debug representation.
144144///
145145/// 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(
15581558 &["asan", "dfsan", "lsan", "msan", "safestack", "tsan", "rtsan"],
15591559 ),
15601560 "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"]),
15611563 "x86_64-unknown-linux-musl" => {
15621564 common_libs("linux", "x86_64", &["asan", "lsan", "msan", "tsan"])
15631565 }
src/bootstrap/src/core/sanity.rs+2
......@@ -37,6 +37,8 @@ pub struct Finder {
3737/// when the newly-bumped stage 0 compiler now knows about the formerly-missing targets.
3838const STAGE0_MISSING_TARGETS: &[&str] = &[
3939 // just a dummy comment so the list doesn't get onelined
40 "x86_64-unknown-linux-gnumsan",
41 "x86_64-unknown-linux-gnutsan",
4042];
4143
4244/// 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
124124ENV TARGETS=$TARGETS,riscv64gc-unknown-linux-musl
125125
126126ENV TARGETS_SANITIZERS=x86_64-unknown-linux-gnuasan
127ENV TARGETS_SANITIZERS=$TARGETS_SANITIZERS,x86_64-unknown-linux-gnumsan
128ENV TARGETS_SANITIZERS=$TARGETS_SANITIZERS,x86_64-unknown-linux-gnutsan
127129
128130# As per https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1300211
129131# 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 @@
155155 - [x86_64-unknown-linux-none](platform-support/x86_64-unknown-linux-none.md)
156156 - [x86_64-unknown-none](platform-support/x86_64-unknown-none.md)
157157 - [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)
158160 - [xtensa-\*-none-elf](platform-support/xtensa.md)
159161 - [\*-nuttx-\*](platform-support/nuttx.md)
src/doc/rustc/src/platform-support.md+2
......@@ -216,6 +216,8 @@ target | std | notes
216216[`x86_64-fortanix-unknown-sgx`](platform-support/x86_64-fortanix-unknown-sgx.md) | ✓ | [Fortanix ABI] for 64-bit Intel SGX
217217[`x86_64-linux-android`](platform-support/android.md) | ✓ | 64-bit x86 Android
218218[`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
219221[`x86_64-unknown-fuchsia`](platform-support/fuchsia.md) | ✓ | 64-bit x86 Fuchsia
220222`x86_64-unknown-linux-gnux32` | ✓ | 64-bit Linux (x32 ABI) (kernel 4.15+, glibc 2.27)
221223[`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
5Target mirroring `x86_64-unknown-linux-gnu` with MemorySanitizer enabled by
6default.
7The goal of this target is to allow shipping MSAN-instrumented standard
8libraries through rustup, enabling a fully instrumented binary without requiring
9nightly features (build-std).
10Once 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
20The target is for cross-compilation only. Host tools are not supported, since
21there is no need to have the host tools instrumented with MSAN. std is fully
22supported.
23
24In all other aspects the target is equivalent to `x86_64-unknown-linux-gnu`.
25
26## Building the target
27
28The target can be built by enabling it for a rustc build:
29
30```toml
31[build]
32target = ["x86_64-unknown-linux-gnumsan"]
33```
34
35## Building Rust programs
36
37Rust programs can be compiled by adding this target via rustup:
38
39```sh
40$ rustup target add x86_64-unknown-linux-gnumsan
41```
42
43and then compiling with the target:
44
45```sh
46$ rustc foo.rs --target x86_64-unknown-linux-gnumsan
47```
48
49## Testing
50
51Created binaries will run on Linux without any external requirements.
52
53## Cross-compilation toolchains and C code
54
55The 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
5Target mirroring `x86_64-unknown-linux-gnu` with ThreadSanitizer enabled by
6default.
7The goal of this target is to allow shipping TSAN-instrumented standard
8libraries through rustup, enabling a fully instrumented binary without requiring
9nightly features (build-std).
10Once 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
20The target is for cross-compilation only. Host tools are not supported, since
21there is no need to have the host tools instrumented with TSAN. std is fully
22supported.
23
24In all other aspects the target is equivalent to `x86_64-unknown-linux-gnu`.
25
26## Building the target
27
28The target can be built by enabling it for a rustc build:
29
30```toml
31[build]
32target = ["x86_64-unknown-linux-gnutsan"]
33```
34
35## Building Rust programs
36
37Rust programs can be compiled by adding this target via rustup:
38
39```sh
40$ rustup target add x86_64-unknown-linux-gnutsan
41```
42
43and then compiling with the target:
44
45```sh
46$ rustc foo.rs --target x86_64-unknown-linux-gnutsan
47```
48
49## Testing
50
51Created binaries will run on Linux without any external requirements.
52
53## Cross-compilation toolchains and C code
54
55The 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 @@
709709//@ revisions: x86_64_unknown_linux_gnuasan
710710//@ [x86_64_unknown_linux_gnuasan] compile-flags: --target x86_64-unknown-linux-gnuasan
711711//@ [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
712718//@ revisions: x86_64_unknown_linux_musl
713719//@ [x86_64_unknown_linux_musl] compile-flags: --target x86_64-unknown-linux-musl
714720//@ [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]
3extern crate std;
4#[prelude_import]
5use ::std::prelude::rust_2015::*;
6//@ pretty-mode:expanded
7//@ pp-exact:asm-operand-order.pp
8//@ only-x86_64
9
10use std::arch::asm;
11
12pub 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
5use std::arch::asm;
6
7pub 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
5use std::ops;
6
7pub struct Foo;
8
9impl Foo {
10 pub fn foo(&mut self) {}
11}
12
13pub struct Bar {
14 foo: Foo,
15}
16
17impl ops::Deref for Bar {
18 type Target = Foo;
19
20 fn deref(&self) -> &Foo {
21 &self.foo
22 }
23}
24
25impl ops::DerefMut for Bar {
26 fn deref_mut(&mut self) -> &mut Foo {
27 &mut self.foo
28 }
29}
30
31fn 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
7trait Default {}
8use std::num::NonZero;
9fn main() {
10 NonZero();
11 todo!();
12}
tests/ui/parallel-rustc/default-trait-shadow-cycle-issue-151358.stderr created+9
......@@ -0,0 +1,9 @@
1error[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
7error: aborting due to 1 previous error
8
9For 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
5trait TensorDimension {
6 const DIM: usize;
7 const ISSCALAR: bool = Self::DIM == 0;
8 fn is_scalar(&self) -> bool {
9 Self::ISSCALAR
10 }
11}
12
13trait 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
20trait 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
38struct LazyUpdim<'a, T: Broadcastable, const OLDDIM: usize, const DIM: usize> {
39 size: [usize; DIM],
40 reference: &'a T,
41}
42
43impl<'a, T: Broadcastable, const DIM: usize> TensorDimension for LazyUpdim<'a, T, { T::DIM }, DIM> {
44 const DIM: usize = DIM;
45}
46impl<'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}
52impl<'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
71struct BMap<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> {
72 reference: &'a T,
73 closure: F,
74}
75
76impl<'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}
81impl<'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}
91impl<'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
104impl<T> TensorDimension for Vec<T> {
105 const DIM: usize = 1;
106}
107impl<T> TensorSize for Vec<T> {
108 fn size(&self) -> [usize; 1] {
109 //~^ ERROR method not compatible with trait
110 [self.len()]
111 }
112}
113impl<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
121fn 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 @@
1error[E0425]: cannot find value `ns_window` in this scope
2 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:97:40
3 |
4LL | self.reference.bget(index).map(ns_window)
5 | ^^^^^^^^^ not found in this scope
6
7error[E0308]: method not compatible with trait
8 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:47:5
9 |
10LL | fn size(&self) -> [usize; DIM] {
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `DIM`
12 |
13 = note: expected constant `Self::DIM`
14 found constant `DIM`
15
16error[E0308]: method not compatible with trait
17 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:54:5
18 |
19LL | 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
25error[E0308]: method not compatible with trait
26 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:84:5
27 |
28LL | fn size(&self) -> [usize; DIM] {
29 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `DIM`
30 |
31 = note: expected constant `Self::DIM`
32 found constant `DIM`
33
34error[E0308]: method not compatible with trait
35 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:95:5
36 |
37LL | 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
43error[E0308]: method not compatible with trait
44 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:108:5
45 |
46LL | fn size(&self) -> [usize; 1] {
47 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `1`
48 |
49 = note: expected constant `Self::DIM`
50 found constant `1`
51
52error[E0308]: method not compatible with trait
53 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:115:5
54 |
55LL | 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
61error: unconstrained generic constant
62 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:57:13
63 |
64LL | if !self.inbounds(index) {
65 | ^^^^
66 |
67note: required by a bound in `TensorSize::inbounds`
68 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:15:39
69 |
70LL | fn inbounds(&self, index: [usize; Self::DIM]) -> bool {
71 | ^^^^^^^^^ required by this bound in `TensorSize::inbounds`
72help: try adding a `where` bound
73 |
74LL | fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> where [(); Self::DIM]: {
75 | ++++++++++++++++++++++
76
77error[E0308]: mismatched types
78 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:57:27
79 |
80LL | if !self.inbounds(index) {
81 | ^^^^^ expected `Self::DIM`, found `DIM`
82 |
83 = note: expected constant `Self::DIM`
84 found constant `DIM`
85
86error: unconstrained generic constant
87 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:62:25
88 |
89LL | let size = self.size();
90 | ^^^^
91 |
92note: required by a bound in `TensorSize::size`
93 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:14:31
94 |
95LL | fn size(&self) -> [usize; Self::DIM];
96 | ^^^^^^^^^ required by this bound in `TensorSize::size`
97help: try adding a `where` bound
98 |
99LL | fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> where [(); Self::DIM]: {
100 | ++++++++++++++++++++++
101
102error[E0277]: the trait bound `[usize; T::DIM]: Default` is not satisfied
103 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:65:41
104 |
105LL | let newindex: [usize; T::DIM] = Default::default();
106 | ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `[usize; T::DIM]`
107 |
108help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
109 |
110LL | impl<'a, T: Broadcastable, const DIM: usize> Broadcastable for LazyUpdim<'a, T, { T::DIM }, DIM> where [usize; T::DIM]: Default {
111 | ++++++++++++++++++++++++++++++
112
113error: unconstrained generic constant
114 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:86:24
115 |
116LL | self.reference.size()
117 | ^^^^
118 |
119note: required by a bound in `TensorSize::size`
120 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:14:31
121 |
122LL | fn size(&self) -> [usize; Self::DIM];
123 | ^^^^^^^^^ required by this bound in `TensorSize::size`
124help: try adding a `where` bound
125 |
126LL | fn size(&self) -> [usize; DIM] where [(); Self::DIM]: {
127 | ++++++++++++++++++++++
128
129error[E0308]: mismatched types
130 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:86:9
131 |
132LL | self.reference.size()
133 | ^^^^^^^^^^^^^^^^^^^^^ expected `DIM`, found `Self::DIM`
134 |
135 = note: expected constant `DIM`
136 found constant `Self::DIM`
137
138error: unconstrained generic constant
139 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:97:9
140 |
141LL | self.reference.bget(index).map(ns_window)
142 | ^^^^^^^^^^^^^^
143 |
144note: required by a bound in `Broadcastable::bget`
145 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:22:35
146 |
147LL | fn bget(&self, index: [usize; Self::DIM]) -> Option<Self::Element>;
148 | ^^^^^^^^^ required by this bound in `Broadcastable::bget`
149help: try adding a `where` bound
150 |
151LL | fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> where [(); Self::DIM]: {
152 | ++++++++++++++++++++++
153
154error[E0308]: mismatched types
155 --> $DIR/generic-const-exprs-deadlock-issue-120757.rs:97:29
156 |
157LL | 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
163error: aborting due to 15 previous errors
164
165Some errors have detailed explanations: E0277, E0308, E0425.
166For 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
5pub struct Struct<const N: usize>;
6
7impl<const N: usize> Struct<N> {
8 pub const OK: usize = 0;
9}
10
11fn main() {
12 function::<0>();
13}
14
15fn function<const NUM_CARDS: usize>()
16where
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 @@
1error[E0391]: cycle detected when building an abstract representation for `function::{constant#0}`
2 --> $DIR/generic-const-exprs-deadlock-issue-134978.rs:17:10
3 |
4LL | [(); Struct::<{ NUM_CARDS + 0 }>::OK]:,
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6 |
7note: ...which requires building THIR for `function::{constant#0}`...
8 --> $DIR/generic-const-exprs-deadlock-issue-134978.rs:17:10
9 |
10LL | [(); Struct::<{ NUM_CARDS + 0 }>::OK]:,
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12note: ...which requires type-checking `function::{constant#0}`...
13 --> $DIR/generic-const-exprs-deadlock-issue-134978.rs:17:10
14 |
15LL | [(); Struct::<{ NUM_CARDS + 0 }>::OK]:,
16 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 = note: ...which again requires building an abstract representation for `function::{constant#0}`, completing the cycle
18note: cycle used when checking that `function` is well-formed
19 --> $DIR/generic-const-exprs-deadlock-issue-134978.rs:15:1
20 |
21LL | / fn function<const NUM_CARDS: usize>()
22LL | | where
23LL | | [(); 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
27error: aborting due to 1 previous error
28
29For 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
3fn no_err() {
4 |x: u32, y| x;
5 //~^ ERROR type annotations needed
6 let _ = String::from("x");
7}
8
9fn err() {
10 String::from("x".as_ref());
11 //~^ ERROR type annotations needed
12 //~| ERROR type annotations needed
13}
14
15fn arg_pat_closure_err() {
16 |x| String::from("x".as_ref());
17 //~^ ERROR type annotations needed
18 //~| ERROR type annotations needed
19}
20
21fn local_pat_closure_err() {
22 let _ = "x".as_ref();
23 //~^ ERROR type annotations needed
24}
25
26fn 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
33fn 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
40fn 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
54fn 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
61fn 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
68fn 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
82fn main() {}
tests/ui/parallel-rustc/infer-unwrap-none-issue-120786.stderr created+256
......@@ -0,0 +1,256 @@
1error[E0282]: type annotations needed
2 --> $DIR/infer-unwrap-none-issue-120786.rs:4:14
3 |
4LL | |x: u32, y| x;
5 | ^
6 |
7help: consider giving this closure parameter an explicit type
8 |
9LL | |x: u32, y: /* Type */| x;
10 | ++++++++++++
11
12error[E0283]: type annotations needed
13 --> $DIR/infer-unwrap-none-issue-120786.rs:10:5
14 |
15LL | 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
22error[E0283]: type annotations needed
23 --> $DIR/infer-unwrap-none-issue-120786.rs:10:22
24 |
25LL | 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;
34help: try using a fully qualified path to specify the expected types
35 |
36LL - String::from("x".as_ref());
37LL + String::from(<str as AsRef<T>>::as_ref("x"));
38 |
39
40error[E0283]: type annotations needed
41 --> $DIR/infer-unwrap-none-issue-120786.rs:16:9
42 |
43LL | |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
50error[E0283]: type annotations needed
51 --> $DIR/infer-unwrap-none-issue-120786.rs:16:26
52 |
53LL | |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;
62help: try using a fully qualified path to specify the expected types
63 |
64LL - |x| String::from("x".as_ref());
65LL + |x| String::from(<str as AsRef<T>>::as_ref("x"));
66 |
67
68error[E0283]: type annotations needed for `&_`
69 --> $DIR/infer-unwrap-none-issue-120786.rs:22:9
70 |
71LL | 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;
80help: consider giving this pattern a type, where the type for type parameter `T` is specified
81 |
82LL | let _: &T = "x".as_ref();
83 | ++++
84
85error[E0283]: type annotations needed
86 --> $DIR/infer-unwrap-none-issue-120786.rs:27:5
87 |
88LL | 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
95error[E0283]: type annotations needed
96 --> $DIR/infer-unwrap-none-issue-120786.rs:27:22
97 |
98LL | 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;
107help: try using a fully qualified path to specify the expected types
108 |
109LL - String::from("x".as_ref());
110LL + String::from(<str as AsRef<T>>::as_ref("x"));
111 |
112
113error[E0283]: type annotations needed
114 --> $DIR/infer-unwrap-none-issue-120786.rs:35:5
115 |
116LL | 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
123error[E0283]: type annotations needed
124 --> $DIR/infer-unwrap-none-issue-120786.rs:35:22
125 |
126LL | 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;
135help: try using a fully qualified path to specify the expected types
136 |
137LL - String::from("x".as_ref());
138LL + String::from(<str as AsRef<T>>::as_ref("x"));
139 |
140
141error[E0283]: type annotations needed
142 --> $DIR/infer-unwrap-none-issue-120786.rs:45:5
143 |
144LL | 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
151error[E0283]: type annotations needed
152 --> $DIR/infer-unwrap-none-issue-120786.rs:45:22
153 |
154LL | 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;
163help: try using a fully qualified path to specify the expected types
164 |
165LL - String::from("x".as_ref());
166LL + String::from(<str as AsRef<T>>::as_ref("x"));
167 |
168
169error[E0283]: type annotations needed
170 --> $DIR/infer-unwrap-none-issue-120786.rs:55:5
171 |
172LL | 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
179error[E0283]: type annotations needed
180 --> $DIR/infer-unwrap-none-issue-120786.rs:55:22
181 |
182LL | 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;
191help: try using a fully qualified path to specify the expected types
192 |
193LL - String::from("x".as_ref());
194LL + String::from(<str as AsRef<T>>::as_ref("x"));
195 |
196
197error[E0283]: type annotations needed
198 --> $DIR/infer-unwrap-none-issue-120786.rs:63:5
199 |
200LL | 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
207error[E0283]: type annotations needed
208 --> $DIR/infer-unwrap-none-issue-120786.rs:63:22
209 |
210LL | 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;
219help: try using a fully qualified path to specify the expected types
220 |
221LL - String::from("x".as_ref());
222LL + String::from(<str as AsRef<T>>::as_ref("x"));
223 |
224
225error[E0283]: type annotations needed
226 --> $DIR/infer-unwrap-none-issue-120786.rs:73:5
227 |
228LL | 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
235error[E0283]: type annotations needed
236 --> $DIR/infer-unwrap-none-issue-120786.rs:73:22
237 |
238LL | 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;
247help: try using a fully qualified path to specify the expected types
248 |
249LL - String::from("x".as_ref());
250LL + String::from(<str as AsRef<T>>::as_ref("x"));
251 |
252
253error: aborting due to 18 previous errors
254
255Some errors have detailed explanations: E0282, E0283.
256For 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
3fn 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 @@
1error[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 |
4LL | type Frc = Frc<{}>::Arc;;
5 | ^^^---- help: remove the unnecessary generics
6 | |
7 | expected 0 generic arguments
8 |
9note: type alias defined here, with 0 generic parameters
10 --> $DIR/nested-type-alias-cycle-issue-129911.rs:11:22
11 |
12LL | type Frc = Frc<{}>::Arc;;
13 | ^^^
14
15error[E0391]: cycle detected when expanding type alias `main::KooArc::{constant#0}::Frc`
16 --> $DIR/nested-type-alias-cycle-issue-129911.rs:11:28
17 |
18LL | 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
25note: 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 |
28LL | 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
32error[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 |
35LL | type Frc = Frc<
36 | ________________________^^^-
37 | | |
38 | | expected 0 generic arguments
39... |
40LL | | },
41LL | | >::Arc;;
42 | |_____________- help: remove the unnecessary generics
43 |
44note: type alias defined here, with 0 generic parameters
45 --> $DIR/nested-type-alias-cycle-issue-129911.rs:15:18
46 |
47LL | type Frc = Frc<
48 | ^^^
49
50error[E0391]: cycle detected when expanding type alias `main::KooArc::{constant#0}::Frc`
51 --> $DIR/nested-type-alias-cycle-issue-129911.rs:15:24
52 |
53LL | type Frc = Frc<
54 | ________________________^
55... |
56LL | | },
57LL | | >::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
64note: 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 |
67LL | 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
71error[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 |
74LL | type Frc = Frc<{}>::Arc;;
75 | ^^^---- help: remove the unnecessary generics
76 | |
77 | expected 0 generic arguments
78 |
79note: type alias defined here, with 0 generic parameters
80 --> $DIR/nested-type-alias-cycle-issue-129911.rs:23:30
81 |
82LL | type Frc = Frc<{}>::Arc;;
83 | ^^^
84
85error[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 |
88LL | 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
95note: 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 |
98LL | 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
102error[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 |
105LL | type Frc = Frc<
106 | ________________________________^^^-
107 | | |
108 | | expected 0 generic arguments
109... |
110LL | | },
111LL | | >::Arc;;
112 | |_____________________- help: remove the unnecessary generics
113 |
114note: type alias defined here, with 0 generic parameters
115 --> $DIR/nested-type-alias-cycle-issue-129911.rs:27:26
116 |
117LL | type Frc = Frc<
118 | ^^^
119
120error[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 |
123LL | type Frc = Frc<
124 | ________________________________^
125... |
126LL | | },
127LL | | >::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
134note: 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 |
137LL | 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
141error[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 |
144LL | ... type Frc = Frc<{}>::Arc;;
145 | ^^^---- help: remove the unnecessary generics
146 | |
147 | expected 0 generic arguments
148 |
149note: type alias defined here, with 0 generic parameters
150 --> $DIR/nested-type-alias-cycle-issue-129911.rs:35:38
151 |
152LL | ... type Frc = Frc<{}>::Arc;;
153 | ^^^
154
155error[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 |
158LL | ... 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
165note: 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 |
168LL | ... 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
172error[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 |
175LL | ... type Frc = Frc<
176 | __________________________________^^^-
177 | | |
178 | | expected 0 generic arguments
179... |
180LL | | ... },
181LL | | ... >::Arc;;
182 | |_______________________- help: remove the unnecessary generics
183 |
184note: type alias defined here, with 0 generic parameters
185 --> $DIR/nested-type-alias-cycle-issue-129911.rs:39:34
186 |
187LL | ... type Frc = Frc<
188 | ^^^
189
190error[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 |
193LL | ... type Frc = Frc<
194 | __________________________________^
195... |
196LL | | ... },
197LL | | ... >::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
204note: 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 |
207LL | ... 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
211error[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 |
214LL | ... type Frc = Frc<{}>::Arc;;
215 | ^^^---- help: remove the unnecessary generics
216 | |
217 | expected 0 generic arguments
218 |
219note: type alias defined here, with 0 generic parameters
220 --> $DIR/nested-type-alias-cycle-issue-129911.rs:47:46
221 |
222LL | ... type Frc = Frc<{}>::Arc;;
223 | ^^^
224
225error[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 |
228LL | ... 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
235note: 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 |
238LL | ... 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
242error[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 |
245LL | ... type Frc = Frc<
246 | __________________________________^^^-
247 | | |
248 | | expected 0 generic arguments
249... |
250LL | | ... },
251LL | | ... >::Arc;;
252 | |_______________________- help: remove the unnecessary generics
253 |
254note: type alias defined here, with 0 generic parameters
255 --> $DIR/nested-type-alias-cycle-issue-129911.rs:51:42
256 |
257LL | ... type Frc = Frc<
258 | ^^^
259
260error[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 |
263LL | ... type Frc = Frc<
264 | __________________________________^
265... |
266LL | | ... },
267LL | | ... >::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
274note: 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 |
277LL | ... 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
281error[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 |
284LL | ... type Frc = Frc<{}>::Arc;;
285 | ^^^---- help: remove the unnecessary generics
286 | |
287 | expected 0 generic arguments
288 |
289note: type alias defined here, with 0 generic parameters
290 --> $DIR/nested-type-alias-cycle-issue-129911.rs:60:58
291 |
292LL | ... type Frc = Frc<{}>::Arc;;
293 | ^^^
294
295error[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 |
298LL | ... 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
305note: 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 |
308LL | ... 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
312error[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 |
315LL | ... type Frc = Frc<
316 | __________________________________^^^-
317 | | |
318 | | expected 0 generic arguments
319... |
320LL | | ... },
321LL | | ... >::Arc;;
322 | |_______________________- help: remove the unnecessary generics
323 |
324note: type alias defined here, with 0 generic parameters
325 --> $DIR/nested-type-alias-cycle-issue-129911.rs:65:50
326 |
327LL | ... type Frc = Frc<
328 | ^^^
329
330error[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 |
333LL | ... type Frc = Frc<
334 | __________________________________^
335... |
336LL | | ... },
337LL | | ... >::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
344note: 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 |
347LL | ... 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
351error[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 |
354LL | ... type Frc = Frc<{}>::Arc;;
355 | ^^^---- help: remove the unnecessary generics
356 | |
357 | expected 0 generic arguments
358 |
359note: type alias defined here, with 0 generic parameters
360 --> $DIR/nested-type-alias-cycle-issue-129911.rs:74:58
361 |
362LL | ... type Frc = Frc<{}>::Arc;;
363 | ^^^
364
365error[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 |
368LL | ... 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
375note: 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 |
378LL | ... 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
382error[E0433]: cannot find type `Frc` in this scope
383 --> $DIR/nested-type-alias-cycle-issue-129911.rs:4:19
384 |
385LL | type KooArc = Frc<
386 | ^^^ use of undeclared type `Frc`
387
388error: aborting due to 23 previous errors
389
390Some errors have detailed explanations: E0107, E0391, E0433.
391For 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
7fn 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
13fn tuple() -> impl Sized {
14 (tuple(),)
15}
16
17fn array() -> _ {
18 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
19 [array()]
20}
21
22fn 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
28fn fn_ptr() -> impl Sized {
29 fn_ptr as fn() -> _
30}
31
32fn closure_capture() -> impl Sized {
33 let x = closure_capture();
34 move || {
35 x;
36 }
37}
38
39fn closure_ref_capture() -> impl Sized {
40 let x = closure_ref_capture();
41 move || {
42 &x;
43 }
44}
45
46fn closure_sig() -> _ {
47 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
48 || closure_sig()
49}
50
51fn generator_sig() -> impl Sized {
52 || i
53 //~^ ERROR cannot find value `i` in this scope
54}
55
56fn 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
68fn substs_change<T: 'static>() -> impl Sized {
69 (substs_change::<&T>(),)
70}
71
72fn 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
85fn use_fn_ptr() -> impl Sized {
86 fn_ptr()
87}
88
89fn mutual_recursion() -> impl Sync {
90 mutual_recursion_b()
91}
92
93fn mutual_recursion_b() -> impl Sized {
94 mutual_recursion()
95}
96
97fn main() {}
tests/ui/parallel-rustc/recursive-impl-trait-deadlock-issue-129912.stderr created+137
......@@ -0,0 +1,137 @@
1error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found reserved keyword `virtual`
2 --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:80:11
3 |
4LL | x virtual ;
5 | ^^^^^^^ expected one of 8 possible tokens
6
7error[E0557]: feature has been removed
8 --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:3:12
9 |
10LL | #![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
16error[E0423]: expected value, found trait `Sized`
17 --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:8:62
18 |
19LL | if generator_sig() < 0 { None } else { Sized((option(i - Sized), i)) }
20 | ^^^^^ not a value
21
22error[E0425]: cannot find value `i` in this scope
23 --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:52:8
24 |
25LL | || i
26 | ^ not found in this scope
27
28error[E0404]: expected trait, found builtin type `i32`
29 --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:56:32
30 |
31LL | fn generator_capture() -> impl i32 {
32 | ^^^ not a trait
33
34error[E0404]: expected trait, found function `generator_capture`
35 --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:72:29
36 |
37LL | fn generator_hold() -> impl generator_capture {
38 | ^^^^^^^^^^^^^^^^^ not a trait
39
40error[E0658]: yield syntax is experimental
41 --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:60:9
42 |
43LL | 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
50error[E0658]: yield syntax is experimental
51 --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:76:9
52 |
53LL | 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
60error[E0562]: `impl Trait` is not allowed in cast expression types
61 --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:24:22
62 |
63LL | &ptr() as *const impl Sized
64 | ^^^^^^^^^^
65 |
66 = note: `impl Trait` is only allowed in arguments and return types of functions and methods
67
68error[E0658]: yield syntax is experimental
69 --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:60:9
70 |
71LL | 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
78error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
79 --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:60:9
80 |
81LL | yield;
82 | ^^^^^
83 |
84help: use `#[coroutine]` to make this closure a coroutine
85 |
86LL | #[coroutine] move || {
87 | ++++++++++++
88
89error[E0658]: yield syntax is experimental
90 --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:76:9
91 |
92LL | 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
99error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
100 --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:76:9
101 |
102LL | yield;
103 | ^^^^^
104 |
105help: use `#[coroutine]` to make this closure a coroutine
106 |
107LL | #[coroutine] move || {
108 | ++++++++++++
109
110error[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 |
113LL | fn array() -> _ {
114 | ^ not allowed in type signatures
115
116error[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 |
119LL | fn ptr() -> _ {
120 | ^ not allowed in type signatures
121
122error[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 |
125LL | fn closure_sig() -> _ {
126 | ^ not allowed in type signatures
127
128error[E0423]: expected function, tuple struct or tuple variant, found trait `Sized`
129 --> $DIR/recursive-impl-trait-deadlock-issue-129912.rs:8:44
130 |
131LL | if generator_sig() < 0 { None } else { Sized((option(i - Sized), i)) }
132 | ^^^^^ not a function, tuple struct or tuple variant
133
134error: aborting due to 17 previous errors
135
136Some errors have detailed explanations: E0121, E0404, E0423, E0425, E0557, E0562, E0658.
137For 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
6struct A<T>(std::sync::OnceLock<Self>);
7//~^ ERROR recursive type `A` has infinite size
8static B: A<()> = todo!();
9fn main() {}
tests/ui/parallel-rustc/recursive-struct-oncelock-issue-151226.stderr created+14
......@@ -0,0 +1,14 @@
1error[E0072]: recursive type `A` has infinite size
2 --> $DIR/recursive-struct-oncelock-issue-151226.rs:6:1
3 |
4LL | struct A<T>(std::sync::OnceLock<Self>);
5 | ^^^^^^^^^^^ ------------------------- recursive without indirection
6 |
7help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
8 |
9LL | struct A<T>(Box<std::sync::OnceLock<Self>>);
10 | ++++ +
11
12error: aborting due to 1 previous error
13
14For 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"]
7trait 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
13trait 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 @@
1warning: trait objects without an explicit `dyn` are deprecated
2 --> $DIR/recursive-trait-fn-sig-issue-142064.rs:7:23
3 |
4LL | 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
10help: if this is a dyn-compatible trait, use `dyn`
11 |
12LL | trait A { fn foo() -> dyn A; }
13 | +++
14
15warning: trait objects without an explicit `dyn` are deprecated
16 --> $DIR/recursive-trait-fn-sig-issue-142064.rs:13:23
17 |
18LL | 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>
23help: if this is a dyn-compatible trait, use `dyn`
24 |
25LL | trait B { fn foo() -> dyn A; }
26 | +++
27
28warning: trait objects without an explicit `dyn` are deprecated
29 --> $DIR/recursive-trait-fn-sig-issue-142064.rs:7:23
30 |
31LL | 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`
37help: if this is a dyn-compatible trait, use `dyn`
38 |
39LL | trait A { fn foo() -> dyn A; }
40 | +++
41
42warning: trait objects without an explicit `dyn` are deprecated
43 --> $DIR/recursive-trait-fn-sig-issue-142064.rs:13:23
44 |
45LL | 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`
51help: if this is a dyn-compatible trait, use `dyn`
52 |
53LL | trait B { fn foo() -> dyn A; }
54 | +++
55
56error[E0038]: the trait `A` is not dyn compatible
57 --> $DIR/recursive-trait-fn-sig-issue-142064.rs:7:23
58 |
59LL | trait A { fn foo() -> A; }
60 | ^ `A` is not dyn compatible
61 |
62note: 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 |
66LL | trait A { fn foo() -> A; }
67 | - ^^^ ...because associated function `foo` has no `self` parameter
68 | |
69 | this trait is not dyn compatible...
70help: consider turning `foo` into a method by giving it a `&self` argument
71 |
72LL | trait A { fn foo(&self) -> A; }
73 | +++++
74help: alternatively, consider constraining `foo` so it does not apply to trait objects
75 |
76LL | trait A { fn foo() -> A where Self: Sized; }
77 | +++++++++++++++++
78help: you might have meant to use `Self` to refer to the implementing type
79 |
80LL - trait A { fn foo() -> A; }
81LL + trait A { fn foo() -> Self; }
82 |
83
84error[E0038]: the trait `A` is not dyn compatible
85 --> $DIR/recursive-trait-fn-sig-issue-142064.rs:13:23
86 |
87LL | trait B { fn foo() -> A; }
88 | ^ `A` is not dyn compatible
89 |
90note: 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 |
94LL | trait A { fn foo() -> A; }
95 | - ^^^ ...because associated function `foo` has no `self` parameter
96 | |
97 | this trait is not dyn compatible...
98help: consider turning `foo` into a method by giving it a `&self` argument
99 |
100LL | trait A { fn foo(&self) -> A; }
101 | +++++
102help: alternatively, consider constraining `foo` so it does not apply to trait objects
103 |
104LL | trait A { fn foo() -> A where Self: Sized; }
105 | +++++++++++++++++
106help: you might have meant to use `Self` to refer to the implementing type
107 |
108LL - trait B { fn foo() -> A; }
109LL + trait B { fn foo() -> Self; }
110 |
111
112error: aborting due to 2 previous errors; 4 warnings emitted
113
114For 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
6mod 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
20fn 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 @@
1error: `self` parameter is only allowed in associated functions
2 --> $DIR/recursive-type-with-transmutability-issue-120759.rs:11:44
3 |
4LL | 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
9error[E0432]: unresolved import `std::mem::BikeshedIntrinsicFrom`
10 --> $DIR/recursive-type-with-transmutability-issue-120759.rs:7:28
11 |
12LL | use std::mem::{Assume, BikeshedIntrinsicFrom};
13 | ^^^^^^^^^^^^^^^^^^^^^ no `BikeshedIntrinsicFrom` in `mem`
14
15error[E0425]: cannot find type `CPU` in this scope
16 --> $DIR/recursive-type-with-transmutability-issue-120759.rs:11:61
17 |
18LL | pub fn is_maybe_transmutable<Src, Dst>(&self, cpu: &mut CPU)
19 | ^^^ not found in this scope
20
21error[E0072]: recursive type `ExplicitlyPadded` has infinite size
22 --> $DIR/recursive-type-with-transmutability-issue-120759.rs:22:5
23 |
24LL | struct ExplicitlyPadded(ExplicitlyPadded);
25 | ^^^^^^^^^^^^^^^^^^^^^^^ ---------------- recursive without indirection
26 |
27help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
28 |
29LL | struct ExplicitlyPadded(Box<ExplicitlyPadded>);
30 | ++++ +
31
32error: aborting due to 4 previous errors
33
34Some errors have detailed explanations: E0072, E0425, E0432.
35For more information about an error, try `rustc --explain E0072`.
x+1-1
......@@ -46,7 +46,7 @@ for SEARCH_PYTHON in $SEARCH; do
4646 fi
4747done
4848
49python=$(bash -c "compgen -c python" | grep '^python[2-3]\.[0-9]+$' | head -n1)
49python=$(bash -c "compgen -c python" | grep -E '^python[2-3](\.[0-9]+)?$' | head -n1)
5050if ! [ "$python" = "" ]; then
5151 exec "$python" "$xpy" "$@"
5252fi