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

Consider implementing "two-dimensional" index for ty::substs #13564

Closed
edwardw opened this issue Apr 16, 2014 · 2 comments
Closed

Consider implementing "two-dimensional" index for ty::substs #13564

edwardw opened this issue Apr 16, 2014 · 2 comments
Labels
A-lifetimes Area: Lifetimes / regions A-type-system Area: Type system

Comments

@edwardw
Copy link
Contributor

edwardw commented Apr 16, 2014

One core data structure of rustc is ty::substs:

pub struct substs {
    pub self_ty: Option<ty::t>,
    pub tps: Vec<t>,
    pub regions: RegionSubsts,
}

And, ty::ty_param and ty::ReEarlyBound variants of ty::t and ty::Region have indexes in them:

pub enum Region {
    ReEarlyBound(ast::NodeId, uint, ast::Name),
    ...
}
pub enum sty {
    ty_param(param_ty),
    ...
}
pub struct param_ty {
    pub idx: uint,
    pub def_id: DefId
}

These indexes are meant to distinguish type and lifetime parameters originated from trait, implementation and method bounds. In order to do so, they are monotonic so merging them from different bounds involves messy index manipulation, such as #13503.

@nikomatsakis in IRC:

the fix I had planned was basically to make the index "two-dimensional": that is, first a namespace and then an index
using def-ids would be another option, I tried it once, found it was kinda messy

@edwardw
Copy link
Contributor Author

edwardw commented Jun 4, 2014

#14604 implements this. So this ticket can be closed as soon as #14604 lands.

@nikomatsakis
Copy link
Contributor

@edwardw thanks, I couldn't find this issue when I searched for it. :)

nikomatsakis added a commit that referenced this issue Jun 4, 2014
parameters

This involves numerous substeps:

1. Treat Self same as any other parameter.
2. No longer compute offsets for method parameters.
3. Store all generic types (both trait/impl and method) with a method,
   eliminating odd discrepancies.
4. Stop doing unspeakable things to static methods and instead just use
   the natural types, now that we can easily add the type parameters from
   trait into the method's polytype.
5. No doubt some more. It was hard to separate these into distinct commits.

Fixes #13564
nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Jun 7, 2014
parameters

This involves numerous substeps:

1. Treat Self same as any other parameter.
2. No longer compute offsets for method parameters.
3. Store all generic types (both trait/impl and method) with a method,
   eliminating odd discrepancies.
4. Stop doing unspeakable things to static methods and instead just use
   the natural types, now that we can easily add the type parameters from
   trait into the method's polytype.
5. No doubt some more. It was hard to separate these into distinct commits.

Fixes rust-lang#13564
flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 7, 2024
…blyxyas

Stop linting manual_bits in any macro invoke

Closes rust-lang#13563.

changelog: [`manual_bits`] No longer lints in macro-generated code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: Lifetimes / regions A-type-system Area: Type system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants