Correctly get source for metatdata-only crate type by abonander · Pull Request #40542 · rust-lang/rust (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation39 Commits2 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
Closes #40535
However, I'm not sure how to approach writing a regression test since I'm still working on a reduced test case from the code that caused the ICE in the first place. It's not enough to have an unknown extern crate
in a metadata crate, it depends on a few extra arguments but I'm not sure which yet.
Also replaced the unwrap()
with a more informative expect()
.
r? @jseyfried
abonander changed the title
Correctly get source for metadata crate type Correctly get source for metatdata-only crate type
Marking as beta-nominated since this affects the current beta.
jseyfried added the T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
label
Marking as beta-accepted, once it is r+'d of course (and yes, with test plz).
Okay, so I've got a minimal case here, involving three crates, foo, bar, baz
:
- Crate
foo
depends onbar
but declares bothextern crate bar
andextern crate baz
- Crate
bar
depends onbaz
and declaresextern crate baz
. cargo check
onfoo
produces the ICE;cargo build
or any missingextern crate
just produces the "unknown cratebaz
" error.
I know about auxiliary builds but how do I force the --emit=metadata
flag and have one auxiliary crate depend on another?
You can create a run-make test (see src/test/run-make).
@arielb1 Can that include Cargo invocations or do I have to write out the commands manually?
Eh I can just copy the output of cargo check -v
.
Regression test pushed, it detects the error and confirms the fix correctly (fails on ICE, succeeds otherwise)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! r=me modulo comment
$(RUSTC) bar.rs --emit=metadata --extern baz=libbaz.rmeta |
---|
$(RUSTC) foo.rs --emit=metadata -L dependency=. --extern bar=libbar.rmeta 2>&1 | \ |
grep -vq "unexpectedly panicked" |
# ^ Succeeds if it doesn't find the ICE message |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add trailing newline (all new files)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really gotta figure out how to get IDEA to add those automatically, it's so easy to forget.
📌 Commit e670335 has been approved by jseyfried
error: could not write output to baz.crate.metadata.o: Read-only file system
Not sure how to fix this.
@abonander The run-make
tests can only write in $(TMPDIR)
.
Note that $(RUSTC) outputs to $(TMPDIR)
by default.
Why is it not writing there now then? Weird.
Not sure -- looks like --emit=metadata
isn't respecting --out-dir
.
cc @nrc
I'm testing explicitly adding --out-dir=$(TMPDIR)
to see if it fixes it, I'll squash it down if it works.
$(RUSTC) baz.rs --emit=metadata |
---|
$(RUSTC) bar.rs --emit=metadata --extern baz=libbaz.rmeta |
$(RUSTC) foo.rs --emit=metadata -L dependency=. --extern bar=libbar.rmeta 2>&1 | \ |
(RUSTC)baz.rs−−emit=metadata−−out−dir=(RUSTC) baz.rs --emit=metadata --out-dir=(RUSTC)baz.rs−−emit=metadata−−out−dir=(TMPDIR) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--out-dir=$(TMPDIR)
is already included in $(RUSTC), would be very strange if adding it again here made a difference...
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may need to be after --emit=metadata
, because that's how Cargo writes the command.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jseyfried Tests passed this time. I guess --emit=metadata
overrides any --out-dir
that appears before it, for some reason.
@bors: r=jseyfried
What weird bug!
📌 Commit 3cbdb8f has been approved by jseyfried
@bors r-
Let me take care of that "(squash me!) ..." commit first, unless you don't care about that showing up in the commit history (which would be pretty funny to come across later, I guess).
Should I leave a FIXME
in the Makefile pointing to the issue I opened about --emit
and --out-dir
?
all: |
---|
(RUSTC)baz.rs−−emit=metadata−−out−dir=(RUSTC) baz.rs --emit=metadata --out-dir=(RUSTC)baz.rs−−emit=metadata−−out−dir=(TMPDIR) |
(RUSTC)bar.rs−−emit=metadata−−externbaz=(RUSTC) bar.rs --emit=metadata --extern baz=(RUSTC)bar.rs−−emit=metadata−−externbaz=(TMPDIR)/libbaz.rmeta --out-dir=$(TMPDIR) |
(RUSTC)foo.rs−−emit=metadata−Ldependency=.−−externbar=(RUSTC) foo.rs --emit=metadata -L dependency=. --extern bar=(RUSTC)foo.rs−−emit=metadata−Ldependency=.−−externbar=(TMPDIR)/libbar.rmeta --out-dir=$(TMPDIR) 2>&1 | \ |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think -L dependency=.
has any effect here.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it seemed to before, but now it's fine.
Should I leave a
FIXME
in the Makefile pointing to the issue I opened about--emit
and--out-dir
?
Sure, I'd at least cc the issue -- if I came across this code I'd probably be curious about the --out-dir=$(TMPDIR)
.
@bors delegate=abonander
@bors: r=jseyfried
Tested it locally, forgot to push before I went out for dinner.
📌 Commit 74d6cce has been approved by jseyfried
brson removed the beta-nominated
Nominated for backporting to the compiler in the beta channel.
label
bors added a commit that referenced this pull request
[beta] Backports and version bump
This PR backports these PRs to beta:
and it also includes a version bump to push out a beta with all recent backports.
replace unwrap()
with expect()
📌 Commit 8a6ef50 has been approved by jseyfried
frewsxcv added a commit to frewsxcv/rust that referenced this pull request
Correctly get source for metatdata-only crate type
Closes rust-lang#40535
However, I'm not sure how to approach writing a regression test since I'm still working on a reduced test case from the code that caused the ICE in the first place. It's not enough to have an unknown extern crate
in a metadata crate, it depends on a few extra arguments but I'm not sure which yet.
Also replaced the unwrap()
with a more informative expect()
.
r? @jseyfried
bors added a commit that referenced this pull request
This was referenced
Mar 25, 2017
This test is failing on 1.21.0 on Debian on amd64 and ppc64el:
/<<BUILDDIR>>/rustc-1.21.0+dfsg1/build/x86_64-unknown-linux-gnu/stage2/bin/rustc: error while loading shared libraries: librustc_driver-ec7cf42bd86068a6.so: cannot open shared object file: No such file or directory
make[2]: *** [all] Error 127
Any clue what's causing it?
Labels
Accepted for backporting to the compiler in the beta channel.
Relevant to the compiler team, which will review and decide on the PR/issue.