Skip to content

endless loop by running cargo test with toolchain 2024-05-14 #125269

Closed
@xMAC94x

Description

@xMAC94x

I tried this code:

(sorry, i couldn't extract a minimal example and reproduce it)

git clone https://gitlab.com/veloren/veloren
cd veloren
git checkout e48fc4c2b235ceab3c1a551292c45c46d47e7130
cd common
cargo test

I expected to see this happen: ElimCase doctest in line 86 to finish after some time

Instead, this happened: the tests takes endless (i waited 2 hours in CI)

Meta

rustc --version --verbose:

rustc 1.80.0-nightly (ab14f944a 2024-05-13)
binary: rustc
commit-hash: ab14f944afe4234db378ced3801e637eae6c0f30
commit-date: 2024-05-13
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.4

cargo test:

   Doc-tests veloren_common

running 14 tests
test common/src/terrain/block.rs - terrain::block::Block (line 120) ... ignored
...
test common/src/typed.rs - typed::ElimCase (line 107) ... ok
...
test common/src/typed.rs - typed::ElimCase (line 86) has been running for over 60 seconds

code in the doc-test in question:

/// ```
/// veloren_common::make_case_elim!(
///     my_type_module,
///     #[repr(u32)]
///     #[derive(Clone,Copy)]
///     pub enum MyType {
///         Constr1 = 0,
///         #[typed(pure)] Constr2(arg : u8) = 1,
///         /* ..., */
///     }
/// );
/// ```

Workaround

As workaround we added a main function to the doctest, as the test doesnt execute code so far (only defines stuff) it then runs immediately again
https://gitlab.com/veloren/veloren/-/commit/3cc4b947ebd049dcdf82ca4a66a815d32d4d43f8

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-compiletimeIssue: Problems and improvements with respect to compile times.L-non_local_definitionsLint: non_local_definitionsP-highHigh priorityS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions