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 11 pull requests #76582

Merged
merged 29 commits into from
Sep 10, 2020
Merged

Rollup of 11 pull requests #76582

merged 29 commits into from
Sep 10, 2020

Conversation

tmandry
Copy link
Member

@tmandry tmandry commented Sep 10, 2020

Successful merges:

Failed merges:

r? @ghost

hameerabbasi and others added 29 commits September 9, 2020 13:28
Those statements are removed by CleanupNonCodegenStatements pass
in drop lowering phase, and should not occur afterwards.
The current description of the trivial casts lint under the "allowed
by default" listing in the rustc book indicates the lint is for lints
which may be removed, which is less clear than saying it's for lints
which may be replaced by coercion (which is the wording used by the
error message included in the doc).

This commit changes the wording slightly to better describe what the
lint does.
This commit adjusts the missing field diagnostic logic for struct
expressions in typeck to improve the diagnostic when the missing
fields are inaccessible.

Signed-off-by: David Wood <david@davidtw.co>
This commit adjusts the missing field diagnostic logic for struct
patterns in typeck to improve the diagnostic when the missing fields are
inaccessible.

Signed-off-by: David Wood <david@davidtw.co>
Syntactically permit unsafety on mods

Similar to rust-lang#66183; we will accept these constructs syntactically but reject with a semantic check after macro expansion if a proc macro hasn't replaced it with something else meaningful to Rust.

```rust
#[mymacro]
unsafe mod m {
    ...
}

#[mymacro]
unsafe extern "C++" {
    ...
}
```

The intention is that this might be used as a kind of "item-level unsafe" in attribute macro DSLs -- holding things which are unsafe to declare but potentially safe to use. For example I look forward to using this in https://github.com/dtolnay/cxx.

In the absence of a procedural macro rewriting them to something else, they'll continue to be rejected at compile time though with a better error message than before.

### Before:

```console
error: expected item, found keyword `unsafe`
 --> src/main.rs:1:1
  |
1 | unsafe mod m {
  | ^^^^^^ expected item
```

### After:

```console
error: module cannot be declared unsafe
 --> src/main.rs:1:1
  |
1 | unsafe mod m {
  | ^^^^^^

error: extern block cannot be declared unsafe
 --> src/main.rs:4:1
  |
4 | unsafe extern "C++" {
  | ^^^^^^
```

Closes rust-lang#68048.
Add docs about crate level documentation support

Wrote information about how to write documentation on the crate level in rhe rustdoc book
…=lcnr

Add revisions to const generic issue UI tests.

Fixes rust-lang#75279.

I have gotten into the flow, so I can do more of these if requested. I'm looking for feedback as to whether my work is on the right track so far.
…private-fields, r=estebank

typeck: don't suggest inaccessible private fields

Fixes rust-lang#76077.

This PR adjusts the missing field diagnostic logic in typeck so that when none of the missing fields in a struct expr are accessible then the error is less confusing.

r? @estebank
Validate removal of AscribeUserType, FakeRead, and Shallow borrow

Those statements are removed by CleanupNonCodegenStatements pass
in drop lowering phase, and should not occur afterwards.
…_lint_doc, r=steveklabnik

Reword `trivial_casts` lint in rustc book to better explain what it does.

The current description of the trivial casts lint under the "allowed
by default" listing in the rustc book indicates the lint is for casts
which may be removed, which is less clear than saying it's for casts
which may be replaced by coercion (which is the wording used by the
error message included in the doc).

This commit changes the wording slightly to better describe what the
lint does.

This issue bit me in some recent code where I was attempting to
convert a `Vec<SomeType>` to a `Vec<SomeTraitObject>`, and
hit my project-wide `#![deny(trivial_casts)]` with
`map(|o| Box::new(o) as TraitObject)`. I'd read the book docs for
`trivial_casts` and was surprised by the error, as I took it to mean
the cast ought to be removed (rather than replaced by ascription
in this case). Removing the cast meant other code didn't compile,
and I then found issues like rust-lang#23742 and realized my misunderstanding.
add the `const_evaluatable_checked` feature

Implements a rather small subset of rust-lang/compiler-team#340

Unlike the MCP, this does not try to compare different constant, but instead only adds the constants found in where clauses
to the predicates of a function. This PR adds the feature gate `const_evaluatable_checked`, without which nothing should change.

r? @oli-obk @eddyb
small typo fix in rustc_parse docs

small typo in rustc_parse::new_parser_from_file's documentation

I'm not sure a PR is the way to do this though.
take reference to Place directly instead of taking reference to Box<Place>

clippy::borrowed_box
use push(char) to add chars (single-char &strs) to strings instead of push_str(&str)
…, r=jyn514

Add missing examples on core traits' method

Linked to rust-lang#76450.

r? @jyn514
@tmandry
Copy link
Member Author

tmandry commented Sep 10, 2020

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

@bors
Copy link
Contributor

bors commented Sep 10, 2020

📌 Commit 044f717 has been approved by tmandry

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

bors commented Sep 10, 2020

⌛ Testing commit 044f717 with merge ad3a6f7...

@bors
Copy link
Contributor

bors commented Sep 10, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: tmandry
Pushing ad3a6f7 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.