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 9 pull requests #88940

Closed
wants to merge 43 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.
estebank and others added 13 commits September 14, 2021 11:03
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.
…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``
…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.
…r=estebank

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

Fixes rust-lang#88803
Move object safety suggestions to the end of the error
`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 d675005 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
@bors
Copy link
Contributor

bors commented Sep 14, 2021

⌛ Testing commit d675005 with merge e65474026ea73d514e85f4cf2da8e600791e690c...

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
   Compiling itertools v0.9.0
[RUSTC-TIMING] build_helper test:false 0.355
[RUSTC-TIMING] lock_api test:false 0.270
   Compiling getopts v0.2.21
   Compiling unic-char-property v0.9.0
[RUSTC-TIMING] unic_char_property test:false 0.085
   Compiling unic-ucd-version v0.9.0
[RUSTC-TIMING] unic_ucd_version test:false 0.039
[RUSTC-TIMING] fixedbitset test:false 0.659
   Compiling crossbeam-utils v0.7.2
[RUSTC-TIMING] ansi_term test:false 0.900
   Compiling memoffset v0.5.5
---
[RUSTC-TIMING] build_script_build test:false 0.275
[RUSTC-TIMING] unicode_script test:false 1.048
[RUSTC-TIMING] bitflags test:false 0.045
[RUSTC-TIMING] maybe_uninit test:false 0.040
   Compiling unic-emoji-char v0.9.0
   Compiling psm v0.1.16
[RUSTC-TIMING] build_script_build test:false 0.310
   Compiling stacker v0.1.14
[RUSTC-TIMING] build_script_build test:false 0.309
[RUSTC-TIMING] build_script_build test:false 0.309
   Compiling rustc_llvm v0.0.0 (/checkout/compiler/rustc_llvm)
[RUSTC-TIMING] log test:false 0.495
[RUSTC-TIMING] build_script_build test:false 0.380
[RUSTC-TIMING] build_script_build test:false 0.438
[RUSTC-TIMING] unic_emoji_char test:false 0.560
[RUSTC-TIMING] tracing_core test:false 1.656
   Compiling rustc_apfloat v0.0.0 (/checkout/compiler/rustc_apfloat)
[RUSTC-TIMING] sharded_slab test:false 1.629
[RUSTC-TIMING] itertools test:false 1.556
---
   Compiling itertools v0.9.0
[RUSTC-TIMING] build_helper test:false 0.519
   Compiling getopts v0.2.21
[RUSTC-TIMING] lock_api test:false 0.491
   Compiling unic-ucd-version v0.9.0
[RUSTC-TIMING] unic_ucd_version test:false 0.042
   Compiling unic-char-property v0.9.0
   Compiling indexmap v1.7.0
[RUSTC-TIMING] unic_char_property test:false 0.116
   Compiling crossbeam-utils v0.7.2
[RUSTC-TIMING] termcolor test:false 1.598
---
[RUSTC-TIMING] maybe_uninit test:false 0.036
[RUSTC-TIMING] build_script_build test:false 0.229
[RUSTC-TIMING] build_script_build test:false 0.317
[RUSTC-TIMING] bitflags test:false 0.044
   Compiling unic-emoji-char v0.9.0
[RUSTC-TIMING] cc test:false 2.765
[RUSTC-TIMING] unicode_script test:false 1.721
[RUSTC-TIMING] log test:false 0.691
[RUSTC-TIMING] log test:false 0.691
[RUSTC-TIMING] unic_emoji_char test:false 0.741
[RUSTC-TIMING] crc32fast test:false 0.522
   Compiling rustc_apfloat v0.0.0 (/checkout/compiler/rustc_apfloat)
[RUSTC-TIMING] tracing_core test:false 2.372
   Compiling psm v0.1.16
---

---- [ui] ui/traits/item-privacy.rs stdout ----
diff of stderr:

140    |               - this trait cannot be made into an object...
141 LL |         const C: u8 = 0;
142    |               ^ ...because it contains this associated `const`
-    = help: consider moving `B` to another trait
144    = help: consider moving `A` to another trait
+    = help: consider moving `B` to another trait
145    = help: consider moving `C` to another trait
147 error[E0223]: ambiguous associated type


The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/item-privacy/item-privacy.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args traits/item-privacy.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/traits/item-privacy.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/item-privacy" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/item-privacy/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0599]: no method named `a` found for struct `S` in the current scope
   |
LL | struct S;
LL | struct S;
   | --------- method `a` not found for this
...
LL |     S.a(); //~ ERROR no method named `a` found
   |       ^ method not found in `S`
   = help: items from traits can only be used if the trait is implemented and in scope
   = help: items from traits can only be used if the trait is implemented and in scope
note: `method::A` defines an item `a`, perhaps you need to implement it
   |
LL |     trait A {
   |     ^^^^^^^


error[E0599]: no method named `b` found for struct `S` in the current scope
   |
LL | struct S;
LL | struct S;
   | --------- method `b` not found for this
LL |         fn b(&self) { }
LL |         fn b(&self) { }
   |            - the method is available for `S` here
...
LL |     S.b(); //~ ERROR no method named `b` found
   |       ^ method not found in `S`
   = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
   |
LL | use method::B;
LL | use method::B;
   |

error[E0624]: associated function `a` is private
   |
LL |         fn a(&self) { }
Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
   |         ----------- private associated function defined here
   |         ----------- private associated function defined here
...
LL |     c.a(); //~ ERROR associated function `a` is private
   |       ^ private associated function

error[E0599]: no function or associated item named `a` found for struct `S` in the current scope
   |
LL | struct S;
LL | struct S;
   | --------- function or associated item `a` not found for this
...
LL |     S::a(&S);
   |        ^ function or associated item not found in `S`
   = help: items from traits can only be used if the trait is implemented and in scope
   = help: items from traits can only be used if the trait is implemented and in scope
note: `method::A` defines an item `a`, perhaps you need to implement it
   |
LL |     trait A {
   |     ^^^^^^^


error[E0599]: no function or associated item named `b` found for struct `S` in the current scope
   |
LL | struct S;
LL | struct S;
   | --------- function or associated item `b` not found for this
...
LL |     S::b(&S);
   |        ^ function or associated item not found in `S`
   = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
   |
LL | use method::B;
LL | use method::B;
   |

error[E0624]: associated function `a` is private
   |
LL |         fn a(&self) { }
   |         ----------- private associated function defined here
...
...
LL |     <dyn C>::a(&S); //~ ERROR associated function `a` is private
   |              ^ private associated function

error[E0599]: no associated item named `A` found for struct `S` in the current scope
   |
LL | struct S;
LL | struct S;
   | --------- associated item `A` not found for this
...
LL |     S::A; //~ ERROR no associated item named `A` found
   |        ^ associated item not found in `S`
   = help: items from traits can only be used if the trait is implemented and in scope
   = help: items from traits can only be used if the trait is implemented and in scope
note: `assoc_const::A` defines an item `A`, perhaps you need to implement it
   |
LL |     trait A {
   |     ^^^^^^^


error[E0599]: no associated item named `B` found for struct `S` in the current scope
   |
LL | struct S;
LL | struct S;
   | --------- associated item `B` not found for this
...
LL |     S::B; //~ ERROR no associated item named `B` found
   |        ^ associated item not found in `S`
   = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
   |
LL | use assoc_const::B;
---
   |
LL |         const A: u8 = 0;
   |         ---------------- private associated constant defined here
...
LL |     <dyn C>::A; //~ ERROR associated constant `A` is private
   |              ^ private associated constant

error[E0038]: the trait `assoc_const::C` cannot be made into an object
   |
   |
LL |     <dyn C>::A; //~ ERROR associated constant `A` is private
   |      ^^^^^ `assoc_const::C` cannot be made into an object
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
  --> /checkout/src/test/ui/traits/item-privacy.rs:25:15
   |
LL |         const A: u8 = 0;
LL |         const A: u8 = 0;
   |               ^ ...because it contains this associated `const`
LL |         const B: u8 = 0;
LL |         const B: u8 = 0;
   |               ^ ...because it contains this associated `const`
...
LL |     pub trait C: A + B {
   |               - this trait cannot be made into an object...
LL |         const C: u8 = 0;
   |               ^ ...because it contains this associated `const`
   = help: consider moving `A` to another trait
   = help: consider moving `B` to another trait
   = help: consider moving `C` to another trait
error[E0223]: ambiguous associated type
  --> /checkout/src/test/ui/traits/item-privacy.rs:115:12
   |
   |
LL |     let _: S::A; //~ ERROR ambiguous associated type
   |            ^^^^ help: use fully-qualified syntax: `<S as Trait>::A`
error[E0223]: ambiguous associated type
  --> /checkout/src/test/ui/traits/item-privacy.rs:116:12
   |
   |
LL |     let _: S::B; //~ ERROR ambiguous associated type
   |            ^^^^ help: use fully-qualified syntax: `<S as Trait>::B`
error[E0223]: ambiguous associated type
  --> /checkout/src/test/ui/traits/item-privacy.rs:117:12
   |
   |
LL |     let _: S::C; //~ ERROR ambiguous associated type
   |            ^^^^ help: use fully-qualified syntax: `<S as Trait>::C`

error: associated type `A` is private
   |
   |
LL |     let _: T::A; //~ ERROR associated type `A` is private


error: associated type `A` is private
   |
   |
LL |         A = u8, //~ ERROR associated type `A` is private

error: aborting due to 15 previous errors

Some errors have detailed explanations: E0038, E0223, E0599, E0624.
---
test result: FAILED. 12032 passed; 1 failed; 102 ignored; 0 measured; 0 filtered out; finished in 133.67s



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-10/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python3" "--lldb-python" "/usr/bin/python3" "--gdb" "/usr/bin/gdb" "--llvm-version" "10.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine frontendopenmp fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcerror orcjit passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--channel" "nightly" "--color" "always"


Build completed unsuccessfully in 0:13:11

@bors
Copy link
Contributor

bors commented Sep 14, 2021

💔 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 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-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet