Turn the RFC1592 warnings into hard errors
The warnings have already reached stable, and I want to improve the trait error reporting code.
Turning warnings into errors, this is obviously a [breaking-change].
r? @nikomatsakis
cc @rust-lang/compiler
Implement std::convert traits for char
This is motivated by avoiding the `as` operator, which sometimes silently truncates, and instead use conversions that are explicitly lossless and infallible.
I’m less certain that `From<u8> for char` should be implemented: while it matches an existing behavior of `as`, it’s not necessarily the right thing to use for non-ASCII bytes. It effectively decodes bytes as ISO/IEC 8859-1 (since Unicode designed its first 256 code points to be compatible with that encoding), but that is not apparent in the API name.
Fix run-pass/signal-exit-status to not trigger UB by writing to NULL.
`run-pass/signal-exit-status` has had UB (NULL dereference) since it was introduced in #10109.
Fixes the test failure found by @camlorn while running under Windows Subsystem for Linux.
Update E0393 to new error format
Fixes#35632.
Part of #35233.
r? @jonathandturner
and a wired thing is that if i add another label
```rust
.span_label(span, &format!("missing reference to `{}`", def.name))
.span_label(span, &format!("because of the default `Self` reference, type parameters must be specified on object types"))
```
and add a new note in the test case like
```rust
trait A<T=Self> {}
fn together_we_will_rule_the_galaxy(son: &A) {}
//~^ ERROR E0393
//~| NOTE missing reference to `T`
//~| NOTE because of the default `Self` reference, type parameters must be specified on object types
```
it will complain that
```
running 1 test
test [compile-fail] compile-fail/E0393.rs ... FAILED
failures:
---- [compile-fail] compile-fail/E0393.rs stdout ----
error: /Users/zjh/Documents/rustspace/rust/src/test/compile-fail/E0393.rs:13: unexpected "error": '13:43: 13:44: the type parameter `T` must be explicitly specified [E0393]'
unexpected errors (from JSON output): [
Error {
line_num: 13,
kind: Some(
Error
),
msg: "13:43: 13:44: the type parameter `T` must be explicitly specified [E0393]"
}
]
```
it is a little bit confusing and through the blog post we can use `//~^` and `//~|` to support multiple notes, @jonathandturner am i missing something here?
Change E0259 to the new error format
Fixes#35514 as part of #35233.
Sorry about creating a new PR I was having a lot of troubles squashing the commit because I didn't properly branch the new feature.
r? @GuillaumeGomez
Implement synchronization scheme for incr. comp. directory
This PR implements a copy-on-write-based synchronization scheme for the incremental compilation cache directory. For technical details, see the documentation at the beginning of `rustc_incremental/persist/fs.rs`.
The PR contains unit tests for some functions but for testing whether the scheme properly handles races, a more elaborate test setup would be needed. It would probably involve a small tool that allows to manipulate the incremental compilation directory in a controlled way and then letting a compiler instance run against directories in different states. I don't know if it's worth the trouble of adding another test category to `compiletest`, but I'd be happy to do so.
Fixes#32754Fixes#34957
There were various places that we are invoking `drain_fulfillment_cx`
with a "result" of `()`. This is kind of pointless, since it amounts to
just a call to `select_all_or_error` along with some extra overhead.
Bonus format for E0194
Bonus fix for #35280. Part of #35233. Fixes#36057. Adding expanded notes/context for what trait a parameter shadows as part of E0194 error messages.
Errors for E0194 now look like this:
```
$> ./build/x86_64-apple-darwin/stage1/bin/rustc src/test/compile-fail/E0194.rs
error[E0194]: type parameter `T` shadows another type parameter of the same name
--> src/test/compile-fail/E0194.rs:13:26
|
11 | trait Foo<T> { //~ NOTE first `T` declared here
| - first `T` declared here
12 | fn do_something(&self) -> T;
13 | fn do_something_else<T: Clone>(&self, bar: T);
| ^ shadows another type parameter
error: aborting due to previous error
```
r? @jonathandturner