Commit Graph

43 Commits

Author SHA1 Message Date
Yuri Astrakhan c13271897d Inline fmt lints for `redirects/`
I couldn't find any documentation of how `redirects/` dir is being used,
but fixed inlined format args for consistency
2024-04-19 15:40:41 -04:00
Chris Krycho 96224742f3
Merge pull request #3048 from nyurik/format-ident
Use v1.58 captured ident formatting in examples
2024-04-19 11:49:12 -06:00
Nicholas Nethercote 5b6c1ceaa6 Prepare for removal of compiler plugin support.
https://github.com/rust-lang/rust/pull/116412 will remove support for
compiler plugins from rustc, which includes the entry in The Rust
Unstable Book. This commit removes a link to that entry so it won't be
broken when that PR merges.
2023-11-01 09:55:24 -04:00
Yuri Astrakhan a786ec4a2b Use v1.58 captured ident formatting in examples
Per https://github.com/rust-lang/book/issues/3047, use captured identifiers instead of the positional ones for some examples, e.g.

```diff
-  println!("Worker {} got a job; executing.", id);
+  println!("Worker {id} got a job; executing.");
```
2023-10-30 11:54:45 -04:00
kadiwa 72187f5cd0 redirects: change link for `#![no_std]` tutorial 2023-08-04 10:42:07 -04:00
Eric Huss 5c5dbc5b19 Fix constants link. 2021-11-09 19:30:43 -05:00
Carol (Nichols || Goulding) 10f89936b0
Remove Advanced Lifetimes section completely 2019-04-11 11:51:14 -04:00
Eric Huss a2bbd29cb9 Fix link to Reference's conditional-compilation. 2019-03-21 14:26:40 -07:00
Kornel 1768b73dcc More link fixes 2019-02-25 01:33:17 +00:00
Carol (Nichols || Goulding) 2978109297
Merge pull request #1644 from psincf/patch-2
Fix chapter number in "Attributes" redirection
2018-12-12 22:29:00 -05:00
Dmitry Borodin aa91a974fd Updated URLs according to the website update
Fixes #1666
Fixes #1678
2018-12-11 01:12:21 +01:00
Matt Brubeck 6a48927b15 Update links in redirects 2018-12-07 07:19:03 -08:00
psincf a4bbe74e82
Fix chapter number in "Attributes" redirection 2018-11-24 20:56:56 +01:00
Steve Klabnik 6c524fa894 fix redirect pages 2018-11-20 17:59:52 -05:00
Steve Klabnik fc4274d906 rustbuild won
I want these in the redirect directory, but rustbuild just isn't having it.
2018-11-20 14:50:24 -05:00
Steve Klabnik 86a3a3beb9 we need a 2018 redirect too 2018-11-20 14:00:05 -05:00
Steve Klabnik 1fedfc4b96 move the book to the top level 2018-11-20 13:45:05 -05:00
Lireer 3b10fa19f3
Redirect to the correct section of the second book 2018-07-06 12:19:21 +02:00
steveklabnik 36d65d0016 fix redirects 2018-05-22 11:29:38 -04:00
Kornel 794c81b7b4 Update link to match change in second edition
Blocks https://github.com/rust-lang/rust/pull/50163
2018-04-23 16:55:52 +01:00
Félix Saparelli 56a40391da
Macros appendix exists in 2nd ed now 2018-04-18 11:36:57 +12:00
steveklabnik 98921e9de8 fix some broken links 2018-02-21 14:17:16 -05:00
steveklabnik a645960fe4 fix the build 2018-01-29 19:56:08 -05:00
steveklabnik 5fb6bdc77c fix redirect 2018-01-29 18:08:51 -05:00
steveklabnik 62210e326c fix many links in redirects
see https://travis-ci.org/rust-lang/rust/builds/333458473
2018-01-26 11:44:04 -05:00
Félix Saparelli 0ed0eef71a
Highlight recommended path and lowlight the rest
Instead of placing the link to the recommended resource i.e. the second
edition in second place, push it up to the top of the list. In fact,
push the link to the first edition always at the bottom.

To emphasise even more that's where new visitors should go, bolden the
first link, and make the first-ed link smaller.

All this as well as a slight edit and simplification of the copy is
designed to make the new and recommended resources the primary path
readers take, without hiding the old resource completely.
2017-12-31 18:12:49 +13:00
Félix Saparelli 6454576fe4
Add blurb and code example
To improve immediate value and reduce discard-because-not-useful factor
upon arriving at a page which does not contain the content you were
expecting, add a small blurb taken/adapted from the newer source,
optionally accompanied by a code sample describing the feature.

