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

feat: Constify many functions #263

Merged
merged 1 commit into from
May 17, 2023
Merged

Conversation

kleinesfilmroellchen
Copy link
Contributor

This is primarily aimed at making SourceSpan and SourceOffset usable in const contexts.

Constifiable functions were found with the clippy::missing_const_for_fn lint, though it reported at least two false positives.

Fixes #261

@kleinesfilmroellchen
Copy link
Contributor Author

Note: I couldn't test this with MSRV or any versions before 1.69 due to this error:

❯ cargo +1.58.0 nextest run      
    Updating crates.io index
error: failed to select a version for the requirement `aho-corasick = "^1.0.0"`
candidate versions found which didn't match: 0.7.20, 0.7.19, 0.7.18, ...
location searched: crates.io index
required by package `regex v1.8.1`
    ... which satisfies dependency `regex = "^1.5"` (locked to 1.8.1) of package `miette v5.8.0 (miette)`
error: command `'\\?\~\.rustup\toolchains\1.58.0-x86_64-pc-windows-msvc\bin\cargo.exe' test --no-run --message-format json-render-diagnostics` exited with code 101

@zkat
Copy link
Owner

zkat commented May 12, 2023

looks like this is relying on stuff that was unstable as of the current MSRV (1.56.0). Considering you can't seem to run this on earlier versions to test, maybe it's better to mark this as "breaking" and include it with miette 6.0 instead?

@kleinesfilmroellchen
Copy link
Contributor Author

looks like this is relying on stuff that was unstable as of the current MSRV (1.56.0). Considering you can't seem to run this on earlier versions to test, maybe it's better to mark this as "breaking" and include it with miette 6.0 instead?

I didn't change my toolchain so these failures are strange. I will just throw away all the constification that cannot be done right now.

@kleinesfilmroellchen kleinesfilmroellchen force-pushed the constify branch 2 times, most recently from 8e7795c to 5cebe99 Compare May 14, 2023 20:35
This is primarily aimed at making `SourceSpan` and `SourceOffset` usable
in const contexts.

Constifiable functions were found with the
`clippy::missing_const_for_fn` lint, though it reported at least two
false positives.
@zkat zkat merged commit 46adb3b into zkat:main May 17, 2023
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.

Constify SourceOffset and SourceSpan
2 participants