Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion compiler/rustc_middle/src/hir/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ impl<'tcx> ItemCollector<'tcx> {
let delayed_kinds =
krate.delayed_ids.iter().copied().map(|id| (id, krate.owners[id].expect_delayed()));

// FIXME(fn_delegation): need to add delayed lints, eiis
// FIXME(fn_delegation): need to add eiis
for (def_id, kind) in delayed_kinds {
let owner_id = OwnerId { def_id };

Expand All @@ -1350,6 +1350,9 @@ impl<'tcx> ItemCollector<'tcx> {
};

collector.body_owners.push(def_id);
// Delegation items are skipped by the HIR walk (see `visit_if_delayed`),
// so we have to account for their delayed lints manually.
collector.delayed_lint_items.push(owner_id);
}
}

Expand Down
17 changes: 17 additions & 0 deletions tests/ui/delegation/ice-issue-155127.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// https://github.com/rust-lang/rust/issues/155127

#![feature(fn_delegation)]
#![allow(incomplete_features)]

struct S;

fn foo() {}

impl S {
#[deprecated]
//~^ ERROR `#[deprecated]` attribute cannot be used on delegations
//~| WARN this was previously accepted by the compiler but is being phased out
reuse foo;
}

fn main() {}
12 changes: 12 additions & 0 deletions tests/ui/delegation/ice-issue-155127.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error: `#[deprecated]` attribute cannot be used on delegations
--> $DIR/ice-issue-155127.rs:11:5
|
LL | #[deprecated]
| ^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[deprecated]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, foreign statics, functions, inherent impl blocks, macro defs, modules, statics, struct fields, traits, type aliases, and use statements
= note: `#[deny(useless_deprecated)]` on by default

error: aborting due to 1 previous error

Loading