These are chat archives for rust-lang/rust

12th
Apr 2018
Rafael Villar Burke (Pachi)
@pachi
Apr 12 2018 12:04
can I define an enum as being composed of any elements of other enums? so the elements in my enum belong to enum1 | enum2?
I did try to define enum as enum { enum1, enum2 }, but that doesn't allow me to parse a value and get an enum type
or use an enum1 type where an enum one is needed
Michal 'vorner' Vaner
@vorner
Apr 12 2018 12:07
No. You could make it tree-like, eg enum Compound { Enum1(Enum1), Enum2(Enum2) }. That way each variant would contain the corresponding sub-enum.
Or maybe you could try doing some macro-magic-something to generate the three enums together and also generate conversion functions without much boiler-plate.
Rafael Villar Burke (Pachi)
@pachi
Apr 12 2018 12:09
ok, thanks again!
Felipe Coury
@fcoury
Apr 12 2018 15:38
Hey guys I am trying to compile a project that uses embedded Rust I believe and I am getting this error: error[E0463]: can't find crate for compiler_builtins
Any idea what I need to do to install this crate?
This is the Makefile in question - https://github.com/ah-/anne-key/blob/master/Makefile
apiraino
@apiraino
Apr 12 2018 16:17
@fcoury I'm not really familiar with the matter, but does this help?
https://github.com/rust-lang-nursery/compiler-builtins
In your Cargo.toml that crate is not imported at all
Felipe Coury
@fcoury
Apr 12 2018 16:19
Thanks @apiraino I am not the author of the project, just trying to compile it. And I am really new to Rust. What do you suggest I try?
apiraino
@apiraino
Apr 12 2018 16:20
I'd follow the instruction in the README of the github repo I linked
namely, you could try to add these lines to the Cargo.toml file:
# Cargo.toml
[dependencies]
compiler_builtins = { git = "https://github.com/rust-lang-nursery/compiler-builtins" }
Felipe Coury
@fcoury
Apr 12 2018 16:20
Thank you so much @apiraino I will do that and report back here!
apiraino
@apiraino
Apr 12 2018 16:20
and/or these:
[dependencies.compiler_builtins]
git = "https://github.com/rust-lang-nursery/compiler-builtins"
features = ["c"]
no problem, just a blind shot ;-)
Eugene Tolmachev
@et1975
Apr 12 2018 17:27

Anyone else has the problem with the latest "nightly" toolchain?

error: expected a table, but found a array for runner in [snip]/.cargo/config

Ingvar Stepanyan
@RReverser
Apr 12 2018 17:28
what does runner in your cargo config look like?
Eugene Tolmachev
@et1975
Apr 12 2018 17:29

actually, that last one was me trying to work around it, the original was:

error: expected a table, but found a string for runner in [snip]/.cargo/config


[target.thumbv7em-none-eabi]
runner = 'arm-none-eabi-gdb'
rustflags = [
  "-C", "link-arg=-Tlink.x",
  "-C", "linker=arm-none-eabi-ld",
  "-Z", "linker-flavor=ld",
  "-Z", "thinlto=no",
]

[target.thumbv7em-none-eabihf]
runner = 'arm-none-eabi-gdb'
rustflags = [
  "-C", "link-arg=-Tlink.x",
  "-C", "linker=arm-none-eabi-ld",
  "-Z", "linker-flavor=ld",
  "-Z", "thinlto=no",
]

[build]
target = "thumbv7em-none-eabihf"
was compiling a moment ago on my previous nightly :worried:
Ingvar Stepanyan
@RReverser
Apr 12 2018 17:46
Hmm I don't see any changes in relevant code since I implemented it
But you can try to wrap runner value into an array and see if it helps (it's another allowed representation that supports extra params to the runner)