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 #74401

Closed
wants to merge 75 commits into from

Conversation

Manishearth
Copy link
Member

Successful merges:

Failed merges:

r? @ghost

mzohreva and others added 30 commits June 12, 2020 11:26
Currently dependency crates of the standard library can sometimes leak
into error messages such as when traits to import are suggested.
Additionally they can leak into documentation such as in the list of
"all traits implemented by `u32`". The dependencies of the standard
library, however, are intended to be private.

The dependencies of the standard library can't actually be stabl-y
imported nor is the documentation that relevant since you can't import
them on stable either. This commit updates both the compiler and rustdoc
to ignore unstable traits in these two scenarios.

Specifically the suggestion for traits to import ignore unstable traits,
and similarly the list of traits implemented by a type excludes unstable
traits.

This commit is extracted from rust-lang#73441 where the addition of some new
dependencies to the standard library was showed to leak into various
error messages and documentation. The intention here is to go ahead and
land these changes ahead of that since it will likely take some time to
land.
This commit also categorizing access as Field, Index, or Subslice.

Ideas are taken from `mir::ProjectionElem`.

Proposed changes: https://github.com/rust-lang/project-rfc-2229/blob/master/hir-place-target.md

Closes: rust-lang/project-rfc-2229#1,
rust-lang/project-rfc-2229#2

Co-authored-by: Aman Arora <[email protected]>
Co-authored-by: Chris Pardy <[email protected]>
Co-authored-by: Dhruv Jauhar <[email protected]>
Fixes rust-lang#72684.

This commit also modifies the signature of `Classifier::new` to avoid
copying the source being highlighted.
As rustc is permanently unstable. So marking every items
with unstable is essential useless.
to avoid surprising listed in API guidelines.
Instead, ignore resolution errors that occur in item bodies.

The reason this can't ignore item bodies altogether is because
`const fn` could be used in generic types, for example `[T; f()]`
- Explicitly check for missing docs
- Don't run any lints except those we explicitly specified
- Remove unnecessary `should_loop` variable
- Report errors for trait implementations

These should give resolution errors because they are visible outside the
current scope. Without these errors, rustdoc will give ICEs:

```
thread 'rustc' panicked at 'attempted .def_id() on invalid res: Err', /home/joshua/src/rust/src/libstd/macros.rs:16:9
  15: rustc_hir::def::Res<Id>::def_id
             at /home/joshua/src/rust/src/librustc_hir/def.rs:382
  16: rustdoc::clean::utils::register_res
             at src/librustdoc/clean/utils.rs:627
  17: rustdoc::clean::utils::resolve_type
             at src/librustdoc/clean/utils.rs:587
```

- Add much more extensive tests
  + fn -> impl -> fn
  + fn -> impl -> fn -> macro
  + errors in function parameters
  + errors in trait bounds
  + errors in the type implementing the trait
  + unknown bounds for the type
  + unknown types in function bodies
  + errors generated by macros

- Use explicit state instead of trying to reconstruct it from random info
- Use an enum instead of a boolean
- Add example of ignored error
Instead, report the error.

This emits the errors on-demand, without special-casing `impl Trait`, so
it should catch all ICEs of this kind, including ones that haven't been
found yet.

Since the error is emitted during type-checking there is less info about
the error; see comments in the code for details.

- Add test case for -> impl Trait
- Add test for impl trait with alias
- Move EmitIgnoredResolutionErrors to rustdoc

This makes `fn typeck_item_bodies` public, which is not desired behavior.
That change should be removed once
rust-lang#74070 is merged.

- Don't visit nested closures twice
Previously, rustdoc would issue a delay_span_bug ICE on the following code:

```rust
pub fn a() -> impl Fn() -> u32 {
    || content::doesnt::matter()
}
```

This wasn't picked up earlier because having `type Alias = impl Trait;`
in the same module caused _all closures_ to be typechecked, even if they
wouldn't normally. Additionally, if _any_ error was emitted, no
delay_span_bug would be emitted. So as part of this commit all of the
tests were separated out into different files.
Just use a boolean instead.
…nikomatsakis

Ignoring test case: [codegen] repr-transparent-aggregates-1.rs for aarch64

Ignoring test case: [codegen] repr-transparent-aggregates-1.rs for aarch64.

Copyright (c) 2020, Arm Limited.
…atsakis

Remove some `ignore-stage1` annotations.

These tests appear to no longer need the `ignore-stage1` marker.

- `run-make-fulldeps/issue-37839` and `run-make-fulldeps/issue-37893`: I believe these were due to the use of proc-macros, and probably were just missed in rust-lang#49219 which fixed the proc-macro compatibility.

