Debian Codegraph @

src/panic.rs

raw symbols SCIP
1 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::{selfrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/, Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#, Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#};
2
3 use proc_macro2rust-analyzer cargo proc-macro2 1.0.107 crate/::Spanrust-analyzer cargo proc-macro2 1.0.107 Span#;
4 use synrust-analyzer cargo syn 2.0.119 crate/::{spannedrust-analyzer cargo syn 2.0.119 spanned/::Spannedrust-analyzer cargo syn 2.0.119 spanned/Spanned#, Identrust-analyzer cargo proc-macro2 1.0.107 Ident#, Pathrust-analyzer cargo syn 2.0.119 path/Path#, Variantrust-analyzer cargo syn 2.0.119 data/Variant#};
5
6 use craterust-analyzer cargo educe 0.6.0 crate/::{commonrust-analyzer cargo educe 0.6.0 common/::pathrust-analyzer cargo educe 0.6.0 common/path/::path_to_stringrust-analyzer cargo educe 0.6.0 common/path/path_to_string()., Traitrust-analyzer cargo educe 0.6.0 supported_traits/Trait#};
7
8 struct DisplayStringSlicerust-analyzer cargo educe 0.6.0 panic/DisplayStringSlice#<'a>(&'a [&'static str]);
9
10 impl<'a> Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for DisplayStringSlicerust-analyzer cargo educe 0.6.0 panic/DisplayStringSlice#<'a> {
11 fn fmtrust-analyzer cargo educe 0.6.0 panic/impl#[`DisplayStringSlice<'a>`][Display]fmt().(&self, f: &mut Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
12 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.0rust-analyzer cargo educe 0.6.0 panic/DisplayStringSlice#0..is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() {
13 f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(", which should be reformatted as follows:")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
14
15 for &s in self.0rust-analyzer cargo educe 0.6.0 panic/DisplayStringSlice#0. {
16 f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("\n ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
17 f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(s)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
18 }
19 }
20
21 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
22 }
23 }
24
25 struct DisplayTraitsrust-analyzer cargo educe 0.6.0 panic/DisplayTraits#;
26
27 impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for DisplayTraitsrust-analyzer cargo educe 0.6.0 panic/DisplayTraits# {
28 #[inline]
29 fn fmtrust-analyzer cargo educe 0.6.0 panic/impl#[DisplayTraits][Display]fmt().(&self, f: &mut Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
30 for t in &Traitrust-analyzer cargo educe 0.6.0 supported_traits/Trait#::VARIANTSrust-analyzer cargo educe 0.6.0 supported_traits/impl#[Trait]VARIANTS.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#Traitrust-analyzer cargo educe 0.6.0 supported_traits/Trait#::VARIANTSrust-analyzer cargo educe 0.6.0 supported_traits/impl#[Trait]VARIANTS..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). {
31 f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("\n ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
32 f.write_fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_fmt().(format_argsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/format_args!!("{t:?}"))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
33 }
34
35 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
36 }
37 }
38
39 #[inline]
40 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn derive_attribute_not_set_up_yetrust-analyzer cargo educe 0.6.0 panic/derive_attribute_not_set_up_yet().() -> synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error# {
41 synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(
42 Spanrust-analyzer cargo proc-macro2 1.0.107 Span#::call_siterust-analyzer cargo proc-macro2 1.0.107 impl#[Span]call_site().(),
43 "you are using `Educe` in the `derive` attribute, but it has not been set up yet",
44 )
45 }
46
47 #[inline]
48 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn attribute_incorrect_placerust-analyzer cargo educe 0.6.0 panic/attribute_incorrect_place().(name: &Identrust-analyzer cargo proc-macro2 1.0.107 Ident#) -> synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error# {
49 synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(name.spanrust-analyzer cargo proc-macro2 1.0.107 impl#[Ident]span().(), formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("the `{name}` attribute cannot be placed here"))
50 }
51
52 #[inline]
53 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn attribute_incorrect_format_with_spanrust-analyzer cargo educe 0.6.0 panic/attribute_incorrect_format_with_span().(
54 name: &Identrust-analyzer cargo proc-macro2 1.0.107 Ident#,
55 span: Spanrust-analyzer cargo proc-macro2 1.0.107 Span#,
56 correct_usage: &[&'static str],
57 ) -> synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error# {
58 if correct_usage.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() {
59 attribute_incorrect_placerust-analyzer cargo educe 0.6.0 panic/attribute_incorrect_place().(name)
60 } else {
61 synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(
62 span,
63 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
64 "you are using an incorrect format of the `{name}` attribute{}",
65 DisplayStringSlicerust-analyzer cargo educe 0.6.0 panic/DisplayStringSlice#(correct_usage)
66 ),
67 )
68 }
69 }
70
71 #[inline]
72 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn attribute_incorrect_formatrust-analyzer cargo educe 0.6.0 panic/attribute_incorrect_format().(
73 name: &Identrust-analyzer cargo proc-macro2 1.0.107 Ident#,
74 correct_usage: &[&'static str],
75 ) -> synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error# {
76 attribute_incorrect_format_with_spanrust-analyzer cargo educe 0.6.0 panic/attribute_incorrect_format_with_span().(name, name.spanrust-analyzer cargo proc-macro2 1.0.107 impl#[Ident]span().(), correct_usage)
77 }
78
79 #[inline]
80 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn parameter_resetrust-analyzer cargo educe 0.6.0 panic/parameter_reset().(name: &Identrust-analyzer cargo proc-macro2 1.0.107 Ident#) -> synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error# {
81 synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(name.spanrust-analyzer cargo proc-macro2 1.0.107 impl#[Ident]span().(), formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("you are trying to reset the `{name}` parameter"))
82 }
83
84 #[inline]
85 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn educe_format_incorrectrust-analyzer cargo educe 0.6.0 panic/educe_format_incorrect().(name: &Identrust-analyzer cargo proc-macro2 1.0.107 Ident#) -> synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error# {
86 attribute_incorrect_formatrust-analyzer cargo educe 0.6.0 panic/attribute_incorrect_format().(name, &[stringifyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/stringify!!(#[educe(Trait1, Trait2, ..., TraitN)])])
87 }
88
89 #[inline]
90 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn unsupported_traitrust-analyzer cargo educe 0.6.0 panic/unsupported_trait().(name: &Pathrust-analyzer cargo syn 2.0.119 path/Path#) -> synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error# {
91 let span = name.spanrust-analyzer cargo syn 2.0.119 spanned/impl#[T][Spanned]span().();
92
93 match name.get_identrust-analyzer cargo syn 2.0.119 path/impl#[Path]get_ident().() {
94 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(name) => synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(
95 span,
96 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("unsupported trait `{name}`, available traits:{DisplayTraits}"),
97 ),
98 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => {
99 let name = path_to_stringrust-analyzer cargo educe 0.6.0 common/path/path_to_string().(name);
100
101 synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(
102 span,
103 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("unsupported trait `{name}`, available traits:{DisplayTraits}"),
104 )
105 },
106 }
107 }
108
109 #[inline]
110 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn reuse_a_traitrust-analyzer cargo educe 0.6.0 panic/reuse_a_trait().(name: &Identrust-analyzer cargo proc-macro2 1.0.107 Ident#) -> synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error# {
111 synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(name.spanrust-analyzer cargo proc-macro2 1.0.107 impl#[Ident]span().(), formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("the trait `{name}` is used repeatedly"))
112 }
113
114 #[inline]
115 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn trait_not_usedrust-analyzer cargo educe 0.6.0 panic/trait_not_used().(name: &Identrust-analyzer cargo proc-macro2 1.0.107 Ident#) -> synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error# {
116 synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(name.spanrust-analyzer cargo proc-macro2 1.0.107 impl#[Ident]span().(), formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("the trait `{name}` is not used"))
117 }
118
119 #[inline]
120 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn trait_not_support_unionrust-analyzer cargo educe 0.6.0 panic/trait_not_support_union().(name: &Identrust-analyzer cargo proc-macro2 1.0.107 Ident#) -> synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error# {
121 synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(name.spanrust-analyzer cargo proc-macro2 1.0.107 impl#[Ident]span().(), formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("the trait `{name}` does not support to a union"))
122 }
123
124 #[inline]
125 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn trait_not_support_unit_variantrust-analyzer cargo educe 0.6.0 panic/trait_not_support_unit_variant().(name: &Identrust-analyzer cargo proc-macro2 1.0.107 Ident#, variant: &Variantrust-analyzer cargo syn 2.0.119 data/Variant#) -> synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error# {
126 synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(
127 variant.spanrust-analyzer cargo syn 2.0.119 spanned/impl#[T][Spanned]span().(),
128 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("the trait `{name}` cannot be implemented for an enum which has unit variants"),
129 )
130 }