Skip to content

Commit

Permalink
Merge pull request #151 from nikomatsakis/publish-formality-core
Browse files Browse the repository at this point in the history
Publish formality core
  • Loading branch information
nikomatsakis authored Nov 2, 2023
2 parents 3691f7c + 0b3ef4b commit 320a42f
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 42 deletions.
52 changes: 26 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[package]
name = "formality"
name = "a-mir-formality"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "Model of the Rust type system maintained by the Rust types team (in development)"
homepage = "https://rust-lang.github.io/a-mir-formality/"
repository = "https://github.com/rust-lang/a-mir-formality/"
readme = "README.md"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
11 changes: 8 additions & 3 deletions crates/formality-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
[package]
name = "formality-core"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "Language-independent formality system used by a-mir-formality"
homepage = "https://rust-lang.github.io/a-mir-formality/"
repository = "https://github.com/rust-lang/a-mir-formality/"
readme = "README.md"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
lazy_static = "1.4.0"
env_logger = "*"
env_logger = "0.10.0"
stacker = "0.1.15"
tracing = "0.1"
tracing-subscriber = {version = "0.3", default-features = false, features = ["env-filter", "fmt"]}
tracing-tree = { version = "0.2" }
formality-macros = { path = "../formality-macros" }
formality-macros = { version = "0.1.0", path = "../formality-macros" }
anyhow = "1.0.75"
contracts = "0.6.3"

Expand Down
4 changes: 4 additions & 0 deletions crates/formality-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# formality-core

`formality_core` is the language independent part of a-mir-formality.
It can be reused by other projects looking to model formal semantics of languages besides Rust.
8 changes: 6 additions & 2 deletions crates/formality-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
name = "formality-macros"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "Macros used by a-mir-formality and formality-core"
homepage = "https://rust-lang.github.io/a-mir-formality/"
repository = "https://github.com/rust-lang/a-mir-formality/"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -11,8 +15,8 @@ proc-macro = true
[dependencies]
quote = "1.0.21"
proc-macro2 = "1.0"
syn = "1.0.102"
synstructure = "0.12.6"
syn = { version = "2.0", features = ["full"] }
synstructure = "0.13.0"
tracing = "0.1"
convert_case = "0.6.0"

Expand Down
5 changes: 5 additions & 0 deletions crates/formality-macros/READE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# formality-macros

Procedural macros used by the formality system.
Don't import this crate directly.
Check out formality-core instead.
2 changes: 1 addition & 1 deletion crates/formality-macros/src/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,5 @@ fn downcast_to_variant(s: &synstructure::Structure, v: &VariantInfo) -> TokenStr
}

pub(crate) fn has_cast_attr(attrs: &[Attribute]) -> bool {
attrs.iter().any(|a| a.path.is_ident("cast"))
attrs.iter().any(|a| a.path().is_ident("cast"))
}
2 changes: 1 addition & 1 deletion crates/formality-macros/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ fn debug_variant_with_attr(
}

fn get_grammar_attr(attrs: &[Attribute]) -> Option<syn::Result<FormalitySpec>> {
let attr = attrs.iter().find(|a| a.path.is_ident("grammar"))?;
let attr = attrs.iter().find(|a| a.path().is_ident("grammar"))?;
Some(attr.parse_args())
}

Expand Down
2 changes: 1 addition & 1 deletion crates/formality-macros/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ fn lookahead(for_field: &Ident, op: Option<&FormalitySpecOp>) -> syn::Result<Lit
}

fn get_grammar_attr(attrs: &[Attribute]) -> Option<syn::Result<FormalitySpec>> {
let attr = attrs.iter().find(|a| a.path.is_ident("grammar"))?;
let attr = attrs.iter().find(|a| a.path().is_ident("grammar"))?;
Some(attr.parse_args())
}

Expand Down
2 changes: 1 addition & 1 deletion crates/formality-macros/src/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn remove_formality_attributes(input: &mut DeriveInput) {
for variant in &mut v.variants {
variant
.attrs
.retain(|attr| !attr.path.is_ident("grammar") && !attr.path.is_ident("cast"));
.retain(|attr| !attr.path().is_ident("grammar") && !attr.path().is_ident("cast"));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fn main() -> anyhow::Result<()> {
formality_core::with_tracing_logs(formality::main)
formality_core::with_tracing_logs(a_mir_formality::main)
}
2 changes: 1 addition & 1 deletion tests/associated_type_normalization.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use formality::test_where_clause;
use a_mir_formality::test_where_clause;

const MIRROR: &str = "[
crate core {
Expand Down
2 changes: 1 addition & 1 deletion tests/coherence_overlap.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(non_snake_case)] // we embed type names into the names for our test functions

use formality::test_program_ok;
use a_mir_formality::test_program_ok;
use formality_macros::test;

#[test]
Expand Down
3 changes: 1 addition & 2 deletions tests/projection.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use formality::test_where_clause;
use a_mir_formality::test_where_clause;

const NORMALIZE_BASIC: &str = "[
crate test {
Expand Down Expand Up @@ -260,7 +260,6 @@ const PROJECTION_EQUALITY: &str = "[
}
]";


#[test]
fn projection_equality() {
expect_test::expect![[r#"
Expand Down
2 changes: 1 addition & 1 deletion tests/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() -> Result<()> {
let mut config = Config::rustc("tests/ui");
// Prevent ui_test from trying to query `formality` for the host platform name
config.host = Some("non of ya bizniz".into());
config.program.program = "target/debug/formality".into();
config.program.program = "target/debug/a-mir-formality".into();
config.mode = Mode::Fail {
require_patterns: false,
};
Expand Down

0 comments on commit 320a42f

Please sign in to comment.