Leads: nikomatsakis Chat: WG-compiler-traits Rust Contribution Guide README for the Rust Crate README for the Rust trait system implementation Chalk blog posts
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
use std::marker::PhantomData; | |
trait Task { | |
type Output; | |
type Error; | |
fn execute(self) -> Result<Self::Output, Self::Error>; | |
fn and_then<F, B>(self, task: F) -> AndThenTask<Self, B, F> | |
where |
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
use std::marker::PhantomData; | |
trait Task { | |
type Output; | |
type Error; | |
fn execute(self) -> Result<Self::Output, Self::Error>; | |
fn and_then<F, B>(self, task: F) -> AndThenTask<Self, B, F> | |
where |
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
Crate { | |
module: Mod { | |
inner: Span { | |
lo: BytePos( | |
0 | |
), | |
hi: BytePos( | |
17 | |
), | |
ctxt: #0 |
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
// This program: | |
#![feature(conservative_impl_trait)] | |
use std::fmt::Debug; | |
#[derive(Debug)] | |
struct Foo<'a> { x: &'a i32 } | |
unsafe impl Send for Foo<'static> { } |
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
if [ -z "$1" ]; then | |
echo "Usage: runtest.sh <file.rs> <options>" | |
exit 1 | |
fi | |
rm -rf incr | |
mkdir incr | |
TEST=$1 | |
shift | |
REVISIONS=$(re "// ?revisions: ?(.*)" '$1' $TEST) |
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
# Sample TOML configuration file for building Rust. | |
# | |
# To configure rustbuild, copy this file to the directory from which you will be | |
# running the build, and name it config.toml. | |
# | |
# All options are commented out by default in this file, and they're commented | |
# out with their default values. The build system by default looks for | |
# `config.toml` in the current directory of a build for build configuration, but | |
# a custom configuration file can also be specified with `--config` to the build | |
# system. |
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
/// This "type relation" matches up the expected types that we get | |
/// from a function signature with the types that the user supplied. | |
/// Our goal is to re-use the **expected signature** ESig en masse, | |
/// with the caveat that if there are hitherto unresolved variables | |
/// appearing in ESig, that we may take values for those variables | |
/// from the **supplied signature** SSig. | |
/// | |
/// The expectation matcher is always applied to types, E and S, | |
/// where E is an input/output type from the expected signature, | |
/// and S is the corresponding type that the user supplied. Note that |
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
ProgramEnvironment { | |
trait_data: { | |
Foo: TraitDatum { | |
binders: for<type> TraitDatumBound { | |
trait_ref: ?0 as Foo, | |
where_clauses: [ | |
<?0 as Foo>::Assoc: Foo | |
], | |
auto: false | |
} |
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
// Some basic examples you can use with the repl. Try this | |
// (you type the parts that go after the `?-`): | |
// | |
// cargo run | |
// ?- load libstd.chalk | |
// ?- Vec<Box<i32>>: Clone | |
trait AsRef<T> { } | |
trait Clone { } | |
trait Copy where Self: Clone { } |