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

Fix associated types in copy implementations #38152

Merged
merged 7 commits into from
Jan 5, 2017

Conversation

arielb1
Copy link
Contributor

@arielb1 arielb1 commented Dec 4, 2016

Fixes an ICE and an error in checking copy implementations.

r? @nikomatsakis

}

fn visit_implementation_of_coerce_unsized<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe separate each arg on its own line?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say just rustfmt this new file and be done with it.

@mrhota
Copy link
Contributor

mrhota commented Dec 4, 2016

curiously, the test will ICE immediately with Stable rustc on play.rust-lang.org, but will timeout with beta and nightly.

for variant in &adt.variants {
for field in &variant.fields {
if !field_implements_copy(field) {
return Err(CopyImplementationError::InfrigingVariant(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing, but it seems like it would be nice to give both the variant name and the field name -- can we do that instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea.

}

fn visit_implementation_of_coerce_unsized<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say just rustfmt this new file and be done with it.

}
let method_def_id = items[0];

let self_type = tcx.item_type(impl_did);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file all code collected from other places, or did you make changes to it? I couldn't tell.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code moved from coherence::mod.

@arielb1
Copy link
Contributor Author

arielb1 commented Dec 9, 2016

How do you rustfmt?

@nikomatsakis
Copy link
Contributor

@arielb1 cargo install rustfmt, then run it on the file I think

@bors
Copy link
Contributor

bors commented Dec 21, 2016

☔ The latest upstream changes (presumably #38099) made this pull request unmergeable. Please resolve the merge conflicts.

@nikomatsakis
Copy link
Contributor

@arielb1 if you don't feel like running rustfmt, no biggy, but let's rebase :)

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 3, 2017

📌 Commit 14efebc has been approved by nikomatsakis

@arielb1
Copy link
Contributor Author

arielb1 commented Jan 3, 2017

I was just going to rustfmt the new file and add better error reporting.

@bors r-

Bar(
&'a mut bool //~ this field does not implement `Copy`
),
Baz,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make this a ui test? I'd like to see precisely where the span is, since it's critical to the message

Span the affected fields instead of reporting the field/variant name.
--> $DIR/E0204.rs:27:6
|
23 | Bar { x: Vec<u32> },
| ----------- this field does not implement `Copy`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great :)

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 3, 2017

📌 Commit 4cab293 has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Jan 3, 2017

⌛ Testing commit 4cab293 with merge be89c6b...

@bors
Copy link
Contributor

bors commented Jan 3, 2017

💔 Test failed - status-appveyor

this makes error messages consistent across architectures
@arielb1
Copy link
Contributor Author

arielb1 commented Jan 4, 2017

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Jan 4, 2017

📌 Commit 5fad51e has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Jan 4, 2017

⌛ Testing commit 5fad51e with merge 5e8f802...

@bors
Copy link
Contributor

bors commented Jan 4, 2017

💔 Test failed - status-appveyor

@arielb1
Copy link
Contributor Author

arielb1 commented Jan 4, 2017

@bors
Copy link
Contributor

bors commented Jan 4, 2017

⌛ Testing commit 5fad51e with merge 4f1a16e...

@bors
Copy link
Contributor

bors commented Jan 4, 2017

💔 Test failed - status-travis

@bluss
Copy link
Member

bluss commented Jan 4, 2017

Network Error:

fatal: clone of 'https://github.com/rust-lang/llvm.git' into submodule path '/Users/travis/build/rust-lang/rust/src/llvm' failed

@bors retry

@bors
Copy link
Contributor

bors commented Jan 4, 2017

⌛ Testing commit 5fad51e with merge 60812a8...

@bors
Copy link
Contributor

bors commented Jan 4, 2017

⌛ Testing commit 5fad51e with merge 7bd015d...

@bors
Copy link
Contributor

bors commented Jan 4, 2017

⌛ Testing commit 5fad51e with merge 2b62184...

@bors
Copy link
Contributor

bors commented Jan 4, 2017

💔 Test failed - status-travis

@arielb1
Copy link
Contributor Author

arielb1 commented Jan 4, 2017

@bors
Copy link
Contributor

bors commented Jan 5, 2017

⌛ Testing commit 5fad51e with merge 90618ce...

@bors
Copy link
Contributor

bors commented Jan 5, 2017

💔 Test failed - status-travis

@arielb1
Copy link
Contributor Author

arielb1 commented Jan 5, 2017

The command "if [ "$ALLOW_PR" = "" ] && [ "$TRAVIS_BRANCH" != "auto" ]; then
    echo skipping, not a full build;
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
    git submodule update --init &&
    src/ci/run.sh;
else
    git submodule update --init &&
    src/ci/docker/run.sh $IMAGE;
fi
" exited with 129.

cc @alexcrichton

@bors retry

@bors
Copy link
Contributor

bors commented Jan 5, 2017

⌛ Testing commit 5fad51e with merge 74e5b7d...

bors added a commit that referenced this pull request Jan 5, 2017
Fix associated types in copy implementations

Fixes an ICE and an error in checking copy implementations.

r? @nikomatsakis
@bors
Copy link
Contributor

bors commented Jan 5, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants