Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 18 pull requests #74305

Closed
wants to merge 85 commits into from

Conversation

Manishearth
Copy link
Member

Successful merges:

Failed merges:

r? @ghost

Lucretiel and others added 30 commits May 31, 2020 00:10
This commit redesigns LineWriter to work more directly on the internals
of BufWriter. This interface change is to enable a future Pull Request
in which Stdout can be switched between Line and Block buffered mode.
- Added a bunch of new unit tests
- Removed test_line_buffer_fail_flush
- Updated erroneous_flush_retried
- Added helper methods to LineWriterShim for code clarity, to distinguish "self.buffer" (the BufWriter) from self.inner (the thing wrapped by the BufWriter)
- Un-expressionized write & write_all
- Added clause to bail early on Ok(0)
- Cleaned up BufWriter::seek
- Updated line_vectored test
- Updated line_vectored_partial_and_errors test
- Added several new tests
- Renamed write_to_buffer to write_to_buf, for consistency
- Fixed references to flush_buf
- Optimized `write` to use one less `memchr` call
- Fixed test after write_vectored bugfix
- Some comments
- Fixed partial-line buffering issue
- Added tests

Thanks @the8472 for catching!
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
…riplett

Document the union keyword

Partial fix of rust-lang#34601.

This documents the `union` keyword by presenting three cases: simply using a union, matching on a union and referencing the fields of a union.

@rustbot modify labels: T-doc,C-enhancement
add (unchecked) indexing methods to raw (and NonNull) slices

This complements the existing (unstable) `len` method. Unfortunately, for non-null slices, we cannot call this method `as_ptr` as that overlaps with the existing method of the same name.

If this looks reasonable to accept, I propose to reuse the rust-lang#71146 tracking issue and rename the feature get to `slice_ptr_methods` or so.

Cc @SimonSapin
Fixes rust-lang#60639
…-Simulacrum

Fix caching issue when building tools.

This fixes a problem with tool builds not being cached properly.

rust-lang#73297 changed it so that Clippy will participate in the "deny warnings" setting. Unfortunately this causes a problem because Clippy shares the build directory with other tools which do not participate in "deny warnings".  Because Cargo does not independently cache artifacts based on different RUSTFLAGS settings, it causes all the shared dependencies to get rebuilt if Clippy ever gets built.

The solution here is to stop using RUSTFLAGS, and just sneak the settings in through the rustc wrapper. Cargo won't know about the different settings, so it will not bust the cache. This should be safe since lint settings on dependencies are ignored. This is how things used to work in the past before rust-lang#64316.

