]> git.lizzy.rs Git - rust.git/commitdiff
track_caller error numbers and text.
authorAdam Perry <adam.n.perry@gmail.com>
Thu, 3 Oct 2019 05:35:58 +0000 (22:35 -0700)
committerAdam Perry <adam.n.perry@gmail.com>
Mon, 7 Oct 2019 15:05:33 +0000 (08:05 -0700)
src/librustc/error_codes.rs
src/librustc/hir/check_attr.rs
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/collect.rs
src/librustc_typeck/error_codes.rs
src/test/ui/rfc-2091-track-caller/error-with-invalid-abi.stderr
src/test/ui/rfc-2091-track-caller/error-with-naked.stderr
src/test/ui/rfc-2091-track-caller/error-with-trait-fns.stderr
src/test/ui/rfc-2091-track-caller/only-for-fns.stderr

index b2671e48be68457076a576cbd89e1f4b90c8ba4f..6be1b6a54fb3f381eda478dd856be4abbbe5d4d3 100644 (file)
@@ -1640,16 +1640,6 @@ impl Foo {
 attribute.
 "##,
 
-E0900: r##"
-FIXME(anp): change error number
-FIXME(anp): track_caller: invalid syntax
-"##,
-
-E0901: r##"
-FIXME(anp): change error number
-FIXME(anp): track_caller: no naked functions
-"##,
-
 E0522: r##"
 The lang attribute is intended for marking special items that are built-in to
 Rust itself. This includes special traits (like `Copy` and `Sized`) that affect
@@ -2085,6 +2075,15 @@ fn foo(){}
 rejected in your own crates.
 "##,
 
+E0736: r##"
+#[track_caller] and #[naked] cannot be applied to the same function.
+
+This is primarily due to ABI incompatibilities between the two attributes.
+See [RFC 2091] for details on this and other limitations.
+
+[RFC 2091]: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md
+"##,
+
 ;
 //  E0006, // merged with E0005
 //  E0101, // replaced with E0282
@@ -2146,4 +2145,5 @@ fn foo(){}
     E0726, // non-explicit (not `'_`) elided lifetime in unsupported position
     E0727, // `async` generators are not yet supported
     E0728, // `await` must be in an `async` function or block
+    E0735, // invalid track_caller application/syntax
 }
index 66415e26281b3de01a7dff5e8d325ffa4ba34187..35c7ffbf14ef376cf483b8dfd0c7bcbd16a39019 100644 (file)
@@ -143,7 +143,7 @@ fn check_track_caller(&self, attr: &hir::Attribute, item: &hir::Item, target: Ta
             struct_span_err!(
                 self.tcx.sess,
                 attr.span,
-                E0900,
+                E0735,
                 "attribute should be applied to function"
             )
             .span_label(item.span, "not a function")
@@ -153,7 +153,7 @@ fn check_track_caller(&self, attr: &hir::Attribute, item: &hir::Item, target: Ta
             struct_span_err!(
                 self.tcx.sess,
                 attr.span,
-                E0901,
+                E0736,
                 "cannot use `#[track_caller]` with `#[naked]`",
             )
             .emit();
index 3c9010de5cb77c419c1ce1f50769dce5dad5135b..b8d1da2bbed85225e6cf79ffa52d31bae2b082a2 100644 (file)
@@ -179,7 +179,7 @@ pub fn check_trait_item(tcx: TyCtxt<'_>, def_id: DefId) {
             struct_span_err!(
                 tcx.sess,
                 attr.span,
-                E0903,
+                E0738,
                 "`#[track_caller]` is not supported for trait items yet."
             ).emit();
         }
index 0b98e4b781d77359bc6519b4bcd7b9f364e2d75c..7f34aa354c9e858c288ae82fff7ae59b4544aa5e 100644 (file)
@@ -2599,7 +2599,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
                 struct_span_err!(
                     tcx.sess,
                     attr.span,
-                    E0902,
+                    E0737,
                     "rust ABI is required to use `#[track_caller]`"
                 ).emit();
             }
index 1ebae19c7d90b9d4d3cc9153833c6ae261a56d85..be1e34661fd1aa0c87e54e12beaa35e386591d2d 100644 (file)
@@ -4908,14 +4908,18 @@ fn foo_recursive(n: usize) -> Pin<Box<dyn Future<Output = ()>>> {
 and the pin is required to keep it in the same place in memory.
 "##,
 
-E0902: r##"
-FIXME(anp): change error number
-FIXME(anp): track_caller: require Rust ABI to use track_caller
+E0737: r##"
+#[track_caller] requires functions to have the "Rust" ABI for passing caller
+location. See [RFC 2091] for details on this and other restrictions.
+
+[RFC 2091]: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md
 "##,
 
-E0903: r##"
-FIXME(anp): change error number
-FIXME(anp): track_caller: can't apply in traits
+E0738: r##"
+#[track_caller] cannot be applied to trait methods. See [RFC 2091]
+for details on this and other restrictions.
+
+[RFC 2091]: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md
 "##,
 
 ;
index fc6f4d17dcc42fd127ed3c7e562b01a2ed6c6a1f..e39e4bee5cf9cd696b1ba10442eb3b33c16628d5 100644 (file)
@@ -1,4 +1,4 @@
-error[E0902]: rust ABI is required to use `#[track_caller]`
+error[E0737]: rust ABI is required to use `#[track_caller]`
   --> $DIR/error-with-invalid-abi.rs:3:1
    |
 LL | #[track_caller]
@@ -6,4 +6,4 @@ LL | #[track_caller]
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0902`.
+For more information about this error, try `rustc --explain E0737`.
index 3566d288ed10b869553318692fcbc2d06c471fb2..2f5003cfdb7a57aab2466517101303f8398d4308 100644 (file)
@@ -1,4 +1,4 @@
-error[E0901]: cannot use `#[track_caller]` with `#[naked]`
+error[E0736]: cannot use `#[track_caller]` with `#[naked]`
   --> $DIR/error-with-naked.rs:3:1
    |
 LL | #[track_caller]
@@ -6,4 +6,4 @@ LL | #[track_caller]
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0901`.
+For more information about this error, try `rustc --explain E0736`.
index bd3d4043a642b9124b6159edd83bb446d298631e..e3f3135cd7366a36b5eddefd82c6d2479c3993f2 100644 (file)
@@ -1,4 +1,4 @@
-error[E0903]: `#[track_caller]` is not supported for trait items yet.
+error[E0738]: `#[track_caller]` is not supported for trait items yet.
   --> $DIR/error-with-trait-fns.rs:4:5
    |
 LL |     #[track_caller]
@@ -6,4 +6,4 @@ LL |     #[track_caller]
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0903`.
+For more information about this error, try `rustc --explain E0738`.
index 9ddc99c02bf9c83a58857a1570b66e270b9b7881..ac5ba0bfbaac689b2f16397095265ebdb4c21788 100644 (file)
@@ -1,4 +1,4 @@
-error[E0900]: attribute should be applied to function
+error[E0735]: attribute should be applied to function
   --> $DIR/only-for-fns.rs:3:1
    |
 LL | #[track_caller]
@@ -8,4 +8,4 @@ LL | struct S;
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0900`.
+For more information about this error, try `rustc --explain E0735`.