rust/compiler/rustc_resolve/src
Matthias Krüger 3e968c7e9f
Rollup merge of #139075 - oli-obk:resolver-item-lifetime, r=compiler-errors
Do not treat lifetimes from parent items as influencing child items

```rust
struct A;
impl Bar<'static> for A {
    const STATIC: &str = "";
    //            ^ no future incompat warning
}
```

has no future incompat warning, because there is no ambiguity. But

```rust
struct C;
impl Bar<'_> for C {
//       ^^ this lifeimte
    const STATIC: &'static str = {
        struct B;
        impl Bar<'static> for B {
            const STATIC: &str = "";
            // causes     ^ to emit a future incompat warning
        }
        ""
    };
}
```

had one before this PR, because the impl for `B` (which is just a copy of `A`) thought it was influenced by a lifetime on the impl for `C`.

I double checked all other `lifetime_ribs` iterations and all of them do check for `Item` boundaries. This feels very fragile tho, and ~~I think we should do not even be able to see ribs from parent items, but that's a different refactoring that I'd rather not do at the same time as a bugfix~~. EDIT: ah nevermind, this is needed for improving diagnostics like "use of undeclared lifetime" being "can't use generic parameters from outer item" instead.

r? `@compiler-errors`
2025-03-28 21:18:32 +01:00
..
late Rollup merge of #139014 - xizheyin:issue-138931, r=oli-obk 2025-03-27 13:11:20 -04:00
build_reduced_graph.rs Rollup merge of #138929 - oli-obk:assoc-ctxt-of-trait, r=compiler-errors 2025-03-25 18:09:07 +01:00
check_unused.rs Fix autofix for self and self as … in unused_imports lint 2025-03-24 13:01:47 +01:00
def_collector.rs Don't deaggregate InvocationParent just to reaggregate it again 2025-03-26 09:40:27 +00:00
diagnostics.rs Rollup merge of #138924 - nnethercote:less-kw-Empty-3, r=compiler-errors 2025-03-25 18:09:07 +01:00
effective_visibilities.rs rustc_resolve: reduce rightwards drift with let..else 👉💨 2025-01-21 13:42:32 +00:00
errors.rs Allow builtin macros to be used more than once. 2025-03-19 14:12:47 +01:00
ident.rs resolve: Avoid some unstable iteration 2 2025-03-24 23:03:11 +03:00
imports.rs resolve: Avoid some unstable iteration 2 2025-03-24 23:03:11 +03:00
late.rs Do not treat lifetimes from parent items as influencing child items 2025-03-28 17:06:00 +00:00
lib.rs Rollup merge of #138929 - oli-obk:assoc-ctxt-of-trait, r=compiler-errors 2025-03-25 18:09:07 +01:00
macros.rs Rollup merge of #138929 - oli-obk:assoc-ctxt-of-trait, r=compiler-errors 2025-03-25 18:09:07 +01:00
rustdoc.rs rustc_resolve: prevent iteration of refids for completeness 2025-03-27 12:39:48 -04:00