Unnamed repository; edit this file 'description' to name the repository.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Everforest (Light Medium)
# Authors: CptPotato, WindSoilder, basbebe

# Original Author:
# URL: https://github.com/sainnhe/everforest
# Filename: colors/everforest.vim
# Author: sainnhe
# Email: [email protected]
# License: MIT License

"type" = "yellow"
"constant" = "fg"
"constant.builtin" = { fg = "purple", modifiers = ["italic"] }
"constant.builtin.boolean" = "purple"
"constant.numeric" = "purple"
"constant.character.escape" = "green"
"string" = "aqua"
"string.regexp" = "green"
"string.special" = "yellow"
"comment" = { fg = "grey1", modifiers = ["italic"] }
"variable" = "fg"
"variable.builtin" = { fg = "purple", modifiers = ["italic"] }
"variable.parameter" = "fg"
"variable.other.member" = "blue"
"label" = "orange"
"punctuation" = "grey2"
"punctuation.delimiter" = "grey1"
"punctuation.bracket" = "fg"
"punctuation.special" = "blue"
"keyword" = "red"
"keyword.operator" = "orange"
"keyword.directive" = "purple"
"keyword.storage" = "red"
"operator" = "orange"
"function" = "green"
"function.macro" = "green"
"tag" = "orange"
"namespace" = { fg = "yellow", modifiers = ["italic"] }
"attribute" = { fg = "purple", modifiers = ["italic"] }
"constructor" = "green"
"module" = "yellow"
"special" = "blue"

"markup.heading.marker" = "grey1"
"markup.heading.1" = { fg = "red", modifiers = ["bold"] }
"markup.heading.2" = { fg = "orange", modifiers = ["bold"] }
"markup.heading.3" = { fg = "yellow", modifiers = ["bold"] }
"markup.heading.4" = { fg = "green", modifiers = ["bold"] }
"markup.heading.5" = { fg = "blue", modifiers = ["bold"] }
"markup.heading.6" = { fg = "purple", modifiers = ["bold"] }
"markup.list" = "red"
"markup.bold" = { modifiers = ["bold"] }
"markup.italic" = { modifiers = ["italic"] }
"markup.strikethrough" = { modifiers = ["crossed_out"] }
"markup.link.url" = { fg = "blue", underline = { style = "line" } }
"markup.link.label" = "orange"
"markup.link.text" = "purple"
"markup.quote" = "grey1"
"markup.raw.inline" = "green"
"markup.raw.block" = "aqua"

"diff.plus" = "green"
"diff.delta" = "blue"
"diff.minus" = "red"

"ui.background" = { bg = "bg0" }
"ui.background.separator" = "bg_visual"
"ui.cursor" = { fg = "bg1", bg = "grey2" }
"ui.cursor.insert" = { fg = "bg0", bg = "grey1" }
"ui.cursor.select" = { fg = "bg0", bg = "blue" }
"ui.cursor.match" = { bg = "bg4", modifiers = ["bold"] }
"ui.cursor.primary" = { fg = "bg0", bg = "fg" }
"ui.cursorline.primary" = { bg = "bg1" }
"ui.cursorline.secondary" = { bg = "bg2" }
"ui.selection" = { bg = "bg3" }
"ui.linenr" = "grey0"
"ui.linenr.selected" = "grey2"
"ui.statusline" = { fg = "grey2", bg = "bg3" }
"ui.statusline.inactive" = { fg = "grey0", bg = "bg1" }
"ui.statusline.normal" = { fg = "bg0", bg = "statusline1", modifiers = [
  "bold",
] }
"ui.statusline.insert" = { fg = "bg0", bg = "statusline2", modifiers = [
  "bold",
] }
"ui.statusline.select" = { fg = "bg0", bg = "blue", modifiers = ["bold"] }
"ui.bufferline" = { fg = "grey2", bg = "bg3" }
"ui.bufferline.active" = { fg = "bg0", bg = "statusline1", modifiers = [
  "bold",
] }
"ui.popup" = { fg = "grey2", bg = "bg2" }
"ui.window" = { fg = "bg4", bg = "bg_dim" }
"ui.help" = { fg = "fg", bg = "bg2" }
"ui.text" = "fg"
"ui.text.focus" = "fg"
"ui.menu" = { fg = "fg", bg = "bg3" }
"ui.menu.selected" = { fg = "bg0", bg = "green" }
"ui.virtual.ruler" = { bg = "bg3" }
"ui.virtual.whitespace" = { fg = "bg4" }
"ui.virtual.indent-guide" = { fg = "bg4" }
"ui.virtual.inlay-hint" = { fg = "grey0" }
"ui.virtual.wrap" = { fg = "grey0" }

"hint" = "green"
"info" = "blue"
"warning" = "yellow"
"error" = "red"

"diagnostic.hint" = { underline = { color = "green", style = "curl" } }
"diagnostic.info" = { underline = { color = "blue", style = "curl" } }
"diagnostic.warning" = { underline = { color = "yellow", style = "curl" } }
"diagnostic.error" = { underline = { color = "red", style = "curl" } }

[palette]

bg_dim = "#efebd4"
bg0 = "#fdf6e3"
bg1 = "#f4f0d9"
bg2 = "#efebd4"
bg3 = "#e6e2cc"
bg4 = "#e0dcc7"
bg5 = "#bdc3af"
bg_red = "#fbe3da"
bg_visual = "#eaedc8"
bg_yellow = "#faedcd"
bg_green = "#f0f1d2"
bg_blue = "#e9f0e9"

fg = "#5c6a72"
red = "#f85552"
orange = "#f57d26"
yellow = "#dfa000"
green = "#8da101"
blue = "#3a94c5"
aqua = "#35a77c"
purple = "#df69ba"

grey0 = "#a6b0a0"
grey1 = "#939f91"
grey2 = "#829181"
statusline1 = "#93b259"
statusline2 = "#708089"
statusline3 = "#e66868"
/ we should get rid of it when talking to chalk. let goal = goal .try_fold_with(&mut UnevaluatedConstEvaluatorFolder { db }, DebruijnIndex::INNERMOST) .unwrap(); // We currently don't deal with universes (I think / hope they're not yet // relevant for our use cases?) let u_canonical = chalk_ir::UCanonical { canonical: goal, universes: 1 }; solve(db, krate, block, &u_canonical) } fn solve( db: &dyn HirDatabase, krate: CrateId, block: Option<BlockId>, goal: &chalk_ir::UCanonical<chalk_ir::InEnvironment<chalk_ir::Goal<Interner>>>, ) -> Option<chalk_solve::Solution<Interner>> { let context = ChalkContext { db, krate, block }; tracing::debug!("solve goal: {:?}", goal); let mut solver = create_chalk_solver(); let fuel = std::cell::Cell::new(CHALK_SOLVER_FUEL); let should_continue = || { db.unwind_if_cancelled(); let remaining = fuel.get(); fuel.set(remaining - 1); if remaining == 0 { tracing::debug!("fuel exhausted"); } remaining > 0 }; let mut solve = || { let _ctx = if is_chalk_debug() || is_chalk_print() { Some(panic_context::enter(format!("solving {goal:?}"))) } else { None }; let solution = if is_chalk_print() { let logging_db = LoggingRustIrDatabaseLoggingOnDrop(LoggingRustIrDatabase::new(context)); solver.solve_limited(&logging_db.0, goal, &should_continue) } else { solver.solve_limited(&context, goal, &should_continue) }; tracing::debug!("solve({:?}) => {:?}", goal, solution); solution }; // don't set the TLS for Chalk unless Chalk debugging is active, to make // extra sure we only use it for debugging if is_chalk_debug() { crate::tls::set_current_program(db, solve) } else { solve() } } struct LoggingRustIrDatabaseLoggingOnDrop<'a>(LoggingRustIrDatabase<Interner, ChalkContext<'a>>); impl Drop for LoggingRustIrDatabaseLoggingOnDrop<'_> { fn drop(&mut self) { eprintln!("chalk program:\n{}", self.0); } } fn is_chalk_debug() -> bool { std::env::var("CHALK_DEBUG").is_ok() } fn is_chalk_print() -> bool { std::env::var("CHALK_PRINT").is_ok() } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] pub enum FnTrait { // Warning: Order is important. If something implements `x` it should also implement // `y` if `y <= x`. FnOnce, FnMut, Fn, } impl FnTrait { const fn lang_item(self) -> LangItem { match self { FnTrait::FnOnce => LangItem::FnOnce, FnTrait::FnMut => LangItem::FnMut, FnTrait::Fn => LangItem::Fn, } } pub const fn to_chalk_ir(self) -> rust_ir::ClosureKind { match self { FnTrait::FnOnce => rust_ir::ClosureKind::FnOnce, FnTrait::FnMut => rust_ir::ClosureKind::FnMut, FnTrait::Fn => rust_ir::ClosureKind::Fn, } } pub fn method_name(self) -> Name { match self { FnTrait::FnOnce => name!(call_once), FnTrait::FnMut => name!(call_mut), FnTrait::Fn => name!(call), } } pub fn get_id(self, db: &dyn HirDatabase, krate: CrateId) -> Option<TraitId> { let target = db.lang_item(krate, self.lang_item())?; match target { LangItemTarget::Trait(t) => Some(t), _ => None, } } }