Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make offset/line/fragment private attributes. #50

Merged
merged 1 commit into from
Feb 8, 2020

Conversation

progval
Copy link
Collaborator

@progval progval commented Feb 8, 2020

Mutating offset and fragment (or building a LocatedSpan from scratch) may result
in undefined behavior if the offset is invalid.
line doesn't need to be private, but I'm making it anyway, just in case we ever need it.

Fixes #45

@0xd34d10cc How does that look?

src/lib.rs Outdated
fragment: program,
extra: extra,
}
}

/// Similar to `new_extra`, but allows overriding offset and line.
/// This is unsafe, because giving an offset too large may result in UD,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: UD -> UB?

src/lib.rs Outdated
self.offset
}

/// The fragment that is spanned.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is doc for fragment() function, not location_line()

@0xd34d10cc
Copy link

Looks good to me.

Mutating them (or building a LocatedSpan from scratch) may result
in undefined behavior if the offset is invalid.
@progval
Copy link
Collaborator Author

progval commented Feb 8, 2020

Good catches, thanks

@progval progval merged commit 180b311 into fflorent:master Feb 8, 2020
@progval progval deleted the private-offset-fragment branch January 29, 2023 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UB in get_columns_and_bytes_before
2 participants