From 55dccb99fd3e39701eebc096b180d590f05d3699 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Mon, 12 Jun 2017 23:40:58 -0400 Subject: [PATCH 1/3] Fix a couple broken links to the reference from error messages. --- src/librustc_typeck/diagnostics.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 37f6f3753d7b4..aaba2f9aa2a86 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -242,7 +242,7 @@ trait_obj.method_two(); You can read more about trait objects in the Trait Object section of the Reference: -https://doc.rust-lang.org/reference.html#trait-objects +https://doc.rust-lang.org/reference/types.html#trait-objects "##, E0034: r##" @@ -875,7 +875,7 @@ optional namespacing), a dereference, an indexing expression or a field reference. More details can be found here: -https://doc.rust-lang.org/reference.html#lvalues-rvalues-and-temporaries +https://doc.rust-lang.org/reference/expressions.html#lvalues-rvalues-and-temporaries Now, we can go further. Here are some erroneous code examples: From 9c0fa15d2cc54e28f7cb3f9ce6eb646668eb1260 Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Wed, 5 Jul 2017 21:12:09 +0000 Subject: [PATCH 2/3] fix description for E0617 It used to point to the Book, but no specific section, and in fact the information is not in the Book (see rust-lang-nursery/reference#77). --- src/librustc_typeck/diagnostics.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index aaba2f9aa2a86..41605cfcb331b 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -4632,9 +4632,10 @@ unsafe { } ``` -To fix this error, you need to pass variables corresponding to C types as much -as possible. For better explanations, see The Rust Book: -https://doc.rust-lang.org/book/ +Certain Rust types must be cast before passing them to a variadic function, +because of arcane ABI rules dictated by the C standard. To fix the error, +cast the value to the type specified by the error message (which you may need +to import from `std::os::raw`). "##, E0618: r##" From 7386288e30bbd4bd2c65c93a3884fd7e307f5d82 Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Wed, 5 Jul 2017 21:13:07 +0000 Subject: [PATCH 3/3] change error URLs to footnote style --- src/librustc_typeck/diagnostics.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 41605cfcb331b..1ce87ca61b07b 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -239,10 +239,10 @@ trait_obj.method_one(); trait_obj.method_two(); ``` -You can read more about trait objects in the Trait Object section of the -Reference: +You can read more about trait objects in the [Trait Objects] section of the +Reference. -https://doc.rust-lang.org/reference/types.html#trait-objects +[Trait Objects]: https://doc.rust-lang.org/reference/types.html#trait-objects "##, E0034: r##" @@ -874,8 +874,9 @@ lvalue expression represents a memory location and can be a variable (with optional namespacing), a dereference, an indexing expression or a field reference. -More details can be found here: -https://doc.rust-lang.org/reference/expressions.html#lvalues-rvalues-and-temporaries +More details can be found in the [Expressions] section of the Reference. + +[Expressions]: https://doc.rust-lang.org/reference/expressions.html#lvalues-rvalues-and-temporaries Now, we can go further. Here are some erroneous code examples: @@ -3485,10 +3486,10 @@ struct Foo<'a, T: 'a> { } ``` -PhantomData can also be used to express information about unused type -parameters. You can read more about it in the API documentation: +[PhantomData] can also be used to express information about unused type +parameters. -https://doc.rust-lang.org/std/marker/struct.PhantomData.html +[PhantomData]: https://doc.rust-lang.org/std/marker/struct.PhantomData.html "##, E0393: r##" @@ -4360,7 +4361,9 @@ let variable = Foo { x: 0, y: -12 }; println!("x: {}, y: {}", variable.x, variable.y); ``` -For more information see The Rust Book: https://doc.rust-lang.org/book/ +For more information about primitives and structs, take a look at The Book: +https://doc.rust-lang.org/book/first-edition/primitive-types.html +https://doc.rust-lang.org/book/first-edition/structs.html "##, E0611: r##"