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

encode trait lifetime params in metadata to allow cross-crate usage #10813

Merged
merged 1 commit into from
Dec 9, 2013

Conversation

dwrensha
Copy link
Contributor

@dwrensha dwrensha commented Dec 5, 2013

Before applying this patch, the included testcase fails with:

src/test/run-pass/xcrate-trait-lifetime-param.rs:20:10: 20:28 error: wrong number of lifetime parameters: expected 0 but found 1
src/test/run-pass/xcrate-trait-lifetime-param.rs:20 impl <'a> other::FromBuf<'a> for Reader<'a> {
                                                              ^~~~~~~~~~~~~~~~~~

There's another example in my comments to #10506.

@alexcrichton
Copy link
Member

cc @nikomatsakis

@dwrensha
Copy link
Contributor Author

dwrensha commented Dec 8, 2013

r please?

For evidence that this pull request is a correct fix to the bug, compare to decoder::get_trait_def:

pub fn get_trait_def(cdata: Cmd,
                     item_id: ast::NodeId,
                     tcx: ty::ctxt) -> ty::TraitDef
{
    let item_doc = lookup_item(item_id, cdata.data);
    let tp_defs = item_ty_param_defs(item_doc, tcx, cdata,
                                     tag_items_data_item_ty_param_bounds);
    let rp_defs = item_region_param_defs(item_doc, tcx, cdata);
...

bors added a commit that referenced this pull request Dec 9, 2013
Before applying this patch, the included testcase fails with:
```
src/test/run-pass/xcrate-trait-lifetime-param.rs:20:10: 20:28 error: wrong number of lifetime parameters: expected 0 but found 1
src/test/run-pass/xcrate-trait-lifetime-param.rs:20 impl <'a> other::FromBuf<'a> for Reader<'a> {
                                                              ^~~~~~~~~~~~~~~~~~
```

There's another example in my comments to #10506.
@bors bors closed this Dec 9, 2013
@bors bors merged commit d99efe8 into rust-lang:master Dec 9, 2013
@dwrensha dwrensha deleted the xcrate-lifetime-param branch December 9, 2013 02:47
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 2, 2023
[`default_constructed_unit_structs`]: do not lint on type alias paths

Fixes rust-lang#10755.

Type aliases cannot be used as a constructor, so this lint should not trigger in those cases.
I also changed `clippy_utils::is_ty_alias` to also consider associated types since [they kinda are type aliases too](https://github.com/rust-lang/rust/blob/48ec50ae39d0ca0baa0e78f56c395dcc6d7ebd65/compiler/rustc_resolve/src/late/diagnostics.rs#L1520).

changelog: [`default_constructed_unit_structs`]: do not lint on type alias paths
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.

4 participants