It was only accessible through the `#[unstable]` crate std_unicode.
It has never been used in the compiler or standard library
since 47e7a05a28 added it in 2012
“for OS API interop”.
It can be replaced with a one-liner:
```rust
fn is_utf16(slice: &[u16]) -> bool {
std::char::decode_utf16(s.iter().cloned()).all(|r| r.is_ok())
}
```
doc: fix inconsistency in error output in guessing-game.md
The line '.expect("failed to read line");' is partly started with a
lower case 'f' and partly with an uppercase one, adding additional
spurious changes to otherwise clean diffs if each sample is
copy-and-pasted over the previous.
This change starts the string with an uppercase everywhere which is in
line with the style of the other strings.
Unit-like structs doc: Improve code sample
r? @steveklabnik
BTW it seems that
```Rust
let p = Proton {};
```
compiles without an error. That's why I didn't add it to the example. It's about consistency anyway.
… instead of silently ignoring a result.
`fmt::Write for String` never returns `Err`,
so implementations of `Display` (or other traits of that family)
never should either.
Fixes#40103
This removes the Cell from AdtDef. Also, moving destructor validity
checking to on-demand (forced during item-type checking) ensures that
invalid destructors can't cause ICEs.
Fixes#38868.
Fixes#40132.
The types of statics, like all other items, are stored in the tcx
unnormalized. This is necessarily so, because
a) Item types other than statics have generics, which can't be
normalized.
b) Eager normalization causes undesirable on-demand dependencies.
Keeping with the principle that MIR lvalues require no normalization in
order to interpret, this patch stores the normalized type of the statics
in the Lvalue and reads it to get the lvalue type.
Fixes#39367.
The line '.expect("failed to read line");' is partly started with a
lower case 'f' and partly with an uppercase one, adding additional
spurious changes to otherwise clean diffs if each sample is
copy-and-pasted over the previous.
This change starts the string with an uppercase everywhere which is in
line with the style of the other strings.
Make transmuting from fn item types to pointer-sized types a hard error.
Closes#19925 by removing the future compatibility lint and the associated workarounds.
This is a `[breaking-change]` if you `transmute` from a function item without casting first.
For more information on how to fix your code, see https://github.com/rust-lang/rust/issues/19925.
Simplify `TokenTree` and fix `macro_rules!` bugs
This PR
- fixes#39390, fixes#39403, and fixes#39404 (each is a [breaking-change], see issues for examples),
- fixes#39889,
- simplifies and optimizes macro invocation parsing,
- cleans up `ext::tt::transcribe`,
- removes `tokenstream::TokenTree::Sequence` and `Token::MatchNt`,
- instead, adds a new type `ext::tt::quoted::TokenTree` for use by `macro_rules!` (`ext::tt`)
- removes `parser.quote_depth` and `parser.parsing_token_tree`, and
- removes `quote_matcher!`.
- Instead, use `quote_tokens!` and `ext::tt::quoted::parse` the result with `expect_matchers=true`.
- I found no outside uses of `quote_matcher!` when searching Rust code on Github.
r? @nrc
Move two large error_reporting fn's to a separate file
Hello!
I tried to make `librustc/infer/error_reporting,rs` more readable by modularizing it and moving its two largest functions to a separate file.
If you have any suggestions, please send it right away! 🚀
Thanks goes to @nikomatsakis for supporting.
added Error and Display impl for std::ffi::FromBytesWithNulError
Fixes#39925.
This is my first PR, so I wasn't quite sure about the stability annotation.
impl RangeArgument for RangeInclusive and add appropriate tests
Now that `RangeArgument` returns a `Bound`, the impl for `RangeInclusive` is natural to implement and all that's required are tests around it.
Simplify `TokenTree` and fix `macro_rules!` bugs
This PR
- fixes#39390, fixes#39403, and fixes#39404 (each is a [breaking-change], see issues for examples),
- fixes#39889,
- simplifies and optimizes macro invocation parsing,
- cleans up `ext::tt::transcribe`,
- removes `tokenstream::TokenTree::Sequence` and `Token::MatchNt`,
- instead, adds a new type `ext::tt::quoted::TokenTree` for use by `macro_rules!` (`ext::tt`)
- removes `parser.quote_depth` and `parser.parsing_token_tree`, and
- removes `quote_matcher!`.
- Instead, use `quote_tokens!` and `ext::tt::quoted::parse` the result with `expect_matchers=true`.
- I found no outside uses of `quote_matcher!` when searching Rust code on Github.
r? @nrc
sort unstable book alphabetically
I made these the same order as they were in the compiler, but for no good reason. Much easier to find out what you need when they're sorted alphabetically
r? @frewsxcv