Split old and experimental wasm builders
#42784 introduced configuration errors in the wasm builder by mixing different versions of the tools. This PR separates the wasm32-unknown-emscripten and wasm32-experimental-emscripten builders to resolve these errors.
Implement fs::rename in sys::redox
This uses a simple implementation of copy + unlink. Redox does not have a rename or link system call for a faster implementation.
Add the Code of Conduct to the repository.
https://github.com/rust-lang/rust/community currently shows that we have
no code of conduct. This will make it understand.
This is an exact copy of the page on the website.
update .mailmap
It's nice to have an up-to-date .mailmap so that contributor listings (like those provided by `git shortlog` or http://thanks.rust-lang.org/) don't split the same author's contributions across two or more variations of their name.
Affected contributors—
@Aaronepower (3 commits as "Aaron Power", 1 as "Aaronepower")
@djrollins (5 commits as "Daniel J Rollins", 1 as "Daniel Rollins")
@eddyb (345 commits as "Eduard-Mihai Burtescu", 678 as "Eduard Burtescu", assuming former is canonical based on recency and GitHub profile display name)
@edunham (1 more recent commit contradicts existing .mailmap entry)
@GuillaumeGomez (942 commits as "Guillaume Gomez", 55 commits as "ggomez", 22 commits as "GuillaumeGomez")
@jonathandturner (362 commits as "Jonathan Turner", 1 as "jonathandturner")
@Mark-Simulacrum (248 commits as "Mark Simulacrum", 97 "Mark-Simulacrum")
@fiveop (1 commit each as "Philipp Matthias Schäfer" and "Philipp Matthias Schaefer", assuming former is canonical based on GitHub profile display name)
@shyaamsundhar (1 commit as "Shyam Sundar B", 3 as ShyamSundarB, assuming former is canonical based on recency)
@steveklabnik (1634 commits as "Steve Klabnik", 41 as "steveklabnik")
Document what happens on failure in path ext is_file is_dir
r? @steveklabnik
Also, what other ways could there be an error that gets discarded and returns false? Should we list them all? Should we say that any errors trying to access the metadata at that path causes it to return false, even if there might be a file or directory there?
Should I add a See also link to the original functions that do return Results?
Thread local try with
https://github.com/rust-lang/rfcs/pull/2030 was turned into this PR (the RFC was closed, but it looks like just a PR should be good).
See also: state stabilization issue: #27716
`try_with` is used in two places in std: stdio and thread_info. In stdio, it would be better if the result was passed to the closure, but in thread_info, it's better as is where the result is returned from the function call. I'm not sure which is better, but I prefer the current way as it better represents the scope.
Updated docker images to share scripts
Attempts to resolve#42201. I managed to pull out five scripts (android-base-apt-get, ubuntu16-apt-get, make3, rustbuild-setup, and crosstool-ng). Let me know if there's more I can do or if I should change some names.
r? @malbarbo
https://github.com/rust-lang/rust/community currently shows that we have
no code of conduct. This will make it understand.
This is an exact copy of the page on the website.
Add warning to BufWriter documentation
When using `BufWriter`, it is very easy to unintentionally ignore errors, because errors which occur when flushing buffered data when the `BufWriter` is dropped are ignored. This has been noted in a couple places: #32677, #37045.
There has been some discussion about how to fix this problem in #32677, but no solution seems likely to land in the near future. For now, anyone who wishes to have robust error handling must remember to manually call `flush()` on a `BufWriter` before it is dropped. Until a permanent fix is in place, it seems worthwhile to add a warning to that effect to the documentation.
Add `isize` and `usize` constructors to Literal
This commit fills out the remaining integer literal constructors on the
`proc_macro::Literal` type with `isize` and `usize`. (I think these were just
left out by accident)
Implement Eq/Hash/Debug etc. for unsized tuples.
As I mentioned in [the comment in #18469](https://github.com/rust-lang/rust/issues/18469#issuecomment-306767422), the implementations of `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `Debug`, `Hash` can be generalized to unsized tuples.
This is consistent with the `derive` behavior for unsized structs.
```rust
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Default, Hash)]
struct MyTuple<X, Y, Z: ?Sized>(X, Y, Z);
fn f(x: &MyTuple<i32, i32, [i32]>) {
x == x;
x < x;
println!("{:?}", x);
}
```
Questions:
- Need an RFC?
- Need a feature gate? I don't think it does because the unsized tuple coercion #42527 is feature-gated.
- I changed `builder.field($name);` into `builder.field(&$name);` in the `Debug` implementation to pass compilation. This won't affect the behavior because `Debug for &'a T` is a mere redirection to `Debug for T`. However, I don't know if it affects code size / performance.
`rustc_on_unimplemented` supports referring to trait
Add support to `rustc_on_unimplemented` to reference the full path of
the annotated trait. For the following code:
```rust
pub mod Bar {
#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}` in `{Foo}`"]
pub trait Foo<Bar, Baz, Quux> {}
}
```
the error message will be:
```
test error `std::string::String` with `u8` `_` `u32` in `Bar::Foo`
```
Note different versions of same crate when absolute paths of different types match.
The current check to address #22750 only works when the paths of the mismatched types relative to the current crate are equal, but this does not always work if one of the types is only included through an indirect dependency. If reexports are involved, the indirectly included path can e.g. [contain private modules](https://github.com/rust-lang/rust/issues/22750#issuecomment-302755516).
This PR takes care of these cases by also comparing the *absolute* path, which is equal if the type hasn't moved in the module hierarchy between versions. A more coarse check would be to compare only the crate names instead of full paths, but that might lead to too many false positives.
Additionally, I believe it would be helpful to show where the differing crates came from, i.e. the information in `rustc::middle::cstore::CrateSource`, but I'm not sure yet how to nicely display all of that, so I'm leaving it to a future PR.
This still does not work on 32-bit archs because of an LLVM limitation,
but this is only an optimization, so let's push it on 64-bit only for now.
Fixes#37945
Refactor pretty printing slightly
This doesn't introduce any functional changes (that I'm aware of). The primary intention here is to clean up the code a little. Each commit is intended to stand alone, reviewing commit-by-commit may be easiest.
incr.comp.: Don't include span information in the ICH of type definitions
This should improve some of the `regex` tests on perf.rlo. Not including spans into the ICH is harmless until we also cache warnings. To really solve the problem, we need to do more refactoring (see #43088).
r? @nikomatsakis
update crate dependencies
I wanted to update mdbook's version. This ended up updating a bunch of other stuff too.
I am not sure if updating this much stuff is considered a Good Idea or not; happy to figure out how to make it smaller if someone can help me figure out how to use x.py to do it.
compilertest (UI test): Support custom normalization.
Closes#42434.
Adds this header for UI tests:
```rust
// normalize-stderr-32bit: "fn() (32 bits)" -> "fn() ($PTR bits)"
```
It will normalize the `stderr` output on 32-bit platforms, by replacing all instances of `fn() (32 bits)` by `fn() ($PTR bits)`.
Extends the UI tests in #42304 and #41968 to 32-bit targets.
r? @nikomatsakis
The literal index was increased in only next_lit, so it isn't
necessary: code now uses an iterator. The cur_cmnt field is also moved
to be increased in print_comment instead of after each call to
print_comment.
Downgrade ProjectionTy's TraitRef to its substs
Addresses the second part of #42171 by removing the `TraitRef` from
`ProjectionTy`, and directly storing its `Substs`.
Closes#42171.