Skip to content

Commit 9900211

Browse files
committed
track_caller error numbers and text.
1 parent d931afe commit 9900211

File tree

9 files changed

+32
-28
lines changed

9 files changed

+32
-28
lines changed

src/librustc/error_codes.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,16 +1640,6 @@ each method; it is not possible to annotate the entire impl with an `#[inline]`
16401640
attribute.
16411641
"##,
16421642

1643-
E0900: r##"
1644-
FIXME(anp): change error number
1645-
FIXME(anp): track_caller: invalid syntax
1646-
"##,
1647-
1648-
E0901: r##"
1649-
FIXME(anp): change error number
1650-
FIXME(anp): track_caller: no naked functions
1651-
"##,
1652-
16531643
E0522: r##"
16541644
The lang attribute is intended for marking special items that are built-in to
16551645
Rust itself. This includes special traits (like `Copy` and `Sized`) that affect
@@ -2085,6 +2075,15 @@ These attributes are meant to only be used by the standard library and are
20852075
rejected in your own crates.
20862076
"##,
20872077

2078+
E0736: r##"
2079+
#[track_caller] and #[naked] cannot be applied to the same function.
2080+
2081+
This is primarily due to ABI incompatibilities between the two attributes.
2082+
See [RFC 2091] for details on this and other limitations.
2083+
2084+
[RFC 2091]: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md
2085+
"##,
2086+
20882087
;
20892088
// E0006, // merged with E0005
20902089
// E0101, // replaced with E0282
@@ -2146,4 +2145,5 @@ rejected in your own crates.
21462145
E0726, // non-explicit (not `'_`) elided lifetime in unsupported position
21472146
E0727, // `async` generators are not yet supported
21482147
E0728, // `await` must be in an `async` function or block
2148+
E0735, // invalid track_caller application/syntax
21492149
}

src/librustc/hir/check_attr.rs

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2599,7 +2599,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
25992599
struct_span_err!(
26002600
tcx.sess,
26012601
attr.span,
2602-
E0902,
2602+
E0737,
26032603
"rust ABI is required to use `#[track_caller]`"
26042604
).emit();
26052605
}

src/librustc_typeck/error_codes.rs

Lines changed: 10 additions & 6 deletions
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
;
Lines changed: 2 additions & 2 deletions
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`.
Lines changed: 2 additions & 2 deletions
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`.
Lines changed: 2 additions & 2 deletions
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`.
Lines changed: 2 additions & 2 deletions
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)