cargo mutants: missed mutants in vortex-session

Open Beginner friendly
#12,633 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
testing-qa

Research direction

Read vortex-session/src/registry.rs around Id::index, then inspect the linked mutation artifacts to see which uses of the returned index survive. Add or adjust tests that fail when index() returns the wrong value, and rerun cargo mutants -f vortex-session/src/registry.rs -F ':53:9:'; done means both reported mutants are killed.

Written by the indexing model from the issue text.

Description

The nightly run at fdb9507c04e2939724aa39c298653a8ea3fd3b49 found 2 mutants in vortex-session that survive the tests. They are in code that changed during the last day.

Artifacts:

vortex-session/src/registry.rs:53:9

replace Id::index -> usize with 0

--- vortex-session/src/registry.rs
+++ replace Id::index -> usize with 0
@@ -45,17 +45,17 @@
 
     /// Returns the id's index in the global interner.
     ///
     /// Ids are interned densely from zero, so the index can address a `Vec` with one slot per id.
     /// An implementation detail of session registries, not part of the public API.
     #[doc(hidden)]
     #[inline]
     pub fn index(&self) -> usize {
-        self.0.into_usize()
+        0 /* ~ changed by cargo-mutants ~ */
     }
 
     /// Returns the interned string.
     pub fn as_str(&self) -> &str {
         let s = INTERNER.resolve(&self.0);
         // SAFETY: INTERNER is 'static and its arena is append-only, so resolved string
         // pointers are stable for the lifetime of the program.
         unsafe { &*(s as *const str) }
cargo mutants -f vortex-session/src/registry.rs -F ':53:9:'
vortex-session/src/registry.rs:53:9

replace Id::index -> usize with 1

--- vortex-session/src/registry.rs
+++ replace Id::index -> usize with 1
@@ -45,17 +45,17 @@
 
     /// Returns the id's index in the global interner.
     ///
     /// Ids are interned densely from zero, so the index can address a `Vec` with one slot per id.
     /// An implementation detail of session registries, not part of the public API.
     #[doc(hidden)]
     #[inline]
     pub fn index(&self) -> usize {
-        self.0.into_usize()
+        1 /* ~ changed by cargo-mutants ~ */
     }
 
     /// Returns the interned string.
     pub fn as_str(&self) -> &str {
         let s = INTERNER.resolve(&self.0);
         // SAFETY: INTERNER is 'static and its arena is append-only, so resolved string
         // pointers are stable for the lifetime of the program.
         unsafe { &*(s as *const str) }
cargo mutants -f vortex-session/src/registry.rs -F ':53:9:'
Dominant language
Rust
Stars
3.2k
Forks
239
Avg merge
1d 4h
Merged PRs (30d)
684

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vortex-data/vortex

All issues in vortex-data/vortex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.