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

edition suggestion UI tests fail when CARGO is set #118058

Closed
Noratrieb opened this issue Nov 19, 2023 · 10 comments · Fixed by #118059
Closed

edition suggestion UI tests fail when CARGO is set #118058

Noratrieb opened this issue Nov 19, 2023 · 10 comments · Fixed by #118059
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Noratrieb
Copy link
Member

Noratrieb commented Nov 19, 2023

⚠️ for understanding this issue, you can ignore my messages here. they may be seen as funny though ⚠️

failures:
    [ui] tests/ui/async-await/suggest-switching-edition-on-await.rs
    [ui] tests/ui/editions/async-block-2015.rs
(this is the wrong way around, i had it blessed already)
error: /home/nils/projects/rust/tests/ui/async-await/suggest-switching-edition-on-await.rs:9: unexpected help message: '9:7: 9:12: set `edition = "2021"` in `Cargo.toml`'

error: /home/nils/projects/rust/tests/ui/async-await/suggest-switching-edition-on-await.rs:22: unexpected help message: '22:7: 22:12: set `edition = "2021"` in `Cargo.toml`'

error: /home/nils/projects/rust/tests/ui/async-await/suggest-switching-edition-on-await.rs:32: unexpected help message: '32:7: 32:12: set `edition = "2021"` in `Cargo.toml`'

error: /home/nils/projects/rust/tests/ui/async-await/suggest-switching-edition-on-await.rs:41: unexpected help message: '41:7: 41:12: set `edition = "2021"` in `Cargo.toml`'

error: /home/nils/projects/rust/tests/ui/async-await/suggest-switching-edition-on-await.rs:9: expected help message not found: pass `--edition 2021` to `rustc`

error: /home/nils/projects/rust/tests/ui/async-await/suggest-switching-edition-on-await.rs:22: expected help message not found: pass `--edition 2021` to `rustc`

error: /home/nils/projects/rust/tests/ui/async-await/suggest-switching-edition-on-await.rs:32: expected help message not found: pass `--edition 2021` to `rustc`

error: /home/nils/projects/rust/tests/ui/async-await/suggest-switching-edition-on-await.rs:41: expected help message not found: pass `--edition 2021` to `rustc`
@Noratrieb Noratrieb added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself labels Nov 19, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 19, 2023
@Noratrieb Noratrieb removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 19, 2023
@Noratrieb
Copy link
Member Author

hm, this might be entangled with the cursed way i set up https://github.com/gankra/cargo-mommy with my x

@Noratrieb
Copy link
Member Author

hm, even ./x.py directly fails, so mommy is probably innocent~

@Noratrieb
Copy link
Member Author

So, rustc checks whether CARGO is defined. The checked-in test results assume that CARGO is set. But somehow it's not set when I execute compiletest, since I get the generic flag suggestions.

@Noratrieb
Copy link
Member Author

actually it probably is related to my cargo-mommy shenanigans, I set CARGO=path/to/bin/xin my x alias to make cargo-mommy pick up x. This does work for builds, but something seems to confuse test execution.

@Noratrieb
Copy link
Member Author

while the compiletest diff tried to tell me that its not set while it should be, the "unexpected errors" bit tells me that the env var is set while it shouldn't be.

@Noratrieb
Copy link
Member Author

I tried running tests in a fresh checkout free of any shenanigans and that worked fine, so this is a me issue. and no, what seems to be happening is that the var ISN'T set for me, I manually checked the stderr dump from compiletest and it suggests --edition. I also inserted a panic when it is set, and that panic is not triggering.

@Noratrieb
Copy link
Member Author

In both my not working run and the working run, CARGO is not set inside main of compiletest.

@Noratrieb
Copy link
Member Author

and in both runs, CARGO is not set in the Debug output of the rustc Command.. ???

@Noratrieb
Copy link
Member Author

Okay, I resolved most of my confusion, leaving sane behavior that can be debugged:

  • turns out I blessed these tests into wrongness before seeing what's wrong, so all results were the wrong way around and confusing
  • compiletest does caching slightly differently than I imagined it would do caching

Now I'm left with the sane behavior of ./x works and x doesn't (so my CARGO= in the alias is causing the problem) which I think I can figure out.

@Noratrieb
Copy link
Member Author

Or rather, there is nothing to debug anymore. CARGO is set, which changes the rustc diagnostic. It's as simple as that.

@Noratrieb Noratrieb changed the title edition suggestion UI tests fail locally on master edition suggestion UI tests fail when CARGO is set Nov 19, 2023
@bors bors closed this as completed in 187d44b Nov 21, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Nov 21, 2023
Rollup merge of rust-lang#118059 - Nilstrieb:unset-cargo, r=dtolnay

Explicitly unset $CARGO for compiletest

Some UI tests trigger behavior in rustc where it reads $CARGO and changes behavior if it exists. To make the tests work that rely on it not being set, make sure it is not set.

By default, this is not set, but people may do weird hacks that cause it to be set.

closes rust-lang#118058
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants