aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/hir/src/semantics.rs17
-rw-r--r--crates/hir_def/src/item_tree/pretty.rs4
-rw-r--r--crates/hir_def/src/nameres/collector.rs2
-rw-r--r--crates/hir_def/src/resolver.rs3
-rw-r--r--crates/hir_def/src/visibility.rs5
-rw-r--r--crates/hir_expand/src/hygiene.rs9
-rw-r--r--crates/hir_expand/src/lib.rs9
-rw-r--r--crates/hir_ty/src/consteval.rs3
-rw-r--r--crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs9
-rw-r--r--crates/hir_ty/src/infer/coerce.rs8
-rw-r--r--crates/hir_ty/src/infer/expr.rs16
-rw-r--r--crates/hir_ty/src/infer/pat.rs9
-rw-r--r--crates/hir_ty/src/op.rs38
-rw-r--r--crates/ide/src/hover.rs29
-rw-r--r--crates/ide/src/join_lines.rs2
-rw-r--r--crates/ide/src/references.rs3
-rw-r--r--crates/ide/src/syntax_highlighting.rs4
-rw-r--r--crates/ide_assists/src/handlers/apply_demorgan.rs114
-rw-r--r--crates/ide_assists/src/handlers/convert_into_to_from.rs44
-rw-r--r--crates/ide_assists/src/handlers/extract_function.rs2
-rw-r--r--crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs27
-rw-r--r--crates/ide_assists/src/handlers/generate_default_from_enum_variant.rs41
-rw-r--r--crates/ide_assists/src/handlers/generate_default_from_new.rs83
-rw-r--r--crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs105
-rw-r--r--crates/ide_assists/src/handlers/inline_local_variable.rs55
-rw-r--r--crates/ide_assists/src/tests.rs8
-rw-r--r--crates/ide_completion/src/completions/attribute.rs2
-rw-r--r--crates/ide_completion/src/completions/attribute/repr.rs199
-rw-r--r--crates/ide_completion/src/completions/qualified_path.rs18
-rw-r--r--crates/ide_completion/src/completions/record.rs28
-rw-r--r--crates/ide_completion/src/completions/unqualified_path.rs8
-rw-r--r--crates/ide_completion/src/context.rs31
-rw-r--r--crates/ide_completion/src/render/builder_ext.rs2
-rw-r--r--crates/ide_db/src/helpers.rs11
-rw-r--r--crates/ide_db/src/helpers/famous_defs_fixture.rs59
-rw-r--r--crates/mbe/src/expander/matcher.rs22
-rw-r--r--crates/parser/src/grammar/params.rs3
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt2
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt2
-rw-r--r--crates/syntax/test_data/lexer/err/0001_unclosed_char_at_eof.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0005_unclosed_char_with_space.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0006_unclosed_char_with_slash.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0013_unclosed_byte_with_space.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.txt4
-rw-r--r--crates/syntax/test_data/lexer/err/0057_lifetime_starts_with_a_number.txt8
-rw-r--r--crates/syntax/test_data/lexer/ok/0006_chars.txt16
-rw-r--r--crates/syntax/test_data/lexer/ok/0007_lifetimes.txt8
-rw-r--r--crates/syntax/test_data/lexer/ok/0008_byte_strings.txt14
-rw-r--r--crates/syntax/test_data/parser/err/0024_many_type_parens.rast16
-rw-r--r--crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast2
-rw-r--r--crates/syntax/test_data/parser/err/0043_weird_blocks.rast2
-rw-r--r--crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast30
-rw-r--r--crates/syntax/test_data/parser/err/0046_ambiguous_trait_object.rast6
-rw-r--r--crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rast4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0006_self_param.rast4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rast2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rast2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0034_break_expr.rast4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0055_literal_pattern.rast2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0056_where_clause.rast12
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0081_for_type.rast10
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rast4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0109_label.rast6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0154_no_dyn_trait_leading_for.rast4
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rast2
-rw-r--r--crates/syntax/test_data/parser/ok/0018_struct_type_params.rast34
-rw-r--r--crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast28
-rw-r--r--crates/syntax/test_data/parser/ok/0030_string_suffixes.rast4
-rw-r--r--crates/syntax/test_data/parser/ok/0032_where_for.rast4
-rw-r--r--crates/syntax/test_data/parser/ok/0033_label_break.rast14
-rw-r--r--crates/syntax/test_data/parser/ok/0035_weird_exprs.rast18
-rw-r--r--crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast12
-rw-r--r--crates/syntax/test_data/parser/ok/0067_where_for_pred.rast30
-rw-r--r--crates/syntax/test_data/parser/ok/0069_multi_trait_object.rast6
-rw-r--r--crates/test_utils/src/minicore.rs98
-rw-r--r--crates/vfs/src/vfs_path.rs2
95 files changed, 920 insertions, 612 deletions
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 613266e07..43162797e 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -51,12 +51,14 @@ impl PathResolution {
51 PathResolution::Def(ModuleDef::BuiltinType(builtin)) => { 51 PathResolution::Def(ModuleDef::BuiltinType(builtin)) => {
52 Some(TypeNs::BuiltinType((*builtin).into())) 52 Some(TypeNs::BuiltinType((*builtin).into()))
53 } 53 }
54 PathResolution::Def(ModuleDef::Const(_)) 54 PathResolution::Def(
55 | PathResolution::Def(ModuleDef::Variant(_)) 55 ModuleDef::Const(_)
56 | PathResolution::Def(ModuleDef::Function(_)) 56 | ModuleDef::Variant(_)
57 | PathResolution::Def(ModuleDef::Module(_)) 57 | ModuleDef::Function(_)
58 | PathResolution::Def(ModuleDef::Static(_)) 58 | ModuleDef::Module(_)
59 | PathResolution::Def(ModuleDef::Trait(_)) => None, 59 | ModuleDef::Static(_)
60 | ModuleDef::Trait(_),
61 ) => None,
60 PathResolution::Def(ModuleDef::TypeAlias(alias)) => { 62 PathResolution::Def(ModuleDef::TypeAlias(alias)) => {
61 Some(TypeNs::TypeAliasId((*alias).into())) 63 Some(TypeNs::TypeAliasId((*alias).into()))
62 } 64 }
@@ -65,8 +67,7 @@ impl PathResolution {
65 } 67 }
66 PathResolution::TypeParam(param) => Some(TypeNs::GenericParam((*param).into())), 68 PathResolution::TypeParam(param) => Some(TypeNs::GenericParam((*param).into())),
67 PathResolution::SelfType(impl_def) => Some(TypeNs::SelfType((*impl_def).into())), 69 PathResolution::SelfType(impl_def) => Some(TypeNs::SelfType((*impl_def).into())),
68 PathResolution::AssocItem(AssocItem::Const(_)) 70 PathResolution::AssocItem(AssocItem::Const(_) | AssocItem::Function(_)) => None,
69 | PathResolution::AssocItem(AssocItem::Function(_)) => None,
70 PathResolution::AssocItem(AssocItem::TypeAlias(alias)) => { 71 PathResolution::AssocItem(AssocItem::TypeAlias(alias)) => {
71 Some(TypeNs::TypeAliasId((*alias).into())) 72 Some(TypeNs::TypeAliasId((*alias).into()))
72 } 73 }
diff --git a/crates/hir_def/src/item_tree/pretty.rs b/crates/hir_def/src/item_tree/pretty.rs
index b1e1b70d0..e63bc8232 100644
--- a/crates/hir_def/src/item_tree/pretty.rs
+++ b/crates/hir_def/src/item_tree/pretty.rs
@@ -63,7 +63,7 @@ impl<'a> Printer<'a> {
63 fn blank(&mut self) { 63 fn blank(&mut self) {
64 let mut iter = self.buf.chars().rev().fuse(); 64 let mut iter = self.buf.chars().rev().fuse();
65 match (iter.next(), iter.next()) { 65 match (iter.next(), iter.next()) {
66 (Some('\n'), Some('\n')) | (Some('\n'), None) | (None, None) => {} 66 (Some('\n'), Some('\n') | None) | (None, None) => {}
67 (Some('\n'), Some(_)) => { 67 (Some('\n'), Some(_)) => {
68 self.buf.push('\n'); 68 self.buf.push('\n');
69 } 69 }
@@ -77,7 +77,7 @@ impl<'a> Printer<'a> {
77 77
78 fn whitespace(&mut self) { 78 fn whitespace(&mut self) {
79 match self.buf.chars().next_back() { 79 match self.buf.chars().next_back() {
80 None | Some('\n') | Some(' ') => {} 80 None | Some('\n' | ' ') => {}
81 _ => self.buf.push(' '), 81 _ => self.buf.push(' '),
82 } 82 }
83 } 83 }
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index fc2c50fb8..927a7b6e8 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -1260,7 +1260,7 @@ impl DefCollector<'_> {
1260 for directive in &self.unresolved_imports { 1260 for directive in &self.unresolved_imports {
1261 if let ImportSource::Import { id: import, use_tree } = &directive.import.source { 1261 if let ImportSource::Import { id: import, use_tree } = &directive.import.source {
1262 match (directive.import.path.segments().first(), &directive.import.path.kind) { 1262 match (directive.import.path.segments().first(), &directive.import.path.kind) {
1263 (Some(krate), PathKind::Plain) | (Some(krate), PathKind::Abs) => { 1263 (Some(krate), PathKind::Plain | PathKind::Abs) => {
1264 if diagnosed_extern_crates.contains(krate) { 1264 if diagnosed_extern_crates.contains(krate) {
1265 continue; 1265 continue;
1266 } 1266 }
diff --git a/crates/hir_def/src/resolver.rs b/crates/hir_def/src/resolver.rs
index d4681fa3e..47e56259f 100644
--- a/crates/hir_def/src/resolver.rs
+++ b/crates/hir_def/src/resolver.rs
@@ -605,8 +605,7 @@ fn to_value_ns(per_ns: PerNs) -> Option<ValueNs> {
605 ModuleDefId::ConstId(it) => ValueNs::ConstId(it), 605 ModuleDefId::ConstId(it) => ValueNs::ConstId(it),
606 ModuleDefId::StaticId(it) => ValueNs::StaticId(it), 606 ModuleDefId::StaticId(it) => ValueNs::StaticId(it),
607 607
608 ModuleDefId::AdtId(AdtId::EnumId(_)) 608 ModuleDefId::AdtId(AdtId::EnumId(_) | AdtId::UnionId(_))
609 | ModuleDefId::AdtId(AdtId::UnionId(_))
610 | ModuleDefId::TraitId(_) 609 | ModuleDefId::TraitId(_)
611 | ModuleDefId::TypeAliasId(_) 610 | ModuleDefId::TypeAliasId(_)
612 | ModuleDefId::BuiltinType(_) 611 | ModuleDefId::BuiltinType(_)
diff --git a/crates/hir_def/src/visibility.rs b/crates/hir_def/src/visibility.rs
index 83500f54e..aeb1e7726 100644
--- a/crates/hir_def/src/visibility.rs
+++ b/crates/hir_def/src/visibility.rs
@@ -172,9 +172,8 @@ impl Visibility {
172 /// visible in unrelated modules). 172 /// visible in unrelated modules).
173 pub(crate) fn max(self, other: Visibility, def_map: &DefMap) -> Option<Visibility> { 173 pub(crate) fn max(self, other: Visibility, def_map: &DefMap) -> Option<Visibility> {
174 match (self, other) { 174 match (self, other) {
175 (Visibility::Module(_), Visibility::Public) 175 (Visibility::Module(_) | Visibility::Public, Visibility::Public)
176 | (Visibility::Public, Visibility::Module(_)) 176 | (Visibility::Public, Visibility::Module(_)) => Some(Visibility::Public),
177 | (Visibility::Public, Visibility::Public) => Some(Visibility::Public),
178 (Visibility::Module(mod_a), Visibility::Module(mod_b)) => { 177 (Visibility::Module(mod_a), Visibility::Module(mod_b)) => {
179 if mod_a.krate != mod_b.krate { 178 if mod_a.krate != mod_b.krate {
180 return None; 179 return None;
diff --git a/crates/hir_expand/src/hygiene.rs b/crates/hir_expand/src/hygiene.rs
index 05c6c3fb1..848522411 100644
--- a/crates/hir_expand/src/hygiene.rs
+++ b/crates/hir_expand/src/hygiene.rs
@@ -146,10 +146,11 @@ impl HygieneInfo {
146 (&self.macro_arg.1, InFile::new(loc.kind.file_id(), arg_start)) 146 (&self.macro_arg.1, InFile::new(loc.kind.file_id(), arg_start))
147 } 147 }
148 mbe::Origin::Def => match (&*self.macro_def, self.def_start) { 148 mbe::Origin::Def => match (&*self.macro_def, self.def_start) {
149 (TokenExpander::MacroDef { def_site_token_map, .. }, Some(tt)) 149 (
150 | (TokenExpander::MacroRules { def_site_token_map, .. }, Some(tt)) => { 150 TokenExpander::MacroDef { def_site_token_map, .. }
151 (def_site_token_map, tt) 151 | TokenExpander::MacroRules { def_site_token_map, .. },
152 } 152 Some(tt),
153 ) => (def_site_token_map, tt),
153 _ => panic!("`Origin::Def` used with non-`macro_rules!` macro"), 154 _ => panic!("`Origin::Def` used with non-`macro_rules!` macro"),
154 }, 155 },
155 }; 156 };
diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs
index 33107aa24..c31426d7c 100644
--- a/crates/hir_expand/src/lib.rs
+++ b/crates/hir_expand/src/lib.rs
@@ -368,10 +368,11 @@ impl ExpansionInfo {
368 let (token_map, tt) = match origin { 368 let (token_map, tt) = match origin {
369 mbe::Origin::Call => (&self.macro_arg.1, self.arg.clone()), 369 mbe::Origin::Call => (&self.macro_arg.1, self.arg.clone()),
370 mbe::Origin::Def => match (&*self.macro_def, self.def.as_ref()) { 370 mbe::Origin::Def => match (&*self.macro_def, self.def.as_ref()) {
371 (db::TokenExpander::MacroRules { def_site_token_map, .. }, Some(tt)) 371 (
372 | (db::TokenExpander::MacroDef { def_site_token_map, .. }, Some(tt)) => { 372 db::TokenExpander::MacroRules { def_site_token_map, .. }
373 (def_site_token_map, tt.as_ref().map(|tt| tt.syntax().clone())) 373 | db::TokenExpander::MacroDef { def_site_token_map, .. },
374 } 374 Some(tt),
375 ) => (def_site_token_map, tt.as_ref().map(|tt| tt.syntax().clone())),
375 _ => panic!("`Origin::Def` used with non-`macro_rules!` macro"), 376 _ => panic!("`Origin::Def` used with non-`macro_rules!` macro"),
376 }, 377 },
377 }; 378 };
diff --git a/crates/hir_ty/src/consteval.rs b/crates/hir_ty/src/consteval.rs
index 6f0bf8f8c..ab1afce08 100644
--- a/crates/hir_ty/src/consteval.rs
+++ b/crates/hir_ty/src/consteval.rs
@@ -38,8 +38,7 @@ impl ConstExt for Const {
38// FIXME: support more than just evaluating literals 38// FIXME: support more than just evaluating literals
39pub fn eval_usize(expr: &Expr) -> Option<u64> { 39pub fn eval_usize(expr: &Expr) -> Option<u64> {
40 match expr { 40 match expr {
41 Expr::Literal(Literal::Uint(v, None)) 41 Expr::Literal(Literal::Uint(v, None | Some(BuiltinUint::Usize))) => (*v).try_into().ok(),
42 | Expr::Literal(Literal::Uint(v, Some(BuiltinUint::Usize))) => (*v).try_into().ok(),
43 _ => None, 42 _ => None,
44 } 43 }
45} 44}
diff --git a/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs b/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs
index 471cd4921..e3d640a79 100644
--- a/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs
+++ b/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs
@@ -84,10 +84,7 @@ impl IntRange {
84 #[inline] 84 #[inline]
85 fn is_integral(ty: &Ty) -> bool { 85 fn is_integral(ty: &Ty) -> bool {
86 match ty.kind(&Interner) { 86 match ty.kind(&Interner) {
87 TyKind::Scalar(Scalar::Char) 87 TyKind::Scalar(Scalar::Char | Scalar::Int(_) | Scalar::Uint(_) | Scalar::Bool) => true,
88 | TyKind::Scalar(Scalar::Int(_))
89 | TyKind::Scalar(Scalar::Uint(_))
90 | TyKind::Scalar(Scalar::Bool) => true,
91 _ => false, 88 _ => false,
92 } 89 }
93 } 90 }
@@ -381,7 +378,7 @@ impl Constructor {
381 // Wildcards cover anything 378 // Wildcards cover anything
382 (_, Wildcard) => true, 379 (_, Wildcard) => true,
383 // The missing ctors are not covered by anything in the matrix except wildcards. 380 // The missing ctors are not covered by anything in the matrix except wildcards.
384 (Missing, _) | (Wildcard, _) => false, 381 (Missing | Wildcard, _) => false,
385 382
386 (Single, Single) => true, 383 (Single, Single) => true,
387 (Variant(self_id), Variant(other_id)) => self_id == other_id, 384 (Variant(self_id), Variant(other_id)) => self_id == other_id,
@@ -523,7 +520,7 @@ impl SplitWildcard {
523 } 520 }
524 } 521 }
525 TyKind::Scalar(Scalar::Char) => unhandled(), 522 TyKind::Scalar(Scalar::Char) => unhandled(),
526 TyKind::Scalar(Scalar::Int(..)) | TyKind::Scalar(Scalar::Uint(..)) => unhandled(), 523 TyKind::Scalar(Scalar::Int(..) | Scalar::Uint(..)) => unhandled(),
527 TyKind::Never if !cx.feature_exhaustive_patterns() && !pcx.is_top_level => { 524 TyKind::Never if !cx.feature_exhaustive_patterns() && !pcx.is_top_level => {
528 smallvec![NonExhaustive] 525 smallvec![NonExhaustive]
529 } 526 }
diff --git a/crates/hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs
index 4b7f31521..7be914451 100644
--- a/crates/hir_ty/src/infer/coerce.rs
+++ b/crates/hir_ty/src/infer/coerce.rs
@@ -47,10 +47,7 @@ impl<'a> InferenceContext<'a> {
47 // pointers to have a chance at getting a match. See 47 // pointers to have a chance at getting a match. See
48 // https://github.com/rust-lang/rust/blob/7b805396bf46dce972692a6846ce2ad8481c5f85/src/librustc_typeck/check/coercion.rs#L877-L916 48 // https://github.com/rust-lang/rust/blob/7b805396bf46dce972692a6846ce2ad8481c5f85/src/librustc_typeck/check/coercion.rs#L877-L916
49 let sig = match (ty1.kind(&Interner), ty2.kind(&Interner)) { 49 let sig = match (ty1.kind(&Interner), ty2.kind(&Interner)) {
50 (TyKind::FnDef(..), TyKind::FnDef(..)) 50 (TyKind::FnDef(..) | TyKind::Closure(..), TyKind::FnDef(..) | TyKind::Closure(..)) => {
51 | (TyKind::Closure(..), TyKind::FnDef(..))
52 | (TyKind::FnDef(..), TyKind::Closure(..))
53 | (TyKind::Closure(..), TyKind::Closure(..)) => {
54 // FIXME: we're ignoring safety here. To be more correct, if we have one FnDef and one Closure, 51 // FIXME: we're ignoring safety here. To be more correct, if we have one FnDef and one Closure,
55 // we should be coercing the closure to a fn pointer of the safety of the FnDef 52 // we should be coercing the closure to a fn pointer of the safety of the FnDef
56 cov_mark::hit!(coerce_fn_reification); 53 cov_mark::hit!(coerce_fn_reification);
@@ -448,8 +445,7 @@ fn safe_to_unsafe_fn_ty(fn_ty: FnPointer) -> FnPointer {
448 445
449fn coerce_mutabilities(from: Mutability, to: Mutability) -> Result<(), TypeError> { 446fn coerce_mutabilities(from: Mutability, to: Mutability) -> Result<(), TypeError> {
450 match (from, to) { 447 match (from, to) {
451 (Mutability::Mut, Mutability::Mut) 448 (Mutability::Mut, Mutability::Mut | Mutability::Not)
452 | (Mutability::Mut, Mutability::Not)
453 | (Mutability::Not, Mutability::Not) => Ok(()), 449 | (Mutability::Not, Mutability::Not) => Ok(()),
454 (Mutability::Not, Mutability::Mut) => Err(TypeError), 450 (Mutability::Not, Mutability::Mut) => Err(TypeError),
455 } 451 }
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index 5ea2e5934..4e4f6e5a4 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -593,11 +593,11 @@ impl<'a> InferenceContext<'a> {
593 UnaryOp::Neg => { 593 UnaryOp::Neg => {
594 match inner_ty.kind(&Interner) { 594 match inner_ty.kind(&Interner) {
595 // Fast path for builtins 595 // Fast path for builtins
596 TyKind::Scalar(Scalar::Int(_)) 596 TyKind::Scalar(Scalar::Int(_) | Scalar::Uint(_) | Scalar::Float(_))
597 | TyKind::Scalar(Scalar::Uint(_)) 597 | TyKind::InferenceVar(
598 | TyKind::Scalar(Scalar::Float(_)) 598 _,
599 | TyKind::InferenceVar(_, TyVariableKind::Integer) 599 TyVariableKind::Integer | TyVariableKind::Float,
600 | TyKind::InferenceVar(_, TyVariableKind::Float) => inner_ty, 600 ) => inner_ty,
601 // Otherwise we resolve via the std::ops::Neg trait 601 // Otherwise we resolve via the std::ops::Neg trait
602 _ => self 602 _ => self
603 .resolve_associated_type(inner_ty, self.resolve_ops_neg_output()), 603 .resolve_associated_type(inner_ty, self.resolve_ops_neg_output()),
@@ -606,9 +606,7 @@ impl<'a> InferenceContext<'a> {
606 UnaryOp::Not => { 606 UnaryOp::Not => {
607 match inner_ty.kind(&Interner) { 607 match inner_ty.kind(&Interner) {
608 // Fast path for builtins 608 // Fast path for builtins
609 TyKind::Scalar(Scalar::Bool) 609 TyKind::Scalar(Scalar::Bool | Scalar::Int(_) | Scalar::Uint(_))
610 | TyKind::Scalar(Scalar::Int(_))
611 | TyKind::Scalar(Scalar::Uint(_))
612 | TyKind::InferenceVar(_, TyVariableKind::Integer) => inner_ty, 610 | TyKind::InferenceVar(_, TyVariableKind::Integer) => inner_ty,
613 // Otherwise we resolve via the std::ops::Not trait 611 // Otherwise we resolve via the std::ops::Not trait
614 _ => self 612 _ => self
@@ -735,7 +733,7 @@ impl<'a> InferenceContext<'a> {
735 Expr::Array(array) => { 733 Expr::Array(array) => {
736 let elem_ty = 734 let elem_ty =
737 match expected.to_option(&mut self.table).as_ref().map(|t| t.kind(&Interner)) { 735 match expected.to_option(&mut self.table).as_ref().map(|t| t.kind(&Interner)) {
738 Some(TyKind::Array(st, _)) | Some(TyKind::Slice(st)) => st.clone(), 736 Some(TyKind::Array(st, _) | TyKind::Slice(st)) => st.clone(),
739 _ => self.table.new_type_var(), 737 _ => self.table.new_type_var(),
740 }; 738 };
741 739
diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs
index 035f4ded6..58cb23e9d 100644
--- a/crates/hir_ty/src/infer/pat.rs
+++ b/crates/hir_ty/src/infer/pat.rs
@@ -297,10 +297,11 @@ fn is_non_ref_pat(body: &hir_def::body::Body, pat: PatId) -> bool {
297 Expr::Literal(Literal::String(..)) => false, 297 Expr::Literal(Literal::String(..)) => false,
298 _ => true, 298 _ => true,
299 }, 299 },
300 Pat::Bind { mode: BindingAnnotation::Mutable, subpat: Some(subpat), .. } 300 Pat::Bind {
301 | Pat::Bind { mode: BindingAnnotation::Unannotated, subpat: Some(subpat), .. } => { 301 mode: BindingAnnotation::Mutable | BindingAnnotation::Unannotated,
302 is_non_ref_pat(body, *subpat) 302 subpat: Some(subpat),
303 } 303 ..
304 } => is_non_ref_pat(body, *subpat),
304 Pat::Wild | Pat::Bind { .. } | Pat::Ref { .. } | Pat::Box { .. } | Pat::Missing => false, 305 Pat::Wild | Pat::Bind { .. } | Pat::Ref { .. } | Pat::Box { .. } | Pat::Missing => false,
305 } 306 }
306} 307}
diff --git a/crates/hir_ty/src/op.rs b/crates/hir_ty/src/op.rs
index 0222de2bc..5ef6342d5 100644
--- a/crates/hir_ty/src/op.rs
+++ b/crates/hir_ty/src/op.rs
@@ -8,17 +8,15 @@ pub(super) fn binary_op_return_ty(op: BinaryOp, lhs_ty: Ty, rhs_ty: Ty) -> Ty {
8 match op { 8 match op {
9 BinaryOp::LogicOp(_) | BinaryOp::CmpOp(_) => TyKind::Scalar(Scalar::Bool).intern(&Interner), 9 BinaryOp::LogicOp(_) | BinaryOp::CmpOp(_) => TyKind::Scalar(Scalar::Bool).intern(&Interner),
10 BinaryOp::Assignment { .. } => TyBuilder::unit(), 10 BinaryOp::Assignment { .. } => TyBuilder::unit(),
11 BinaryOp::ArithOp(ArithOp::Shl) | BinaryOp::ArithOp(ArithOp::Shr) => { 11 BinaryOp::ArithOp(ArithOp::Shl | ArithOp::Shr) => {
12 // all integer combinations are valid here 12 // all integer combinations are valid here
13 if matches!( 13 if matches!(
14 lhs_ty.kind(&Interner), 14 lhs_ty.kind(&Interner),
15 TyKind::Scalar(Scalar::Int(_)) 15 TyKind::Scalar(Scalar::Int(_) | Scalar::Uint(_))
16 | TyKind::Scalar(Scalar::Uint(_))
17 | TyKind::InferenceVar(_, TyVariableKind::Integer) 16 | TyKind::InferenceVar(_, TyVariableKind::Integer)
18 ) && matches!( 17 ) && matches!(
19 rhs_ty.kind(&Interner), 18 rhs_ty.kind(&Interner),
20 TyKind::Scalar(Scalar::Int(_)) 19 TyKind::Scalar(Scalar::Int(_) | Scalar::Uint(_))
21 | TyKind::Scalar(Scalar::Uint(_))
22 | TyKind::InferenceVar(_, TyVariableKind::Integer) 20 | TyKind::InferenceVar(_, TyVariableKind::Integer)
23 ) { 21 ) {
24 lhs_ty 22 lhs_ty
@@ -32,15 +30,15 @@ pub(super) fn binary_op_return_ty(op: BinaryOp, lhs_ty: Ty, rhs_ty: Ty) -> Ty {
32 | (TyKind::Scalar(Scalar::Uint(_)), TyKind::Scalar(Scalar::Uint(_))) 30 | (TyKind::Scalar(Scalar::Uint(_)), TyKind::Scalar(Scalar::Uint(_)))
33 | (TyKind::Scalar(Scalar::Float(_)), TyKind::Scalar(Scalar::Float(_))) => rhs_ty, 31 | (TyKind::Scalar(Scalar::Float(_)), TyKind::Scalar(Scalar::Float(_))) => rhs_ty,
34 // ({int}, int) | ({int}, uint) 32 // ({int}, int) | ({int}, uint)
35 (TyKind::InferenceVar(_, TyVariableKind::Integer), TyKind::Scalar(Scalar::Int(_))) 33 (
36 | (TyKind::InferenceVar(_, TyVariableKind::Integer), TyKind::Scalar(Scalar::Uint(_))) => { 34 TyKind::InferenceVar(_, TyVariableKind::Integer),
37 rhs_ty 35 TyKind::Scalar(Scalar::Int(_) | Scalar::Uint(_)),
38 } 36 ) => rhs_ty,
39 // (int, {int}) | (uint, {int}) 37 // (int, {int}) | (uint, {int})
40 (TyKind::Scalar(Scalar::Int(_)), TyKind::InferenceVar(_, TyVariableKind::Integer)) 38 (
41 | (TyKind::Scalar(Scalar::Uint(_)), TyKind::InferenceVar(_, TyVariableKind::Integer)) => { 39 TyKind::Scalar(Scalar::Int(_) | Scalar::Uint(_)),
42 lhs_ty 40 TyKind::InferenceVar(_, TyVariableKind::Integer),
43 } 41 ) => lhs_ty,
44 // ({float} | float) 42 // ({float} | float)
45 (TyKind::InferenceVar(_, TyVariableKind::Float), TyKind::Scalar(Scalar::Float(_))) => { 43 (TyKind::InferenceVar(_, TyVariableKind::Float), TyKind::Scalar(Scalar::Float(_))) => {
46 rhs_ty 44 rhs_ty
@@ -69,21 +67,15 @@ pub(super) fn binary_op_rhs_expectation(op: BinaryOp, lhs_ty: Ty) -> Ty {
69 BinaryOp::Assignment { op: None } => lhs_ty, 67 BinaryOp::Assignment { op: None } => lhs_ty,
70 BinaryOp::CmpOp(CmpOp::Eq { .. }) => match lhs_ty.kind(&Interner) { 68 BinaryOp::CmpOp(CmpOp::Eq { .. }) => match lhs_ty.kind(&Interner) {
71 TyKind::Scalar(_) | TyKind::Str => lhs_ty, 69 TyKind::Scalar(_) | TyKind::Str => lhs_ty,
72 TyKind::InferenceVar(_, TyVariableKind::Integer) 70 TyKind::InferenceVar(_, TyVariableKind::Integer | TyVariableKind::Float) => lhs_ty,
73 | TyKind::InferenceVar(_, TyVariableKind::Float) => lhs_ty,
74 _ => TyKind::Error.intern(&Interner), 71 _ => TyKind::Error.intern(&Interner),
75 }, 72 },
76 BinaryOp::ArithOp(ArithOp::Shl) | BinaryOp::ArithOp(ArithOp::Shr) => { 73 BinaryOp::ArithOp(ArithOp::Shl | ArithOp::Shr) => TyKind::Error.intern(&Interner),
77 TyKind::Error.intern(&Interner)
78 }
79 BinaryOp::CmpOp(CmpOp::Ord { .. }) 74 BinaryOp::CmpOp(CmpOp::Ord { .. })
80 | BinaryOp::Assignment { op: Some(_) } 75 | BinaryOp::Assignment { op: Some(_) }
81 | BinaryOp::ArithOp(_) => match lhs_ty.kind(&Interner) { 76 | BinaryOp::ArithOp(_) => match lhs_ty.kind(&Interner) {
82 TyKind::Scalar(Scalar::Int(_)) 77 TyKind::Scalar(Scalar::Int(_) | Scalar::Uint(_) | Scalar::Float(_)) => lhs_ty,
83 | TyKind::Scalar(Scalar::Uint(_)) 78 TyKind::InferenceVar(_, TyVariableKind::Integer | TyVariableKind::Float) => lhs_ty,
84 | TyKind::Scalar(Scalar::Float(_)) => lhs_ty,
85 TyKind::InferenceVar(_, TyVariableKind::Integer)
86 | TyKind::InferenceVar(_, TyVariableKind::Float) => lhs_ty,
87 _ => TyKind::Error.intern(&Interner), 79 _ => TyKind::Error.intern(&Interner),
88 }, 80 },
89 } 81 }
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 529cf5f33..409f81ca0 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -568,8 +568,6 @@ mod tests {
568 568
569 use crate::fixture; 569 use crate::fixture;
570 570
571 use super::*;
572
573 fn check_hover_no_result(ra_fixture: &str) { 571 fn check_hover_no_result(ra_fixture: &str) {
574 let (analysis, position) = fixture::position(ra_fixture); 572 let (analysis, position) = fixture::position(ra_fixture);
575 assert!(analysis.hover(position, true, true).unwrap().is_none()); 573 assert!(analysis.hover(position, true, true).unwrap().is_none());
@@ -3016,8 +3014,8 @@ fn foo() {
3016 file_id: FileId( 3014 file_id: FileId(
3017 1, 3015 1,
3018 ), 3016 ),
3019 full_range: 245..427, 3017 full_range: 248..430,
3020 focus_range: 284..290, 3018 focus_range: 287..293,
3021 name: "Future", 3019 name: "Future",
3022 kind: Trait, 3020 kind: Trait,
3023 description: "pub trait Future", 3021 description: "pub trait Future",
@@ -3813,11 +3811,14 @@ use foo::bar::{self$0};
3813 3811
3814 #[test] 3812 #[test]
3815 fn hover_keyword() { 3813 fn hover_keyword() {
3816 let ra_fixture = r#"//- /main.rs crate:main deps:std
3817fn f() { retur$0n; }"#;
3818 let fixture = format!("{}\n{}", ra_fixture, FamousDefs::FIXTURE);
3819 check( 3814 check(
3820 &fixture, 3815 r#"
3816//- /main.rs crate:main deps:std
3817fn f() { retur$0n; }
3818//- /libstd.rs crate:std
3819/// Docs for return_keyword
3820mod return_keyword {}
3821"#,
3821 expect![[r#" 3822 expect![[r#"
3822 *return* 3823 *return*
3823 3824
@@ -3834,11 +3835,15 @@ fn f() { retur$0n; }"#;
3834 3835
3835 #[test] 3836 #[test]
3836 fn hover_builtin() { 3837 fn hover_builtin() {
3837 let ra_fixture = r#"//- /main.rs crate:main deps:std
3838cosnt _: &str$0 = ""; }"#;
3839 let fixture = format!("{}\n{}", ra_fixture, FamousDefs::FIXTURE);
3840 check( 3838 check(
3841 &fixture, 3839 r#"
3840//- /main.rs crate:main deps:std
3841cosnt _: &str$0 = ""; }
3842
3843//- /libstd.rs crate:std
3844/// Docs for prim_str
3845mod prim_str {}
3846"#,
3842 expect![[r#" 3847 expect![[r#"
3843 *str* 3848 *str*
3844 3849
diff --git a/crates/ide/src/join_lines.rs b/crates/ide/src/join_lines.rs
index 93d3760bf..ffa8bd182 100644
--- a/crates/ide/src/join_lines.rs
+++ b/crates/ide/src/join_lines.rs
@@ -197,7 +197,7 @@ fn join_single_use_tree(edit: &mut TextEditBuilder, token: &SyntaxToken) -> Opti
197} 197}
198 198
199fn is_trailing_comma(left: SyntaxKind, right: SyntaxKind) -> bool { 199fn is_trailing_comma(left: SyntaxKind, right: SyntaxKind) -> bool {
200 matches!((left, right), (T![,], T![')']) | (T![,], T![']'])) 200 matches!((left, right), (T![,], T![')'] | T![']']))
201} 201}
202 202
203fn compute_ws(left: SyntaxKind, right: SyntaxKind) -> &'static str { 203fn compute_ws(left: SyntaxKind, right: SyntaxKind) -> &'static str {
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index 945c9b9e1..5808562a7 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -79,8 +79,7 @@ pub(crate) fn find_all_refs(
79 }); 79 });
80 usages.references.retain(|_, it| !it.is_empty()); 80 usages.references.retain(|_, it| !it.is_empty());
81 } 81 }
82 Definition::ModuleDef(hir::ModuleDef::Adt(_)) 82 Definition::ModuleDef(hir::ModuleDef::Adt(_) | hir::ModuleDef::Variant(_)) => {
83 | Definition::ModuleDef(hir::ModuleDef::Variant(_)) => {
84 refs.for_each(|it| { 83 refs.for_each(|it| {
85 it.retain(|reference| { 84 it.retain(|reference| {
86 reference.name.as_name_ref().map_or(false, is_lit_name_ref) 85 reference.name.as_name_ref().map_or(false, is_lit_name_ref)
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs
index e186b82b7..d44a1b45f 100644
--- a/crates/ide/src/syntax_highlighting.rs
+++ b/crates/ide/src/syntax_highlighting.rs
@@ -294,7 +294,7 @@ fn traverse(
294 Some(parent) => { 294 Some(parent) => {
295 // We only care Name and Name_ref 295 // We only care Name and Name_ref
296 match (token.kind(), parent.kind()) { 296 match (token.kind(), parent.kind()) {
297 (IDENT, NAME) | (IDENT, NAME_REF) => parent.into(), 297 (IDENT, NAME | NAME_REF) => parent.into(),
298 _ => token.into(), 298 _ => token.into(),
299 } 299 }
300 } 300 }
@@ -310,7 +310,7 @@ fn traverse(
310 Some(parent) => { 310 Some(parent) => {
311 // We only care Name and Name_ref 311 // We only care Name and Name_ref
312 match (token.kind(), parent.kind()) { 312 match (token.kind(), parent.kind()) {
313 (IDENT, NAME) | (IDENT, NAME_REF) => parent.into(), 313 (IDENT, NAME | NAME_REF) => parent.into(),
314 _ => token.into(), 314 _ => token.into(),
315 } 315 }
316 } 316 }
diff --git a/crates/ide_assists/src/handlers/apply_demorgan.rs b/crates/ide_assists/src/handlers/apply_demorgan.rs
index c93959e66..e2bd6e456 100644
--- a/crates/ide_assists/src/handlers/apply_demorgan.rs
+++ b/crates/ide_assists/src/handlers/apply_demorgan.rs
@@ -147,74 +147,92 @@ fn opposite_logic_op(kind: ast::BinOp) -> Option<&'static str> {
147 147
148#[cfg(test)] 148#[cfg(test)]
149mod tests { 149mod tests {
150 use ide_db::helpers::FamousDefs;
151
152 use super::*;
153
154 use crate::tests::{check_assist, check_assist_not_applicable}; 150 use crate::tests::{check_assist, check_assist_not_applicable};
155 151
156 const ORDABLE_FIXTURE: &'static str = r" 152 use super::*;
157//- /lib.rs deps:core crate:ordable
158struct NonOrderable;
159struct Orderable;
160impl core::cmp::Ord for Orderable {}
161";
162
163 fn check(ra_fixture_before: &str, ra_fixture_after: &str) {
164 let before = &format!(
165 "//- /main.rs crate:main deps:core,ordable\n{}\n{}{}",
166 ra_fixture_before,
167 FamousDefs::FIXTURE,
168 ORDABLE_FIXTURE
169 );
170 check_assist(apply_demorgan, before, &format!("{}\n", ra_fixture_after));
171 }
172 153
173 #[test] 154 #[test]
174 fn demorgan_handles_leq() { 155 fn demorgan_handles_leq() {
175 check( 156 check_assist(
176 r"use ordable::Orderable; 157 apply_demorgan,
158 r#"
159//- minicore: ord, derive
160#[derive(PartialEq, Eq, PartialOrd, Ord)]
161struct S;
162
177fn f() { 163fn f() {
178 Orderable < Orderable &&$0 Orderable <= Orderable 164 S < S &&$0 S <= S
179}", 165}
180 r"use ordable::Orderable; 166"#,
167 r#"
168#[derive(PartialEq, Eq, PartialOrd, Ord)]
169struct S;
170
181fn f() { 171fn f() {
182 !(Orderable >= Orderable || Orderable > Orderable) 172 !(S >= S || S > S)
183}", 173}
174"#,
184 ); 175 );
185 check( 176
186 r"use ordable::NonOrderable; 177 check_assist(
178 apply_demorgan,
179 r#"
180//- minicore: ord, derive
181struct S;
182
187fn f() { 183fn f() {
188 NonOrderable < NonOrderable &&$0 NonOrderable <= NonOrderable 184 S < S &&$0 S <= S
189}", 185}
190 r"use ordable::NonOrderable; 186"#,
187 r#"
188struct S;
189
191fn f() { 190fn f() {
192 !(!(NonOrderable < NonOrderable) || !(NonOrderable <= NonOrderable)) 191 !(!(S < S) || !(S <= S))
193}", 192}
193"#,
194 ); 194 );
195 } 195 }
196 196
197 #[test] 197 #[test]
198 fn demorgan_handles_geq() { 198 fn demorgan_handles_geq() {
199 check( 199 check_assist(
200 r"use ordable::Orderable; 200 apply_demorgan,
201 r#"
202//- minicore: ord, derive
203#[derive(PartialEq, Eq, PartialOrd, Ord)]
204struct S;
205
201fn f() { 206fn f() {
202 Orderable > Orderable &&$0 Orderable >= Orderable 207 S > S &&$0 S >= S
203}", 208}
204 r"use ordable::Orderable; 209"#,
210 r#"
211#[derive(PartialEq, Eq, PartialOrd, Ord)]
212struct S;
213
205fn f() { 214fn f() {
206 !(Orderable <= Orderable || Orderable < Orderable) 215 !(S <= S || S < S)
207}", 216}
217"#,
208 ); 218 );
209 check( 219 check_assist(
210 r"use ordable::NonOrderable; 220 apply_demorgan,
221 r#"
222//- minicore: ord, derive
223struct S;
224
211fn f() { 225fn f() {
212 Orderable > Orderable &&$0 Orderable >= Orderable 226 S > S &&$0 S >= S
213}", 227}
214 r"use ordable::NonOrderable; 228"#,
229 r#"
230struct S;
231
215fn f() { 232fn f() {
216 !(!(Orderable > Orderable) || !(Orderable >= Orderable)) 233 !(!(S > S) || !(S >= S))
217}", 234}
235"#,
218 ); 236 );
219 } 237 }
220 238
diff --git a/crates/ide_assists/src/handlers/convert_into_to_from.rs b/crates/ide_assists/src/handlers/convert_into_to_from.rs
index 199e1ad5c..79a0c4879 100644
--- a/crates/ide_assists/src/handlers/convert_into_to_from.rs
+++ b/crates/ide_assists/src/handlers/convert_into_to_from.rs
@@ -6,6 +6,8 @@ use syntax::ast::{self, AstNode, NameOwner};
6 6
7use crate::{AssistContext, AssistId, AssistKind, Assists}; 7use crate::{AssistContext, AssistId, AssistKind, Assists};
8 8
9// FIXME: this should be a diagnostic
10
9// Assist: convert_into_to_from 11// Assist: convert_into_to_from
10// 12//
11// Converts an Into impl to an equivalent From impl. 13// Converts an Into impl to an equivalent From impl.
@@ -114,12 +116,14 @@ pub(crate) fn convert_into_to_from(acc: &mut Assists, ctx: &AssistContext) -> Op
114mod tests { 116mod tests {
115 use super::*; 117 use super::*;
116 118
117 use crate::tests::check_assist; 119 use crate::tests::{check_assist, check_assist_not_applicable};
118 120
119 #[test] 121 #[test]
120 fn convert_into_to_from_converts_a_struct() { 122 fn convert_into_to_from_converts_a_struct() {
121 check_convert_into_to_from( 123 check_assist(
124 convert_into_to_from,
122 r#" 125 r#"
126//- minicore: from
123struct Thing { 127struct Thing {
124 a: String, 128 a: String,
125 b: usize 129 b: usize
@@ -154,8 +158,10 @@ impl From<usize> for Thing {
154 158
155 #[test] 159 #[test]
156 fn convert_into_to_from_converts_enums() { 160 fn convert_into_to_from_converts_enums() {
157 check_convert_into_to_from( 161 check_assist(
162 convert_into_to_from,
158 r#" 163 r#"
164//- minicore: from
159enum Thing { 165enum Thing {
160 Foo(String), 166 Foo(String),
161 Bar(String) 167 Bar(String)
@@ -190,8 +196,10 @@ impl From<Thing> for String {
190 196
191 #[test] 197 #[test]
192 fn convert_into_to_from_on_enum_with_lifetimes() { 198 fn convert_into_to_from_on_enum_with_lifetimes() {
193 check_convert_into_to_from( 199 check_assist(
200 convert_into_to_from,
194 r#" 201 r#"
202//- minicore: from
195enum Thing<'a> { 203enum Thing<'a> {
196 Foo(&'a str), 204 Foo(&'a str),
197 Bar(&'a str) 205 Bar(&'a str)
@@ -226,8 +234,10 @@ impl<'a> From<Thing<'a>> for &'a str {
226 234
227 #[test] 235 #[test]
228 fn convert_into_to_from_works_on_references() { 236 fn convert_into_to_from_works_on_references() {
229 check_convert_into_to_from( 237 check_assist(
238 convert_into_to_from,
230 r#" 239 r#"
240//- minicore: from
231struct Thing(String); 241struct Thing(String);
232 242
233impl $0core::convert::Into<String> for &Thing { 243impl $0core::convert::Into<String> for &Thing {
@@ -250,8 +260,10 @@ impl From<&Thing> for String {
250 260
251 #[test] 261 #[test]
252 fn convert_into_to_from_works_on_qualified_structs() { 262 fn convert_into_to_from_works_on_qualified_structs() {
253 check_convert_into_to_from( 263 check_assist(
264 convert_into_to_from,
254 r#" 265 r#"
266//- minicore: from
255mod things { 267mod things {
256 pub struct Thing(String); 268 pub struct Thing(String);
257 pub struct BetterThing(String); 269 pub struct BetterThing(String);
@@ -280,8 +292,10 @@ impl From<&things::Thing> for things::BetterThing {
280 292
281 #[test] 293 #[test]
282 fn convert_into_to_from_works_on_qualified_enums() { 294 fn convert_into_to_from_works_on_qualified_enums() {
283 check_convert_into_to_from( 295 check_assist(
296 convert_into_to_from,
284 r#" 297 r#"
298//- minicore: from
285mod things { 299mod things {
286 pub enum Thing { 300 pub enum Thing {
287 A(String) 301 A(String)
@@ -323,10 +337,12 @@ impl From<&things::Thing> for things::BetterThing {
323 #[test] 337 #[test]
324 fn convert_into_to_from_not_applicable_on_any_trait_named_into() { 338 fn convert_into_to_from_not_applicable_on_any_trait_named_into() {
325 check_assist_not_applicable( 339 check_assist_not_applicable(
340 convert_into_to_from,
326 r#" 341 r#"
327pub trait Into<T> {{ 342//- minicore: from
343pub trait Into<T> {
328 pub fn into(self) -> T; 344 pub fn into(self) -> T;
329}} 345}
330 346
331struct Thing { 347struct Thing {
332 a: String, 348 a: String,
@@ -342,14 +358,4 @@ impl $0Into<Thing> for String {
342"#, 358"#,
343 ); 359 );
344 } 360 }
345
346 fn check_convert_into_to_from(before: &str, after: &str) {
347 let before = &format!("//- /main.rs crate:main deps:core{}{}", before, FamousDefs::FIXTURE);
348 check_assist(convert_into_to_from, before, after);
349 }
350
351 fn check_assist_not_applicable(before: &str) {
352 let before = &format!("//- /main.rs crate:main deps:core{}{}", before, FamousDefs::FIXTURE);
353 crate::tests::check_assist_not_applicable(convert_into_to_from, before);
354 }
355} 361}
diff --git a/crates/ide_assists/src/handlers/extract_function.rs b/crates/ide_assists/src/handlers/extract_function.rs
index f2be091f4..7085a0c48 100644
--- a/crates/ide_assists/src/handlers/extract_function.rs
+++ b/crates/ide_assists/src/handlers/extract_function.rs
@@ -1384,7 +1384,7 @@ fn fix_param_usages(ctx: &AssistContext, params: &[Param], syntax: &SyntaxNode)
1384 for (param, usages) in usages_for_param { 1384 for (param, usages) in usages_for_param {
1385 for usage in usages { 1385 for usage in usages {
1386 match usage.syntax().ancestors().skip(1).find_map(ast::Expr::cast) { 1386 match usage.syntax().ancestors().skip(1).find_map(ast::Expr::cast) {
1387 Some(ast::Expr::MethodCallExpr(_)) | Some(ast::Expr::FieldExpr(_)) => { 1387 Some(ast::Expr::MethodCallExpr(_) | ast::Expr::FieldExpr(_)) => {
1388 // do nothing 1388 // do nothing
1389 } 1389 }
1390 Some(ast::Expr::RefExpr(node)) 1390 Some(ast::Expr::RefExpr(node))
diff --git a/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs
index d3ff7b65c..6c6ff16c2 100644
--- a/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs
+++ b/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs
@@ -48,6 +48,7 @@ pub(crate) fn extract_struct_from_enum_variant(
48 let variant_name = variant.name()?; 48 let variant_name = variant.name()?;
49 let variant_hir = ctx.sema.to_def(&variant)?; 49 let variant_hir = ctx.sema.to_def(&variant)?;
50 if existing_definition(ctx.db(), &variant_name, &variant_hir) { 50 if existing_definition(ctx.db(), &variant_name, &variant_hir) {
51 cov_mark::hit!(test_extract_enum_not_applicable_if_struct_exists);
51 return None; 52 return None;
52 } 53 }
53 54
@@ -300,18 +301,10 @@ fn reference_to_node(
300 301
301#[cfg(test)] 302#[cfg(test)]
302mod tests { 303mod tests {
303 use ide_db::helpers::FamousDefs;
304
305 use crate::tests::{check_assist, check_assist_not_applicable}; 304 use crate::tests::{check_assist, check_assist_not_applicable};
306 305
307 use super::*; 306 use super::*;
308 307
309 fn check_not_applicable(ra_fixture: &str) {
310 let fixture =
311 format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE);
312 check_assist_not_applicable(extract_struct_from_enum_variant, &fixture)
313 }
314
315 #[test] 308 #[test]
316 fn test_extract_struct_several_fields_tuple() { 309 fn test_extract_struct_several_fields_tuple() {
317 check_assist( 310 check_assist(
@@ -699,29 +692,33 @@ fn foo() {
699 692
700 #[test] 693 #[test]
701 fn test_extract_enum_not_applicable_for_element_with_no_fields() { 694 fn test_extract_enum_not_applicable_for_element_with_no_fields() {
702 check_not_applicable("enum A { $0One }"); 695 check_assist_not_applicable(extract_struct_from_enum_variant, r#"enum A { $0One }"#);
703 } 696 }
704 697
705 #[test] 698 #[test]
706 fn test_extract_enum_not_applicable_if_struct_exists() { 699 fn test_extract_enum_not_applicable_if_struct_exists() {
707 check_not_applicable( 700 cov_mark::check!(test_extract_enum_not_applicable_if_struct_exists);
708 r#"struct One; 701 check_assist_not_applicable(
709 enum A { $0One(u8, u32) }"#, 702 extract_struct_from_enum_variant,
703 r#"
704struct One;
705enum A { $0One(u8, u32) }
706"#,
710 ); 707 );
711 } 708 }
712 709
713 #[test] 710 #[test]
714 fn test_extract_not_applicable_one_field() { 711 fn test_extract_not_applicable_one_field() {
715 check_not_applicable(r"enum A { $0One(u32) }"); 712 check_assist_not_applicable(extract_struct_from_enum_variant, r"enum A { $0One(u32) }");
716 } 713 }
717 714
718 #[test] 715 #[test]
719 fn test_extract_not_applicable_no_field_tuple() { 716 fn test_extract_not_applicable_no_field_tuple() {
720 check_not_applicable(r"enum A { $0None() }"); 717 check_assist_not_applicable(extract_struct_from_enum_variant, r"enum A { $0None() }");
721 } 718 }
722 719
723 #[test] 720 #[test]
724 fn test_extract_not_applicable_no_field_named() { 721 fn test_extract_not_applicable_no_field_named() {
725 check_not_applicable(r"enum A { $0None {} }"); 722 check_assist_not_applicable(extract_struct_from_enum_variant, r"enum A { $0None {} }");
726 } 723 }
727} 724}
diff --git a/crates/ide_assists/src/handlers/generate_default_from_enum_variant.rs b/crates/ide_assists/src/handlers/generate_default_from_enum_variant.rs
index 588ee1350..e55c38502 100644
--- a/crates/ide_assists/src/handlers/generate_default_from_enum_variant.rs
+++ b/crates/ide_assists/src/handlers/generate_default_from_enum_variant.rs
@@ -1,5 +1,4 @@
1use ide_db::helpers::FamousDefs; 1use ide_db::{helpers::FamousDefs, RootDatabase};
2use ide_db::RootDatabase;
3use syntax::ast::{self, AstNode, NameOwner}; 2use syntax::ast::{self, AstNode, NameOwner};
4 3
5use crate::{AssistContext, AssistId, AssistKind, Assists}; 4use crate::{AssistContext, AssistId, AssistKind, Assists};
@@ -92,23 +91,20 @@ mod tests {
92 91
93 use super::*; 92 use super::*;
94 93
95 fn check_not_applicable(ra_fixture: &str) {
96 let fixture =
97 format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE);
98 check_assist_not_applicable(generate_default_from_enum_variant, &fixture)
99 }
100
101 #[test] 94 #[test]
102 fn test_generate_default_from_variant() { 95 fn test_generate_default_from_variant() {
103 check_assist( 96 check_assist(
104 generate_default_from_enum_variant, 97 generate_default_from_enum_variant,
105 r#" 98 r#"
99//- minicore: default
106enum Variant { 100enum Variant {
107 Undefined, 101 Undefined,
108 Minor$0, 102 Minor$0,
109 Major, 103 Major,
110}"#, 104}
111 r#"enum Variant { 105"#,
106 r#"
107enum Variant {
112 Undefined, 108 Undefined,
113 Minor, 109 Minor,
114 Major, 110 Major,
@@ -118,15 +114,18 @@ impl Default for Variant {
118 fn default() -> Self { 114 fn default() -> Self {
119 Self::Minor 115 Self::Minor
120 } 116 }
121}"#, 117}
118"#,
122 ); 119 );
123 } 120 }
124 121
125 #[test] 122 #[test]
126 fn test_generate_default_already_implemented() { 123 fn test_generate_default_already_implemented() {
127 cov_mark::check!(test_gen_default_impl_already_exists); 124 cov_mark::check!(test_gen_default_impl_already_exists);
128 check_not_applicable( 125 check_assist_not_applicable(
126 generate_default_from_enum_variant,
129 r#" 127 r#"
128//- minicore: default
130enum Variant { 129enum Variant {
131 Undefined, 130 Undefined,
132 Minor$0, 131 Minor$0,
@@ -137,20 +136,24 @@ impl Default for Variant {
137 fn default() -> Self { 136 fn default() -> Self {
138 Self::Minor 137 Self::Minor
139 } 138 }
140}"#, 139}
140"#,
141 ); 141 );
142 } 142 }
143 143
144 #[test] 144 #[test]
145 fn test_add_from_impl_no_element() { 145 fn test_add_from_impl_no_element() {
146 cov_mark::check!(test_gen_default_on_non_unit_variant_not_implemented); 146 cov_mark::check!(test_gen_default_on_non_unit_variant_not_implemented);
147 check_not_applicable( 147 check_assist_not_applicable(
148 generate_default_from_enum_variant,
148 r#" 149 r#"
150//- minicore: default
149enum Variant { 151enum Variant {
150 Undefined, 152 Undefined,
151 Minor(u32)$0, 153 Minor(u32)$0,
152 Major, 154 Major,
153}"#, 155}
156"#,
154 ); 157 );
155 } 158 }
156 159
@@ -158,7 +161,10 @@ enum Variant {
158 fn test_generate_default_from_variant_with_one_variant() { 161 fn test_generate_default_from_variant_with_one_variant() {
159 check_assist( 162 check_assist(
160 generate_default_from_enum_variant, 163 generate_default_from_enum_variant,
161 r#"enum Variant { Undefi$0ned }"#, 164 r#"
165//- minicore: default
166enum Variant { Undefi$0ned }
167"#,
162 r#" 168 r#"
163enum Variant { Undefined } 169enum Variant { Undefined }
164 170
@@ -166,7 +172,8 @@ impl Default for Variant {
166 fn default() -> Self { 172 fn default() -> Self {
167 Self::Undefined 173 Self::Undefined
168 } 174 }
169}"#, 175}
176"#,
170 ); 177 );
171 } 178 }
172} 179}
diff --git a/crates/ide_assists/src/handlers/generate_default_from_new.rs b/crates/ide_assists/src/handlers/generate_default_from_new.rs
index bad826366..b54ec59da 100644
--- a/crates/ide_assists/src/handlers/generate_default_from_new.rs
+++ b/crates/ide_assists/src/handlers/generate_default_from_new.rs
@@ -1,7 +1,3 @@
1use crate::{
2 assist_context::{AssistContext, Assists},
3 AssistId,
4};
5use ide_db::helpers::FamousDefs; 1use ide_db::helpers::FamousDefs;
6use itertools::Itertools; 2use itertools::Itertools;
7use stdx::format_to; 3use stdx::format_to;
@@ -10,6 +6,11 @@ use syntax::{
10 AstNode, 6 AstNode,
11}; 7};
12 8
9use crate::{
10 assist_context::{AssistContext, Assists},
11 AssistId,
12};
13
13// Assist: generate_default_from_new 14// Assist: generate_default_from_new
14// 15//
15// Generates default implementation from new method. 16// Generates default implementation from new method.
@@ -140,16 +141,16 @@ fn is_default_implemented(ctx: &AssistContext, impl_: &Impl) -> bool {
140 141
141#[cfg(test)] 142#[cfg(test)]
142mod tests { 143mod tests {
143 use ide_db::helpers::FamousDefs;
144
145 use crate::tests::{check_assist, check_assist_not_applicable}; 144 use crate::tests::{check_assist, check_assist_not_applicable};
146 145
147 use super::*; 146 use super::*;
148 147
149 #[test] 148 #[test]
150 fn generate_default() { 149 fn generate_default() {
151 check_pass( 150 check_assist(
151 generate_default_from_new,
152 r#" 152 r#"
153//- minicore: default
153struct Example { _inner: () } 154struct Example { _inner: () }
154 155
155impl Example { 156impl Example {
@@ -182,8 +183,10 @@ fn main() {}
182 183
183 #[test] 184 #[test]
184 fn generate_default2() { 185 fn generate_default2() {
185 check_pass( 186 check_assist(
187 generate_default_from_new,
186 r#" 188 r#"
189//- minicore: default
187struct Test { value: u32 } 190struct Test { value: u32 }
188 191
189impl Test { 192impl Test {
@@ -212,8 +215,10 @@ impl Default for Test {
212 215
213 #[test] 216 #[test]
214 fn new_function_with_generic() { 217 fn new_function_with_generic() {
215 check_pass( 218 check_assist(
219 generate_default_from_new,
216 r#" 220 r#"
221//- minicore: default
217pub struct Foo<T> { 222pub struct Foo<T> {
218 _bar: *mut T, 223 _bar: *mut T,
219} 224}
@@ -246,8 +251,10 @@ impl<T> Default for Foo<T> {
246 251
247 #[test] 252 #[test]
248 fn new_function_with_generics() { 253 fn new_function_with_generics() {
249 check_pass( 254 check_assist(
255 generate_default_from_new,
250 r#" 256 r#"
257//- minicore: default
251pub struct Foo<T, B> { 258pub struct Foo<T, B> {
252 _tars: *mut T, 259 _tars: *mut T,
253 _bar: *mut B, 260 _bar: *mut B,
@@ -282,8 +289,10 @@ impl<T, B> Default for Foo<T, B> {
282 289
283 #[test] 290 #[test]
284 fn new_function_with_generic_and_bound() { 291 fn new_function_with_generic_and_bound() {
285 check_pass( 292 check_assist(
293 generate_default_from_new,
286 r#" 294 r#"
295//- minicore: default
287pub struct Foo<T> { 296pub struct Foo<T> {
288 t: T, 297 t: T,
289} 298}
@@ -316,8 +325,10 @@ impl<T: From<i32>> Default for Foo<T> {
316 325
317 #[test] 326 #[test]
318 fn new_function_with_generics_and_bounds() { 327 fn new_function_with_generics_and_bounds() {
319 check_pass( 328 check_assist(
329 generate_default_from_new,
320 r#" 330 r#"
331//- minicore: default
321pub struct Foo<T, B> { 332pub struct Foo<T, B> {
322 _tars: T, 333 _tars: T,
323 _bar: B, 334 _bar: B,
@@ -352,8 +363,10 @@ impl<T: From<i32>, B: From<i64>> Default for Foo<T, B> {
352 363
353 #[test] 364 #[test]
354 fn new_function_with_generic_and_where() { 365 fn new_function_with_generic_and_where() {
355 check_pass( 366 check_assist(
367 generate_default_from_new,
356 r#" 368 r#"
369//- minicore: default
357pub struct Foo<T> { 370pub struct Foo<T> {
358 t: T, 371 t: T,
359} 372}
@@ -395,8 +408,10 @@ where
395 408
396 #[test] 409 #[test]
397 fn new_function_with_generics_and_wheres() { 410 fn new_function_with_generics_and_wheres() {
398 check_pass( 411 check_assist(
412 generate_default_from_new,
399 r#" 413 r#"
414//- minicore: default
400pub struct Foo<T, B> { 415pub struct Foo<T, B> {
401 _tars: T, 416 _tars: T,
402 _bar: B, 417 _bar: B,
@@ -441,8 +456,10 @@ where
441 #[test] 456 #[test]
442 fn new_function_with_parameters() { 457 fn new_function_with_parameters() {
443 cov_mark::check!(new_function_with_parameters); 458 cov_mark::check!(new_function_with_parameters);
444 check_not_applicable( 459 check_assist_not_applicable(
460 generate_default_from_new,
445 r#" 461 r#"
462//- minicore: default
446struct Example { _inner: () } 463struct Example { _inner: () }
447 464
448impl Example { 465impl Example {
@@ -457,7 +474,8 @@ impl Example {
457 #[test] 474 #[test]
458 fn other_function_than_new() { 475 fn other_function_than_new() {
459 cov_mark::check!(other_function_than_new); 476 cov_mark::check!(other_function_than_new);
460 check_not_applicable( 477 check_assist_not_applicable(
478 generate_default_from_new,
461 r#" 479 r#"
462struct Example { _inner: () } 480struct Example { _inner: () }
463 481
@@ -474,8 +492,10 @@ impl Example {
474 #[test] 492 #[test]
475 fn default_block_is_already_present() { 493 fn default_block_is_already_present() {
476 cov_mark::check!(default_block_is_already_present); 494 cov_mark::check!(default_block_is_already_present);
477 check_not_applicable( 495 check_assist_not_applicable(
496 generate_default_from_new,
478 r#" 497 r#"
498//- minicore: default
479struct Example { _inner: () } 499struct Example { _inner: () }
480 500
481impl Example { 501impl Example {
@@ -495,7 +515,8 @@ impl Default for Example {
495 515
496 #[test] 516 #[test]
497 fn standalone_new_function() { 517 fn standalone_new_function() {
498 check_not_applicable( 518 check_assist_not_applicable(
519 generate_default_from_new,
499 r#" 520 r#"
500fn n$0ew() -> u32 { 521fn n$0ew() -> u32 {
501 0 522 0
@@ -506,8 +527,10 @@ fn n$0ew() -> u32 {
506 527
507 #[test] 528 #[test]
508 fn multiple_struct_blocks() { 529 fn multiple_struct_blocks() {
509 check_pass( 530 check_assist(
531 generate_default_from_new,
510 r#" 532 r#"
533//- minicore: default
511struct Example { _inner: () } 534struct Example { _inner: () }
512struct Test { value: u32 } 535struct Test { value: u32 }
513 536
@@ -538,8 +561,10 @@ impl Default for Example {
538 561
539 #[test] 562 #[test]
540 fn when_struct_is_after_impl() { 563 fn when_struct_is_after_impl() {
541 check_pass( 564 check_assist(
565 generate_default_from_new,
542 r#" 566 r#"
567//- minicore: default
543impl Example { 568impl Example {
544 pub fn $0new() -> Self { 569 pub fn $0new() -> Self {
545 Self { _inner: () } 570 Self { _inner: () }
@@ -568,8 +593,10 @@ struct Example { _inner: () }
568 593
569 #[test] 594 #[test]
570 fn struct_in_module() { 595 fn struct_in_module() {
571 check_pass( 596 check_assist(
597 generate_default_from_new,
572 r#" 598 r#"
599//- minicore: default
573mod test { 600mod test {
574 struct Example { _inner: () } 601 struct Example { _inner: () }
575 602
@@ -603,8 +630,10 @@ impl Default for Example {
603 #[test] 630 #[test]
604 fn struct_in_module_with_default() { 631 fn struct_in_module_with_default() {
605 cov_mark::check!(struct_in_module_with_default); 632 cov_mark::check!(struct_in_module_with_default);
606 check_not_applicable( 633 check_assist_not_applicable(
634 generate_default_from_new,
607 r#" 635 r#"
636//- minicore: default
608mod test { 637mod test {
609 struct Example { _inner: () } 638 struct Example { _inner: () }
610 639
@@ -623,14 +652,4 @@ mod test {
623"#, 652"#,
624 ); 653 );
625 } 654 }
626
627 fn check_pass(before: &str, after: &str) {
628 let before = &format!("//- /main.rs crate:main deps:core{}{}", before, FamousDefs::FIXTURE);
629 check_assist(generate_default_from_new, before, after);
630 }
631
632 fn check_not_applicable(before: &str) {
633 let before = &format!("//- /main.rs crate:main deps:core{}{}", before, FamousDefs::FIXTURE);
634 check_assist_not_applicable(generate_default_from_new, before);
635 }
636} 655}
diff --git a/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs b/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs
index ce6998d82..8727be07d 100644
--- a/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs
+++ b/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs
@@ -110,14 +110,19 @@ mod tests {
110 fn test_generate_from_impl_for_enum() { 110 fn test_generate_from_impl_for_enum() {
111 check_assist( 111 check_assist(
112 generate_from_impl_for_enum, 112 generate_from_impl_for_enum,
113 "enum A { $0One(u32) }", 113 r#"
114 r#"enum A { One(u32) } 114//- minicore: from
115enum A { $0One(u32) }
116"#,
117 r#"
118enum A { One(u32) }
115 119
116impl From<u32> for A { 120impl From<u32> for A {
117 fn from(v: u32) -> Self { 121 fn from(v: u32) -> Self {
118 Self::One(v) 122 Self::One(v)
119 } 123 }
120}"#, 124}
125"#,
121 ); 126 );
122 } 127 }
123 128
@@ -125,53 +130,71 @@ impl From<u32> for A {
125 fn test_generate_from_impl_for_enum_complicated_path() { 130 fn test_generate_from_impl_for_enum_complicated_path() {
126 check_assist( 131 check_assist(
127 generate_from_impl_for_enum, 132 generate_from_impl_for_enum,
128 r#"enum A { $0One(foo::bar::baz::Boo) }"#, 133 r#"
129 r#"enum A { One(foo::bar::baz::Boo) } 134//- minicore: from
135enum A { $0One(foo::bar::baz::Boo) }
136"#,
137 r#"
138enum A { One(foo::bar::baz::Boo) }
130 139
131impl From<foo::bar::baz::Boo> for A { 140impl From<foo::bar::baz::Boo> for A {
132 fn from(v: foo::bar::baz::Boo) -> Self { 141 fn from(v: foo::bar::baz::Boo) -> Self {
133 Self::One(v) 142 Self::One(v)
134 } 143 }
135}"#, 144}
145"#,
136 ); 146 );
137 } 147 }
138 148
139 fn check_not_applicable(ra_fixture: &str) {
140 let fixture =
141 format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE);
142 check_assist_not_applicable(generate_from_impl_for_enum, &fixture)
143 }
144
145 #[test] 149 #[test]
146 fn test_add_from_impl_no_element() { 150 fn test_add_from_impl_no_element() {
147 check_not_applicable("enum A { $0One }"); 151 check_assist_not_applicable(
152 generate_from_impl_for_enum,
153 r#"
154//- minicore: from
155enum A { $0One }
156"#,
157 );
148 } 158 }
149 159
150 #[test] 160 #[test]
151 fn test_add_from_impl_more_than_one_element_in_tuple() { 161 fn test_add_from_impl_more_than_one_element_in_tuple() {
152 check_not_applicable("enum A { $0One(u32, String) }"); 162 check_assist_not_applicable(
163 generate_from_impl_for_enum,
164 r#"
165//- minicore: from
166enum A { $0One(u32, String) }
167"#,
168 );
153 } 169 }
154 170
155 #[test] 171 #[test]
156 fn test_add_from_impl_struct_variant() { 172 fn test_add_from_impl_struct_variant() {
157 check_assist( 173 check_assist(
158 generate_from_impl_for_enum, 174 generate_from_impl_for_enum,
159 "enum A { $0One { x: u32 } }", 175 r#"
160 r#"enum A { One { x: u32 } } 176//- minicore: from
177enum A { $0One { x: u32 } }
178"#,
179 r#"
180enum A { One { x: u32 } }
161 181
162impl From<u32> for A { 182impl From<u32> for A {
163 fn from(x: u32) -> Self { 183 fn from(x: u32) -> Self {
164 Self::One { x } 184 Self::One { x }
165 } 185 }
166}"#, 186}
187"#,
167 ); 188 );
168 } 189 }
169 190
170 #[test] 191 #[test]
171 fn test_add_from_impl_already_exists() { 192 fn test_add_from_impl_already_exists() {
172 cov_mark::check!(test_add_from_impl_already_exists); 193 cov_mark::check!(test_add_from_impl_already_exists);
173 check_not_applicable( 194 check_assist_not_applicable(
195 generate_from_impl_for_enum,
174 r#" 196 r#"
197//- minicore: from
175enum A { $0One(u32), } 198enum A { $0One(u32), }
176 199
177impl From<u32> for A { 200impl From<u32> for A {
@@ -187,7 +210,9 @@ impl From<u32> for A {
187 fn test_add_from_impl_different_variant_impl_exists() { 210 fn test_add_from_impl_different_variant_impl_exists() {
188 check_assist( 211 check_assist(
189 generate_from_impl_for_enum, 212 generate_from_impl_for_enum,
190 r#"enum A { $0One(u32), Two(String), } 213 r#"
214//- minicore: from
215enum A { $0One(u32), Two(String), }
191 216
192impl From<String> for A { 217impl From<String> for A {
193 fn from(v: String) -> Self { 218 fn from(v: String) -> Self {
@@ -197,8 +222,10 @@ impl From<String> for A {
197 222
198pub trait From<T> { 223pub trait From<T> {
199 fn from(T) -> Self; 224 fn from(T) -> Self;
200}"#, 225}
201 r#"enum A { One(u32), Two(String), } 226"#,
227 r#"
228enum A { One(u32), Two(String), }
202 229
203impl From<u32> for A { 230impl From<u32> for A {
204 fn from(v: u32) -> Self { 231 fn from(v: u32) -> Self {
@@ -214,7 +241,8 @@ impl From<String> for A {
214 241
215pub trait From<T> { 242pub trait From<T> {
216 fn from(T) -> Self; 243 fn from(T) -> Self;
217}"#, 244}
245"#,
218 ); 246 );
219 } 247 }
220 248
@@ -222,14 +250,19 @@ pub trait From<T> {
222 fn test_add_from_impl_static_str() { 250 fn test_add_from_impl_static_str() {
223 check_assist( 251 check_assist(
224 generate_from_impl_for_enum, 252 generate_from_impl_for_enum,
225 "enum A { $0One(&'static str) }", 253 r#"
226 r#"enum A { One(&'static str) } 254//- minicore: from
255enum A { $0One(&'static str) }
256"#,
257 r#"
258enum A { One(&'static str) }
227 259
228impl From<&'static str> for A { 260impl From<&'static str> for A {
229 fn from(v: &'static str) -> Self { 261 fn from(v: &'static str) -> Self {
230 Self::One(v) 262 Self::One(v)
231 } 263 }
232}"#, 264}
265"#,
233 ); 266 );
234 } 267 }
235 268
@@ -237,14 +270,19 @@ impl From<&'static str> for A {
237 fn test_add_from_impl_generic_enum() { 270 fn test_add_from_impl_generic_enum() {
238 check_assist( 271 check_assist(
239 generate_from_impl_for_enum, 272 generate_from_impl_for_enum,
240 "enum Generic<T, U: Clone> { $0One(T), Two(U) }", 273 r#"
241 r#"enum Generic<T, U: Clone> { One(T), Two(U) } 274//- minicore: from
275enum Generic<T, U: Clone> { $0One(T), Two(U) }
276"#,
277 r#"
278enum Generic<T, U: Clone> { One(T), Two(U) }
242 279
243impl<T, U: Clone> From<T> for Generic<T, U> { 280impl<T, U: Clone> From<T> for Generic<T, U> {
244 fn from(v: T) -> Self { 281 fn from(v: T) -> Self {
245 Self::One(v) 282 Self::One(v)
246 } 283 }
247}"#, 284}
285"#,
248 ); 286 );
249 } 287 }
250 288
@@ -252,14 +290,19 @@ impl<T, U: Clone> From<T> for Generic<T, U> {
252 fn test_add_from_impl_with_lifetime() { 290 fn test_add_from_impl_with_lifetime() {
253 check_assist( 291 check_assist(
254 generate_from_impl_for_enum, 292 generate_from_impl_for_enum,
255 "enum Generic<'a> { $0One(&'a i32) }", 293 r#"
256 r#"enum Generic<'a> { One(&'a i32) } 294//- minicore: from
295enum Generic<'a> { $0One(&'a i32) }
296"#,
297 r#"
298enum Generic<'a> { One(&'a i32) }
257 299
258impl<'a> From<&'a i32> for Generic<'a> { 300impl<'a> From<&'a i32> for Generic<'a> {
259 fn from(v: &'a i32) -> Self { 301 fn from(v: &'a i32) -> Self {
260 Self::One(v) 302 Self::One(v)
261 } 303 }
262}"#, 304}
305"#,
263 ); 306 );
264 } 307 }
265} 308}
diff --git a/crates/ide_assists/src/handlers/inline_local_variable.rs b/crates/ide_assists/src/handlers/inline_local_variable.rs
index 2441dbb8b..945d28650 100644
--- a/crates/ide_assists/src/handlers/inline_local_variable.rs
+++ b/crates/ide_assists/src/handlers/inline_local_variable.rs
@@ -65,32 +65,35 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O
65 Some(u) => u, 65 Some(u) => u,
66 None => return Some(false), 66 None => return Some(false),
67 }; 67 };
68 68 Some(
69 Some(!matches!( 69 !(matches!(
70 (&initializer_expr, usage_parent), 70 initializer_expr,
71 (ast::Expr::CallExpr(_), _) 71 ast::Expr::CallExpr(_)
72 | (ast::Expr::IndexExpr(_), _) 72 | ast::Expr::IndexExpr(_)
73 | (ast::Expr::MethodCallExpr(_), _) 73 | ast::Expr::MethodCallExpr(_)
74 | (ast::Expr::FieldExpr(_), _) 74 | ast::Expr::FieldExpr(_)
75 | (ast::Expr::TryExpr(_), _) 75 | ast::Expr::TryExpr(_)
76 | (ast::Expr::RefExpr(_), _) 76 | ast::Expr::RefExpr(_)
77 | (ast::Expr::Literal(_), _) 77 | ast::Expr::Literal(_)
78 | (ast::Expr::TupleExpr(_), _) 78 | ast::Expr::TupleExpr(_)
79 | (ast::Expr::ArrayExpr(_), _) 79 | ast::Expr::ArrayExpr(_)
80 | (ast::Expr::ParenExpr(_), _) 80 | ast::Expr::ParenExpr(_)
81 | (ast::Expr::PathExpr(_), _) 81 | ast::Expr::PathExpr(_)
82 | (ast::Expr::BlockExpr(_), _) 82 | ast::Expr::BlockExpr(_)
83 | (ast::Expr::EffectExpr(_), _) 83 | ast::Expr::EffectExpr(_),
84 | (_, ast::Expr::CallExpr(_)) 84 ) || matches!(
85 | (_, ast::Expr::TupleExpr(_)) 85 usage_parent,
86 | (_, ast::Expr::ArrayExpr(_)) 86 ast::Expr::CallExpr(_)
87 | (_, ast::Expr::ParenExpr(_)) 87 | ast::Expr::TupleExpr(_)
88 | (_, ast::Expr::ForExpr(_)) 88 | ast::Expr::ArrayExpr(_)
89 | (_, ast::Expr::WhileExpr(_)) 89 | ast::Expr::ParenExpr(_)
90 | (_, ast::Expr::BreakExpr(_)) 90 | ast::Expr::ForExpr(_)
91 | (_, ast::Expr::ReturnExpr(_)) 91 | ast::Expr::WhileExpr(_)
92 | (_, ast::Expr::MatchExpr(_)) 92 | ast::Expr::BreakExpr(_)
93 )) 93 | ast::Expr::ReturnExpr(_)
94 | ast::Expr::MatchExpr(_)
95 )),
96 )
94 }) 97 })
95 .collect::<Option<_>>() 98 .collect::<Option<_>>()
96 .map(|b| (file_id, b)) 99 .map(|b| (file_id, b))
diff --git a/crates/ide_assists/src/tests.rs b/crates/ide_assists/src/tests.rs
index 60cecd94c..4e96ff1ec 100644
--- a/crates/ide_assists/src/tests.rs
+++ b/crates/ide_assists/src/tests.rs
@@ -35,6 +35,7 @@ pub(crate) fn with_single_file(text: &str) -> (RootDatabase, FileId) {
35 RootDatabase::with_single_file(text) 35 RootDatabase::with_single_file(text)
36} 36}
37 37
38#[track_caller]
38pub(crate) fn check_assist(assist: Handler, ra_fixture_before: &str, ra_fixture_after: &str) { 39pub(crate) fn check_assist(assist: Handler, ra_fixture_before: &str, ra_fixture_after: &str) {
39 let ra_fixture_after = trim_indent(ra_fixture_after); 40 let ra_fixture_after = trim_indent(ra_fixture_after);
40 check(assist, ra_fixture_before, ExpectedResult::After(&ra_fixture_after), None); 41 check(assist, ra_fixture_before, ExpectedResult::After(&ra_fixture_after), None);
@@ -179,9 +180,10 @@ fn check(handler: Handler, before: &str, expected: ExpectedResult, assist_label:
179 "unresolved assist should not contain source changes" 180 "unresolved assist should not contain source changes"
180 ), 181 ),
181 (Some(_), ExpectedResult::NotApplicable) => panic!("assist should not be applicable!"), 182 (Some(_), ExpectedResult::NotApplicable) => panic!("assist should not be applicable!"),
182 (None, ExpectedResult::After(_)) 183 (
183 | (None, ExpectedResult::Target(_)) 184 None,
184 | (None, ExpectedResult::Unresolved) => { 185 ExpectedResult::After(_) | ExpectedResult::Target(_) | ExpectedResult::Unresolved,
186 ) => {
185 panic!("code action is not applicable") 187 panic!("code action is not applicable")
186 } 188 }
187 (None, ExpectedResult::NotApplicable) => (), 189 (None, ExpectedResult::NotApplicable) => (),
diff --git a/crates/ide_completion/src/completions/attribute.rs b/crates/ide_completion/src/completions/attribute.rs
index ab24a6521..78fc30e16 100644
--- a/crates/ide_completion/src/completions/attribute.rs
+++ b/crates/ide_completion/src/completions/attribute.rs
@@ -17,12 +17,14 @@ use crate::{
17 17
18mod derive; 18mod derive;
19mod lint; 19mod lint;
20mod repr;
20 21
21pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { 22pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> {
22 let attribute = ctx.attribute_under_caret.as_ref()?; 23 let attribute = ctx.attribute_under_caret.as_ref()?;
23 match (attribute.path().and_then(|p| p.as_single_name_ref()), attribute.token_tree()) { 24 match (attribute.path().and_then(|p| p.as_single_name_ref()), attribute.token_tree()) {
24 (Some(path), Some(token_tree)) => match path.text().as_str() { 25 (Some(path), Some(token_tree)) => match path.text().as_str() {
25 "derive" => derive::complete_derive(acc, ctx, token_tree), 26 "derive" => derive::complete_derive(acc, ctx, token_tree),
27 "repr" => repr::complete_repr(acc, ctx, token_tree),
26 "feature" => lint::complete_lint(acc, ctx, token_tree, FEATURES), 28 "feature" => lint::complete_lint(acc, ctx, token_tree, FEATURES),
27 "allow" | "warn" | "deny" | "forbid" => { 29 "allow" | "warn" | "deny" | "forbid" => {
28 lint::complete_lint(acc, ctx, token_tree.clone(), DEFAULT_LINTS); 30 lint::complete_lint(acc, ctx, token_tree.clone(), DEFAULT_LINTS);
diff --git a/crates/ide_completion/src/completions/attribute/repr.rs b/crates/ide_completion/src/completions/attribute/repr.rs
new file mode 100644
index 000000000..92a262a43
--- /dev/null
+++ b/crates/ide_completion/src/completions/attribute/repr.rs
@@ -0,0 +1,199 @@
1//! Completion for representations.
2
3use syntax::ast;
4
5use crate::{
6 context::CompletionContext,
7 item::{CompletionItem, CompletionItemKind, CompletionKind},
8 Completions,
9};
10
11pub(super) fn complete_repr(
12 acc: &mut Completions,
13 ctx: &CompletionContext,
14 derive_input: ast::TokenTree,
15) {
16 if let Some(existing_reprs) = super::parse_comma_sep_input(derive_input) {
17 for repr_completion in REPR_COMPLETIONS {
18 if existing_reprs
19 .iter()
20 .any(|it| repr_completion.label == it || repr_completion.collides.contains(&&**it))
21 {
22 continue;
23 }
24 let mut item = CompletionItem::new(
25 CompletionKind::Attribute,
26 ctx.source_range(),
27 repr_completion.label,
28 );
29 item.kind(CompletionItemKind::Attribute);
30 if let Some(lookup) = repr_completion.lookup {
31 item.lookup_by(lookup);
32 }
33 if let Some((snippet, cap)) = repr_completion.snippet.zip(ctx.config.snippet_cap) {
34 item.insert_snippet(cap, snippet);
35 }
36 item.add_to(acc);
37 }
38 }
39}
40
41struct ReprCompletion {
42 label: &'static str,
43 snippet: Option<&'static str>,
44 lookup: Option<&'static str>,
45 collides: &'static [&'static str],
46}
47
48const fn attr(label: &'static str, collides: &'static [&'static str]) -> ReprCompletion {
49 ReprCompletion { label, snippet: None, lookup: None, collides }
50}
51
52#[rustfmt::skip]
53const REPR_COMPLETIONS: &[ReprCompletion] = &[
54 ReprCompletion { label: "align($0)", snippet: Some("align($0)"), lookup: Some("align"), collides: &["transparent", "packed"] },
55 attr("packed", &["transparent", "align"]),
56 attr("transparent", &["C", "u8", "u16", "u32", "u64", "u128", "usize", "i8", "i16", "i32", "i64", "i128", "isize"]),
57 attr("C", &["transparent"]),
58 attr("u8", &["transparent", "u16", "u32", "u64", "u128", "usize", "i8", "i16", "i32", "i64", "i128", "isize"]),
59 attr("u16", &["transparent", "u8", "u32", "u64", "u128", "usize", "i8", "i16", "i32", "i64", "i128", "isize"]),
60 attr("u32", &["transparent", "u8", "u16", "u64", "u128", "usize", "i8", "i16", "i32", "i64", "i128", "isize"]),
61 attr("u64", &["transparent", "u8", "u16", "u32", "u128", "usize", "i8", "i16", "i32", "i64", "i128", "isize"]),
62 attr("u128", &["transparent", "u8", "u16", "u32", "u64", "usize", "i8", "i16", "i32", "i64", "i128", "isize"]),
63 attr("usize", &["transparent", "u8", "u16", "u32", "u64", "u128", "i8", "i16", "i32", "i64", "i128", "isize"]),
64 attr("i8", &["transparent", "u8", "u16", "u32", "u64", "u128", "usize", "i16", "i32", "i64", "i128", "isize"]),
65 attr("i16", &["transparent", "u8", "u16", "u32", "u64", "u128", "usize", "i8", "i32", "i64", "i128", "isize"]),
66 attr("i32", &["transparent", "u8", "u16", "u32", "u64", "u128", "usize", "i8", "i16", "i64", "i128", "isize"]),
67 attr("i64", &["transparent", "u8", "u16", "u32", "u64", "u128", "usize", "i8", "i16", "i32", "i128", "isize"]),
68 attr("i28", &["transparent", "u8", "u16", "u32", "u64", "u128", "usize", "i8", "i16", "i32", "i64", "isize"]),
69 attr("isize", &["transparent", "u8", "u16", "u32", "u64", "u128", "usize", "i8", "i16", "i32", "i64", "i128"]),
70];
71
72#[cfg(test)]
73mod tests {
74 use expect_test::{expect, Expect};
75
76 use crate::tests::completion_list;
77
78 fn check(ra_fixture: &str, expect: Expect) {
79 let actual = completion_list(ra_fixture);
80 expect.assert_eq(&actual);
81 }
82
83 #[test]
84 fn no_completion_for_incorrect_repr() {
85 check(r#"#[repr{$0)] struct Test;"#, expect![[]])
86 }
87
88 #[test]
89 fn empty() {
90 check(
91 r#"#[repr($0)] struct Test;"#,
92 expect![[r#"
93 at align($0)
94 at packed
95 at transparent
96 at C
97 at u8
98 at u16
99 at u32
100 at u64
101 at u128
102 at usize
103 at i8
104 at i16
105 at i32
106 at i64
107 at i28
108 at isize
109 "#]],
110 );
111 }
112
113 #[test]
114 fn transparent() {
115 check(r#"#[repr(transparent, $0)] struct Test;"#, expect![[r#""#]]);
116 }
117
118 #[test]
119 fn align() {
120 check(
121 r#"#[repr(align(1), $0)] struct Test;"#,
122 expect![[r#"
123 at align($0)
124 at transparent
125 at C
126 at u8
127 at u16
128 at u32
129 at u64
130 at u128
131 at usize
132 at i8
133 at i16
134 at i32
135 at i64
136 at i28
137 at isize
138 "#]],
139 );
140 }
141
142 #[test]
143 fn packed() {
144 check(
145 r#"#[repr(packed, $0)] struct Test;"#,
146 expect![[r#"
147 at transparent
148 at C
149 at u8
150 at u16
151 at u32
152 at u64
153 at u128
154 at usize
155 at i8
156 at i16
157 at i32
158 at i64
159 at i28
160 at isize
161 "#]],
162 );
163 }
164
165 #[test]
166 fn c() {
167 check(
168 r#"#[repr(C, $0)] struct Test;"#,
169 expect![[r#"
170 at align($0)
171 at packed
172 at u8
173 at u16
174 at u32
175 at u64
176 at u128
177 at usize
178 at i8
179 at i16
180 at i32
181 at i64
182 at i28
183 at isize
184 "#]],
185 );
186 }
187
188 #[test]
189 fn prim() {
190 check(
191 r#"#[repr(usize, $0)] struct Test;"#,
192 expect![[r#"
193 at align($0)
194 at packed
195 at C
196 "#]],
197 );
198 }
199}
diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs
index 88f4d940d..f5dbd203b 100644
--- a/crates/ide_completion/src/completions/qualified_path.rs
+++ b/crates/ide_completion/src/completions/qualified_path.rs
@@ -65,9 +65,11 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
65 // Don't suggest attribute macros and derives. 65 // Don't suggest attribute macros and derives.
66 hir::ScopeDef::MacroDef(mac) => mac.is_fn_like(), 66 hir::ScopeDef::MacroDef(mac) => mac.is_fn_like(),
67 // no values in type places 67 // no values in type places
68 hir::ScopeDef::ModuleDef(hir::ModuleDef::Function(_)) 68 hir::ScopeDef::ModuleDef(
69 | hir::ScopeDef::ModuleDef(hir::ModuleDef::Variant(_)) 69 hir::ModuleDef::Function(_)
70 | hir::ScopeDef::ModuleDef(hir::ModuleDef::Static(_)) 70 | hir::ModuleDef::Variant(_)
71 | hir::ModuleDef::Static(_),
72 )
71 | hir::ScopeDef::Local(_) => !ctx.expects_type(), 73 | hir::ScopeDef::Local(_) => !ctx.expects_type(),
72 // unless its a constant in a generic arg list position 74 // unless its a constant in a generic arg list position
73 hir::ScopeDef::ModuleDef(hir::ModuleDef::Const(_)) => { 75 hir::ScopeDef::ModuleDef(hir::ModuleDef::Const(_)) => {
@@ -81,9 +83,13 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
81 } 83 }
82 } 84 }
83 } 85 }
84 hir::PathResolution::Def(def @ hir::ModuleDef::Adt(_)) 86 hir::PathResolution::Def(
85 | hir::PathResolution::Def(def @ hir::ModuleDef::TypeAlias(_)) 87 def
86 | hir::PathResolution::Def(def @ hir::ModuleDef::BuiltinType(_)) => { 88 @
89 (hir::ModuleDef::Adt(_)
90 | hir::ModuleDef::TypeAlias(_)
91 | hir::ModuleDef::BuiltinType(_)),
92 ) => {
87 if let hir::ModuleDef::Adt(hir::Adt::Enum(e)) = def { 93 if let hir::ModuleDef::Adt(hir::Adt::Enum(e)) = def {
88 add_enum_variants(acc, ctx, e); 94 add_enum_variants(acc, ctx, e);
89 } 95 }
diff --git a/crates/ide_completion/src/completions/record.rs b/crates/ide_completion/src/completions/record.rs
index 47523f72f..e876337f1 100644
--- a/crates/ide_completion/src/completions/record.rs
+++ b/crates/ide_completion/src/completions/record.rs
@@ -48,10 +48,9 @@ pub(crate) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) ->
48#[cfg(test)] 48#[cfg(test)]
49mod tests { 49mod tests {
50 use expect_test::{expect, Expect}; 50 use expect_test::{expect, Expect};
51 use ide_db::helpers::FamousDefs;
52 51
53 use crate::{ 52 use crate::{
54 tests::{self, filtered_completion_list}, 53 tests::{check_edit, filtered_completion_list},
55 CompletionKind, 54 CompletionKind,
56 }; 55 };
57 56
@@ -61,31 +60,17 @@ mod tests {
61 } 60 }
62 61
63 fn check_snippet(ra_fixture: &str, expect: Expect) { 62 fn check_snippet(ra_fixture: &str, expect: Expect) {
64 let actual = filtered_completion_list( 63 let actual = filtered_completion_list(ra_fixture, CompletionKind::Snippet);
65 &format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE),
66 CompletionKind::Snippet,
67 );
68 expect.assert_eq(&actual); 64 expect.assert_eq(&actual);
69 } 65 }
70 66
71 fn check_edit(what: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
72 tests::check_edit(
73 what,
74 &format!(
75 "//- /main.rs crate:main deps:core{}\n{}",
76 ra_fixture_before,
77 FamousDefs::FIXTURE,
78 ),
79 &(ra_fixture_after.to_owned() + "\n"),
80 );
81 }
82
83 #[test] 67 #[test]
84 fn test_record_literal_field_default() { 68 fn test_record_literal_field_default() {
85 let test_code = r#" 69 let test_code = r#"
70//- minicore: default
86struct S { foo: u32, bar: usize } 71struct S { foo: u32, bar: usize }
87 72
88impl core::default::Default for S { 73impl Default for S {
89 fn default() -> Self { 74 fn default() -> Self {
90 S { 75 S {
91 foo: 0, 76 foo: 0,
@@ -121,9 +106,10 @@ fn process(f: S) {
121 check_edit( 106 check_edit(
122 "..Default::default()", 107 "..Default::default()",
123 r#" 108 r#"
109//- minicore: default
124struct S { foo: u32, bar: usize } 110struct S { foo: u32, bar: usize }
125 111
126impl core::default::Default for S { 112impl Default for S {
127 fn default() -> Self { 113 fn default() -> Self {
128 S { 114 S {
129 foo: 0, 115 foo: 0,
@@ -142,7 +128,7 @@ fn process(f: S) {
142 r#" 128 r#"
143struct S { foo: u32, bar: usize } 129struct S { foo: u32, bar: usize }
144 130
145impl core::default::Default for S { 131impl Default for S {
146 fn default() -> Self { 132 fn default() -> Self {
147 S { 133 S {
148 foo: 0, 134 foo: 0,
diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs
index 8ea5a2d5b..81c4fb305 100644
--- a/crates/ide_completion/src/completions/unqualified_path.rs
+++ b/crates/ide_completion/src/completions/unqualified_path.rs
@@ -74,9 +74,11 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC
74 // Don't suggest attribute macros and derives. 74 // Don't suggest attribute macros and derives.
75 ScopeDef::MacroDef(mac) => mac.is_fn_like(), 75 ScopeDef::MacroDef(mac) => mac.is_fn_like(),
76 // no values in type places 76 // no values in type places
77 ScopeDef::ModuleDef(hir::ModuleDef::Function(_)) 77 ScopeDef::ModuleDef(
78 | ScopeDef::ModuleDef(hir::ModuleDef::Variant(_)) 78 hir::ModuleDef::Function(_)
79 | ScopeDef::ModuleDef(hir::ModuleDef::Static(_)) 79 | hir::ModuleDef::Variant(_)
80 | hir::ModuleDef::Static(_),
81 )
80 | ScopeDef::Local(_) => !ctx.expects_type(), 82 | ScopeDef::Local(_) => !ctx.expects_type(),
81 // unless its a constant in a generic arg list position 83 // unless its a constant in a generic arg list position
82 ScopeDef::ModuleDef(hir::ModuleDef::Const(_)) 84 ScopeDef::ModuleDef(hir::ModuleDef::Const(_))
diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs
index d7a7e9cca..98fb36042 100644
--- a/crates/ide_completion/src/context.rs
+++ b/crates/ide_completion/src/context.rs
@@ -242,24 +242,23 @@ impl<'a> CompletionContext<'a> {
242 } 242 }
243 243
244 pub(crate) fn expects_assoc_item(&self) -> bool { 244 pub(crate) fn expects_assoc_item(&self) -> bool {
245 matches!( 245 matches!(self.completion_location, Some(ImmediateLocation::Trait | ImmediateLocation::Impl))
246 self.completion_location,
247 Some(ImmediateLocation::Trait) | Some(ImmediateLocation::Impl)
248 )
249 } 246 }
250 247
251 pub(crate) fn has_dot_receiver(&self) -> bool { 248 pub(crate) fn has_dot_receiver(&self) -> bool {
252 matches!( 249 matches!(
253 &self.completion_location, 250 &self.completion_location,
254 Some(ImmediateLocation::FieldAccess { receiver, .. }) | Some(ImmediateLocation::MethodCall { receiver,.. }) 251 Some(ImmediateLocation::FieldAccess { receiver, .. } | ImmediateLocation::MethodCall { receiver,.. })
255 if receiver.is_some() 252 if receiver.is_some()
256 ) 253 )
257 } 254 }
258 255
259 pub(crate) fn dot_receiver(&self) -> Option<&ast::Expr> { 256 pub(crate) fn dot_receiver(&self) -> Option<&ast::Expr> {
260 match &self.completion_location { 257 match &self.completion_location {
261 Some(ImmediateLocation::MethodCall { receiver, .. }) 258 Some(
262 | Some(ImmediateLocation::FieldAccess { receiver, .. }) => receiver.as_ref(), 259 ImmediateLocation::MethodCall { receiver, .. }
260 | ImmediateLocation::FieldAccess { receiver, .. },
261 ) => receiver.as_ref(),
263 _ => None, 262 _ => None,
264 } 263 }
265 } 264 }
@@ -283,7 +282,7 @@ impl<'a> CompletionContext<'a> {
283 pub(crate) fn expects_ident_pat_or_ref_expr(&self) -> bool { 282 pub(crate) fn expects_ident_pat_or_ref_expr(&self) -> bool {
284 matches!( 283 matches!(
285 self.completion_location, 284 self.completion_location,
286 Some(ImmediateLocation::IdentPat) | Some(ImmediateLocation::RefExpr) 285 Some(ImmediateLocation::IdentPat | ImmediateLocation::RefExpr)
287 ) 286 )
288 } 287 }
289 288
@@ -294,14 +293,14 @@ impl<'a> CompletionContext<'a> {
294 pub(crate) fn in_use_tree(&self) -> bool { 293 pub(crate) fn in_use_tree(&self) -> bool {
295 matches!( 294 matches!(
296 self.completion_location, 295 self.completion_location,
297 Some(ImmediateLocation::Use) | Some(ImmediateLocation::UseTree) 296 Some(ImmediateLocation::Use | ImmediateLocation::UseTree)
298 ) 297 )
299 } 298 }
300 299
301 pub(crate) fn has_impl_or_trait_prev_sibling(&self) -> bool { 300 pub(crate) fn has_impl_or_trait_prev_sibling(&self) -> bool {
302 matches!( 301 matches!(
303 self.prev_sibling, 302 self.prev_sibling,
304 Some(ImmediatePrevSibling::ImplDefType) | Some(ImmediatePrevSibling::TraitDefName) 303 Some(ImmediatePrevSibling::ImplDefType | ImmediatePrevSibling::TraitDefName)
305 ) 304 )
306 } 305 }
307 306
@@ -322,14 +321,16 @@ impl<'a> CompletionContext<'a> {
322 || self.previous_token_is(T![unsafe]) 321 || self.previous_token_is(T![unsafe])
323 || matches!( 322 || matches!(
324 self.prev_sibling, 323 self.prev_sibling,
325 Some(ImmediatePrevSibling::Attribute) | Some(ImmediatePrevSibling::Visibility) 324 Some(ImmediatePrevSibling::Attribute | ImmediatePrevSibling::Visibility)
326 ) 325 )
327 || matches!( 326 || matches!(
328 self.completion_location, 327 self.completion_location,
329 Some(ImmediateLocation::Attribute(_)) 328 Some(
330 | Some(ImmediateLocation::ModDeclaration(_)) 329 ImmediateLocation::Attribute(_)
331 | Some(ImmediateLocation::RecordPat(_)) 330 | ImmediateLocation::ModDeclaration(_)
332 | Some(ImmediateLocation::RecordExpr(_)) 331 | ImmediateLocation::RecordPat(_)
332 | ImmediateLocation::RecordExpr(_)
333 )
333 ) 334 )
334 } 335 }
335 336
diff --git a/crates/ide_completion/src/render/builder_ext.rs b/crates/ide_completion/src/render/builder_ext.rs
index 749dfc665..33d3a5ee1 100644
--- a/crates/ide_completion/src/render/builder_ext.rs
+++ b/crates/ide_completion/src/render/builder_ext.rs
@@ -32,7 +32,7 @@ impl Builder {
32 cov_mark::hit!(no_parens_in_use_item); 32 cov_mark::hit!(no_parens_in_use_item);
33 return false; 33 return false;
34 } 34 }
35 if matches!(ctx.path_call_kind(), Some(CallKind::Expr) | Some(CallKind::Pat)) 35 if matches!(ctx.path_call_kind(), Some(CallKind::Expr | CallKind::Pat))
36 | matches!( 36 | matches!(
37 ctx.completion_location, 37 ctx.completion_location,
38 Some(ImmediateLocation::MethodCall { has_parens: true, .. }) 38 Some(ImmediateLocation::MethodCall { has_parens: true, .. })
diff --git a/crates/ide_db/src/helpers.rs b/crates/ide_db/src/helpers.rs
index 00900cdc2..d96028cbc 100644
--- a/crates/ide_db/src/helpers.rs
+++ b/crates/ide_db/src/helpers.rs
@@ -74,12 +74,19 @@ pub fn visit_file_defs(
74/// somewhat similar to the known paths infra inside hir, but it different; We 74/// somewhat similar to the known paths infra inside hir, but it different; We
75/// want to make sure that IDE specific paths don't become interesting inside 75/// want to make sure that IDE specific paths don't become interesting inside
76/// the compiler itself as well. 76/// the compiler itself as well.
77///
78/// Note that, by default, rust-analyzer tests **do not** include core or std
79/// libraries. If you are writing tests for functionality using [`FamousDefs`],
80/// you'd want to include [minicore](test_utils::MiniCore) declaration at the
81/// start of your tests:
82///
83/// ```
84/// //- minicore: iterator, ord, derive
85/// ```
77pub struct FamousDefs<'a, 'b>(pub &'a Semantics<'b, RootDatabase>, pub Option<Crate>); 86pub struct FamousDefs<'a, 'b>(pub &'a Semantics<'b, RootDatabase>, pub Option<Crate>);
78 87
79#[allow(non_snake_case)] 88#[allow(non_snake_case)]
80impl FamousDefs<'_, '_> { 89impl FamousDefs<'_, '_> {
81 pub const FIXTURE: &'static str = include_str!("helpers/famous_defs_fixture.rs");
82
83 pub fn std(&self) -> Option<Crate> { 90 pub fn std(&self) -> Option<Crate> {
84 self.find_crate("std") 91 self.find_crate("std")
85 } 92 }
diff --git a/crates/ide_db/src/helpers/famous_defs_fixture.rs b/crates/ide_db/src/helpers/famous_defs_fixture.rs
deleted file mode 100644
index 551203936..000000000
--- a/crates/ide_db/src/helpers/famous_defs_fixture.rs
+++ /dev/null
@@ -1,59 +0,0 @@
1//- /libcore.rs crate:core
2//! Signatures of traits, types and functions from the core lib for use in tests.
3pub mod cmp {
4
5 pub trait Ord {
6 fn cmp(&self, other: &Self) -> Ordering;
7 fn max(self, other: Self) -> Self;
8 fn min(self, other: Self) -> Self;
9 fn clamp(self, min: Self, max: Self) -> Self;
10 }
11}
12
13pub mod convert {
14 pub trait From<T> {
15 fn from(t: T) -> Self;
16 }
17
18 pub trait Into<T> {
19 pub fn into(self) -> T;
20 }
21}
22
23pub mod default {
24 pub trait Default {
25 fn default() -> Self;
26 }
27}
28
29pub mod option {
30 pub enum Option<T> {
31 None,
32 Some(T),
33 }
34}
35
36pub mod prelude {
37 pub mod rust_2018 {
38 pub use crate::{
39 cmp::Ord,
40 convert::{From, Into},
41 default::Default,
42 iter::{IntoIterator, Iterator},
43 ops::{Fn, FnMut, FnOnce},
44 option::Option::{self, *},
45 };
46 }
47}
48#[prelude_import]
49pub use prelude::rust_2018::*;
50//- /libstd.rs crate:std deps:core
51//! Signatures of traits, types and functions from the std lib for use in tests.
52
53/// Docs for return_keyword
54mod return_keyword {}
55
56/// Docs for prim_str
57mod prim_str {}
58
59pub use core::ops;
diff --git a/crates/mbe/src/expander/matcher.rs b/crates/mbe/src/expander/matcher.rs
index c2a9a38c9..b4f2fe9a4 100644
--- a/crates/mbe/src/expander/matcher.rs
+++ b/crates/mbe/src/expander/matcher.rs
@@ -804,33 +804,17 @@ impl<'a> TtIter<'a> {
804 }; 804 };
805 805
806 match (punct.char, second, third) { 806 match (punct.char, second, third) {
807 ('.', '.', Some('.')) 807 ('.', '.', Some('.' | '=')) | ('<', '<', Some('=')) | ('>', '>', Some('=')) => {
808 | ('.', '.', Some('='))
809 | ('<', '<', Some('='))
810 | ('>', '>', Some('=')) => {
811 let tt2 = self.next().unwrap().clone(); 808 let tt2 = self.next().unwrap().clone();
812 let tt3 = self.next().unwrap().clone(); 809 let tt3 = self.next().unwrap().clone();
813 Ok(tt::Subtree { delimiter: None, token_trees: vec![tt, tt2, tt3] }.into()) 810 Ok(tt::Subtree { delimiter: None, token_trees: vec![tt, tt2, tt3] }.into())
814 } 811 }
815 ('-', '=', _) 812 ('-' | '!' | '*' | '/' | '&' | '%' | '^' | '+' | '<' | '=' | '>' | '|', '=', _)
816 | ('-', '>', _) 813 | ('-' | '=' | '>', '>', _)
817 | (':', ':', _) 814 | (':', ':', _)
818 | ('!', '=', _)
819 | ('.', '.', _) 815 | ('.', '.', _)
820 | ('*', '=', _)
821 | ('/', '=', _)
822 | ('&', '&', _) 816 | ('&', '&', _)
823 | ('&', '=', _)
824 | ('%', '=', _)
825 | ('^', '=', _)
826 | ('+', '=', _)
827 | ('<', '<', _) 817 | ('<', '<', _)
828 | ('<', '=', _)
829 | ('=', '=', _)
830 | ('=', '>', _)
831 | ('>', '=', _)
832 | ('>', '>', _)
833 | ('|', '=', _)
834 | ('|', '|', _) => { 818 | ('|', '|', _) => {
835 let tt2 = self.next().unwrap().clone(); 819 let tt2 = self.next().unwrap().clone();
836 Ok(tt::Subtree { delimiter: None, token_trees: vec![tt, tt2] }.into()) 820 Ok(tt::Subtree { delimiter: None, token_trees: vec![tt, tt2] }.into())
diff --git a/crates/parser/src/grammar/params.rs b/crates/parser/src/grammar/params.rs
index 01ee26a53..5a78675fb 100644
--- a/crates/parser/src/grammar/params.rs
+++ b/crates/parser/src/grammar/params.rs
@@ -184,8 +184,7 @@ fn opt_self_param(p: &mut Parser, m: Marker) -> Result<(), Marker> {
184 if !matches!( 184 if !matches!(
185 (p.current(), la1, la2, la3), 185 (p.current(), la1, la2, la3),
186 (T![&], T![self], _, _) 186 (T![&], T![self], _, _)
187 | (T![&], T![mut], T![self], _) 187 | (T![&], T![mut] | LIFETIME_IDENT, T![self], _)
188 | (T![&], LIFETIME_IDENT, T![self], _)
189 | (T![&], LIFETIME_IDENT, T![mut], T![self]) 188 | (T![&], LIFETIME_IDENT, T![mut], T![self])
190 ) { 189 ) {
191 return Err(m); 190 return Err(m);
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt b/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt
index d5ab03576..a7f936a70 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt
@@ -54,7 +54,7 @@
54 source: Some( 54 source: Some(
55 "rustc", 55 "rustc",
56 ), 56 ),
57 message: "can\'t compare `{integer}` with `&str`\nthe trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`", 57 message: "can't compare `{integer}` with `&str`\nthe trait `std::cmp::PartialEq<&str>` is not implemented for `{integer}`",
58 related_information: None, 58 related_information: None,
59 tags: None, 59 tags: None,
60 data: None, 60 data: None,
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt
index ada540ea6..afc562a0e 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt
@@ -54,7 +54,7 @@
54 source: Some( 54 source: Some(
55 "rustc", 55 "rustc",
56 ), 56 ),
57 message: "method `next` has an incompatible type for trait\nexpected type `fn(&mut ty::list_iter::ListIterator<\'list, M>) -> std::option::Option<&ty::Ref<M>>`\n found type `fn(&ty::list_iter::ListIterator<\'list, M>) -> std::option::Option<&\'list ty::Ref<M>>`", 57 message: "method `next` has an incompatible type for trait\nexpected type `fn(&mut ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&ty::Ref<M>>`\n found type `fn(&ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&'list ty::Ref<M>>`",
58 related_information: None, 58 related_information: None,
59 tags: None, 59 tags: None,
60 data: None, 60 data: None,
diff --git a/crates/syntax/test_data/lexer/err/0001_unclosed_char_at_eof.txt b/crates/syntax/test_data/lexer/err/0001_unclosed_char_at_eof.txt
index 4d5ad74df..135f49552 100644
--- a/crates/syntax/test_data/lexer/err/0001_unclosed_char_at_eof.txt
+++ b/crates/syntax/test_data/lexer/err/0001_unclosed_char_at_eof.txt
@@ -1,2 +1,2 @@
1CHAR 1 "\'" 1CHAR 1 "'"
2> error0..1 token("\'") msg(Missing trailing `'` symbol to terminate the character literal) 2> error0..1 token("'") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.txt b/crates/syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.txt
index eafdb3c7c..cc3933d95 100644
--- a/crates/syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.txt
+++ b/crates/syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.txt
@@ -1,2 +1,2 @@
1CHAR 5 "\'🦀" 1CHAR 5 "'🦀"
2> error0..5 token("\'🦀") msg(Missing trailing `'` symbol to terminate the character literal) 2> error0..5 token("'🦀") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.txt b/crates/syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.txt
index cc2b4866a..21d990e6f 100644
--- a/crates/syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.txt
+++ b/crates/syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.txt
@@ -1,2 +1,2 @@
1CHAR 5 "\'\\x7f" 1CHAR 5 "'\\x7f"
2> error0..5 token("\'\\x7f") msg(Missing trailing `'` symbol to terminate the character literal) 2> error0..5 token("'\\x7f") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.txt b/crates/syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.txt
index a6d422cb3..055dba64c 100644
--- a/crates/syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.txt
+++ b/crates/syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.txt
@@ -1,2 +1,2 @@
1CHAR 9 "\'\\u{20AA}" 1CHAR 9 "'\\u{20AA}"
2> error0..9 token("\'\\u{20AA}") msg(Missing trailing `'` symbol to terminate the character literal) 2> error0..9 token("'\\u{20AA}") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0005_unclosed_char_with_space.txt b/crates/syntax/test_data/lexer/err/0005_unclosed_char_with_space.txt
index 47e7baa70..9ee5e93fa 100644
--- a/crates/syntax/test_data/lexer/err/0005_unclosed_char_with_space.txt
+++ b/crates/syntax/test_data/lexer/err/0005_unclosed_char_with_space.txt
@@ -1,2 +1,2 @@
1CHAR 2 "\' " 1CHAR 2 "' "
2> error0..2 token("\' ") msg(Missing trailing `'` symbol to terminate the character literal) 2> error0..2 token("' ") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0006_unclosed_char_with_slash.txt b/crates/syntax/test_data/lexer/err/0006_unclosed_char_with_slash.txt
index 511029d80..dc3a596f6 100644
--- a/crates/syntax/test_data/lexer/err/0006_unclosed_char_with_slash.txt
+++ b/crates/syntax/test_data/lexer/err/0006_unclosed_char_with_slash.txt
@@ -1,2 +1,2 @@
1CHAR 2 "\'\\" 1CHAR 2 "'\\"
2> error0..2 token("\'\\") msg(Missing trailing `'` symbol to terminate the character literal) 2> error0..2 token("'\\") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.txt b/crates/syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.txt
index d2ba5742c..e46edea98 100644
--- a/crates/syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.txt
+++ b/crates/syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.txt
@@ -1,2 +1,2 @@
1CHAR 3 "\'\\n" 1CHAR 3 "'\\n"
2> error0..3 token("\'\\n") msg(Missing trailing `'` symbol to terminate the character literal) 2> error0..3 token("'\\n") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.txt b/crates/syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.txt
index ae9a7f0e2..8ad1e913a 100644
--- a/crates/syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.txt
+++ b/crates/syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.txt
@@ -1,2 +1,2 @@
1CHAR 3 "\'\\\'" 1CHAR 3 "'\\'"
2> error0..3 token("\'\\\'") msg(Missing trailing `'` symbol to terminate the character literal) 2> error0..3 token("'\\'") msg(Missing trailing `'` symbol to terminate the character literal)
diff --git a/crates/syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.txt b/crates/syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.txt
index ff1504592..9d30c7466 100644
--- a/crates/syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.txt
+++ b/crates/syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.txt
@@ -1,2 +1,2 @@
1BYTE 2 "b\'" 1BYTE 2 "b'"
2> error0..2 token("b\'") msg(Missing trailing `'` symbol to terminate the byte literal) 2> error0..2 token("b'") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.txt b/crates/syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.txt
index 34f7bd6d4..9dbf4203e 100644
--- a/crates/syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.txt
+++ b/crates/syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.txt
@@ -1,2 +1,2 @@
1BYTE 6 "b\'🦀" 1BYTE 6 "b'🦀"
2> error0..6 token("b\'🦀") msg(Missing trailing `'` symbol to terminate the byte literal) 2> error0..6 token("b'🦀") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.txt b/crates/syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.txt
index c964d0f00..d5d9c2ef7 100644
--- a/crates/syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.txt
+++ b/crates/syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.txt
@@ -1,2 +1,2 @@
1BYTE 6 "b\'\\x7f" 1BYTE 6 "b'\\x7f"
2> error0..6 token("b\'\\x7f") msg(Missing trailing `'` symbol to terminate the byte literal) 2> error0..6 token("b'\\x7f") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.txt b/crates/syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.txt
index cc65fb86f..a99b9666a 100644
--- a/crates/syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.txt
+++ b/crates/syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.txt
@@ -1,2 +1,2 @@
1BYTE 10 "b\'\\u{20AA}" 1BYTE 10 "b'\\u{20AA}"
2> error0..10 token("b\'\\u{20AA}") msg(Missing trailing `'` symbol to terminate the byte literal) 2> error0..10 token("b'\\u{20AA}") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0013_unclosed_byte_with_space.txt b/crates/syntax/test_data/lexer/err/0013_unclosed_byte_with_space.txt
index 800834a14..8a344f712 100644
--- a/crates/syntax/test_data/lexer/err/0013_unclosed_byte_with_space.txt
+++ b/crates/syntax/test_data/lexer/err/0013_unclosed_byte_with_space.txt
@@ -1,2 +1,2 @@
1BYTE 3 "b\' " 1BYTE 3 "b' "
2> error0..3 token("b\' ") msg(Missing trailing `'` symbol to terminate the byte literal) 2> error0..3 token("b' ") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.txt b/crates/syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.txt
index 7b85ee646..b78a43c02 100644
--- a/crates/syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.txt
+++ b/crates/syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.txt
@@ -1,2 +1,2 @@
1BYTE 3 "b\'\\" 1BYTE 3 "b'\\"
2> error0..3 token("b\'\\") msg(Missing trailing `'` symbol to terminate the byte literal) 2> error0..3 token("b'\\") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.txt b/crates/syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.txt
index 4b9a63117..5147363ba 100644
--- a/crates/syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.txt
+++ b/crates/syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.txt
@@ -1,2 +1,2 @@
1BYTE 4 "b\'\\n" 1BYTE 4 "b'\\n"
2> error0..4 token("b\'\\n") msg(Missing trailing `'` symbol to terminate the byte literal) 2> error0..4 token("b'\\n") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.txt b/crates/syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.txt
index fe337f8d3..261c0894f 100644
--- a/crates/syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.txt
+++ b/crates/syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.txt
@@ -1,2 +1,2 @@
1BYTE 4 "b\'\\\'" 1BYTE 4 "b'\\'"
2> error0..4 token("b\'\\\'") msg(Missing trailing `'` symbol to terminate the byte literal) 2> error0..4 token("b'\\'") msg(Missing trailing `'` symbol to terminate the byte literal)
diff --git a/crates/syntax/test_data/lexer/err/0057_lifetime_starts_with_a_number.txt b/crates/syntax/test_data/lexer/err/0057_lifetime_starts_with_a_number.txt
index 11e0ae14a..b746404d2 100644
--- a/crates/syntax/test_data/lexer/err/0057_lifetime_starts_with_a_number.txt
+++ b/crates/syntax/test_data/lexer/err/0057_lifetime_starts_with_a_number.txt
@@ -1,6 +1,6 @@
1LIFETIME_IDENT 2 "\'1" 1LIFETIME_IDENT 2 "'1"
2WHITESPACE 1 "\n" 2WHITESPACE 1 "\n"
3LIFETIME_IDENT 10 "\'1lifetime" 3LIFETIME_IDENT 10 "'1lifetime"
4WHITESPACE 1 "\n" 4WHITESPACE 1 "\n"
5> error0..2 token("\'1") msg(Lifetime name cannot start with a number) 5> error0..2 token("'1") msg(Lifetime name cannot start with a number)
6> error3..13 token("\'1lifetime") msg(Lifetime name cannot start with a number) 6> error3..13 token("'1lifetime") msg(Lifetime name cannot start with a number)
diff --git a/crates/syntax/test_data/lexer/ok/0006_chars.txt b/crates/syntax/test_data/lexer/ok/0006_chars.txt
index 950954fbc..756477dc9 100644
--- a/crates/syntax/test_data/lexer/ok/0006_chars.txt
+++ b/crates/syntax/test_data/lexer/ok/0006_chars.txt
@@ -1,16 +1,16 @@
1CHAR 3 "\'x\'" 1CHAR 3 "'x'"
2WHITESPACE 1 " " 2WHITESPACE 1 " "
3CHAR 3 "\' \'" 3CHAR 3 "' '"
4WHITESPACE 1 " " 4WHITESPACE 1 " "
5CHAR 3 "\'0\'" 5CHAR 3 "'0'"
6WHITESPACE 1 " " 6WHITESPACE 1 " "
7CHAR 7 "\'hello\'" 7CHAR 7 "'hello'"
8WHITESPACE 1 " " 8WHITESPACE 1 " "
9CHAR 6 "\'\\x7f\'" 9CHAR 6 "'\\x7f'"
10WHITESPACE 1 " " 10WHITESPACE 1 " "
11CHAR 4 "\'\\n\'" 11CHAR 4 "'\\n'"
12WHITESPACE 1 " " 12WHITESPACE 1 " "
13CHAR 4 "\'\\\\\'" 13CHAR 4 "'\\\\'"
14WHITESPACE 1 " " 14WHITESPACE 1 " "
15CHAR 4 "\'\\\'\'" 15CHAR 4 "'\\''"
16WHITESPACE 1 "\n" 16WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/lexer/ok/0007_lifetimes.txt b/crates/syntax/test_data/lexer/ok/0007_lifetimes.txt
index 4d6625c3a..32ed9ed50 100644
--- a/crates/syntax/test_data/lexer/ok/0007_lifetimes.txt
+++ b/crates/syntax/test_data/lexer/ok/0007_lifetimes.txt
@@ -1,8 +1,8 @@
1LIFETIME_IDENT 2 "\'a" 1LIFETIME_IDENT 2 "'a"
2WHITESPACE 1 " " 2WHITESPACE 1 " "
3LIFETIME_IDENT 4 "\'foo" 3LIFETIME_IDENT 4 "'foo"
4WHITESPACE 1 " " 4WHITESPACE 1 " "
5LIFETIME_IDENT 12 "\'foo_bar_baz" 5LIFETIME_IDENT 12 "'foo_bar_baz"
6WHITESPACE 1 " " 6WHITESPACE 1 " "
7LIFETIME_IDENT 2 "\'_" 7LIFETIME_IDENT 2 "'_"
8WHITESPACE 1 "\n" 8WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/lexer/ok/0008_byte_strings.txt b/crates/syntax/test_data/lexer/ok/0008_byte_strings.txt
index e61ad99be..06d6bdd1f 100644
--- a/crates/syntax/test_data/lexer/ok/0008_byte_strings.txt
+++ b/crates/syntax/test_data/lexer/ok/0008_byte_strings.txt
@@ -1,22 +1,22 @@
1BYTE 3 "b\'\'" 1BYTE 3 "b''"
2WHITESPACE 1 " " 2WHITESPACE 1 " "
3BYTE 4 "b\'x\'" 3BYTE 4 "b'x'"
4WHITESPACE 1 " " 4WHITESPACE 1 " "
5BYTE_STRING 6 "b\"foo\"" 5BYTE_STRING 6 "b\"foo\""
6WHITESPACE 1 " " 6WHITESPACE 1 " "
7BYTE_STRING 4 "br\"\"" 7BYTE_STRING 4 "br\"\""
8WHITESPACE 1 "\n" 8WHITESPACE 1 "\n"
9BYTE 6 "b\'\'suf" 9BYTE 6 "b''suf"
10WHITESPACE 1 " " 10WHITESPACE 1 " "
11BYTE_STRING 5 "b\"\"ix" 11BYTE_STRING 5 "b\"\"ix"
12WHITESPACE 1 " " 12WHITESPACE 1 " "
13BYTE_STRING 6 "br\"\"br" 13BYTE_STRING 6 "br\"\"br"
14WHITESPACE 1 "\n" 14WHITESPACE 1 "\n"
15BYTE 5 "b\'\\n\'" 15BYTE 5 "b'\\n'"
16WHITESPACE 1 " " 16WHITESPACE 1 " "
17BYTE 5 "b\'\\\\\'" 17BYTE 5 "b'\\\\'"
18WHITESPACE 1 " " 18WHITESPACE 1 " "
19BYTE 5 "b\'\\\'\'" 19BYTE 5 "b'\\''"
20WHITESPACE 1 " " 20WHITESPACE 1 " "
21BYTE 8 "b\'hello\'" 21BYTE 8 "b'hello'"
22WHITESPACE 1 "\n" 22WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/parser/err/0024_many_type_parens.rast b/crates/syntax/test_data/parser/err/0024_many_type_parens.rast
index 4c4ddf5ec..be4a62940 100644
--- a/crates/syntax/test_data/parser/err/0024_many_type_parens.rast
+++ b/crates/syntax/test_data/parser/err/0024_many_type_parens.rast
@@ -43,7 +43,7 @@ [email protected]
43 [email protected] "<" 43 [email protected] "<"
44 [email protected] 44 [email protected]
45 [email protected] 45 [email protected]
46 [email protected] "\'a" 46 [email protected] "'a"
47 [email protected] ">" 47 [email protected] ">"
48 [email protected] " " 48 [email protected] " "
49 [email protected] 49 [email protected]
@@ -55,7 +55,7 @@ [email protected]
55 [email protected] "<" 55 [email protected] "<"
56 [email protected] 56 [email protected]
57 [email protected] 57 [email protected]
58 [email protected] "\'a" 58 [email protected] "'a"
59 [email protected] ">" 59 [email protected] ">"
60 [email protected] ")" 60 [email protected] ")"
61 [email protected] ">" 61 [email protected] ">"
@@ -128,7 +128,7 @@ [email protected]
128 [email protected] "<" 128 [email protected] "<"
129 [email protected] 129 [email protected]
130 [email protected] 130 [email protected]
131 [email protected] "\'a" 131 [email protected] "'a"
132 [email protected] ">" 132 [email protected] ">"
133 [email protected] " " 133 [email protected] " "
134 [email protected] 134 [email protected]
@@ -140,7 +140,7 @@ [email protected]
140 [email protected] "<" 140 [email protected] "<"
141 [email protected] 141 [email protected]
142 [email protected] 142 [email protected]
143 [email protected] "\'a" 143 [email protected] "'a"
144 [email protected] ">" 144 [email protected] ">"
145 [email protected] ")" 145 [email protected] ")"
146 [email protected] 146 [email protected]
@@ -191,7 +191,7 @@ [email protected]
191 [email protected] 191 [email protected]
192 [email protected] "<" 192 [email protected] "<"
193 [email protected] 193 [email protected]
194 [email protected] "\'a" 194 [email protected] "'a"
195 [email protected] ">" 195 [email protected] ">"
196 [email protected] " " 196 [email protected] " "
197 [email protected] 197 [email protected]
@@ -205,7 +205,7 @@ [email protected]
205 [email protected] "Trait" 205 [email protected] "Trait"
206 [email protected] "<" 206 [email protected] "<"
207 [email protected] 207 [email protected]
208 [email protected] "\'a" 208 [email protected] "'a"
209 [email protected] ">" 209 [email protected] ">"
210 [email protected] 210 [email protected]
211 [email protected] ")" 211 [email protected] ")"
@@ -250,7 +250,7 @@ [email protected]
250 [email protected] "<" 250 [email protected] "<"
251 [email protected] 251 [email protected]
252 [email protected] 252 [email protected]
253 [email protected] "\'a" 253 [email protected] "'a"
254 [email protected] ">" 254 [email protected] ">"
255 [email protected] " " 255 [email protected] " "
256 [email protected] 256 [email protected]
@@ -262,7 +262,7 @@ [email protected]
262 [email protected] "<" 262 [email protected] "<"
263 [email protected] 263 [email protected]
264 [email protected] 264 [email protected]
265 [email protected] "\'a" 265 [email protected] "'a"
266 [email protected] ">" 266 [email protected] ">"
267 [email protected] ")" 267 [email protected] ")"
268 [email protected] " " 268 [email protected] " "
diff --git a/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast b/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast
index c5215d6b1..b021783fc 100644
--- a/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast
+++ b/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast
@@ -17,7 +17,7 @@ [email protected]
17 [email protected] "<" 17 [email protected] "<"
18 [email protected] 18 [email protected]
19 [email protected] 19 [email protected]
20 [email protected] "\'a" 20 [email protected] "'a"
21 [email protected] ">" 21 [email protected] ">"
22 [email protected] "\n" 22 [email protected] "\n"
23 [email protected] 23 [email protected]
diff --git a/crates/syntax/test_data/parser/err/0043_weird_blocks.rast b/crates/syntax/test_data/parser/err/0043_weird_blocks.rast
index e73bd1aea..e24f01e29 100644
--- a/crates/syntax/test_data/parser/err/0043_weird_blocks.rast
+++ b/crates/syntax/test_data/parser/err/0043_weird_blocks.rast
@@ -55,7 +55,7 @@ [email protected]
55 [email protected] 55 [email protected]
56 [email protected] 56 [email protected]
57 [email protected] 57 [email protected]
58 [email protected] "\'label" 58 [email protected] "'label"
59 [email protected] ":" 59 [email protected] ":"
60 [email protected] " " 60 [email protected] " "
61 [email protected] 61 [email protected]
diff --git a/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast b/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast
index cc54185e5..a2460a7ec 100644
--- a/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast
+++ b/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast
@@ -13,13 +13,13 @@ [email protected]
13 [email protected] "<" 13 [email protected] "<"
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 [email protected] "\'a" 16 [email protected] "'a"
17 [email protected] ">" 17 [email protected] ">"
18 [email protected] " " 18 [email protected] " "
19 [email protected] 19 [email protected]
20 [email protected] "&" 20 [email protected] "&"
21 [email protected] 21 [email protected]
22 [email protected] "\'a" 22 [email protected] "'a"
23 [email protected] " " 23 [email protected] " "
24 [email protected] 24 [email protected]
25 [email protected] 25 [email protected]
@@ -42,7 +42,7 @@ [email protected]
42 [email protected] "<" 42 [email protected] "<"
43 [email protected] 43 [email protected]
44 [email protected] 44 [email protected]
45 [email protected] "\'a" 45 [email protected] "'a"
46 [email protected] ">" 46 [email protected] ">"
47 [email protected] " " 47 [email protected] " "
48 [email protected] 48 [email protected]
@@ -50,7 +50,7 @@ [email protected]
50 [email protected] 50 [email protected]
51 [email protected] "&" 51 [email protected] "&"
52 [email protected] 52 [email protected]
53 [email protected] "\'a" 53 [email protected] "'a"
54 [email protected] " " 54 [email protected] " "
55 [email protected] 55 [email protected]
56 [email protected] 56 [email protected]
@@ -75,7 +75,7 @@ [email protected]
75 [email protected] "<" 75 [email protected] "<"
76 [email protected] 76 [email protected]
77 [email protected] 77 [email protected]
78 [email protected] "\'a" 78 [email protected] "'a"
79 [email protected] ">" 79 [email protected] ">"
80 [email protected] " " 80 [email protected] " "
81 [email protected] 81 [email protected]
@@ -102,7 +102,7 @@ [email protected]
102 [email protected] "<" 102 [email protected] "<"
103 [email protected] 103 [email protected]
104 [email protected] 104 [email protected]
105 [email protected] "\'a" 105 [email protected] "'a"
106 [email protected] ">" 106 [email protected] ">"
107 [email protected] " " 107 [email protected] " "
108 [email protected] 108 [email protected]
@@ -111,7 +111,7 @@ [email protected]
111 [email protected] "<" 111 [email protected] "<"
112 [email protected] 112 [email protected]
113 [email protected] 113 [email protected]
114 [email protected] "\'b" 114 [email protected] "'b"
115 [email protected] ">" 115 [email protected] ">"
116 [email protected] " " 116 [email protected] " "
117 [email protected] 117 [email protected]
@@ -122,7 +122,7 @@ [email protected]
122 [email protected] 122 [email protected]
123 [email protected] "&" 123 [email protected] "&"
124 [email protected] 124 [email protected]
125 [email protected] "\'a" 125 [email protected] "'a"
126 [email protected] " " 126 [email protected] " "
127 [email protected] 127 [email protected]
128 [email protected] 128 [email protected]
@@ -135,7 +135,7 @@ [email protected]
135 [email protected] 135 [email protected]
136 [email protected] "&" 136 [email protected] "&"
137 [email protected] 137 [email protected]
138 [email protected] "\'b" 138 [email protected] "'b"
139 [email protected] " " 139 [email protected] " "
140 [email protected] 140 [email protected]
141 [email protected] 141 [email protected]
@@ -169,7 +169,7 @@ [email protected]
169 [email protected] "<" 169 [email protected] "<"
170 [email protected] 170 [email protected]
171 [email protected] 171 [email protected]
172 [email protected] "\'a" 172 [email protected] "'a"
173 [email protected] ">" 173 [email protected] ">"
174 [email protected] " " 174 [email protected] " "
175 [email protected] 175 [email protected]
@@ -178,7 +178,7 @@ [email protected]
178 [email protected] "<" 178 [email protected] "<"
179 [email protected] 179 [email protected]
180 [email protected] 180 [email protected]
181 [email protected] "\'b" 181 [email protected] "'b"
182 [email protected] ">" 182 [email protected] ">"
183 [email protected] " " 183 [email protected] " "
184 [email protected] 184 [email protected]
@@ -187,7 +187,7 @@ [email protected]
187 [email protected] "<" 187 [email protected] "<"
188 [email protected] 188 [email protected]
189 [email protected] 189 [email protected]
190 [email protected] "\'c" 190 [email protected] "'c"
191 [email protected] ">" 191 [email protected] ">"
192 [email protected] " " 192 [email protected] " "
193 [email protected] 193 [email protected]
@@ -198,7 +198,7 @@ [email protected]
198 [email protected] 198 [email protected]
199 [email protected] "&" 199 [email protected] "&"
200 [email protected] 200 [email protected]
201 [email protected] "\'a" 201 [email protected] "'a"
202 [email protected] " " 202 [email protected] " "
203 [email protected] 203 [email protected]
204 [email protected] 204 [email protected]
@@ -211,7 +211,7 @@ [email protected]
211 [email protected] 211 [email protected]
212 [email protected] "&" 212 [email protected] "&"
213 [email protected] 213 [email protected]
214 [email protected] "\'b" 214 [email protected] "'b"
215 [email protected] " " 215 [email protected] " "
216 [email protected] 216 [email protected]
217 [email protected] 217 [email protected]
@@ -224,7 +224,7 @@ [email protected]
224 [email protected] 224 [email protected]
225 [email protected] "&" 225 [email protected] "&"
226 [email protected] 226 [email protected]
227 [email protected] "\'c" 227 [email protected] "'c"
228 [email protected] " " 228 [email protected] " "
229 [email protected] 229 [email protected]
230 [email protected] 230 [email protected]
diff --git a/crates/syntax/test_data/parser/err/0046_ambiguous_trait_object.rast b/crates/syntax/test_data/parser/err/0046_ambiguous_trait_object.rast
index 7049f4734..6eaa32b96 100644
--- a/crates/syntax/test_data/parser/err/0046_ambiguous_trait_object.rast
+++ b/crates/syntax/test_data/parser/err/0046_ambiguous_trait_object.rast
@@ -8,7 +8,7 @@ [email protected]
8 [email protected] "<" 8 [email protected] "<"
9 [email protected] 9 [email protected]
10 [email protected] 10 [email protected]
11 [email protected] "\'a" 11 [email protected] "'a"
12 [email protected] ">" 12 [email protected] ">"
13 [email protected] " " 13 [email protected] " "
14 [email protected] "=" 14 [email protected] "="
@@ -16,7 +16,7 @@ [email protected]
16 [email protected] 16 [email protected]
17 [email protected] "&" 17 [email protected] "&"
18 [email protected] 18 [email protected]
19 [email protected] "\'a" 19 [email protected] "'a"
20 [email protected] " " 20 [email protected] " "
21 [email protected] 21 [email protected]
22 [email protected] "dyn" 22 [email protected] "dyn"
@@ -104,7 +104,7 @@ [email protected]
104 [email protected] " " 104 [email protected] " "
105 [email protected] 105 [email protected]
106 [email protected] 106 [email protected]
107 [email protected] "\'static" 107 [email protected] "'static"
108 [email protected] ";" 108 [email protected] ";"
109 [email protected] "\n" 109 [email protected] "\n"
110 [email protected] 110 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast b/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast
index 0adf2cd5a..97bb5059d 100644
--- a/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast
+++ b/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast
@@ -15,7 +15,7 @@ [email protected]
15 [email protected] 15 [email protected]
16 [email protected] 16 [email protected]
17 [email protected] 17 [email protected]
18 [email protected] "\'loop" 18 [email protected] "'loop"
19 [email protected] ":" 19 [email protected] ":"
20 [email protected] " " 20 [email protected] " "
21 [email protected] 21 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rast b/crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rast
index 6cdfd058b..12f5040f9 100644
--- a/crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rast
@@ -23,7 +23,7 @@ [email protected]
23 [email protected] "<" 23 [email protected] "<"
24 [email protected] 24 [email protected]
25 [email protected] 25 [email protected]
26 [email protected] "\'a" 26 [email protected] "'a"
27 [email protected] ">" 27 [email protected] ">"
28 [email protected] " " 28 [email protected] " "
29 [email protected] 29 [email protected]
@@ -46,7 +46,7 @@ [email protected]
46 [email protected] 46 [email protected]
47 [email protected] "&" 47 [email protected] "&"
48 [email protected] 48 [email protected]
49 [email protected] "\'a" 49 [email protected] "'a"
50 [email protected] " " 50 [email protected] " "
51 [email protected] 51 [email protected]
52 [email protected] 52 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast b/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast
index f0d152d33..d4c8b9d67 100644
--- a/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast
@@ -55,7 +55,7 @@ [email protected]
55 [email protected] 55 [email protected]
56 [email protected] "&" 56 [email protected] "&"
57 [email protected] 57 [email protected]
58 [email protected] "\'a" 58 [email protected] "'a"
59 [email protected] " " 59 [email protected] " "
60 [email protected] 60 [email protected]
61 [email protected] "self" 61 [email protected] "self"
@@ -76,7 +76,7 @@ [email protected]
76 [email protected] 76 [email protected]
77 [email protected] "&" 77 [email protected] "&"
78 [email protected] 78 [email protected]
79 [email protected] "\'a" 79 [email protected] "'a"
80 [email protected] " " 80 [email protected] " "
81 [email protected] "mut" 81 [email protected] "mut"
82 [email protected] " " 82 [email protected] " "
diff --git a/crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast b/crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast
index 075b438d2..121c3966a 100644
--- a/crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast
@@ -14,7 +14,7 @@ [email protected]
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 [email protected] 16 [email protected]
17 [email protected] "\'a" 17 [email protected] "'a"
18 [email protected] " " 18 [email protected] " "
19 [email protected] "+" 19 [email protected] "+"
20 [email protected] " " 20 [email protected] " "
diff --git a/crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rast b/crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rast
index b9e92b57a..b67ea2682 100644
--- a/crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rast
@@ -27,7 +27,7 @@ [email protected]
27 [email protected] "continue" 27 [email protected] "continue"
28 [email protected] " " 28 [email protected] " "
29 [email protected] 29 [email protected]
30 [email protected] "\'l" 30 [email protected] "'l"
31 [email protected] ";" 31 [email protected] ";"
32 [email protected] "\n " 32 [email protected] "\n "
33 [email protected] "}" 33 [email protected] "}"
diff --git a/crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast b/crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast
index dad4362b7..b44f46f05 100644
--- a/crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast
@@ -32,7 +32,7 @@ [email protected]
32 [email protected] "<" 32 [email protected] "<"
33 [email protected] 33 [email protected]
34 [email protected] 34 [email protected]
35 [email protected] "\'a" 35 [email protected] "'a"
36 [email protected] ">" 36 [email protected] ">"
37 [email protected] ">" 37 [email protected] ">"
38 [email protected] " " 38 [email protected] " "
@@ -40,6 +40,6 @@ [email protected]
40 [email protected] " " 40 [email protected] " "
41 [email protected] 41 [email protected]
42 [email protected] 42 [email protected]
43 [email protected] "\'a" 43 [email protected] "'a"
44 [email protected] ";" 44 [email protected] ";"
45 [email protected] "\n" 45 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rast b/crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rast
index ac0299268..7cb288bf0 100644
--- a/crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rast
@@ -25,7 +25,7 @@ [email protected]
25 [email protected] 25 [email protected]
26 [email protected] "&" 26 [email protected] "&"
27 [email protected] 27 [email protected]
28 [email protected] "\'static" 28 [email protected] "'static"
29 [email protected] " " 29 [email protected] " "
30 [email protected] 30 [email protected]
31 [email protected] "(" 31 [email protected] "("
diff --git a/crates/syntax/test_data/parser/inline/ok/0034_break_expr.rast b/crates/syntax/test_data/parser/inline/ok/0034_break_expr.rast
index 828013d45..783b25338 100644
--- a/crates/syntax/test_data/parser/inline/ok/0034_break_expr.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0034_break_expr.rast
@@ -27,7 +27,7 @@ [email protected]
27 [email protected] "break" 27 [email protected] "break"
28 [email protected] " " 28 [email protected] " "
29 [email protected] 29 [email protected]
30 [email protected] "\'l" 30 [email protected] "'l"
31 [email protected] ";" 31 [email protected] ";"
32 [email protected] "\n " 32 [email protected] "\n "
33 [email protected] 33 [email protected]
@@ -43,7 +43,7 @@ [email protected]
43 [email protected] "break" 43 [email protected] "break"
44 [email protected] " " 44 [email protected] " "
45 [email protected] 45 [email protected]
46 [email protected] "\'l" 46 [email protected] "'l"
47 [email protected] " " 47 [email protected] " "
48 [email protected] 48 [email protected]
49 [email protected] "92" 49 [email protected] "92"
diff --git a/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast b/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast
index 68c0f1c66..11efa23a4 100644
--- a/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast
@@ -16,7 +16,7 @@ [email protected]
16 [email protected] "<" 16 [email protected] "<"
17 [email protected] 17 [email protected]
18 [email protected] 18 [email protected]
19 [email protected] "\'static" 19 [email protected] "'static"
20 [email protected] "," 20 [email protected] ","
21 [email protected] " " 21 [email protected] " "
22 [email protected] 22 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast b/crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast
index b6f5a5689..abc258b33 100644
--- a/crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast
@@ -34,7 +34,7 @@ [email protected]
34 [email protected] "<" 34 [email protected] "<"
35 [email protected] 35 [email protected]
36 [email protected] 36 [email protected]
37 [email protected] "\'a" 37 [email protected] "'a"
38 [email protected] ">" 38 [email protected] ">"
39 [email protected] ")" 39 [email protected] ")"
40 [email protected] ">" 40 [email protected] ">"
diff --git a/crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast b/crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast
index 7df6e190a..e1b88c5db 100644
--- a/crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast
@@ -32,7 +32,7 @@ [email protected]
32 [email protected] " " 32 [email protected] " "
33 [email protected] 33 [email protected]
34 [email protected] 34 [email protected]
35 [email protected] "\'f" 35 [email protected] "'f"
36 [email protected] ">" 36 [email protected] ">"
37 [email protected] " " 37 [email protected] " "
38 [email protected] 38 [email protected]
@@ -74,7 +74,7 @@ [email protected]
74 [email protected] " " 74 [email protected] " "
75 [email protected] 75 [email protected]
76 [email protected] 76 [email protected]
77 [email protected] "\'f" 77 [email protected] "'f"
78 [email protected] ">" 78 [email protected] ">"
79 [email protected] " " 79 [email protected] " "
80 [email protected] 80 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0055_literal_pattern.rast b/crates/syntax/test_data/parser/inline/ok/0055_literal_pattern.rast
index 68bb43852..acf18fc2b 100644
--- a/crates/syntax/test_data/parser/inline/ok/0055_literal_pattern.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0055_literal_pattern.rast
@@ -49,7 +49,7 @@ [email protected]
49 [email protected] 49 [email protected]
50 [email protected] 50 [email protected]
51 [email protected] 51 [email protected]
52 [email protected] "\'c\'" 52 [email protected] "'c'"
53 [email protected] " " 53 [email protected] " "
54 [email protected] "=>" 54 [email protected] "=>"
55 [email protected] " " 55 [email protected] " "
diff --git a/crates/syntax/test_data/parser/inline/ok/0056_where_clause.rast b/crates/syntax/test_data/parser/inline/ok/0056_where_clause.rast
index 61dea413d..d42a7e295 100644
--- a/crates/syntax/test_data/parser/inline/ok/0056_where_clause.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0056_where_clause.rast
@@ -13,19 +13,19 @@ [email protected]
13 [email protected] "\n " 13 [email protected] "\n "
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 [email protected] "\'a" 16 [email protected] "'a"
17 [email protected] ":" 17 [email protected] ":"
18 [email protected] " " 18 [email protected] " "
19 [email protected] 19 [email protected]
20 [email protected] 20 [email protected]
21 [email protected] 21 [email protected]
22 [email protected] "\'b" 22 [email protected] "'b"
23 [email protected] " " 23 [email protected] " "
24 [email protected] "+" 24 [email protected] "+"
25 [email protected] " " 25 [email protected] " "
26 [email protected] 26 [email protected]
27 [email protected] 27 [email protected]
28 [email protected] "\'c" 28 [email protected] "'c"
29 [email protected] "," 29 [email protected] ","
30 [email protected] "\n " 30 [email protected] "\n "
31 [email protected] 31 [email protected]
@@ -57,7 +57,7 @@ [email protected]
57 [email protected] " " 57 [email protected] " "
58 [email protected] 58 [email protected]
59 [email protected] 59 [email protected]
60 [email protected] "\'static" 60 [email protected] "'static"
61 [email protected] "," 61 [email protected] ","
62 [email protected] "\n " 62 [email protected] "\n "
63 [email protected] 63 [email protected]
@@ -76,7 +76,7 @@ [email protected]
76 [email protected] 76 [email protected]
77 [email protected] 77 [email protected]
78 [email protected] 78 [email protected]
79 [email protected] "\'a" 79 [email protected] "'a"
80 [email protected] "," 80 [email protected] ","
81 [email protected] "\n " 81 [email protected] "\n "
82 [email protected] 82 [email protected]
@@ -108,7 +108,7 @@ [email protected]
108 [email protected] 108 [email protected]
109 [email protected] 109 [email protected]
110 [email protected] 110 [email protected]
111 [email protected] "\'a" 111 [email protected] "'a"
112 [email protected] "\n" 112 [email protected] "\n"
113 [email protected] 113 [email protected]
114 [email protected] "{" 114 [email protected] "{"
diff --git a/crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast b/crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast
index 49d26cef4..8f76177d1 100644
--- a/crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast
@@ -32,7 +32,7 @@ [email protected]
32 [email protected] "<" 32 [email protected] "<"
33 [email protected] 33 [email protected]
34 [email protected] 34 [email protected]
35 [email protected] "\'a" 35 [email protected] "'a"
36 [email protected] ">" 36 [email protected] ">"
37 [email protected] ">" 37 [email protected] ">"
38 [email protected] " " 38 [email protected] " "
@@ -40,6 +40,6 @@ [email protected]
40 [email protected] " " 40 [email protected] " "
41 [email protected] 41 [email protected]
42 [email protected] 42 [email protected]
43 [email protected] "\'a" 43 [email protected] "'a"
44 [email protected] ";" 44 [email protected] ";"
45 [email protected] "\n" 45 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0081_for_type.rast b/crates/syntax/test_data/parser/inline/ok/0081_for_type.rast
index 8c909b5af..7958e32e5 100644
--- a/crates/syntax/test_data/parser/inline/ok/0081_for_type.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0081_for_type.rast
@@ -13,7 +13,7 @@ [email protected]
13 [email protected] "<" 13 [email protected] "<"
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 [email protected] "\'a" 16 [email protected] "'a"
17 [email protected] ">" 17 [email protected] ">"
18 [email protected] " " 18 [email protected] " "
19 [email protected] 19 [email protected]
@@ -44,7 +44,7 @@ [email protected]
44 [email protected] "<" 44 [email protected] "<"
45 [email protected] 45 [email protected]
46 [email protected] 46 [email protected]
47 [email protected] "\'a" 47 [email protected] "'a"
48 [email protected] ">" 48 [email protected] ">"
49 [email protected] " " 49 [email protected] " "
50 [email protected] 50 [email protected]
@@ -62,7 +62,7 @@ [email protected]
62 [email protected] 62 [email protected]
63 [email protected] "&" 63 [email protected] "&"
64 [email protected] 64 [email protected]
65 [email protected] "\'a" 65 [email protected] "'a"
66 [email protected] " " 66 [email protected] " "
67 [email protected] 67 [email protected]
68 [email protected] "(" 68 [email protected] "("
@@ -91,7 +91,7 @@ [email protected]
91 [email protected] "<" 91 [email protected] "<"
92 [email protected] 92 [email protected]
93 [email protected] 93 [email protected]
94 [email protected] "\'a" 94 [email protected] "'a"
95 [email protected] ">" 95 [email protected] ">"
96 [email protected] " " 96 [email protected] " "
97 [email protected] 97 [email protected]
@@ -105,7 +105,7 @@ [email protected]
105 [email protected] 105 [email protected]
106 [email protected] "&" 106 [email protected] "&"
107 [email protected] 107 [email protected]
108 [email protected] "\'a" 108 [email protected] "'a"
109 [email protected] " " 109 [email protected] " "
110 [email protected] 110 [email protected]
111 [email protected] 111 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rast b/crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rast
index ae838105d..f784e96e0 100644
--- a/crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0085_expr_literals.rast
@@ -68,7 +68,7 @@ [email protected]
68 [email protected] "=" 68 [email protected] "="
69 [email protected] " " 69 [email protected] " "
70 [email protected] 70 [email protected]
71 [email protected] "b\'a\'" 71 [email protected] "b'a'"
72 [email protected] ";" 72 [email protected] ";"
73 [email protected] "\n " 73 [email protected] "\n "
74 [email protected] 74 [email protected]
@@ -80,7 +80,7 @@ [email protected]
80 [email protected] "=" 80 [email protected] "="
81 [email protected] " " 81 [email protected] " "
82 [email protected] 82 [email protected]
83 [email protected] "\'b\'" 83 [email protected] "'b'"
84 [email protected] ";" 84 [email protected] ";"
85 [email protected] "\n " 85 [email protected] "\n "
86 [email protected] 86 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0109_label.rast b/crates/syntax/test_data/parser/inline/ok/0109_label.rast
index 860dfe608..8540b8520 100644
--- a/crates/syntax/test_data/parser/inline/ok/0109_label.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0109_label.rast
@@ -15,7 +15,7 @@ [email protected]
15 [email protected] 15 [email protected]
16 [email protected] 16 [email protected]
17 [email protected] 17 [email protected]
18 [email protected] "\'a" 18 [email protected] "'a"
19 [email protected] ":" 19 [email protected] ":"
20 [email protected] " " 20 [email protected] " "
21 [email protected] "loop" 21 [email protected] "loop"
@@ -28,7 +28,7 @@ [email protected]
28 [email protected] 28 [email protected]
29 [email protected] 29 [email protected]
30 [email protected] 30 [email protected]
31 [email protected] "\'b" 31 [email protected] "'b"
32 [email protected] ":" 32 [email protected] ":"
33 [email protected] " " 33 [email protected] " "
34 [email protected] "while" 34 [email protected] "while"
@@ -44,7 +44,7 @@ [email protected]
44 [email protected] 44 [email protected]
45 [email protected] 45 [email protected]
46 [email protected] 46 [email protected]
47 [email protected] "\'c" 47 [email protected] "'c"
48 [email protected] ":" 48 [email protected] ":"
49 [email protected] " " 49 [email protected] " "
50 [email protected] "for" 50 [email protected] "for"
diff --git a/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast b/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast
index 840181383..5682bd28c 100644
--- a/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast
@@ -22,7 +22,7 @@ [email protected]
22 [email protected] "]" 22 [email protected] "]"
23 [email protected] " " 23 [email protected] " "
24 [email protected] 24 [email protected]
25 [email protected] "\'a" 25 [email protected] "'a"
26 [email protected] "," 26 [email protected] ","
27 [email protected] " " 27 [email protected] " "
28 [email protected] 28 [email protected]
@@ -53,7 +53,7 @@ [email protected]
53 [email protected] 53 [email protected]
54 [email protected] "&" 54 [email protected] "&"
55 [email protected] 55 [email protected]
56 [email protected] "\'a" 56 [email protected] "'a"
57 [email protected] " " 57 [email protected] " "
58 [email protected] 58 [email protected]
59 [email protected] 59 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0154_no_dyn_trait_leading_for.rast b/crates/syntax/test_data/parser/inline/ok/0154_no_dyn_trait_leading_for.rast
index edfcb288c..860684b29 100644
--- a/crates/syntax/test_data/parser/inline/ok/0154_no_dyn_trait_leading_for.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0154_no_dyn_trait_leading_for.rast
@@ -16,7 +16,7 @@ [email protected]
16 [email protected] "<" 16 [email protected] "<"
17 [email protected] 17 [email protected]
18 [email protected] 18 [email protected]
19 [email protected] "\'a" 19 [email protected] "'a"
20 [email protected] ">" 20 [email protected] ">"
21 [email protected] " " 21 [email protected] " "
22 [email protected] 22 [email protected]
@@ -28,7 +28,7 @@ [email protected]
28 [email protected] "<" 28 [email protected] "<"
29 [email protected] 29 [email protected]
30 [email protected] 30 [email protected]
31 [email protected] "\'a" 31 [email protected] "'a"
32 [email protected] ">" 32 [email protected] ">"
33 [email protected] " " 33 [email protected] " "
34 [email protected] "+" 34 [email protected] "+"
diff --git a/crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rast b/crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rast
index c2dea1cc1..47e8859ed 100644
--- a/crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rast
@@ -15,7 +15,7 @@ [email protected]
15 [email protected] 15 [email protected]
16 [email protected] 16 [email protected]
17 [email protected] 17 [email protected]
18 [email protected] "\'label" 18 [email protected] "'label"
19 [email protected] ":" 19 [email protected] ":"
20 [email protected] " " 20 [email protected] " "
21 [email protected] 21 [email protected]
diff --git a/crates/syntax/test_data/parser/ok/0018_struct_type_params.rast b/crates/syntax/test_data/parser/ok/0018_struct_type_params.rast
index 83e17757b..f845d5cff 100644
--- a/crates/syntax/test_data/parser/ok/0018_struct_type_params.rast
+++ b/crates/syntax/test_data/parser/ok/0018_struct_type_params.rast
@@ -81,7 +81,7 @@ [email protected]
81 [email protected] "<" 81 [email protected] "<"
82 [email protected] 82 [email protected]
83 [email protected] 83 [email protected]
84 [email protected] "\'a" 84 [email protected] "'a"
85 [email protected] ">" 85 [email protected] ">"
86 [email protected] ";" 86 [email protected] ";"
87 [email protected] "\n" 87 [email protected] "\n"
@@ -94,7 +94,7 @@ [email protected]
94 [email protected] "<" 94 [email protected] "<"
95 [email protected] 95 [email protected]
96 [email protected] 96 [email protected]
97 [email protected] "\'a" 97 [email protected] "'a"
98 [email protected] ":" 98 [email protected] ":"
99 [email protected] ">" 99 [email protected] ">"
100 [email protected] ";" 100 [email protected] ";"
@@ -108,11 +108,11 @@ [email protected]
108 [email protected] "<" 108 [email protected] "<"
109 [email protected] 109 [email protected]
110 [email protected] 110 [email protected]
111 [email protected] "\'a" 111 [email protected] "'a"
112 [email protected] ":" 112 [email protected] ":"
113 [email protected] " " 113 [email protected] " "
114 [email protected] 114 [email protected]
115 [email protected] "\'b" 115 [email protected] "'b"
116 [email protected] ">" 116 [email protected] ">"
117 [email protected] ";" 117 [email protected] ";"
118 [email protected] "\n" 118 [email protected] "\n"
@@ -125,11 +125,11 @@ [email protected]
125 [email protected] "<" 125 [email protected] "<"
126 [email protected] 126 [email protected]
127 [email protected] 127 [email protected]
128 [email protected] "\'a" 128 [email protected] "'a"
129 [email protected] ":" 129 [email protected] ":"
130 [email protected] " " 130 [email protected] " "
131 [email protected] 131 [email protected]
132 [email protected] "\'b" 132 [email protected] "'b"
133 [email protected] " " 133 [email protected] " "
134 [email protected] "+" 134 [email protected] "+"
135 [email protected] " " 135 [email protected] " "
@@ -145,16 +145,16 @@ [email protected]
145 [email protected] "<" 145 [email protected] "<"
146 [email protected] 146 [email protected]
147 [email protected] 147 [email protected]
148 [email protected] "\'a" 148 [email protected] "'a"
149 [email protected] ":" 149 [email protected] ":"
150 [email protected] " " 150 [email protected] " "
151 [email protected] 151 [email protected]
152 [email protected] "\'b" 152 [email protected] "'b"
153 [email protected] " " 153 [email protected] " "
154 [email protected] "+" 154 [email protected] "+"
155 [email protected] " " 155 [email protected] " "
156 [email protected] 156 [email protected]
157 [email protected] "\'c" 157 [email protected] "'c"
158 [email protected] ">" 158 [email protected] ">"
159 [email protected] ";" 159 [email protected] ";"
160 [email protected] "\n" 160 [email protected] "\n"
@@ -167,7 +167,7 @@ [email protected]
167 [email protected] "<" 167 [email protected] "<"
168 [email protected] 168 [email protected]
169 [email protected] 169 [email protected]
170 [email protected] "\'a" 170 [email protected] "'a"
171 [email protected] "," 171 [email protected] ","
172 [email protected] ">" 172 [email protected] ">"
173 [email protected] ";" 173 [email protected] ";"
@@ -181,12 +181,12 @@ [email protected]
181 [email protected] "<" 181 [email protected] "<"
182 [email protected] 182 [email protected]
183 [email protected] 183 [email protected]
184 [email protected] "\'a" 184 [email protected] "'a"
185 [email protected] "," 185 [email protected] ","
186 [email protected] " " 186 [email protected] " "
187 [email protected] 187 [email protected]
188 [email protected] 188 [email protected]
189 [email protected] "\'b" 189 [email protected] "'b"
190 [email protected] ">" 190 [email protected] ">"
191 [email protected] ";" 191 [email protected] ";"
192 [email protected] "\n" 192 [email protected] "\n"
@@ -199,21 +199,21 @@ [email protected]
199 [email protected] "<" 199 [email protected] "<"
200 [email protected] 200 [email protected]
201 [email protected] 201 [email protected]
202 [email protected] "\'a" 202 [email protected] "'a"
203 [email protected] ":" 203 [email protected] ":"
204 [email protected] " " 204 [email protected] " "
205 [email protected] 205 [email protected]
206 [email protected] "\'b" 206 [email protected] "'b"
207 [email protected] "+" 207 [email protected] "+"
208 [email protected] "," 208 [email protected] ","
209 [email protected] " " 209 [email protected] " "
210 [email protected] 210 [email protected]
211 [email protected] 211 [email protected]
212 [email protected] "\'b" 212 [email protected] "'b"
213 [email protected] ":" 213 [email protected] ":"
214 [email protected] " " 214 [email protected] " "
215 [email protected] 215 [email protected]
216 [email protected] "\'c" 216 [email protected] "'c"
217 [email protected] "," 217 [email protected] ","
218 [email protected] ">" 218 [email protected] ">"
219 [email protected] ";" 219 [email protected] ";"
@@ -258,7 +258,7 @@ [email protected]
258 [email protected] "<" 258 [email protected] "<"
259 [email protected] 259 [email protected]
260 [email protected] 260 [email protected]
261 [email protected] "\'a" 261 [email protected] "'a"
262 [email protected] "," 262 [email protected] ","
263 [email protected] " " 263 [email protected] " "
264 [email protected] 264 [email protected]
diff --git a/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast b/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast
index 21c564a20..9d4b001ae 100644
--- a/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast
+++ b/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast
@@ -42,7 +42,7 @@ [email protected]
42 [email protected] 42 [email protected]
43 [email protected] 43 [email protected]
44 [email protected] 44 [email protected]
45 [email protected] "\'a" 45 [email protected] "'a"
46 [email protected] ">" 46 [email protected] ">"
47 [email protected] ";" 47 [email protected] ";"
48 [email protected] "\n" 48 [email protected] "\n"
@@ -61,7 +61,7 @@ [email protected]
61 [email protected] 61 [email protected]
62 [email protected] 62 [email protected]
63 [email protected] 63 [email protected]
64 [email protected] "\'a" 64 [email protected] "'a"
65 [email protected] " " 65 [email protected] " "
66 [email protected] "+" 66 [email protected] "+"
67 [email protected] " " 67 [email protected] " "
@@ -83,13 +83,13 @@ [email protected]
83 [email protected] 83 [email protected]
84 [email protected] 84 [email protected]
85 [email protected] 85 [email protected]
86 [email protected] "\'a" 86 [email protected] "'a"
87 [email protected] " " 87 [email protected] " "
88 [email protected] "+" 88 [email protected] "+"
89 [email protected] " " 89 [email protected] " "
90 [email protected] 90 [email protected]
91 [email protected] 91 [email protected]
92 [email protected] "\'d" 92 [email protected] "'d"
93 [email protected] " " 93 [email protected] " "
94 [email protected] ">" 94 [email protected] ">"
95 [email protected] ";" 95 [email protected] ";"
@@ -109,13 +109,13 @@ [email protected]
109 [email protected] 109 [email protected]
110 [email protected] 110 [email protected]
111 [email protected] 111 [email protected]
112 [email protected] "\'a" 112 [email protected] "'a"
113 [email protected] " " 113 [email protected] " "
114 [email protected] "+" 114 [email protected] "+"
115 [email protected] " " 115 [email protected] " "
116 [email protected] 116 [email protected]
117 [email protected] 117 [email protected]
118 [email protected] "\'d" 118 [email protected] "'d"
119 [email protected] " " 119 [email protected] " "
120 [email protected] "+" 120 [email protected] "+"
121 [email protected] " " 121 [email protected] " "
@@ -198,7 +198,7 @@ [email protected]
198 [email protected] " " 198 [email protected] " "
199 [email protected] 199 [email protected]
200 [email protected] 200 [email protected]
201 [email protected] "\'a" 201 [email protected] "'a"
202 [email protected] ">" 202 [email protected] ">"
203 [email protected] ";" 203 [email protected] ";"
204 [email protected] "\n" 204 [email protected] "\n"
@@ -234,25 +234,25 @@ [email protected]
234 [email protected] "<" 234 [email protected] "<"
235 [email protected] 235 [email protected]
236 [email protected] 236 [email protected]
237 [email protected] "\'a" 237 [email protected] "'a"
238 [email protected] ":" 238 [email protected] ":"
239 [email protected] " " 239 [email protected] " "
240 [email protected] 240 [email protected]
241 [email protected] "\'d" 241 [email protected] "'d"
242 [email protected] "," 242 [email protected] ","
243 [email protected] " " 243 [email protected] " "
244 [email protected] 244 [email protected]
245 [email protected] 245 [email protected]
246 [email protected] "\'d" 246 [email protected] "'d"
247 [email protected] ":" 247 [email protected] ":"
248 [email protected] " " 248 [email protected] " "
249 [email protected] 249 [email protected]
250 [email protected] "\'a" 250 [email protected] "'a"
251 [email protected] " " 251 [email protected] " "
252 [email protected] "+" 252 [email protected] "+"
253 [email protected] " " 253 [email protected] " "
254 [email protected] 254 [email protected]
255 [email protected] "\'b" 255 [email protected] "'b"
256 [email protected] "," 256 [email protected] ","
257 [email protected] " " 257 [email protected] " "
258 [email protected] 258 [email protected]
@@ -263,13 +263,13 @@ [email protected]
263 [email protected] 263 [email protected]
264 [email protected] 264 [email protected]
265 [email protected] 265 [email protected]
266 [email protected] "\'a" 266 [email protected] "'a"
267 [email protected] " " 267 [email protected] " "
268 [email protected] "+" 268 [email protected] "+"
269 [email protected] " " 269 [email protected] " "
270 [email protected] 270 [email protected]
271 [email protected] 271 [email protected]
272 [email protected] "\'d" 272 [email protected] "'d"
273 [email protected] " " 273 [email protected] " "
274 [email protected] "+" 274 [email protected] "+"
275 [email protected] " " 275 [email protected] " "
diff --git a/crates/syntax/test_data/parser/ok/0030_string_suffixes.rast b/crates/syntax/test_data/parser/ok/0030_string_suffixes.rast
index 80f7f5942..115861585 100644
--- a/crates/syntax/test_data/parser/ok/0030_string_suffixes.rast
+++ b/crates/syntax/test_data/parser/ok/0030_string_suffixes.rast
@@ -20,7 +20,7 @@ [email protected]
20 [email protected] "=" 20 [email protected] "="
21 [email protected] " " 21 [email protected] " "
22 [email protected] 22 [email protected]
23 [email protected] "\'c\'u32" 23 [email protected] "'c'u32"
24 [email protected] ";" 24 [email protected] ";"
25 [email protected] "\n " 25 [email protected] "\n "
26 [email protected] 26 [email protected]
@@ -44,7 +44,7 @@ [email protected]
44 [email protected] "=" 44 [email protected] "="
45 [email protected] " " 45 [email protected] " "
46 [email protected] 46 [email protected]
47 [email protected] "b\'b\'_suff" 47 [email protected] "b'b'_suff"
48 [email protected] ";" 48 [email protected] ";"
49 [email protected] "\n " 49 [email protected] "\n "
50 [email protected] 50 [email protected]
diff --git a/crates/syntax/test_data/parser/ok/0032_where_for.rast b/crates/syntax/test_data/parser/ok/0032_where_for.rast
index 0cb2eca33..b527cc3ac 100644
--- a/crates/syntax/test_data/parser/ok/0032_where_for.rast
+++ b/crates/syntax/test_data/parser/ok/0032_where_for.rast
@@ -42,7 +42,7 @@ [email protected]
42 [email protected] "<" 42 [email protected] "<"
43 [email protected] 43 [email protected]
44 [email protected] 44 [email protected]
45 [email protected] "\'de" 45 [email protected] "'de"
46 [email protected] ">" 46 [email protected] ">"
47 [email protected] " " 47 [email protected] " "
48 [email protected] 48 [email protected]
@@ -54,7 +54,7 @@ [email protected]
54 [email protected] "<" 54 [email protected] "<"
55 [email protected] 55 [email protected]
56 [email protected] 56 [email protected]
57 [email protected] "\'de" 57 [email protected] "'de"
58 [email protected] ">" 58 [email protected] ">"
59 [email protected] " " 59 [email protected] " "
60 [email protected] "+" 60 [email protected] "+"
diff --git a/crates/syntax/test_data/parser/ok/0033_label_break.rast b/crates/syntax/test_data/parser/ok/0033_label_break.rast
index 487e073ba..4b0f0997e 100644
--- a/crates/syntax/test_data/parser/ok/0033_label_break.rast
+++ b/crates/syntax/test_data/parser/ok/0033_label_break.rast
@@ -17,7 +17,7 @@ [email protected]
17 [email protected] 17 [email protected]
18 [email protected] 18 [email protected]
19 [email protected] 19 [email protected]
20 [email protected] "\'empty_block" 20 [email protected] "'empty_block"
21 [email protected] ":" 21 [email protected] ":"
22 [email protected] " " 22 [email protected] " "
23 [email protected] 23 [email protected]
@@ -28,7 +28,7 @@ [email protected]
28 [email protected] 28 [email protected]
29 [email protected] 29 [email protected]
30 [email protected] 30 [email protected]
31 [email protected] "\'block" 31 [email protected] "'block"
32 [email protected] ":" 32 [email protected] ":"
33 [email protected] " " 33 [email protected] " "
34 [email protected] 34 [email protected]
@@ -69,7 +69,7 @@ [email protected]
69 [email protected] "break" 69 [email protected] "break"
70 [email protected] " " 70 [email protected] " "
71 [email protected] 71 [email protected]
72 [email protected] "\'block" 72 [email protected] "'block"
73 [email protected] ";" 73 [email protected] ";"
74 [email protected] "\n " 74 [email protected] "\n "
75 [email protected] "}" 75 [email protected] "}"
@@ -109,7 +109,7 @@ [email protected]
109 [email protected] "break" 109 [email protected] "break"
110 [email protected] " " 110 [email protected] " "
111 [email protected] 111 [email protected]
112 [email protected] "\'block" 112 [email protected] "'block"
113 [email protected] ";" 113 [email protected] ";"
114 [email protected] "\n " 114 [email protected] "\n "
115 [email protected] "}" 115 [email protected] "}"
@@ -140,7 +140,7 @@ [email protected]
140 [email protected] 140 [email protected]
141 [email protected] 141 [email protected]
142 [email protected] 142 [email protected]
143 [email protected] "\'block" 143 [email protected] "'block"
144 [email protected] ":" 144 [email protected] ":"
145 [email protected] " " 145 [email protected] " "
146 [email protected] 146 [email protected]
@@ -171,7 +171,7 @@ [email protected]
171 [email protected] "break" 171 [email protected] "break"
172 [email protected] " " 172 [email protected] " "
173 [email protected] 173 [email protected]
174 [email protected] "\'block" 174 [email protected] "'block"
175 [email protected] " " 175 [email protected] " "
176 [email protected] 176 [email protected]
177 [email protected] "1" 177 [email protected] "1"
@@ -204,7 +204,7 @@ [email protected]
204 [email protected] "break" 204 [email protected] "break"
205 [email protected] " " 205 [email protected] " "
206 [email protected] 206 [email protected]
207 [email protected] "\'block" 207 [email protected] "'block"
208 [email protected] " " 208 [email protected] " "
209 [email protected] 209 [email protected]
210 [email protected] "2" 210 [email protected] "2"
diff --git a/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast
index 20675dbf5..2fa46ad2d 100644
--- a/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast
+++ b/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast
@@ -1378,14 +1378,14 @@ [email protected]
1378 [email protected] " " 1378 [email protected] " "
1379 [email protected] "u8" 1379 [email protected] "u8"
1380 [email protected] "<" 1380 [email protected] "<"
1381 [email protected] "\'u8" 1381 [email protected] "'u8"
1382 [email protected] ":" 1382 [email protected] ":"
1383 [email protected] " " 1383 [email protected] " "
1384 [email protected] "\'u8" 1384 [email protected] "'u8"
1385 [email protected] " " 1385 [email protected] " "
1386 [email protected] "+" 1386 [email protected] "+"
1387 [email protected] " " 1387 [email protected] " "
1388 [email protected] "\'u8" 1388 [email protected] "'u8"
1389 [email protected] ">" 1389 [email protected] ">"
1390 [email protected] 1390 [email protected]
1391 [email protected] "(" 1391 [email protected] "("
@@ -1393,7 +1393,7 @@ [email protected]
1393 [email protected] ":" 1393 [email protected] ":"
1394 [email protected] " " 1394 [email protected] " "
1395 [email protected] "&" 1395 [email protected] "&"
1396 [email protected] "\'u8" 1396 [email protected] "'u8"
1397 [email protected] " " 1397 [email protected] " "
1398 [email protected] "u8" 1398 [email protected] "u8"
1399 [email protected] ")" 1399 [email protected] ")"
@@ -1402,7 +1402,7 @@ [email protected]
1402 [email protected] ">" 1402 [email protected] ">"
1403 [email protected] " " 1403 [email protected] " "
1404 [email protected] "&" 1404 [email protected] "&"
1405 [email protected] "\'u8" 1405 [email protected] "'u8"
1406 [email protected] " " 1406 [email protected] " "
1407 [email protected] "u8" 1407 [email protected] "u8"
1408 [email protected] " " 1408 [email protected] " "
@@ -1574,7 +1574,7 @@ [email protected]
1574 [email protected] "<" 1574 [email protected] "<"
1575 [email protected] 1575 [email protected]
1576 [email protected] 1576 [email protected]
1577 [email protected] "\'union" 1577 [email protected] "'union"
1578 [email protected] ">" 1578 [email protected] ">"
1579 [email protected] " " 1579 [email protected] " "
1580 [email protected] 1580 [email protected]
@@ -1588,7 +1588,7 @@ [email protected]
1588 [email protected] 1588 [email protected]
1589 [email protected] "&" 1589 [email protected] "&"
1590 [email protected] 1590 [email protected]
1591 [email protected] "\'union" 1591 [email protected] "'union"
1592 [email protected] " " 1592 [email protected] " "
1593 [email protected] 1593 [email protected]
1594 [email protected] 1594 [email protected]
@@ -1599,7 +1599,7 @@ [email protected]
1599 [email protected] "<" 1599 [email protected] "<"
1600 [email protected] 1600 [email protected]
1601 [email protected] 1601 [email protected]
1602 [email protected] "\'union" 1602 [email protected] "'union"
1603 [email protected] ">" 1603 [email protected] ">"
1604 [email protected] "," 1604 [email protected] ","
1605 [email protected] " " 1605 [email protected] " "
@@ -1681,7 +1681,7 @@ [email protected]
1681 [email protected] "\"\\\\\"" 1681 [email protected] "\"\\\\\""
1682 [email protected] "," 1682 [email protected] ","
1683 [email protected] 1683 [email protected]
1684 [email protected] "\'🤔\'" 1684 [email protected] "'🤔'"
1685 [email protected] ")" 1685 [email protected] ")"
1686 [email protected] "/**/" 1686 [email protected] "/**/"
1687 [email protected] "," 1687 [email protected] ","
diff --git a/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast b/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast
index f935a0df5..a7f0f7bc6 100644
--- a/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast
+++ b/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast
@@ -181,7 +181,7 @@ [email protected]
181 [email protected] "<" 181 [email protected] "<"
182 [email protected] 182 [email protected]
183 [email protected] 183 [email protected]
184 [email protected] "\'a" 184 [email protected] "'a"
185 [email protected] ">" 185 [email protected] ">"
186 [email protected] ")" 186 [email protected] ")"
187 [email protected] ">" 187 [email protected] ">"
@@ -359,7 +359,7 @@ [email protected]
359 [email protected] "<" 359 [email protected] "<"
360 [email protected] 360 [email protected]
361 [email protected] 361 [email protected]
362 [email protected] "\'a" 362 [email protected] "'a"
363 [email protected] ">" 363 [email protected] ">"
364 [email protected] 364 [email protected]
365 [email protected] "(" 365 [email protected] "("
@@ -394,7 +394,7 @@ [email protected]
394 [email protected] "<" 394 [email protected] "<"
395 [email protected] 395 [email protected]
396 [email protected] 396 [email protected]
397 [email protected] "\'a" 397 [email protected] "'a"
398 [email protected] ">" 398 [email protected] ">"
399 [email protected] 399 [email protected]
400 [email protected] "(" 400 [email protected] "("
@@ -411,7 +411,7 @@ [email protected]
411 [email protected] " " 411 [email protected] " "
412 [email protected] "&" 412 [email protected] "&"
413 [email protected] 413 [email protected]
414 [email protected] "\'a" 414 [email protected] "'a"
415 [email protected] " " 415 [email protected] " "
416 [email protected] 416 [email protected]
417 [email protected] "self" 417 [email protected] "self"
@@ -430,7 +430,7 @@ [email protected]
430 [email protected] "<" 430 [email protected] "<"
431 [email protected] 431 [email protected]
432 [email protected] 432 [email protected]
433 [email protected] "\'a" 433 [email protected] "'a"
434 [email protected] ">" 434 [email protected] ">"
435 [email protected] 435 [email protected]
436 [email protected] "(" 436 [email protected] "("
@@ -447,7 +447,7 @@ [email protected]
447 [email protected] " " 447 [email protected] " "
448 [email protected] "&" 448 [email protected] "&"
449 [email protected] 449 [email protected]
450 [email protected] "\'a" 450 [email protected] "'a"
451 [email protected] " " 451 [email protected] " "
452 [email protected] "mut" 452 [email protected] "mut"
453 [email protected] " " 453 [email protected] " "
diff --git a/crates/syntax/test_data/parser/ok/0067_where_for_pred.rast b/crates/syntax/test_data/parser/ok/0067_where_for_pred.rast
index 325e9e655..79e2b2867 100644
--- a/crates/syntax/test_data/parser/ok/0067_where_for_pred.rast
+++ b/crates/syntax/test_data/parser/ok/0067_where_for_pred.rast
@@ -23,7 +23,7 @@ [email protected]
23 [email protected] "<" 23 [email protected] "<"
24 [email protected] 24 [email protected]
25 [email protected] 25 [email protected]
26 [email protected] "\'a" 26 [email protected] "'a"
27 [email protected] ">" 27 [email protected] ">"
28 [email protected] " " 28 [email protected] " "
29 [email protected] 29 [email protected]
@@ -46,7 +46,7 @@ [email protected]
46 [email protected] 46 [email protected]
47 [email protected] "&" 47 [email protected] "&"
48 [email protected] 48 [email protected]
49 [email protected] "\'a" 49 [email protected] "'a"
50 [email protected] " " 50 [email protected] " "
51 [email protected] 51 [email protected]
52 [email protected] 52 [email protected]
@@ -85,13 +85,13 @@ [email protected]
85 [email protected] "<" 85 [email protected] "<"
86 [email protected] 86 [email protected]
87 [email protected] 87 [email protected]
88 [email protected] "\'a" 88 [email protected] "'a"
89 [email protected] ">" 89 [email protected] ">"
90 [email protected] " " 90 [email protected] " "
91 [email protected] 91 [email protected]
92 [email protected] "&" 92 [email protected] "&"
93 [email protected] 93 [email protected]
94 [email protected] "\'a" 94 [email protected] "'a"
95 [email protected] " " 95 [email protected] " "
96 [email protected] 96 [email protected]
97 [email protected] 97 [email protected]
@@ -138,7 +138,7 @@ [email protected]
138 [email protected] "<" 138 [email protected] "<"
139 [email protected] 139 [email protected]
140 [email protected] 140 [email protected]
141 [email protected] "\'a" 141 [email protected] "'a"
142 [email protected] ">" 142 [email protected] ">"
143 [email protected] " " 143 [email protected] " "
144 [email protected] 144 [email protected]
@@ -146,7 +146,7 @@ [email protected]
146 [email protected] 146 [email protected]
147 [email protected] "&" 147 [email protected] "&"
148 [email protected] 148 [email protected]
149 [email protected] "\'a" 149 [email protected] "'a"
150 [email protected] " " 150 [email protected] " "
151 [email protected] 151 [email protected]
152 [email protected] 152 [email protected]
@@ -169,7 +169,7 @@ [email protected]
169 [email protected] 169 [email protected]
170 [email protected] "&" 170 [email protected] "&"
171 [email protected] 171 [email protected]
172 [email protected] "\'a" 172 [email protected] "'a"
173 [email protected] " " 173 [email protected] " "
174 [email protected] 174 [email protected]
175 [email protected] 175 [email protected]
@@ -208,7 +208,7 @@ [email protected]
208 [email protected] "<" 208 [email protected] "<"
209 [email protected] 209 [email protected]
210 [email protected] 210 [email protected]
211 [email protected] "\'a" 211 [email protected] "'a"
212 [email protected] ">" 212 [email protected] ">"
213 [email protected] " " 213 [email protected] " "
214 [email protected] 214 [email protected]
@@ -216,7 +216,7 @@ [email protected]
216 [email protected] 216 [email protected]
217 [email protected] "&" 217 [email protected] "&"
218 [email protected] 218 [email protected]
219 [email protected] "\'a" 219 [email protected] "'a"
220 [email protected] " " 220 [email protected] " "
221 [email protected] 221 [email protected]
222 [email protected] 222 [email protected]
@@ -277,7 +277,7 @@ [email protected]
277 [email protected] "<" 277 [email protected] "<"
278 [email protected] 278 [email protected]
279 [email protected] 279 [email protected]
280 [email protected] "\'a" 280 [email protected] "'a"
281 [email protected] ">" 281 [email protected] ">"
282 [email protected] " " 282 [email protected] " "
283 [email protected] 283 [email protected]
@@ -288,7 +288,7 @@ [email protected]
288 [email protected] 288 [email protected]
289 [email protected] "&" 289 [email protected] "&"
290 [email protected] 290 [email protected]
291 [email protected] "\'a" 291 [email protected] "'a"
292 [email protected] " " 292 [email protected] " "
293 [email protected] 293 [email protected]
294 [email protected] 294 [email protected]
@@ -348,7 +348,7 @@ [email protected]
348 [email protected] "<" 348 [email protected] "<"
349 [email protected] 349 [email protected]
350 [email protected] 350 [email protected]
351 [email protected] "\'a" 351 [email protected] "'a"
352 [email protected] ">" 352 [email protected] ">"
353 [email protected] " " 353 [email protected] " "
354 [email protected] 354 [email protected]
@@ -357,7 +357,7 @@ [email protected]
357 [email protected] "<" 357 [email protected] "<"
358 [email protected] 358 [email protected]
359 [email protected] 359 [email protected]
360 [email protected] "\'b" 360 [email protected] "'b"
361 [email protected] ">" 361 [email protected] ">"
362 [email protected] " " 362 [email protected] " "
363 [email protected] 363 [email protected]
@@ -368,7 +368,7 @@ [email protected]
368 [email protected] 368 [email protected]
369 [email protected] "&" 369 [email protected] "&"
370 [email protected] 370 [email protected]
371 [email protected] "\'a" 371 [email protected] "'a"
372 [email protected] " " 372 [email protected] " "
373 [email protected] 373 [email protected]
374 [email protected] 374 [email protected]
@@ -381,7 +381,7 @@ [email protected]
381 [email protected] 381 [email protected]
382 [email protected] "&" 382 [email protected] "&"
383 [email protected] 383 [email protected]
384 [email protected] "\'b" 384 [email protected] "'b"
385 [email protected] " " 385 [email protected] " "
386 [email protected] 386 [email protected]
387 [email protected] 387 [email protected]
diff --git a/crates/syntax/test_data/parser/ok/0069_multi_trait_object.rast b/crates/syntax/test_data/parser/ok/0069_multi_trait_object.rast
index 8d3e187ae..026c776e2 100644
--- a/crates/syntax/test_data/parser/ok/0069_multi_trait_object.rast
+++ b/crates/syntax/test_data/parser/ok/0069_multi_trait_object.rast
@@ -8,7 +8,7 @@ [email protected]
8 [email protected] "<" 8 [email protected] "<"
9 [email protected] 9 [email protected]
10 [email protected] 10 [email protected]
11 [email protected] "\'a" 11 [email protected] "'a"
12 [email protected] ">" 12 [email protected] ">"
13 [email protected] " " 13 [email protected] " "
14 [email protected] "=" 14 [email protected] "="
@@ -16,7 +16,7 @@ [email protected]
16 [email protected] 16 [email protected]
17 [email protected] "&" 17 [email protected] "&"
18 [email protected] 18 [email protected]
19 [email protected] "\'a" 19 [email protected] "'a"
20 [email protected] " " 20 [email protected] " "
21 [email protected] 21 [email protected]
22 [email protected] "(" 22 [email protected] "("
@@ -112,7 +112,7 @@ [email protected]
112 [email protected] " " 112 [email protected] " "
113 [email protected] 113 [email protected]
114 [email protected] 114 [email protected]
115 [email protected] "\'static" 115 [email protected] "'static"
116 [email protected] ")" 116 [email protected] ")"
117 [email protected] ";" 117 [email protected] ";"
118 [email protected] "\n" 118 [email protected] "\n"
diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs
index e6d2301c7..9ec541c57 100644
--- a/crates/test_utils/src/minicore.rs
+++ b/crates/test_utils/src/minicore.rs
@@ -22,6 +22,11 @@
22//! result: 22//! result:
23//! iterator: option 23//! iterator: option
24//! iterators: iterator 24//! iterators: iterator
25//! default: sized
26//! from: sized
27//! eq: sized
28//! ord: eq, option
29//! derive:
25 30
26pub mod marker { 31pub mod marker {
27 // region:sized 32 // region:sized
@@ -37,6 +42,40 @@ pub mod marker {
37 // endregion:unsize 42 // endregion:unsize
38} 43}
39 44
45// region:default
46pub mod default {
47 pub trait Default: Sized {
48 fn default() -> Self;
49 }
50}
51// endregion:default
52
53// region:from
54pub mod convert {
55 pub trait From<T>: Sized {
56 fn from(_: T) -> Self;
57 }
58 pub trait Into<T>: Sized {
59 fn into(self) -> T;
60 }
61
62 impl<T, U> Into<U> for T
63 where
64 U: From<T>,
65 {
66 fn into(self) -> U {
67 U::from(self)
68 }
69 }
70
71 impl<T> From<T> for T {
72 fn from(t: T) -> T {
73 t
74 }
75 }
76}
77// endregion:from
78
40pub mod ops { 79pub mod ops {
41 // region:coerce_unsized 80 // region:coerce_unsized
42 mod unsize { 81 mod unsize {
@@ -137,6 +176,49 @@ pub mod ops {
137 // endregion:fn 176 // endregion:fn
138} 177}
139 178
179// region:eq
180pub mod cmp {
181 #[lang = "eq"]
182 pub trait PartialEq<Rhs: ?Sized = Self> {
183 fn eq(&self, other: &Rhs) -> bool;
184 }
185
186 pub trait Eq: PartialEq<Self> {}
187
188 // region:derive
189 #[rustc_builtin_macro]
190 pub macro PartialEq($item:item) {}
191 #[rustc_builtin_macro]
192 pub macro Eq($item:item) {}
193 // endregion:derive
194
195 // region:ord
196 #[lang = "partial_ord"]
197 pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
198 fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
199 }
200
201 pub trait Ord: Eq + PartialOrd<Self> {
202 fn cmp(&self, other: &Self) -> Ordering;
203 }
204
205 pub enum Ordering {
206 Less = -1,
207 Equal = 0,
208 Greater = 1,
209 }
210
211 // region:derive
212 #[rustc_builtin_macro]
213 pub macro PartialOrd($item:item) {}
214 #[rustc_builtin_macro]
215 pub macro Ord($item:item) {}
216 // endregion:derive
217
218 // endregion:ord
219}
220// endregion:eq
221
140// region:slice 222// region:slice
141pub mod slice { 223pub mod slice {
142 #[lang = "slice"] 224 #[lang = "slice"]
@@ -306,10 +388,26 @@ pub mod iter {
306} 388}
307// endregion:iterator 389// endregion:iterator
308 390
391// region:derive
392mod macros {
393 pub(crate) mod builtin {
394 #[rustc_builtin_macro]
395 pub macro derive($item:item) {
396 /* compiler built-in */
397 }
398 }
399}
400// endregion:derive
401
309pub mod prelude { 402pub mod prelude {
310 pub mod v1 { 403 pub mod v1 {
311 pub use crate::{ 404 pub use crate::{
405 cmp::{Eq, PartialEq}, // :eq
406 cmp::{Ord, PartialOrd}, // :ord
407 convert::{From, Into}, // :from
408 default::Default, // :default
312 iter::{IntoIterator, Iterator}, // :iterator 409 iter::{IntoIterator, Iterator}, // :iterator
410 macros::builtin::derive, // :derive
313 marker::Sized, // :sized 411 marker::Sized, // :sized
314 ops::{Fn, FnMut, FnOnce}, // :fn 412 ops::{Fn, FnMut, FnOnce}, // :fn
315 option::Option::{self, None, Some}, // :option 413 option::Option::{self, None, Some}, // :option
diff --git a/crates/vfs/src/vfs_path.rs b/crates/vfs/src/vfs_path.rs
index 2b3d7fd84..ef2d7657a 100644
--- a/crates/vfs/src/vfs_path.rs
+++ b/crates/vfs/src/vfs_path.rs
@@ -389,7 +389,7 @@ impl VirtualPath {
389 389
390 match (file_stem, extension) { 390 match (file_stem, extension) {
391 (None, None) => None, 391 (None, None) => None,
392 (None, Some(_)) | (Some(""), Some(_)) => Some((file_name, None)), 392 (None | Some(""), Some(_)) => Some((file_name, None)),
393 (Some(file_stem), extension) => Some((file_stem, extension)), 393 (Some(file_stem), extension) => Some((file_stem, extension)),
394 } 394 }
395 } 395 }