remove specialization. bevy now builds on stable rust!

This commit is contained in:
Carter Anderson 2020-06-07 23:35:40 -07:00
parent be23f119d5
commit 4568f5dae3
8 changed files with 18 additions and 10 deletions

View file

@ -1,7 +1,16 @@
# Rename this file to `config` to enable "fast build" configuration. Please read the notes below.
# NOTE: For maximum performance, build using a nightly compiler
If you are using rust stable, remove the "-Zshare-generics=y" below.
[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/clang"
rustflags = ["-Clink-arg=-fuse-ld=lld", "-Zshare-generics=y"]
[target.x86_64-apple-darwin]
linker = "/usr/bin/clang"
rustflags = ["-Zshare-generics=y"]
# NOTE: you must manually install lld on windows. you can easily do this with the "scoop" package manager:
# `scoop install llvm`
[target.x86_64-pc-windows-msvc]

View file

@ -15,9 +15,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Build
run: cargo build --verbose
- name: Run tests

View file

@ -40,10 +40,14 @@ We recommend checking out [The Bevy Book](https://bevyengine.org/learn/book/intr
cargo run --example scene
```
### Nightly Compiler
Bevy requires nightly rust right now. It currently uses [specialization](https://github.com/rust-lang/rfcs/blob/master/text/1210-impl-specialization.md) features, which are unstable. If specialization goes stable soon then we can go back to a stable compiler. [There is actually good forward progress happening here](https://github.com/rust-lang/rust/pull/68970). In the meantime, we will try our best to remove specialization usage so we can go back to stable.
### Fast Compiles
Bevy can be built just fine using default configuration on stable Rust. However for really fast iterative compiles, you should use nightly Rust and rename [.cargo/config_fast_builds](.cargo/config_fast_builds) to `.cargo/config`. This enables the following:
* Shared Generics: This feature shares generic monomorphization between crates, which significantly reduces the amount of redundant code generated (which gives a nice speed boost).
* LLD linker: Rust spends a lot of time linking, and LLD is _much_ faster. This config swaps in LLD as the linker on Windows and Linux (sorry MacOS users ... LLD currently does not support MacOS). You must have lld installed, which is part of llvm distributions:
* Ubuntu: `sudo apt-get install lld`
* Arch: `sudo pacman -S lld`
* Windows (using scoop package manager): `scoop install llvm`
## Libraries Used

View file

@ -1,4 +1,3 @@
#![feature(min_specialization)]
mod app;
mod app_builder;
mod entity_archetype;

View file

@ -8,7 +8,7 @@ impl<T> FromResources for T
where
T: Default,
{
default fn from_resources(_resources: &Resources) -> Self {
fn from_resources(_resources: &Resources) -> Self {
Self::default()
}
}

View file

@ -1,4 +1,3 @@
#![feature(min_specialization)]
pub mod batch;
mod camera;
pub mod entity;

View file

@ -7,6 +7,7 @@ fn main() {
.run();
}
/// set up a simple scene
fn setup(
command_buffer: &mut CommandBuffer,

View file

@ -33,7 +33,6 @@
//!
//! If you prefer it, you can also consume the individual bevy crates directly.
#![feature(min_specialization)]
#![doc(
html_logo_url = "https://bevyengine.org/assets/icon.png",
html_favicon_url = "https://bevyengine.org/assets/icon.png"