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 8 pull requests #88939

Closed
wants to merge 39 commits into from

Conversation

Manishearth
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

m-ou-se and others added 30 commits September 6, 2021 18:12
This reverts commit 059b68d.

Note that this was manually adjusted to retain some of the refactoring
introduced by commit 059b68d, so that it could
likewise retain the correction introduced in commit
5b4bc05
In the lexer, consider emojis to be valid identifiers and reject
them later to avoid knock down parse errors.
tmiasko and others added 9 commits September 14, 2021 13:58
Since 88839 `min_align_of` is lowered to AlignOf operator.
…haelwoerister

Introduce -Z remap-cwd-prefix switch

This switch remaps any absolute paths rooted under the current
working directory to a new value. This includes remapping the
debug info in `DW_AT_comp_dir` and `DW_AT_decl_file`.

Importantly, this flag does not require passing the current working
directory to the compiler, such that the command line can be
run on any machine (with the same input files) and produce the
same results. This is critical property for debugging compiler
issues that crop up on remote machines.

This is based on adetaylor's rust-lang@dbc4ae7

Major Change Proposal: rust-lang/compiler-team#450
Discussed on rust-lang#38322. Would resolve issue rust-lang#87325.
…xpr-parse, r=nagisa

Accept `m!{ .. }.method()` and `m!{ .. }?` statements.

This PR fixes something that I keep running into when using `quote!{}.into()` in a proc macro to convert the `proc_macro2::TokenStream` to a `proc_macro::TokenStream`:

Before:

```
error: expected expression, found `.`
 --> src/lib.rs:6:6
  |
4 |     quote! {
5 |         ...
6 |     }.into()
  |      ^ expected expression
```

After:
```
```
(No output, compiles fine.)

---

Context:

For expressions like `{ 1 }` and `if true { 1 } else { 2 }`, we accept them as full statements without a trailing `;`, which means the following is not accepted:

```rust
{ 1 } - 1 // error
```

since that is parsed as two statements: `{ 1 }` and `-1`. Syntactically correct, but the type of `{ 1 }` should be `()` as there is no `;`.

However, for specifically `.` and `?` after the `}`, we do [continue parsing it as an expression](https://github.com/rust-lang/rust/blob/13db8440bbbe42870bc828d4ec3e965b38670277/compiler/rustc_parse/src/parser/expr.rs#L864-L876):

```rust
{ "abc" }.len(); // ok
```

For braced macro invocations, we do not do this:

```rust
vec![1, 2, 3].len(); // ok
vec!{1, 2, 3}.len(); // error
```

(It parses `vec!{1, 2, 3}` as a full statement, and then complains about `.len()` not being a valid expression.)

This PR changes this to also look for a `.` and `?` after a braced macro invocation. We can be sure the macro is an expression and not a full statement in those cases, since no statement can start with a `.` or `?`.
… r=davidtwco

Revert anon union parsing

Revert PR rust-lang#84571 and rust-lang#85515, which implemented anonymous union parsing in a manner that broke the context-sensitivity for the `union` keyword and thus broke stable Rust code.

Fix rust-lang#88583.
Tokenize emoji as if they were valid identifiers

In the lexer, consider emojis to be valid identifiers and reject
them later to avoid knock down parse errors.

Partially address rust-lang#86102.
Fix ICE when `start` lang item has wrong generics

In my previous pr rust-lang#87875 I missed the requirements on the `start` lang item due to its relative difficulty to test and opting for more conservative estimates.  This fixes that by updating the requirement to be exactly one generic type.

The `start` lang item should have exactly one generic type for the return type of the `main` fn ptr passed to it.  I believe having zero would previously *sometimes* compile (often with the use of `fn() -> ()` as the fn ptr but it was likely UB to call if the return type of `main` was not `()` as far as I know) however it also sometimes would not for various errors including ICEs and LLVM errors depending on exact situations.  Having more than 1 generic has always failed with an ICE because only the one generic type is expected and provided.

Fixes rust-lang#79559, fixes rust-lang#73584, fixes rust-lang#83117 (all duplicates)
Relevant to rust-lang#9307

r? ``@cjgillot``
…r=estebank

feat(rustc_typeck): suggest removing bad parens in `(recv.method)()`

Fixes rust-lang#88803
`Wrapping<T>` has the same layout and ABI as `T`
Remove implementation of `min_align_of` intrinsic

Since rust-lang#88839 `min_align_of` is lowered to AlignOf operator.
@rustbot rustbot added the rollup A PR which is a rollup label Sep 14, 2021
@Manishearth
Copy link
Member Author

@bors r+ p=2

@bors
Copy link
Contributor

bors commented Sep 14, 2021

📌 Commit c92ae5f has been approved by Manishearth

@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 14, 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)
  IMAGE: x86_64-gnu-tools
##[endgroup]
From https://github.com/rust-lang/rust
 * branch              master     -> FETCH_HEAD
Searching for toolstate changes between ec9a1bdc4586eec99acbe34df3717b3fd1277b06 and f54d20ab77cbdcf6fbb859bfb35530ae832d4bab
Clippy or rustfmt subtrees were updated
##[group]Run src/ci/scripts/verify-channel.sh
src/ci/scripts/verify-channel.sh
shell: /bin/bash --noprofile --norc -e -o pipefail {0}
env:
---
   Compiling rustc_graphviz v0.0.0 (/checkout/compiler/rustc_graphviz)
   Compiling stable_deref_trait v1.2.0
   Compiling cpuid-bool v0.1.2
   Compiling unicode-width v0.1.8
   Compiling unic-char-range v0.9.0
   Compiling unic-common v0.9.0
   Compiling serde_derive v1.0.125
   Compiling termcolor v1.1.2
   Compiling serde v1.0.125