Alternate solutions:
* Treat Clippy as a "submodule" and don't enforce warnings on it. This was the behavior before rust-lang#73297. The consequence is that if a warning sneaks into clippy, that the clippy maintainers will need to fix it when they sync clippy back to the clippy repo.
* Just deny warnings on all tools (removing the in-tree/submodule distinction). This is tempting, but with some issues (cc rust-lang#52336):
  * Adding or changing warnings in rustc can be difficult to land because tools have to be updated if they trip the warning. In practice, this isn't too bad.  Cargo (and rustfmt) already runs with `deny(warnings)`, so this has been the de-facto standard already (although they do not use the extra lints like `unused_lifetimes`).
* Teach Cargo to add flags to the workspace members, but not dependencies.
* Teach Cargo to add flags without fingerprinting them?
* Teach Cargo to independently cache different RUSTFLAGS artifacts (this was [reverted](rust-lang/cargo#7417) due to complications). This would also unnecessarily rebuild dependencies, but would avoid cache thrashing.
* Teach Cargo about lint settings.

Closes rust-lang#74016
…jyn514

rustdoc: Allow linking from private items to private types

Fixes rust-lang#74134

After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning
when rustdoc is invoked without --document-private-items. Links from private
items to private types are however never actually generated in that case and
thus shouldn't produce a warning. These links are in fact a very useful tool to
document crate internals.

Tests are added for all 4 combinations of public/private items and link
targets. Test 1 is the case mentioned above and fails without this commit. Tests
2 - 4 passed before already but are added nonetheless to prevent regressions.
…ochenkov

Detect tuple struct incorrectly used as struct pat

Subpart of rust-lang#74005.

r? @petrochenkov
Don't panic if the lhs of a div by zero is not statically known

Fixes rust-lang#73993 for real this time

r? @wesleywiser
Remove an unwrap in layout computation

A tiny improvement.
Provide structured suggestion on unsized fields and fn params

* Suggest borrowing or boxing unsized fields
* Suggest borrowing fn parameters
* Remove some verbosity of unsized errors
* Remove `on_unimplemented` note from `trait Sized`

Fix rust-lang#23286, fix rust-lang#28653.

r? @davidtwco
Update llvm-project to latest origin/rustc/10.0-2020-05-05 commit

which includes LVI segfault fix when building fortanix/rust-sgx#267
And a few earlier commits.
…r=Mark-Simulacrum

Teach bootstrap about target files vs target triples

`rustc` allows passing in predefined target triples as well as JSON
target specification files. This change allows bootstrap to have the
first inkling about those differences. This allows building a
cross-compiler for an out-of-tree architecture (even though that
compiler won't work for other reasons).

Even if no one ever uses this functionality, I think the newtype
around the `Interned<String>` improves the readability of the code.
don't mark linux kernel module targets as a unix environment

refs rust-lang#74247

r?@joshtriplett

cc: @ehuss
…acrum

Slight reorganization of sys/(fast_)thread_local

I was long confused by the `thread_local` and `fast_thread_local` modules in the `sys(_common)` part of libstd. The names make it *sound* like `fast_thread_local` is just a faster version of `thread_local`, but really these are totally different APIs: one provides thread-local "keys", which are non-addressable pointer-sized pieces of local storage with an associated destructor; the other (the "fast" one) provides just a destructor.

So I propose we rename `fast_thread_local` to `thread_local_dtor`, and `thread_local` to `thread_local_key`. That's what this PR does.
…der-type-error, r=estebank

typeck: report placeholder type error w/out span

Fixes rust-lang#74086.

This PR fixes a regression introduced in rust-lang#70369 which meant that an error was not being emitted for invalid placeholder types when there wasn't a span available.

r? @estebank
rust-lang#71669: add ui, codegen tests for volatile + nearby int intrinsics

Added some tests for intrinsics. See rust-lang#71669.
…Gomez

Added detailed error code explanation for issue E0688 in Rust compiler.

Added proper error explanation for issue E0688 in the Rust compiler.
Error Code E0688

Sub Part of Issue rust-lang#61137

r? @GuillaumeGomez
@Manishearth
Copy link
Member Author

@rustbot modify labels: +rollup
@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Jul 13, 2020

📌 Commit b64d6b9 has been approved by Manishearth

@rustbot rustbot added the rollup A PR which is a rollup label Jul 13, 2020
@bors
Copy link
Contributor

bors commented Jul 13, 2020

🌲 The tree is currently closed for pull requests below priority 5, this pull request will be tested once the tree is reopened

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jul 13, 2020
@bors
Copy link
Contributor

bors commented Jul 13, 2020

⌛ Testing commit b64d6b9 with merge 50ae19316e73c81e2ddc088c199190f3dd85b8e9...

@bors
Copy link
Contributor

bors commented Jul 13, 2020

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 13, 2020
@Manishearth
Copy link
Member Author

2020-07-13T21:53:24.5772669Z failures:
2020-07-13T21:53:24.5880703Z 
2020-07-13T21:53:24.5882233Z ---- [ui (nll)] ui/kindck/kindck-impl-type-params.rs stdout ----
2020-07-13T21:53:24.5882642Z diff of stderr:
2020-07-13T21:53:24.5882803Z 
2020-07-13T21:53:24.5883062Z 4	LL |     let a = &t as &dyn Gettable<T>;
2020-07-13T21:53:24.5883808Z 5	   |             ^^ `T` cannot be sent between threads safely
2020-07-13T21:53:24.5884084Z 6	   |
2020-07-13T21:53:24.5890649Z -	   = help: the trait `std::marker::Send` is not implemented for `T`
2020-07-13T21:53:24.5891497Z 8	   = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
2020-07-13T21:53:24.5891844Z 9	   = note: required for the cast to the object type `dyn Gettable<T>`
2020-07-13T21:53:24.5892159Z 10	help: consider restricting type parameter `T`
2020-07-13T21:53:24.5892326Z 
2020-07-13T21:53:24.5892575Z 31	LL |     let a: &dyn Gettable<T> = &t;
2020-07-13T21:53:24.5892867Z 32	   |                               ^^ `T` cannot be sent between threads safely
2020-07-13T21:53:24.5893144Z 33	   |
2020-07-13T21:53:24.5894121Z -	   = help: the trait `std::marker::Send` is not implemented for `T`
2020-07-13T21:53:24.5894460Z 35	   = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
2020-07-13T21:53:24.5894778Z 36	   = note: required for the cast to the object type `dyn Gettable<T>`
2020-07-13T21:53:24.5895082Z 37	help: consider restricting type parameter `T`
2020-07-13T21:53:24.5895248Z 
2020-07-13T21:53:24.5895366Z 
2020-07-13T21:53:24.5895620Z The actual stderr differed from the expected stderr.
2020-07-13T21:53:24.5896440Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/kindck/kindck-impl-type-params.nll/kindck-impl-type-params.nll.stderr
2020-07-13T21:53:24.5897133Z To update references, rerun the tests and pass the `--bless` flag
2020-07-13T21:53:24.5897807Z To only update this specific test, also pass `--test-args kindck/kindck-impl-type-params.rs`
2020-07-13T21:53:24.5897987Z 
2020-07-13T21:53:24.5898244Z error: 1 errors occurred comparing output.
2020-07-13T21:53:24.5898521Z status: exit code: 1
2020-07-13T21:53:24.5900416Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/kindck/kindck-impl-type-params.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/kindck/kindck-impl-type-params.nll" "-Zborrowck=mir" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/kindck/kindck-impl-type-params.nll/auxiliary"
2020-07-13T21:53:24.5901106Z stdout:
2020-07-13T21:53:24.5901640Z ------------------------------------------
2020-07-13T21:53:24.5901808Z 
2020-07-13T21:53:24.5902313Z ------------------------------------------
2020-07-13T21:53:24.5902578Z stderr:
2020-07-13T21:53:24.5903300Z ------------------------------------------
2020-07-13T21:53:24.5903596Z error[E0277]: `T` cannot be sent between threads safely
2020-07-13T21:53:24.5904216Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:18:13
2020-07-13T21:53:24.5904499Z    |
2020-07-13T21:53:24.5904748Z LL |     let a = &t as &dyn Gettable<T>;
2020-07-13T21:53:24.5905052Z    |             ^^ `T` cannot be sent between threads safely
2020-07-13T21:53:24.5905320Z    |
2020-07-13T21:53:24.5905595Z    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
2020-07-13T21:53:24.5905928Z    = note: required for the cast to the object type `dyn Gettable<T>`
2020-07-13T21:53:24.5906228Z help: consider restricting type parameter `T`
2020-07-13T21:53:24.5906483Z    |
2020-07-13T21:53:24.5906805Z LL | fn f<T: std::marker::Send>(val: T) {
2020-07-13T21:53:24.5907061Z    |       ^^^^^^^^^^^^^^^^^^^
2020-07-13T21:53:24.5907219Z 
2020-07-13T21:53:24.5907541Z error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
2020-07-13T21:53:24.5908172Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:18:13
2020-07-13T21:53:24.5908451Z    |
2020-07-13T21:53:24.5908693Z LL |     let a = &t as &dyn Gettable<T>;
2020-07-13T21:53:24.5909051Z    |             ^^ the trait `std::marker::Copy` is not implemented for `T`
2020-07-13T21:53:24.5909331Z    |
2020-07-13T21:53:24.5909608Z    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
2020-07-13T21:53:24.5909932Z    = note: required for the cast to the object type `dyn Gettable<T>`
2020-07-13T21:53:24.5910358Z help: consider restricting type parameter `T`
2020-07-13T21:53:24.5910630Z    |
2020-07-13T21:53:24.5910950Z LL | fn f<T: std::marker::Copy>(val: T) {
2020-07-13T21:53:24.5911211Z    |       ^^^^^^^^^^^^^^^^^^^
2020-07-13T21:53:24.5911352Z 
2020-07-13T21:53:24.5911606Z error[E0277]: `T` cannot be sent between threads safely
2020-07-13T21:53:24.5912249Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:25:31
2020-07-13T21:53:24.5912527Z    |
2020-07-13T21:53:24.5912771Z LL |     let a: &dyn Gettable<T> = &t;
2020-07-13T21:53:24.5913059Z    |                               ^^ `T` cannot be sent between threads safely
2020-07-13T21:53:24.5913358Z    |
2020-07-13T21:53:24.5913631Z    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
2020-07-13T21:53:24.5913950Z    = note: required for the cast to the object type `dyn Gettable<T>`
2020-07-13T21:53:24.5914240Z help: consider restricting type parameter `T`
2020-07-13T21:53:24.5914493Z    |
2020-07-13T21:53:24.5914805Z LL | fn g<T: std::marker::Send>(val: T) {
2020-07-13T21:53:24.5915071Z    |       ^^^^^^^^^^^^^^^^^^^
2020-07-13T21:53:24.5915226Z 
2020-07-13T21:53:24.5915538Z error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
2020-07-13T21:53:24.5916176Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:25:31
2020-07-13T21:53:24.5916447Z    |
2020-07-13T21:53:24.5916688Z LL |     let a: &dyn Gettable<T> = &t;
2020-07-13T21:53:24.5917051Z    |                               ^^ the trait `std::marker::Copy` is not implemented for `T`
2020-07-13T21:53:24.5917368Z    |
2020-07-13T21:53:24.5917642Z    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
2020-07-13T21:53:24.5917954Z    = note: required for the cast to the object type `dyn Gettable<T>`
2020-07-13T21:53:24.5918243Z help: consider restricting type parameter `T`
2020-07-13T21:53:24.5918502Z    |
2020-07-13T21:53:24.5918800Z LL | fn g<T: std::marker::Copy>(val: T) {
2020-07-13T21:53:24.5919071Z    |       ^^^^^^^^^^^^^^^^^^^
2020-07-13T21:53:24.5919227Z 
2020-07-13T21:53:24.5919673Z error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied
2020-07-13T21:53:24.5920342Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:38:13
2020-07-13T21:53:24.5920620Z    |
2020-07-13T21:53:24.5920874Z LL |     let a = t as Box<dyn Gettable<String>>;
2020-07-13T21:53:24.5921242Z    |             ^ the trait `std::marker::Copy` is not implemented for `std::string::String`
2020-07-13T21:53:24.5921544Z    |
2020-07-13T21:53:24.5922242Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:344:22
2020-07-13T21:53:24.5922570Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2020-07-13T21:53:24.5922987Z    = note: required because of the requirements on the impl of `Gettable<std::string::String>` for `S<std::string::String>`
2020-07-13T21:53:24.5923411Z    = note: required for the cast to the object type `dyn Gettable<std::string::String>`
2020-07-13T21:53:24.5923605Z 
2020-07-13T21:53:24.5924222Z error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied
2020-07-13T21:53:24.5924887Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:46:37
2020-07-13T21:53:24.5925161Z    |
2020-07-13T21:53:24.5925409Z LL |     let a: Box<dyn Gettable<Foo>> = t;
2020-07-13T21:53:24.5925806Z    |                                     ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo`
2020-07-13T21:53:24.5926091Z    |
2020-07-13T21:53:24.5926423Z    = note: required because of the requirements on the impl of `Gettable<foo3::Foo>` for `S<foo3::Foo>`
2020-07-13T21:53:24.5926804Z    = note: required for the cast to the object type `dyn Gettable<foo3::Foo>`
2020-07-13T21:53:24.5926972Z 
2020-07-13T21:53:24.5927220Z error: aborting due to 6 previous errors
2020-07-13T21:53:24.5927380Z 
2020-07-13T21:53:24.5927976Z For more information about this error, try `rustc --explain E0277`.
2020-07-13T21:53:24.5928266Z 
2020-07-13T21:53:24.5928794Z ------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.