Skip to content

Commit

Permalink
Update Chalk
Browse files Browse the repository at this point in the history
  • Loading branch information
jackh726 committed Feb 2, 2021
1 parent 4b64bc1 commit a0622d6
Show file tree
Hide file tree
Showing 18 changed files with 51 additions and 72 deletions.
20 changes: 12 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "chalk-derive"
version = "0.47.0-dev.0"
source = "git+https://github.com/jackh726/chalk.git?rev=972534b01b54f96ff37e5afa4ce18d8a7cdd932d#972534b01b54f96ff37e5afa4ce18d8a7cdd932d"
version = "0.55.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3983193cacd81f0f924acb666b7fe5e1a0d81db9f113fa69203eda7ea8ce8b6c"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -507,8 +508,9 @@ dependencies = [

[[package]]
name = "chalk-engine"
version = "0.47.0-dev.0"
source = "git+https://github.com/jackh726/chalk.git?rev=972534b01b54f96ff37e5afa4ce18d8a7cdd932d#972534b01b54f96ff37e5afa4ce18d8a7cdd932d"
version = "0.55.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05a171ce5abbf0fbd06f221ab80ab182c7ef78603d23b858bc44e7ce8a86a396"
dependencies = [
"chalk-derive",
"chalk-ir",
Expand All @@ -519,8 +521,9 @@ dependencies = [

[[package]]
name = "chalk-ir"
version = "0.47.0-dev.0"
source = "git+https://github.com/jackh726/chalk.git?rev=972534b01b54f96ff37e5afa4ce18d8a7cdd932d#972534b01b54f96ff37e5afa4ce18d8a7cdd932d"
version = "0.55.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a522f53af971e7678f472d687e053120157b3ae26e2ebd5ecbc0f5ab124f2cb6"
dependencies = [
"bitflags",
"chalk-derive",
Expand All @@ -529,8 +532,9 @@ dependencies = [

[[package]]
name = "chalk-solve"
version = "0.47.0-dev.0"
source = "git+https://github.com/jackh726/chalk.git?rev=972534b01b54f96ff37e5afa4ce18d8a7cdd932d#972534b01b54f96ff37e5afa4ce18d8a7cdd932d"
version = "0.55.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdf79fb77a567e456a170f7ec84ea6584163d4ba3f13660cd182013d34ca667c"
dependencies = [
"chalk-derive",
"chalk-ir",
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_middle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ rustc_index = { path = "../rustc_index" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" }
#chalk-ir = {"0.46.0"}
chalk-ir = { git = "https://github.com/jackh726/chalk.git", rev = "972534b01b54f96ff37e5afa4ce18d8a7cdd932d" }
chalk-ir = "0.55.0"
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
measureme = "9.0.0"
rustc_session = { path = "../rustc_session" }
Expand Down
25 changes: 21 additions & 4 deletions compiler/rustc_middle/src/traits/chalk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,34 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
write!(fmt, "{:?}", pci.consequence)?;

let conditions = pci.conditions.interned();
let constraints = pci.constraints.interned();

let conds = conditions.len();
if conds == 0 {
let consts = constraints.len();
if conds == 0 && consts == 0 {
return Ok(());
}

write!(fmt, " :- ")?;
for cond in &conditions[..conds - 1] {
write!(fmt, "{:?}, ", cond)?;

if conds != 0 {
for cond in &conditions[..conds - 1] {
write!(fmt, "{:?}, ", cond)?;
}
write!(fmt, "{:?}", conditions[conds - 1])?;
}

if conds != 0 && consts != 0 {
write!(fmt, " ; ")?;
}
write!(fmt, "{:?}", conditions[conds - 1])?;

if consts != 0 {
for constraint in &constraints[..consts - 1] {
write!(fmt, "{:?}, ", constraint)?;
}
write!(fmt, "{:?}", constraints[consts - 1])?;
}

Ok(())
};
Some(write())
Expand Down
9 changes: 3 additions & 6 deletions compiler/rustc_traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }
rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" }
#chalk-ir = "0.46.0"
chalk-ir = { git = "https://github.com/jackh726/chalk.git", rev = "972534b01b54f96ff37e5afa4ce18d8a7cdd932d" }
#chalk-solve = "0.46.0"
chalk-solve = { git = "https://github.com/jackh726/chalk.git", rev = "972534b01b54f96ff37e5afa4ce18d8a7cdd932d" }
#chalk-engine = "0.46.0"
chalk-engine = { git = "https://github.com/jackh726/chalk.git", rev = "972534b01b54f96ff37e5afa4ce18d8a7cdd932d" }
chalk-ir = "0.55.0"
chalk-solve = "0.55.0"
chalk-engine = "0.55.0"
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
rustc_infer = { path = "../rustc_infer" }
rustc_trait_selection = { path = "../rustc_trait_selection" }
4 changes: 2 additions & 2 deletions compiler/rustc_traits/src/chalk/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ impl<'tcx> chalk_ir::UnificationDatabase<RustInterner<'tcx>> for RustIrDatabase<
def_id: chalk_ir::FnDefId<RustInterner<'tcx>>,
) -> chalk_ir::Variances<RustInterner<'tcx>> {
let variances = self.interner.tcx.variances_of(def_id.0);
chalk_ir::Variances::from(
chalk_ir::Variances::from_iter(
&self.interner,
variances.iter().map(|v| match v {
ty::Variance::Invariant => chalk_ir::Variance::Invariant,
Expand All @@ -706,7 +706,7 @@ impl<'tcx> chalk_ir::UnificationDatabase<RustInterner<'tcx>> for RustIrDatabase<
def_id: chalk_ir::AdtId<RustInterner<'tcx>>,
) -> chalk_ir::Variances<RustInterner<'tcx>> {
let variances = self.interner.tcx.variances_of(def_id.0.did);
chalk_ir::Variances::from(
chalk_ir::Variances::from_iter(
&self.interner,
variances.iter().map(|v| match v {
ty::Variance::Invariant => chalk_ir::Variance::Invariant,
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_traits/src/chalk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ crate fn evaluate_goal<'tcx>(
use chalk_solve::Solver;
let mut solver = chalk_engine::solve::SLGSolver::new(32, None);
let db = ChalkRustIrDatabase { interner, reempty_placeholder };
//dbg!("evaluate_goal_pre", &obligation, &lowered_goal);
let solution = solver.solve(&db, &lowered_goal);
debug!(?obligation, ?solution, "evaluate goal");

Expand Down
2 changes: 1 addition & 1 deletion src/doc/book
Submodule book updated 59 files
+4 −4 .github/workflows/main.yml
+69 −54 ADMIN_TASKS.md
+0 −15 listings/ch03-common-programming-concepts/no-listing-15-invalid-array-access/output.txt
+19 −2 listings/ch03-common-programming-concepts/no-listing-15-invalid-array-access/src/main.rs
+1 −1 listings/ch06-enums-and-pattern-matching/no-listing-12-if-let/src/main.rs
+1 −1 listings/ch11-writing-automated-tests/listing-11-10/output.txt
+3 −3 listings/ch12-an-io-project/listing-12-03/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-04/output.txt
+3 −3 listings/ch12-an-io-project/listing-12-04/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-05/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-06/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-07/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-08/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-09/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-10/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-11/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-12/output.txt
+3 −3 listings/ch12-an-io-project/listing-12-12/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-13/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-14/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-15/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-16/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-17/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-18/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-19/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-20/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-21/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-22/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-23/poem.txt
+3 −3 listings/ch12-an-io-project/listing-12-24/poem.txt
+3 −3 listings/ch12-an-io-project/no-listing-01-handling-errors-in-main/poem.txt
+3 −3 listings/ch12-an-io-project/no-listing-02-using-search-in-run/poem.txt
+3 −3 listings/ch12-an-io-project/output-only-02-missing-lifetimes/poem.txt
+1 −1 listings/ch12-an-io-project/output-only-03-multiple-matches/output.txt
+3 −3 listings/ch12-an-io-project/output-only-03-multiple-matches/poem.txt
+3 −3 listings/ch12-an-io-project/output-only-04-no-matches/poem.txt
+2 −1 listings/ch17-oop/no-listing-01-trait-object-of-clone/output.txt
+1 −1 rust-toolchain
+20 −7 src/ch03-02-data-types.md
+3 −2 src/ch04-01-what-is-ownership.md
+2 −2 src/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.md
+4 −4 src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md
+5 −5 src/ch10-02-traits.md
+1 −1 src/ch11-02-running-tests.md
+1 −1 src/ch11-03-test-organization.md
+3 −3 src/ch13-01-closures.md
+2 −2 src/ch14-03-cargo-workspaces.md
+1 −1 src/ch15-05-interior-mutability.md
+1 −3 src/ch16-03-shared-state.md
+2 −2 src/ch17-01-what-is-oo.md
+4 −4 src/ch17-02-trait-objects.md
+5 −5 src/ch17-03-oo-design-patterns.md
+3 −3 src/ch19-03-advanced-traits.md
+1 −1 src/ch19-04-advanced-types.md
+1 −1 src/ch19-05-advanced-functions-and-closures.md
+2 −2 src/ch19-06-macros.md
+2 −2 src/ch20-02-multithreaded.md
+1 −1 src/title-page.md
+10 −7 tools/update-rustc.sh
2 changes: 1 addition & 1 deletion src/doc/embedded-book
Submodule embedded-book updated 1 files
+3 −0 book.toml
2 changes: 1 addition & 1 deletion src/llvm-project
Submodule llvm-project updated 190 files
37 changes: 0 additions & 37 deletions src/test/ui/associated-type-bounds/atb.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/tools/cargo
Submodule cargo updated 165 files
2 changes: 1 addition & 1 deletion src/tools/rust-installer
2 changes: 1 addition & 1 deletion src/tools/rustfmt
Submodule rustfmt updated 63 files
+5 −0 .github/workflows/upload-assets.yml
+12 −1 .github/workflows/windows.yml
+64 −1 CHANGELOG.md
+41 −41 Cargo.lock
+10 −10 Cargo.toml
+62 −4 Configurations.md
+1 −1 LICENSE-APACHE
+1 −1 LICENSE-MIT
+1 −0 rust-toolchain
+0 −1 src/closures.rs
+21 −2 src/config/config_type.rs
+70 −2 src/config/mod.rs
+31 −6 src/config/options.rs
+13 −3 src/expr.rs
+1 −1 src/formatting.rs
+123 −34 src/imports.rs
+19 −11 src/items.rs
+1 −0 src/lib.rs
+1 −1 src/macros.rs
+1 −5 src/modules.rs
+10 −5 src/reorder.rs
+10 −2 src/spanned.rs
+38 −0 src/test/mod.rs
+11 −7 src/types.rs
+8 −0 src/utils.rs
+44 −13 src/visitor.rs
+1 −1 tests/source/configs/group_imports/StdExternalCrate-merge_imports.rs
+1 −1 tests/source/configs/imports_layout/merge_mixed.rs
+12 −0 tests/source/const_generics.rs
+8 −0 tests/source/impls.rs
+4 −1 tests/source/imports_granularity_crate.rs
+6 −0 tests/source/imports_granularity_item.rs
+18 −0 tests/source/imports_granularity_module.rs
+1 −1 tests/source/issue-3750.rs
+20 −0 tests/source/issue-4646.rs
+2 −0 tests/source/issue-4656/format_me_please.rs
+7 −0 tests/source/issue-4656/lib.rs
+3 −0 tests/source/issue-4656/lib2.rs
+13 −0 tests/source/issue_3868.rs
+13 −0 tests/source/issue_4636.rs
+8 −0 tests/source/issue_4675.rs
+4 −0 tests/source/merge_imports_true_compat.rs
+43 −0 tests/source/statements.rs
+1 −1 tests/target/configs/group_imports/StdExternalCrate-merge_imports.rs
+1 −1 tests/target/configs/imports_layout/merge_mixed.rs
+13 −0 tests/target/const_generics.rs
+8 −0 tests/target/impls.rs
+3 −0 tests/target/imports_2021_edition.rs
+4 −1 tests/target/imports_granularity_crate.rs
+13 −0 tests/target/imports_granularity_item.rs
+20 −0 tests/target/imports_granularity_module.rs
+1 −1 tests/target/issue-3750.rs
+9 −0 tests/target/issue-4310.rs
+20 −0 tests/target/issue-4646.rs
+1 −0 tests/target/issue-4656/format_me_please.rs
+7 −0 tests/target/issue-4656/lib.rs
+3 −0 tests/target/issue-4656/lib2.rs
+9 −0 tests/target/issue_3868.rs
+13 −0 tests/target/issue_4636.rs
+8 −0 tests/target/issue_4675.rs
+1 −1 tests/target/macro_rules.rs
+3 −0 tests/target/merge_imports_true_compat.rs
+42 −0 tests/target/statements.rs
4 changes: 2 additions & 2 deletions src/tools/tidy/src/extdeps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const ALLOWED_SOURCES: &[&str] = &["\"registry+https://github.com/rust-lang/crat

/// Checks for external package sources. `root` is the path to the directory that contains the
/// workspace `Cargo.toml`.
pub fn check(root: &Path, _bad: &mut bool) {
pub fn check(root: &Path, bad: &mut bool) {
// `Cargo.lock` of rust.
let path = root.join("Cargo.lock");

Expand All @@ -27,7 +27,7 @@ pub fn check(root: &Path, _bad: &mut bool) {

// Ensure source is allowed.
if !ALLOWED_SOURCES.contains(&&*source) {
//tidy_error!(bad, "invalid source: {}", source);
tidy_error!(bad, "invalid source: {}", source);
}
}
}

0 comments on commit a0622d6

Please sign in to comment.