Here is my attempt to resolve issue #28822, @Manishearth.
Please let me know if it's fine. And if not, what should I do instead?
This issue felt like quite a good start for some rust contributions. It allows me to get used to the workflow and codebase of rust in an easy-to-swallow manner. Are there any other issues you would recommend me to look at? :) Would love to do some more stuff!
For enum variants, the default alignment for a specific variant might be
lower than the alignment of the enum type itself. In such cases we, for
example, generate memcpy calls with an alignment that's higher than the
alignment of the constant we copy from.
To avoid that, we need to explicitly set the required alignment on
constants.
Fixes#28912.
Previously, `/**/` was incorrectly regarded as a doc comment because it starts with `/**` and ends with `*/`. However, this caused an ICE because some code assumed that the length of a doc comment is at least 5. This commit adds an additional check to `is_block_doc_comment` that tests the length of the input.
Fixes#28844.
For enum variants, the default alignment for a specific variant might be
lower than the alignment of the enum type itself. In such cases we, for
example, generate memcpy calls with an alignment that's higher than the
alignment of the constant we copy from.
To avoid that, we need to explicitly set the required alignment on
constants.
Fixes#28912.
Previously, `/**/` was incorrectly regarded as a doc comment because it
starts with `/**` and ends with `*/`. However, this caused an ICE
because some code assumed that the length of a doc comment is at least
5. This commit adds an additional check to `is_block_doc_comment` that
tests the length of the input.
Fixes#28844.
The intent with this chapter is to have a central place where users can
go to find out what a random bit of syntax means, be it a keyword,
symbol, or some unusual bit of composite syntax (like `for <...>`). This
should be useful both for new users (who may not know what to call this
weird `'blah` thing), and for experienced users (who may just wish to
link someone to the appropriate section on `Trait + Trait` bounds).
Where possible, entries have been linked to an appropriate section of
the book which explains the syntax. This was not possible in all cases.
If an entry is missing links, that's because I was unable to *find*
anything appropriate to link to.
This commit should include all stable keywords, operators and symbols,
as well as a selection of potentially confusing or unusual syntax.
Major revision to the dropck_legal_cycles test.
1. Added big comment block explaining the test framework.
2. Added tests exericising Rc and Arc. This was inspired by a comment
from eefriedman on PR #28861.
3. Made the cycle-detection not issue false-positives on acyclic dags.
Doing this efficiently required revising the framework; instead of
visiting all children (i.e. doing a traversal), now each test is
responsible for supplying the path that will act as a witness to
the cycle.
Luckily for me, all of the pre-existing tests worked with a trivial
path built from "always tke your first left", but new tests I added
did require other input paths (i.e., "first turn right, then left".
(The path representation is a bit-string and its branches are
n-ary, not word phrases and binary branches as you might think
from the outline above.)
cc PR #27185
Improving the use of 2nd and 3rd person
Adding a few contractions to make the text less formal
Tidying up some notes
Providing a little bit more clarification for Windows users
Replacing all references to the 2nd person with references to the 3rd
person (excluding `authors = [ "Your name <you@example.com>" ]` and
`file:///home/yourname/projects/hello_world` in `hello-cargo.md`)
1. Added big comment block explaining the test framework.
2. Added tests exericising Rc and Arc. This was inspired by a comment
from eefriedman on PR #28861.
3. Made the cycle-detection not issue false-positives on acyclic dags.
Doing this efficiently required revising the framework; instead of
visiting all children (i.e. doing a traversal), now each test is
responsible for supplying the path that will act as a witness to
the cycle.
Luckily for me, all of the pre-existing tests worked with a trivial
path built from "always tke your first left", but new tests I added
did require other input paths (i.e., "first turn right, then left".
(The path representation is a bit-string and its branches are
n-ary, not word phrases and binary branches as you might think
from the outline above.)
* removed reference to struct fields from `mut` description.
* changed `..` pattern example to not be syntactically bogus.
* changed `@` pattern example for similar reasons.
(Thanks petrochenkov)
The intent with this chapter is to have a central place where users can
go to find out what a random bit of syntax means, be it a keyword,
symbol, or some unusual bit of composite syntax (like `for <...>`). This
should be useful both for new users (who may not know what to call this
weird `'blah` thing), and for experienced users (who may just wish to
link someone to the appropriate section on `Trait + Trait` bounds).
Where possible, entries have been linked to an appropriate section of
the book which explains the syntax. This was not possible in all cases.
If an entry is missing links, that's because I was unable to *find*
anything appropriate to link to.
This commit should include all stable keywords, operators and symbols,
as well as a selection of potentially confusing or unusual syntax.
This adds a chapter to the nightly section of the book on leveraging and
implementing the `#![allocator]` attribute to write custom allocators as well as
explaining the current situation with allocators.
I found these automatically, but fixed them manually to ensure the semantics are correct. I know things like these are hardly important, since they only marginally improve clarity. But at least for me typos and simple grammatical errors trigger an---unjustified---sense of unprofessionalism, despite the fact that I make them all the time and I understand that they're the sort of thing that is bound to slip through review.
Anyway, to find most of these I used:
* `ag '.*//.*(\b[A-Za-z]{2,}\b) \1\b'` for repeated words
* `ag '\b(the|this|those|these|a|it) (a|the|this|those|these|it)\b'` to find constructs like 'the this' etc. many false positives, but not too hard to scroll through them to actually find the mistakes.
* `cat ../../typos.txt | paste -d'|' - - - - - - - - - - - - - - - - - - - - - - | tr '\n' '\0' | xargs -0 -P4 -n1 ag`. Hacky way to find misspellings, but it works ok. I got `typos.txt` from [Wikipedia](https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines)
* `ag '.*//.* a ([ae][a-z]|(o[^n])|(i[a-rt-z]))'` to find places where 'a' was followed by a vowel (requiring 'an' instead).
I also used a handful more one off regexes that are too boring to reproduce here.