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

error message when trying to move from an Rc or Arc is ungreat #54703

Merged
merged 2 commits into from Oct 5, 2018

Conversation

Projects
None yet
6 participants
@davidtwco
Member

davidtwco commented Sep 30, 2018

Fixes #52086.

r? @nikomatsakis

@rust-highfive

This comment was marked as outdated.

Show comment
Hide comment
@rust-highfive

rust-highfive Sep 30, 2018

Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:47:35] .................................................................................................... 2000/4314
[00:47:38] .................................................................i.................................. 2100/4314
[00:47:41] .................................................................................................... 2200/4314
[00:47:44] .................................................................................................... 2300/4314
[00:47:47] ..............iiiiiiiii............................................................................. 2400/4314
[00:47:52] .................................................................................................... 2600/4314
[00:47:56] ..................................................................................................i. 2700/4314
[00:47:59] .................................................................................................... 2800/4314
[00:48:02] ..........................................................i.i..ii................................... 2900/4314
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:00:23] 
[01:00:23] running 106 tests
[01:00:26] i..ii..iii....i...i.........i..iii...........i.....i....ii...i.i.ii..............i...ii..ii.i....iii 100/106
[01:00:26] test result: ok. 76 passed; 0 failed; 30 ignored; 0 measured; 0 filtered out
[01:00:26] 
[01:00:26]  finished in 3.219
[01:00:26] travis_fold:end:test_codegen
---
[01:08:17]    Compiling libc v0.2.43
[01:08:17]    Compiling rand_core v0.2.1
[01:08:18]    Compiling rand v0.5.5
[01:08:21]    Compiling alloc v0.0.0 (/checkout/src/liballoc)
[01:08:22] error[E0152]: duplicate lang item found: `arc`.
[01:08:22]     |
[01:08:22]     |
[01:08:22] 204 | / pub struct Arc<T: ?Sized> {
[01:08:22] 205 | |     ptr: NonNull<ArcInner<T>>,
[01:08:22] 206 | |     phantom: PhantomData<T>,
[01:08:22]     | |_^
[01:08:22]     |
[01:08:22]     |
[01:08:22]     = note: first defined in crate `alloc`.
[01:08:22] 
[01:08:22] error[E0152]: duplicate lang item found: `rc`.
[01:08:22]     |
[01:08:22]     |
[01:08:22] 287 | / pub struct Rc<T: ?Sized> {
[01:08:22] 288 | |     ptr: NonNull<RcBox<T>>,
[01:08:22] 289 | |     phantom: PhantomData<T>,
[01:08:22]     | |_^
[01:08:22]     |
[01:08:22]     |
[01:08:22]     = note: first defined in crate `alloc`.
[01:08:25] error: aborting due to 2 previous errors
[01:08:25] 
[01:08:25] For more information about this error, try `rustc --explain E0152`.
[01:08:25] error: Could not compile `alloc`.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

Collaborator

rust-highfive commented Sep 30, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:47:35] .................................................................................................... 2000/4314
[00:47:38] .................................................................i.................................. 2100/4314
[00:47:41] .................................................................................................... 2200/4314
[00:47:44] .................................................................................................... 2300/4314
[00:47:47] ..............iiiiiiiii............................................................................. 2400/4314
[00:47:52] .................................................................................................... 2600/4314
[00:47:56] ..................................................................................................i. 2700/4314
[00:47:59] .................................................................................................... 2800/4314
[00:48:02] ..........................................................i.i..ii................................... 2900/4314
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:00:23] 
[01:00:23] running 106 tests
[01:00:26] i..ii..iii....i...i.........i..iii...........i.....i....ii...i.i.ii..............i...ii..ii.i....iii 100/106
[01:00:26] test result: ok. 76 passed; 0 failed; 30 ignored; 0 measured; 0 filtered out
[01:00:26] 
[01:00:26]  finished in 3.219
[01:00:26] travis_fold:end:test_codegen
---
[01:08:17]    Compiling libc v0.2.43
[01:08:17]    Compiling rand_core v0.2.1
[01:08:18]    Compiling rand v0.5.5
[01:08:21]    Compiling alloc v0.0.0 (/checkout/src/liballoc)
[01:08:22] error[E0152]: duplicate lang item found: `arc`.
[01:08:22]     |
[01:08:22]     |
[01:08:22] 204 | / pub struct Arc<T: ?Sized> {
[01:08:22] 205 | |     ptr: NonNull<ArcInner<T>>,
[01:08:22] 206 | |     phantom: PhantomData<T>,
[01:08:22]     | |_^
[01:08:22]     |
[01:08:22]     |
[01:08:22]     = note: first defined in crate `alloc`.
[01:08:22] 
[01:08:22] error[E0152]: duplicate lang item found: `rc`.
[01:08:22]     |
[01:08:22]     |
[01:08:22] 287 | / pub struct Rc<T: ?Sized> {
[01:08:22] 288 | |     ptr: NonNull<RcBox<T>>,
[01:08:22] 289 | |     phantom: PhantomData<T>,
[01:08:22]     | |_^
[01:08:22]     |
[01:08:22]     |
[01:08:22]     = note: first defined in crate `alloc`.
[01:08:25] error: aborting due to 2 previous errors
[01:08:25] 
[01:08:25] For more information about this error, try `rustc --explain E0152`.
[01:08:25] error: Could not compile `alloc`.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@tmandry

This comment has been minimized.

Show comment
Hide comment
@tmandry

tmandry Oct 1, 2018

Contributor

Nice! Just curious, was there any discussion of fixing this for smart pointer types other than Rc and Arc? (i.e. any type that used Deref along the path)

I have no idea if this is possible. This clearly fixes the most important error messages, but wonder if it could be done more generically at some point.

Contributor

tmandry commented Oct 1, 2018

Nice! Just curious, was there any discussion of fixing this for smart pointer types other than Rc and Arc? (i.e. any type that used Deref along the path)

I have no idea if this is possible. This clearly fixes the most important error messages, but wonder if it could be done more generically at some point.

davidtwco added some commits Sep 30, 2018

Introduce language items for `Arc` and `Rc`.
This commit introduces language items for `Arc` and `Rc` so that types
can later be checked to be `Arc` or `Rc` in the NLL borrow checker. The
`lang` attribute is currently limited to `stage1` as it requires a
compiler built with knowledge of the expected language items.
Add special cases for move from `Rc`/`Arc` errors.
This commit special cases the move out of borrowed content error,
previously:

```
error[E0507]: cannot move out of borrowed content
 --> src/main.rs:7:10
  |
7 |     drop(x.field);
  |          ^ cannot move out of borrowed content
```

to instead mention that it is a move out of a `Rc`/`Arc` which is more
helpful:

```
error[E0507]: cannot move out of an `Rc`
 --> src/main.rs:7:10
  |
7 |     drop(x.field);
  |          ^ cannot move out of an `Rc`
```
@nikomatsakis

Thoughts?

Show resolved Hide resolved src/librustc_mir/borrow_check/move_errors.rs Outdated
@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Oct 2, 2018

Contributor

(I'm ok with starting with the Rc-Arc error for now)

Contributor

nikomatsakis commented Oct 2, 2018

(I'm ok with starting with the Rc-Arc error for now)

@davidtwco

This comment has been minimized.

Show comment
Hide comment
@davidtwco

davidtwco Oct 3, 2018

Member

@bors r=nikomatsakis

Member

davidtwco commented Oct 3, 2018

@bors r=nikomatsakis

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 3, 2018

Contributor

📌 Commit 8c6d08b has been approved by nikomatsakis

Contributor

bors commented Oct 3, 2018

📌 Commit 8c6d08b has been approved by nikomatsakis

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 5, 2018

Contributor

⌛️ Testing commit 8c6d08b with merge eaddf28...

Contributor

bors commented Oct 5, 2018

⌛️ Testing commit 8c6d08b with merge eaddf28...

bors added a commit that referenced this pull request Oct 5, 2018

Auto merge of #54703 - davidtwco:issue-52086, r=nikomatsakis
error message when trying to move from an Rc or Arc is ungreat

Fixes #52086.

r? @nikomatsakis
@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 5, 2018

Contributor

💔 Test failed - status-travis

Contributor

bors commented Oct 5, 2018

💔 Test failed - status-travis

@rust-highfive

This comment has been minimized.

Show comment
Hide comment
@rust-highfive

rust-highfive Oct 5, 2018

Collaborator

The job dist-armhf-linux of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:0790a088:start=1538721235880881776,finish=1538721235888764958,duration=7883182
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1421a759
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:00cd6410
travis_time:start:00cd6410
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:030eb627
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

Collaborator

rust-highfive commented Oct 5, 2018

The job dist-armhf-linux of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:0790a088:start=1538721235880881776,finish=1538721235888764958,duration=7883182
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1421a759
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:00cd6410
travis_time:start:00cd6410
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:030eb627
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@davidtwco

This comment has been minimized.

Show comment
Hide comment
@davidtwco

davidtwco Oct 5, 2018

Member

@bors retry

Member

davidtwco commented Oct 5, 2018

@bors retry

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 5, 2018

Contributor

⌛️ Testing commit 8c6d08b with merge 61f5ca7...

Contributor

bors commented Oct 5, 2018

⌛️ Testing commit 8c6d08b with merge 61f5ca7...

bors added a commit that referenced this pull request Oct 5, 2018

Auto merge of #54703 - davidtwco:issue-52086, r=nikomatsakis
error message when trying to move from an Rc or Arc is ungreat

Fixes #52086.

r? @nikomatsakis
@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 5, 2018

Contributor

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 61f5ca7 to master...

Contributor

bors commented Oct 5, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 61f5ca7 to master...

@bors bors merged commit 8c6d08b into rust-lang:master Oct 5, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@davidtwco davidtwco deleted the davidtwco:issue-52086 branch Oct 5, 2018

@pnkfelix pnkfelix added the A-NLL label Oct 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment