This is part of #28572, but doesn't complete it. Amongst other things,
this patch:
* Increases consistency in the way feature flags are used with other
docs.
* Removes the ignores, which is nice: we actually had some syntax errors
in the examples 😭.
* Mentions #![no_core]
Realistically, this document used to be in the order of least to most:
nothing, then adding core. But with the changes in RFC 1184, this is
backwards: it now shows stuff that uses core from the beginning. In the
future, I'd like to revamp this to go from 'most to least', but I'd like
to see the discussion in https://github.com/rust-lang/rust/issues/27701
goes before I write more.
The behavior here isn't really ideal, but we can't really do much better
given the current state of constant evaluation.
Fixes#28670, and probably a bunch of duplicates.
This lint warning was originally intended to help against misuse of the old Rust
`int` and `uint` types in FFI bindings where the Rust `int` was not equal to the
C `int`. This confusion no longer exists (as Rust's types are now `isize` and
`usize`), and as a result the need for this lint has become much less over time.
Additionally, starting with [the RFC for libc][rfc] it's likely that `isize` and
`usize` will be quite common in FFI bindings (e.g. they're the definition of
`size_t` and `ssize_t` on many platforms).
[rfc]: https://github.com/rust-lang/rfcs/pull/1291
This commit disables these lints to instead consider `isize` and `usize` valid
types to have in FFI signatures.
this simplifies the code while reducing the size of libcore.rlib by
3.3 MiB (~1M of which is bloat a separate patch of mine removes
too), while reducing rustc memory usage on small crates by 18MiB.
This also simplifies the code considerably.
We don't completely cover documentation tests in the testing chapter,
since we cover them in the documentation chapter. So make sure people
know that.
Fixes#28082
The original blog post referred to examples by their file names, and now
that it's in guide form, there is no file name. So edit the text so that
it makes a bit more sense.
Fixes#28428
The links in the rustdoc for several places in fmt were trying to link to
the std::fmt module but actually linking to std, which was confusing.
While trying to figure out why I noticed that the documentation chapter of
the Rust book has examples that show this same bug (although it doesn't seem
widespread in practice).
r? @steveklabnik
- Expand the first paragraph
- Improve readability by partitioning the chapter into the following
sections: "Patterns", "Type annotations", "Mutability", and
"Initializing bindings"
- Add "Scope and shadowing" section (fix#28177)
r? @steveklabnik
Currently the compiler supports the ability to emit multiple output types as
part of one compilation (e.g. asm, LLVM IR, bytecode, link, dep-info, etc). It
does not, however, support the ability to customize the output filename for each
of these output types. The `-o` flag is ignored if multiple emit types are
specified (and the compiler emits a warning about this).
Normally this doesn't matter too much, but in the case of `dep-info` it can lead
to a number of problems (e.g. see #28716). By allowing customization of the
output filename for each emit type we're able to solve the problems in that
issue.
This commit adds support for the `--emit` option to the compiler to look like:
rustc foo.rs --emit dep-info=.deps/foo.d,link
This indicates that the `dep-info` output type will be placed at `.deps/foo.d`
and the `link` output type will otherwise be determined via the `--out-dir` and
`-o` flags.
Closes#28716
We don't completely cover documentation tests in the testing chapter,
since we cover them in the documentation chapter. So make sure people
know that.
Fixes#28082
- Expand the first paragraph
- Improve readability by partitioning the chapter into the following
sections: "Patterns", "Type annotations", "Mutability", and
"Initializing bindings"
- Add "Scope and shadowing" section (fix#28177)
r? @steveklabnik
The original blog post referred to examples by their file names, and now
that it's in guide form, there is no file name. So edit the text so that
it makes a bit more sense.
Fixes#28428
The links in the rustdoc for several places in fmt were trying to link to
the std::fmt module but actually linking to std, which was confusing.
While trying to figure out why I noticed that the documentation chapter of
the Rust book has examples that show this same bug (although it doesn't seem
widespread in practice).
This is part of #28572, but doesn't complete it. Amongst other things,
this patch:
* Increases consistency in the way feature flags are used with other
docs.
* Removes the ignores, which is nice: we actually had some syntax errors
in the examples 😭.
* Mentions #![no_core]
Realistically, this document used to be in the order of least to most:
nothing, then adding core. But with the changes in RFC 1184, this is
backwards: it now shows stuff that uses core from the beginning. In the
future, I'd like to revamp this to go from 'most to least', but I'd like
to see the discussion in https://github.com/rust-lang/rust/issues/27701
goes before I write more.