mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
Require explicit cloning of State
This commit is contained in:
parent
49818343dd
commit
2e85c19101
5 changed files with 27 additions and 28 deletions
|
@ -5,7 +5,7 @@ use roc_region::all::{Position, Region};
|
|||
use std::fmt;
|
||||
|
||||
/// A position in a source file.
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(Clone)]
|
||||
pub struct State<'a> {
|
||||
/// The raw input bytes from the file.
|
||||
bytes: &'a [u8],
|
||||
|
@ -36,7 +36,7 @@ impl<'a> State<'a> {
|
|||
|
||||
#[must_use]
|
||||
pub fn advance(&self, offset: usize) -> State<'a> {
|
||||
let mut state = *self;
|
||||
let mut state = self.clone();
|
||||
state.bytes = &state.bytes[offset..];
|
||||
state
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue