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

1.54.0 compilation fault with nightly, miri and parallel-compiler #87623

Closed
Miezhiko opened this issue Jul 30, 2021 · 18 comments · Fixed by rust-lang/miri#1863
Closed

1.54.0 compilation fault with nightly, miri and parallel-compiler #87623

Miezhiko opened this issue Jul 30, 2021 · 18 comments · Fixed by rust-lang/miri#1863
Labels
C-bug Category: This is a bug.

Comments

@Miezhiko
Copy link

error[E0308]: mismatched types
  --> src/tools/miri/src/bin/miri.rs:44:30
   |
44 |                 Rc::make_mut(&mut crate_source).rlib = Some((PathBuf::new(), PathKind::All));
   |                              ^^^^^^^^^^^^^^^^^ expected struct `Rc`, found struct `Arc`
   |
   = note: expected mutable reference `&mut Rc<_>`
              found mutable reference `&mut Arc<CrateSource>`

error[E0609]: no field `rlib` on type `&mut _`
  --> src/tools/miri/src/bin/miri.rs:44:49
   |
44 |                 Rc::make_mut(&mut crate_source).rlib = Some((PathBuf::new(), PathKind::All));
   |                                                 ^^^^
@Miezhiko Miezhiko added the C-bug Category: This is a bug. label Jul 30, 2021
@Urgau
Copy link
Member

Urgau commented Jul 30, 2021

Miri is a nightly-only tool, not a stable one. You shouldn't being able to built it from a stable release.
See #86436 for more informations.

@Miezhiko
Copy link
Author

Miezhiko commented Jul 30, 2021

I use nightly flag too, I'm just using release sources.

@Urgau
Copy link
Member

Urgau commented Jul 30, 2021

The release source shouldn't include miri, in fact I don't see it in the release source. Where did you download it ? Have you used the official tarballs ?

Miri is also one of the few tools that are allow to not always compile, see the Rustup Components History. So it's perfectly possible that when the beta-cut happen miri was not compiling at the moment.

@Miezhiko
Copy link
Author

Miezhiko commented Jul 30, 2021

miri can be set as additional tool in tools in config.toml before build, it needs nightly flag too (I have it), yes I use official tarballs, I wonder if there is patch for it already, maybe this issue should be on miri repository.

@ghost
Copy link

ghost commented Jul 30, 2021

   = note: expected mutable reference `&mut Rc<_>`
             found mutable reference `&mut Arc<CrateSource>`

That looks like a parallel_compiler issue rather than a toolstate issue.

@Miezhiko
Copy link
Author

Miezhiko commented Jul 30, 2021

   = note: expected mutable reference `&mut Rc<_>`
             found mutable reference `&mut Arc<CrateSource>`

That looks like a parallel_compiler issue rather than a toolstate issue.

Okay, what is parallel_compiler? Is it related with parallel compilation (many jobs) or is it some crate?

@Miezhiko
Copy link
Author

Sub-module hashtag for 1.54.0 tag is the same as for master at the moment https://github.com/rust-lang/rust/tree/1.54.0/src/tools

@ghost
Copy link

ghost commented Jul 30, 2021

Okay, what is parallel_compiler? Does it related with parallel rust compilation (many jobs) or is it some crate?

rust/config.toml.example

Lines 457 to 459 in 1195bea

# Build a multi-threaded rustc
# FIXME(#75760): Some UI tests fail when this option is enabled.
#parallel-compiler = false

@Miezhiko
Copy link
Author

@hyd-dev yes I have it enabled too

@Miezhiko Miezhiko changed the title 1.54.0 compilation fault with miri 1.54.0 compilation fault with miri and parallel-compiler Jul 30, 2021
@Miezhiko Miezhiko changed the title 1.54.0 compilation fault with miri and parallel-compiler 1.54.0 compilation fault with nightly, miri and parallel-compiler Jul 30, 2021
@Urgau
Copy link
Member

