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

Inferring the Rust edition in use doesn't always work #274

Open
meithecatte opened this issue Jun 4, 2024 · 0 comments
Open

Inferring the Rust edition in use doesn't always work #274

meithecatte opened this issue Jun 4, 2024 · 0 comments

Comments

@meithecatte
Copy link

Hi,

my tests started suddenly failing because CI pulled in the latest version of trybuild. I tracked this down to commit c74de40 "Use 2015 as the default edition if not found in Cargo.toml".

It's somewhat unfortunate that this (technically breaking!) change wasn't listed in the changelog, but this shouldn't affect anyone in the first place because cargo warns when no edition is specified and it defaults to Rust 2015.

Indeed, the underlying issue is in how the following Cargo.toml file will get parsed (full file from my repo):

[package]
name = "test-suite"
version = "0.0.0"
publish = false
# note: no edition key here, I am setting this separately per test

[[test]]
name = "ui-tests"
path = "ui_tests.rs"
edition = "2018"

[[test]]
name = "test-edition-2015"
path = "tests/tests.rs"
edition = "2015"

Cargo will use one of the edition keys in the [[test]] sections, while trybuild will only look in [package], not find anything, and silently default to 2015.

Ideally, trybuild would correctly grab the edition field corresponding to the test being ran. Alternatively, a small and easy solution would be to warn when the default fallback is being used.

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

No branches or pull requests

1 participant