Skip to content

Typechecker can't pass copies to functions taking [const T]/& #2405

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

Closed
eholk opened this issue May 18, 2012 · 3 comments
Closed

Typechecker can't pass copies to functions taking [const T]/& #2405

eholk opened this issue May 18, 2012 · 3 comments
Assignees
Labels
A-lifetimes Area: Lifetimes / regions

Comments

@eholk
Copy link
Contributor

eholk commented May 18, 2012

Consider this code from base.rs:

        vec::riter(copy cleanups) {|cu|
            ...
        }

When I change riter to take a [const T]/&, I get the following error message:

/Users/eholk/Documents/projects/mozilla/rust/src/rustc/middle/trans/base.rs:4011:24: 4011:32 error: mismatched types: expected `[const <V10>]/&<R0>` but found `[middle::trans::common::cleanup]` (vector vs vector)
/Users/eholk/Documents/projects/mozilla/rust/src/rustc/middle/trans/base.rs:4011         vec::riter(copy cleanups) {|cu|
                                                                                                         ^~~~~~~~
error: aborting due to previous errors

These types should be coercible...

@ghost ghost assigned nikomatsakis May 18, 2012
@nikomatsakis
Copy link
Contributor

This may be nothing more than an artifact of the type inferencer, but I think it oughta' work... in particular I can't see why it would fix things to store copy cleanups into a temporary variable, but apparently it does.

@nikomatsakis
Copy link
Contributor

I understand the problem now. It has to do w/ the limitation that we only perform borrowing for call args---the expected types then get passed down via copy and it requires a subtyping, not assignability, relationship.

@pcwalton
Copy link
Contributor

Seems obsolete now. Please reopen if necessary.

bors added a commit to rust-lang-ci/rust that referenced this issue Sep 22, 2022
fix auto-toolchain pwd

`rustup-toolchain` needs to be called in the right directory
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Use the overflow result operations instead of doing the math twice.

This is related to the performance degradation we are seeing in the toolchain upgrade: rust-lang#2293

Co-authored-by: Michael Tautschnig <[email protected]>
tshepang pushed a commit to tshepang/rust that referenced this issue Jun 2, 2025
…-lang-ci

Remove mentions of rust-lang-ci/rust
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: Lifetimes / regions
Projects
None yet
Development

No branches or pull requests

3 participants