---
   Compiling thread_local v1.0.1
   Compiling sharded-slab v0.1.1
   Compiling itertools v0.9.0
   Compiling getopts v0.2.21
   Compiling unic-char-property v0.9.0
   Compiling unic-ucd-version v0.9.0
   Compiling crossbeam-utils v0.7.2
   Compiling memoffset v0.5.5
   Compiling crossbeam-epoch v0.8.2
   Compiling num-traits v0.2.12
   Compiling num-traits v0.2.12
   Compiling num-integer v0.1.43
   Compiling generic-array v0.14.4
   Compiling unicode-normalization v0.1.13
   Compiling unic-emoji-char v0.9.0
   Compiling stacker v0.1.14
   Compiling rustc_llvm v0.0.0 (/checkout/compiler/rustc_llvm)
   Compiling rustc_apfloat v0.0.0 (/checkout/compiler/rustc_apfloat)
   Compiling ena v0.14.0
---
   Compiling stable_deref_trait v1.2.0
   Compiling opaque-debug v0.3.0
   Compiling cpuid-bool v0.1.2
   Compiling unicode-width v0.1.8
   Compiling unic-common v0.9.0
   Compiling unic-char-range v0.9.0
   Compiling serde_derive v1.0.125
   Compiling termcolor v1.1.2
   Compiling serde v1.0.125
   Compiling annotate-snippets v0.8.0
---
   Compiling tracing-core v0.1.17
   Compiling sharded-slab v0.1.1
   Compiling thread_local v1.0.1
   Compiling itertools v0.9.0
   Compiling unic-ucd-version v0.9.0
   Compiling getopts v0.2.21
   Compiling unic-char-property v0.9.0
   Compiling crossbeam-utils v0.7.2
   Compiling memoffset v0.5.5
   Compiling crossbeam-epoch v0.8.2
   Compiling generic-array v0.14.4
   Compiling generic-array v0.14.4
   Compiling num-traits v0.2.12
   Compiling num-integer v0.1.43
   Compiling unicode-normalization v0.1.13
   Compiling unic-emoji-char v0.9.0
   Compiling psm v0.1.16
   Compiling stacker v0.1.14
   Compiling rustc_llvm v0.0.0 (/checkout/compiler/rustc_llvm)
   Compiling rustc_lexer v0.1.0 (/checkout/compiler/rustc_lexer)
---

---- compile_test stdout ----
diff of stderr:

-error: methods called `as_*` usually take `self` by reference or `self` by mutable reference
-  --> $DIR/def_id_nocore.rs:26:19
+error[E0718]: `start` language item must be applied to a function with 1 generic argument
    |
    |
-LL |     pub fn as_ref(self) -> &'static str {
-   |                   ^^^^
-   |
-   = note: `-D clippy::wrong-self-convention` implied by `-D warnings`
-   = help: consider choosing a less ambiguous name
+LL | #[lang = "start"]
+   | ^^^^^^^^^^^^^^^^^
+LL | #[start]
+LL | fn start(_argc: isize, _argv: *const *const u8) -> isize {
+   |         - this function has 0 generic arguments
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0718`.
 
---
To only update this specific test, also pass `--test-args def_id_nocore.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools-bin/clippy-driver" "tests/ui/def_id_nocore.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/def_id_nocore.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" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-b0f19a5fad83a10b.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-392b40a2759b0504.rlib" "--extern" "clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-bc2b0c8a9dcb9fb3.rlib" "--extern" "serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-8bd56d0234290b82.so" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-2c42e7af51424ce5.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-c6bd037ba33baa25.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" "derive_new=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libderive_new-ea1db0c41efed0d6.so" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-89222f6e0d369b36.rlib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/test_build_base/def_id_nocore.stage-id.aux"
error: test failed, to rerun pass '--test compile-test'
------------------------------------------

------------------------------------------
------------------------------------------
stderr:
------------------------------------------
{"message":"`start` language item must be applied to a function with 1 generic argument","code":{"code":"E0718","explanation":"A `#[lang = \"..\"]` attribute was placed on the wrong item type.\n\nErroneous code example:\n\n```compile_fail,E0718\n#![feature(lang_items)]\n\n#[lang = \"owned_box\"]\nstatic X: u32 = 42;\n```\n"},"level":"error","spans":[{"file_name":"tests/ui/def_id_nocore.rs","byte_start":277,"byte_end":277,"line_start":19,"line_end":19,"column_start":9,"column_end":9,"is_primary":false,"text":[{"text":"fn start(_argc: isize, _argv: *const *const u8) -> isize {","highlight_start":9,"highlight_end":9}],"label":"this function has 0 generic arguments","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"tests/ui/def_id_nocore.rs","byte_start":242,"byte_end":259,"line_start":17,"line_end":17,"column_start":1,"column_end":18,"is_primary":true,"text":[{"text":"#[lang = \"start\"]","highlight_start":1,"highlight_end":18}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0718]: `start` language item must be applied to a function with 1 generic argument\n  --> tests/ui/def_id_nocore.rs:17:1\n   |\nLL | #[lang = \"start\"]\n   | ^^^^^^^^^^^^^^^^^\nLL | #[start]\nLL | fn start(_argc: isize, _argv: *const *const u8) -> isize {\n   |         - this function has 0 generic arguments\n\n"}
{"message":"For more information about this error, try `rustc --explain E0718`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0718`.\n"}

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

@Manishearth
Copy link
Member Author

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 14, 2021
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.

None yet