However, due to the transitive nature of this resource, there must be no
content here that isn't available elsewhere.
2017-12-31 16:15:12 +13:00
Félix Saparelli fb9f9805ed
Add the title of the link into its text
To make it clearer where links are going, eliminate entirely the
language of "Related" or the long verbose book titles. Instead, simply
prefix with "In the first/second edition" as needed, and in similar
style for other resources like the reference or the Unsafe book.

Add the target's title, i.e. chapter number, name, and sometimes
subsection, directly to the link copy.
2017-12-31 12:20:58 +13:00
Félix Saparelli e1381afbce
Always go somewhere
Unless it is the correct place to go, never link to the index of the
second edition as fallback. Point instead to different books, to the
reference, to the API documentation, etc.
2017-12-31 12:20:58 +13:00
Félix Saparelli ebbdd0132f
Put the chapter title as the title
And reword the blurb to include what was previously in the title.

This makes it easier to see that one has arrived to the right place:
beforehand, the only indication was through the link target for the
first edition; it was nowhere in the copy itself for most pages.
2017-12-31 12:20:58 +13:00
Carol (Nichols || Goulding) fa96d84192 Make a few small corrections to the redirect pages 2017-11-03 12:08:11 -04:00
Ludwig Weinzierl 9d57d663d4 Fix links to second edition on redirect pages
Search engines often show the redirect page for search terms like "rust
topic" or "rust book topic". Currently the redirect targets all go to the
index.html of the second edition of the book. This discourages users
to use the second edition, because many will click on the direct link to
the first edition out of laziness. In addition, as long as the pages of
the second edition are not well linked, the old pages will probably stay
at the top of the search results.

To fix this, this commit changes the target links to go to the related
content in the second edition, in the following way:

Old content maps in different ways to new content:

  1.  1:1 mapping

      content is comprehensively covered in a single location of the
      second edition

  2. basic/advanced mapping

     content is comprehensively covered in two locations of the second
     edition; first location covers the basics, second location covers
     advanced topics

  3.  split mapping

      content is covered in muliple locations of the second edition

  4.  moved

      content has moved to another place

  5.  removed

      content doesn't exist in the second edition

This commit handles these cases in the following way:

1. Mapping type 1: 1:1 mapping

   Change the link target from "second-edition/index.html" to the
   respective chapter, page or section of the second edition.
   Change the link text from "Index of the second edition..." to
   either of:

	- "Related chapter in the second edition"

	- "Related page in the second edition"

	- "Related section in the second edition"

   "Related" was chosen because content of two versions is at least
   related but not necessarily equivalent.

   Example: closures.md

2. Mapping type 2: basic/advanced mapping

   Change the link target from "second-edition/index.html" to the
   respective chapter, page or section of the second edition. Add
   a second link target for the advanced chapter, page or section.
   Change the link text like for type 1. Add the second link with
   the following text: "Related chapter in the second edition
   of The Rust Programming Language (covering more advanced
   topics)". Similar to the messages of type 2 there are variants
   with "page" and "section".

   Example: lifetimes.md

3. Mapping type 3: split mapping

   Change similar to changes for type 2. but add multiple links
   with text in parens describing relationship.

4. Mapping type 4: moved

   No changes.
   Example: compiler-plugins.md

5. Mapping type 5: removed

   No changes. See "Improvements" below.
   Example: attributes.md