Urgau commented Jul 30, 2021

miri can be set as additional tool in tools in config.toml before build, it needs nightly flag too (I have it), yes I use official tarballs, I wonder if there is patch for it already, maybe this issue should be on miri repository.

Yes, but as I said before miri as no guarantee to build with any rust version or even master.
Because 1.54.0 was cut many weeks ago, the problem has already be fixed on master.

Sub-module hashtag for 1.54.0 tag is the same as for master at the moment https://github.com/rust-lang/rust/tree/1.54.0/src/tools

I don't know were you are looking, but it's not the case, the 1.54.0 beta-cut happen 6 weeks ago. There have been many commit since.

Miezhiko added a commit to Miezhiko/Overlay that referenced this issue Jul 30, 2021
@ghost
Copy link

ghost commented Jul 30, 2021

the problem has already be fixed on master

I don't think Miri on master works with parallel-compiler = true. The code still uses Rc which would not be work with parallel-compiler = true:
https://github.com/rust-lang/miri/blob/453e3ef7dab5aad6450bee09b2c02de94c5b18cb/src/bin/miri.rs#L45.
I don't know whether Miri is intended to work with parallel-compiler = true or not, at least it's not tested in CI.

@Miezhiko
Copy link
Author

@hyd-dev it was working for me on 1.53.0

@Urgau
Copy link
Member

Urgau commented Jul 30, 2021

Maybe @RalfJung (the miri maintainer) can help you here.

@Mark-Simulacrum
Copy link
Member

parallel-compiler = true is not a supported configuration at this time, both for rustc and especially for tools. I'd expect that patches to fix compilation and runtime bugs to be accepted for the most part, but there's not currently active development on that configuration and it's definitely not expected that git tags (i.e., stable releases) will build with parallel compiler enabled.

@RalfJung
Copy link
Member

Shouldn't #86413 have landed the change that avoids Miri being built on stable? Or do we need some other change so it is not in tools by default?

@RalfJung
Copy link
Member

RalfJung commented Jul 30, 2021

@Miezhiko why did you even build Miri? Did you explicitly ask for it in your config.toml, or did it get enabled implicitly somehow?

(If you want to build Miri, you should always use a nightly compiler. That is the only configuration we support. And even then, not all nightlies come with Miri, see https://rust-lang.github.io/rustup-components-history/. Sometimes stable releases don't come with a working Miri at all; sometimes it just happens to work, but that's basically a 'happy accident'.)

@Miezhiko
Copy link
Author

@RalfJung I enable it manually in config.toml (was thinking maybe it may be useful for me in future) I also build with nightly flag, needed for some features (not sure if FFI is stable already), I'm closing this but personally I'd port (if I know which one) patch fixing this error into sources from which ones I rebuild rust.

@RalfJung
Copy link
Member

I also build with nightly flag

Yeah, that doesn't really help for nightly tools like Miri.
The nightly flag will get you a rustc that can use feature, but we're still not making any promises about the Miri in a stable release even building.

That said, if you are okay with patching things, I'm happy to give pointers for which patches you'll likely need. :)

bors added a commit to rust-lang/miri that referenced this issue Jul 30, 2021
Use `Lrc` instead of `Rc` in `MiriCompilerCalls::config()`

The `used_crate_source` query defines its return type as [`Lrc<CrateSource>`](https://github.com/rust-lang/rust/blob/1195bea5a7b73e079fa14b37ac7e375fc77d368a/compiler/rustc_middle/src/query/mod.rs#L1418), which would be `Arc` when `parallel-compiler = true`.

I assume this fixes rust-lang/rust#87623. I didn't test that locally -- I'm not interested in `parallel-compiler = true` enough to be willing to recompile rustc with that configuration to test it, but I'm submitting this in case it might be useful for `parallel-compiler = true` users.
Miezhiko added a commit to Masha/gentoo that referenced this issue Aug 9, 2021
gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants