Skip to content

Commit 8ac9104

Browse files
committed
track_caller error numbers and text.
1 parent da86007 commit 8ac9104

File tree

9 files changed

+32
-28
lines changed

9 files changed

+32
-28
lines changed

src/librustc/error_codes.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -1727,16 +1727,6 @@ each method; it is not possible to annotate the entire impl with an `#[inline]`
17271727
attribute.
17281728
"##,
17291729

1730-
E0900: r##"
1731-
FIXME(anp): change error number
1732-
FIXME(anp): track_caller: invalid syntax
1733-
"##,
1734-
1735-
E0901: r##"
1736-
FIXME(anp): change error number
1737-
FIXME(anp): track_caller: no naked functions
1738-
"##,
1739-
17401730
E0522: r##"
17411731
The lang attribute is intended for marking special items that are built-in to
17421732
Rust itself. This includes special traits (like `Copy` and `Sized`) that affect
@@ -2244,6 +2234,15 @@ These attributes are meant to only be used by the standard library and are
22442234
rejected in your own crates.
22452235
"##,
22462236

2237+
E0736: r##"
2238+
#[track_caller] and #[naked] cannot be applied to the same function.
2239+
2240+
This is primarily due to ABI incompatibilities between the two attributes.
2241+
See [RFC 2091] for details on this and other limitations.
2242+
2243+
[RFC 2091]: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md
2244+
"##,
2245+
22472246
;
22482247
// E0006, // merged with E0005
22492248
// E0101, // replaced with E0282
@@ -2306,4 +2305,5 @@ rejected in your own crates.
23062305
E0726, // non-explicit (not `'_`) elided lifetime in unsupported position
23072306
E0727, // `async` generators are not yet supported
23082307
E0728, // `await` must be in an `async` function or block
2308+
E0735, // invalid track_caller application/syntax
23092309
}

src/librustc/hir/check_attr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl CheckAttrVisitor<'tcx> {
143143
struct_span_err!(
144144
self.tcx.sess,
145145
attr.span,
146-
E0900,
146+
E0735,
147147
"attribute should be applied to function"
148148
)
149149
.span_label(item.span, "not a function")
@@ -153,7 +153,7 @@ impl CheckAttrVisitor<'tcx> {
153153
struct_span_err!(
154154
self.tcx.sess,
155155
attr.span,
156-
E0901,
156+
E0736,
157157
"cannot use `#[track_caller]` with `#[naked]`",
158158
)
159159
.emit();

src/librustc_typeck/check/wfcheck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ pub fn check_trait_item(tcx: TyCtxt<'_>, def_id: DefId) {
179179
struct_span_err!(
180180
tcx.sess,
181181
attr.span,
182-
E0903,
182+
E0738,
183183
"`#[track_caller]` is not supported for trait items yet."
184184
).emit();
185185
}

src/librustc_typeck/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2601,7 +2601,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
26012601
struct_span_err!(
26022602
tcx.sess,
26032603
attr.span,
2604-
E0902,
2604+
E0737,
26052605
"rust ABI is required to use `#[track_caller]`"
26062606
).emit();
26072607
}

src/librustc_typeck/error_codes.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -4908,14 +4908,18 @@ The `Box<...>` ensures that the result is of known size,
49084908
and the pin is required to keep it in the same place in memory.
49094909
"##,
49104910

4911-
E0902: r##"
4912-
FIXME(anp): change error number
4913-
FIXME(anp): track_caller: require Rust ABI to use track_caller
4911+
E0737: r##"
4912+
#[track_caller] requires functions to have the "Rust" ABI for passing caller
4913+
location. See [RFC 2091] for details on this and other restrictions.
4914+
4915+
[RFC 2091]: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md
49144916
"##,
49154917

4916-
E0903: r##"
4917-
FIXME(anp): change error number
4918-
FIXME(anp): track_caller: can't apply in traits
4918+
E0738: r##"
4919+
#[track_caller] cannot be applied to trait methods. See [RFC 2091]
4920+
for details on this and other restrictions.
4921+
4922+
[RFC 2091]: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md
49194923
"##,
49204924

49214925
;
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
error[E0902]: rust ABI is required to use `#[track_caller]`
1+
error[E0737]: rust ABI is required to use `#[track_caller]`
22
--> $DIR/error-with-invalid-abi.rs:3:1
33
|
44
LL | #[track_caller]
55
| ^^^^^^^^^^^^^^^
66

77
error: aborting due to previous error
88

9-
For more information about this error, try `rustc --explain E0902`.
9+
For more information about this error, try `rustc --explain E0737`.
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
error[E0901]: cannot use `#[track_caller]` with `#[naked]`
1+
error[E0736]: cannot use `#[track_caller]` with `#[naked]`
22
--> $DIR/error-with-naked.rs:3:1
33
|
44
LL | #[track_caller]
55
| ^^^^^^^^^^^^^^^
66

77
error: aborting due to previous error
88

9-
For more information about this error, try `rustc --explain E0901`.
9+
For more information about this error, try `rustc --explain E0736`.
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
error[E0903]: `#[track_caller]` is not supported for trait items yet.
1+
error[E0738]: `#[track_caller]` is not supported for trait items yet.
22
--> $DIR/error-with-trait-fns.rs:4:5
33
|
44
LL | #[track_caller]
55
| ^^^^^^^^^^^^^^^
66

77
error: aborting due to previous error
88

9-
For more information about this error, try `rustc --explain E0903`.
9+
For more information about this error, try `rustc --explain E0738`.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0900]: attribute should be applied to function
1+
error[E0735]: attribute should be applied to function
22
--> $DIR/only-for-fns.rs:3:1
33
|
44
LL | #[track_caller]
@@ -8,4 +8,4 @@ LL | struct S;
88

99
error: aborting due to previous error
1010

11-
For more information about this error, try `rustc --explain E0900`.
11+
For more information about this error, try `rustc --explain E0735`.

0 commit comments

Comments
 (0)