- `compile-fail/asm-src-loc-codegen-units.rs`: This was due to an old issue with landing pads (as mentioned in the linked issue rust-lang#20184). `-Zno-landing-pads` was an option when building the first stage (it was much faster), but somewhere along the way (I think the switch from makefiles to rustbuild), the option was removed.
  - NOTE: This test doesn't actually test what it was originally written for, and is probably mostly pointless now. This test was asserting the message "build without -C codegen-units for more exact errors", but that was removed in rust-lang#42682. It is now in essence identical to `asm-src-loc.rs`.
…, r=nikomatsakis

Make hir ProjectionKind more precise

This commit also categorizing access as Field, Index, or Subslice.

Ideas are taken from `mir::ProjectionElem`.

Proposed changes: https://github.com/rust-lang/project-rfc-2229/blob/master/hir-place-target.md

Closes: rust-lang/project-rfc-2229#1,
Closes: rust-lang/project-rfc-2229#2

r? @nikomatsakis @matthewjasper
forbid generic params in the type of const params

implements and closes rust-lang#74152

fixes rust-lang#74101, closes rust-lang#71169, fixes rust-lang#73491, closes rust-lang#62878

@eddyb and I talked [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/type.20of.20const.20parameters/near/203405696) about this and we probably want to also forbid generic consts in the default
type of a parameter, e.g. `struct Foo<T, U = [u8; std::mem::size_of::<T>()]>`, this is currently still allowed
and I will probably fix that in a followup PR.

r? @varkor @eddyb
…akis

Fix 44056 test with debug on macos.

The test `codegen/issue-44056-macos-tls-align.rs` fails on macos if `debug-assertions` is enabled in `config.toml`.  It has the following error:

```
/Users/eric/Proj/rust/rust/src/test/codegen/issue-44056-macos-tls-align.rs:9:11: error: CHECK: expected string not found in input
// CHECK: @STATIC_VAR_1 = thread_local local_unnamed_addr global <{ [32 x i8] }> zeroinitializer, section "__DATA,__thread_bss", align 4
          ^
/Users/eric/Proj/rust/rust/build/x86_64-apple-darwin/test/codegen/issue-44056-macos-tls-align/issue-44056-macos-tls-align.ll:1:1: note: scanning from here
; ModuleID = 'issue_44056_macos_tls_align.3a1fbbbh-cgu.0'
^
/Users/eric/Proj/rust/rust/build/x86_64-apple-darwin/test/codegen/issue-44056-macos-tls-align/issue-44056-macos-tls-align.ll:9:1: note: possible intended match here
@STATIC_VAR_1 = thread_local global <{ [32 x i8] }> zeroinitializer, section "__DATA,__thread_bss", align 4
^
```

Comparing the output, the actual output is missing the text "`local_unnamed_addr`".

The fix here is to ignore `local_unnamed_addr`, as it doesn't seem relevant to the test.
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
…eGomez

rustdoc: Rename internal API fns to `into_string`

to avoid surprising listed in API guidelines.
… r=pietroalbini

Add RISC-V GNU/Linux to src/tools/build-manifest as a host platform

Missed during rust-lang#72973
…lacrum

BtreeMap: superficially refactor root access

Remove or comment every unwrap in BTreeMap's main code and more.

r? @Mark-Simulacrum
…roalbini

Bump version to 1.47

This also bumps to a more recent rustfmt version, just to keep us relatively up to date (though almost nothing has changed in rustfmt we use beyond bumps to the parser infra). No formatting changes as a result of this.

r? @pietroalbini
@Manishearth
Copy link
Member Author

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

@bors
Copy link
Contributor

bors commented Jul 16, 2020

📌 Commit 828708d has been approved by Manishearth

@rustbot rustbot added the rollup A PR which is a rollup label Jul 16, 2020
@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 16, 2020
@bors
Copy link
Contributor

bors commented Jul 16, 2020

⌛ Testing commit 828708d with merge bd3985d8d7709f5abd239694179f419b5e89a2e8...

@Manishearth
Copy link
Member Author

@bors treeclosed=5

So that I can make sure this lands

@bors
Copy link
Contributor

bors commented Jul 16, 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 16, 2020
@Manishearth
Copy link
Member Author

i have no idea how that would happen

2020-07-16T16:35:36.7648931Z W�i�n�d�o�w�s� �S�u�b�s�y�s�t�e�m� �f�o�r� �L�i�n�u�x� �h�a�s� �n�o� �i�n�s�t�a�l�l�e�d� �d�i�s�t�r�i�b�u�t�i�o�n�s�.�
2020-07-16T16:35:36.7649189Z �
2020-07-16T16:35:36.7649669Z �
2020-07-16T16:35:36.7649930Z �D�i�s�t�r�i�b�u�t�i�o�n�s� �c�a�n� �b�e� �i�n�s�t�a�l�l�e�d� �b�y� �v�i�s�i�t�i�n�g� �t�h�e� �M�i�c�r�o�s�o�f�t� �S�t�o�r�e�:�
2020-07-16T16:35:36.7650115Z �
2020-07-16T16:35:36.7650242Z �
2020-07-16T16:35:36.7650398Z �h�t�t�p�s�:�/�/�a�k�a�.�m�s�/�w�s�l�s�t�o�r�e�
2020-07-16T16:35:36.7650821Z �
2020-07-16T16:35:36.7650978Z �
2020-07-16T16:35:36.7708043Z �

@jyn514
Copy link
Member

jyn514 commented Jul 16, 2020

Maybe from #74395 ?

@Manishearth
Copy link
Member Author

That's my guess too but I'm not sure how

@jyn514
Copy link
Member

jyn514 commented Jul 16, 2020

Could also be #74386

@Manishearth Manishearth deleted the rollup-tob20n1 branch July 18, 2020 01:14
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.