Improvements:
  This commit tries to introduce the target links with a minimum of changes.
  Copy was adapted only to the extent absolutely necessary. This leaves room
  for improvements:

  - Better deal with case 3. Describe mapping in copy not only link text.
    Actually refer to the links in the body copy.

  - Redirect pages of type 5 (content doesn't exist in second edition)
    should distinguish between "Content removed for good" and "Content
    not ready yet". For the latter category we could link to stub pages.

All the new links were tested manually. The html was produced by a
little script that invokes rustdoc, builds the book and copies
everything into place. The script is not part of this commit.

Here is a list with all mappings:

associated-types.html		-1->	ch19-03-advanced-traits.html#associated-types
attributes.html			-5-> 	index.html
bibliography.html		-5->	index.html
borrow-and-asref.html		-5->	index.html
casting-between-types.html	-5->	index.html
choosing-your-guarantees.html	~1~>	ch15-00-smart-pointers.html
closures.html			-1->	ch13-01-closures.html
comments.html 			-1->	ch03-04-comments.html
compiler-plugins.html		-4->	../unstable-book/language-features/plugin.html
concurrency.html        	-1->	ch16-00-concurrency.html
conditional-compilation.html	-5->	index.html
const-and-static.html		~1~>	ch19-01-unsafe-rust.html#accessing-or-modifying-a-mutable-static-variable
crates-and-modules.html		-3->	Modules: ch07-00-modules.html
					Crates: ch14-00-more-about-cargo.html
deref-coercions.html		~1~>	ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods
documentation.html		~1~>	ch14-02-publishing-to-crates-io.html#making-useful-documentation-comments
drop.html			-1->	ch15-03-drop.html
effective-rust.html		-5->	index.html
enums.html      		-1->	ch06-01-defining-an-enum.html
error-handling.html		-1-> 	ch09-00-error-handling.html
ffi.html			-1->	ch19-01-unsafe-rust.html#calling-an-unsafe-function-or-method
functions.html			-1->	ch03-03-how-functions-work.html
generics.html			-1->	ch10-00-generics.html
getting-started.html		~1~>	ch01-00-introduction.html
glossary.html			-5->	index.html
guessing-game.html		-1->	ch02-00-guessing-game-tutorial.html
if-let.html			-1->	ch06-03-if-let.html
if.html				-1->	ch03-05-control-flow.html#if-expressions
iterators.html			-1->	ch13-02-iterators.html
lifetimes.html			-2->	ch10-03-lifetime-syntax.html
					ch19-02-advanced-lifetimes.html
loops.html			-1->	ch03-05-control-flow.html#repetition-with-loops
macros.html			-5->	index.html (appendix-05-macros.html is in TOC, but doesn't exist)
match.html			-2->	ch06-02-match.html
				-2-> 	ch18-00-patterns.html
method-syntax.html		-1->	ch05-03-method-syntax.html
mutability.html			-1->	ch03-01-variables-and-mutability.html
operators-and-overloading.html	-1-> 	ch19-03-advanced-traits.html#operator-overloading-and-default-type-parameters
ownership.html			-1->	ch04-00-understanding-ownership.html
patterns.html			-2->	ch06-02-match.html#patterns-that-bind-to-values
					ch18-03-pattern-syntax.html
primitive-types.html		~1~>	ch03-02-data-types.html
procedural-macros.html		-5->	index.html (appendix-05-macros.html is in TOC, but doesn't exist)
raw-pointers.html		~1~>	ch19-01-unsafe-rust.html#dereferencing-a-raw-pointer
references-and-borrowing.html	-1->	ch04-02-references-and-borrowing.html
release-channels.html		-5->	index.hmtl
strings.html			~2~>	ch04-03-slices.html#string-slices [Should be type 3 maybe with distinction &str and String]
				~2~>	ch08-02-strings.html
structs.html			-1->	ch05-00-structs.html
syntax-and-semantics.html	~3~>	ch03-00-common-programming-concepts.html
					appendix-01-keywords.html
					appendix-02-operators.html
					appendix-05-macros.html [WIP]
syntax-index.html		-5->	index.html
testing.html			-1->	ch11-00-testing.html
the-stack-and-the-heap.html	-5->	index.html
trait-objects.html		-1->	ch17-02-trait-objects.html
traits.html			-2->	ch10-02-traits.html
					ch19-03-advanced-traits.html
type-aliases.html		~1~>	ch19-04-advanced-types.html#type-aliases-create-type-synonyms
ufcs.html			-5->	index.html
unsafe.html			~1~>	ch19-01-unsafe-rust.html
unsized-types.html		~1~>	ch19-04-advanced-types.html#dynamically-sized-types--sized
using-rust-without-the[..].html	-5->	index.html
variable-bindings.html		-5->	index.html
vectors.html			-1->	ch08-01-vectors.html
2017-10-23 21:07:33 +02:00
John Keiser dafaacc7a6 Add link to specific new page in redirect 2017-09-27 09:25:59 -07:00
Kornel dc3c9b5472 Make explanation on redirect pages shorter to make the links forward obvious 2017-06-14 19:44:30 +01:00
Corey Farwell 98b18fabdd Update Unstable Book links to reflect to new layout.
https://github.com/rust-lang/rust/pull/41295
2017-04-17 13:33:10 -04:00
steveklabnik 5f2262bf90 we didn't need this 2017-04-13 18:02:26 -04:00
steveklabnik 69b461acdd fix broken link
we moved this to the unstable book
2017-04-13 18:00:11 -04:00
Matt Brubeck 3a5480dbba Link to specific first edition chapters from /redirects 2017-04-06 16:49:56 -07:00
Matt Brubeck 581359bd23 Fix links from /redirects to /second-edition 2017-04-06 16:35:12 -07:00
steveklabnik d6d4f48178 Fix up redirects
These fail tidy check upstream, because while linking to `/` is valid,
it won't show up on many systems, so linking to `/index.html` is
preferred.
2017-03-15 11:53:23 -04:00
steveklabnik fd90f5f743 Fix up some frontmatter issues.
1. Explain the differences between the two books in the index.
2. format redirects to 80 cols.
2017-03-07 16:28:29 -05:00
steveklabnik b4efb723af Rustdoc hates markdown
Markdown wants #, but rustodoc wants %.

Whatever.
2017-03-07 16:02:53 -05:00
steveklabnik 852d2427aa add redirects for original book 2017-03-03 11:45:13 -05:00