The functions BitSet::{iter,union,symmetric_difference} each had docs that claimed u32s were output when their actual output each end up being usizes.
r? @steveklabnik
Adds long diagnostic messages for:
- E0184
- E0204
- E0205
- E0206
- E0243
- E0244
- E0249
- E0250
This PR also adds some comments to the error codes in `librustc_typeck/diagnostics.rs`.
cc #24407
They're only enabled in debug builds, but a panic is usually more
welcome than UB in debug builds.
Previous review at https://github.com/rust-lang/rust/pull/22069
r? @Gankro
cc @huon
Rustdoc fixes for associated items
This is related to isssue #22442 and solves it partly.
This solves the search index links of associated types and constants,
so that they link to the trait page.
Also add an Associated Constants section if constants are present.
core::slice::Iter.ptr can be null when iterating a slice of zero-sized
elements, but the pointer value used for the slice itself cannot. Handle
this case by always returning a dummy pointer for slices of zero-sized
elements.
We don't need to copy any elements if `at` is behind the last element
in the map. The last element is at index `self.v.len() - 1`, so we
should not copy if `at` is greater **or equals** `self.v.len()`.
r? @Gankro
Hiiii, I've got another chunk of updates to the grammar documentation! ⭐🌟🌠
Chipping away at #22445, still have some more to go. I'm learning so much!!!
Maybe it's me, but I really needed an example to understand if let and refutable statements.
Playpen: http://is.gd/mjX3Gf
Let me know if the variable names are too, uh, culinary.
Several Minor API / Reference Documentation Fixes
- Fix a few small errors in the reference.
- Fix paper cuts in the API docs.
Fixes#24882Fixes#25233Fixes#25250
The reference was claiming all vectors all bounds-checked at run-time, when constant vectors are usually checked at compile-time.
For the changed example see http://is.gd/28ak9E
Also fixed a minor grammar issue.
We don't need to copy any elements if `at` is behind the last element
in the map. The last element is at index `self.v.len() - 1`, so we
should not copy if `at` is greater or equals `self.v.len()`.
core::slice was originally written to tolerate overflow (notably, with
slices of zero-sized elements), but it was never updated to use wrapping
arithmetic when overflow traps were added.
Also correctly handle the case of calling .nth() on an Iter with a
zero-sized element type. The iterator was assuming that the pointer
value of the returned reference was meaningful, but that's not true for
zero-sized elements.
Fixes#25016.
Corrected "Ownership":
- [`Variable bindings`] link was not processed properly.
- Changed the paragraph about move semantics with two vectors, because it was confusing.
- Removed "So it may not be as inefficient as it initially seems", because there is nothing that seems inefficient in copying pointers only.
- Other text corrections.
Fixed copied-and-pasted text mistakes.
Revised the paragraph about moving a vector (taking into account suggestions by echochamber).
Fixed markdown.
Fixes requested by steveklabnik.
Brought back a sentence about supposed inefficiency.
There were still some mentions of `~[T]` and `~T`, mostly in comments and debugging statements. I tried to do my best to preserve meaning, but I might have gotten some wrong-- I'm happy to fix anything :)
Between ffc5f1c, when grammar.md was created by copying parts of the
reference, and 8cf2552, when all EBNF was removed from reference.md,
there were parts of the grammar that were updated in reference.md but
not grammar.md, and then they weren't copied over because they existed
already, but they were slightly out of date.
Example: the `path_item : ident | "self" ;` rule in Use declarations was
changed from "mod" to "self" in the reference in 195fd9a but wasn't
updated in the grammar.