about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/interface.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-09-24 21:30:35 +0000
committerbors <bors@rust-lang.org>2021-09-24 21:30:35 +0000
commit043972f152398a7e4c579dd465da42bb52d6da31 (patch)
tree836198df21f11ee63228cadffd205661c5267981 /compiler/rustc_interface/src/interface.rs
parent73422130ee96c09e7214c876a3600ac1f32aa8c8 (diff)
parentcb6c13977aa23f1d814a5504cf8b03a76743d06b (diff)
downloadrust-043972f152398a7e4c579dd465da42bb52d6da31.tar.gz
rust-043972f152398a7e4c579dd465da42bb52d6da31.zip
Auto merge of #86246 - FabianWolff:issue-83471, r=estebank
Add basic checks for well-formedness of `fn`/`fn_mut` lang items

This pull request fixes #83471. Lang items are never actually checked for well-formedness (#9307). This means that one can get an ICE quite easily, e.g. as follows:
```rust
#![feature(lang_items)]
#[lang = "fn"]
trait MyFn {
    const call: i32 = 42;
}

fn main() {
    (|| 42)();
}
```
or this:
```rust
#![feature(lang_items)]
#[lang = "fn"]
trait MyFn {
    fn call(i: i32, j: i32);
}

fn main() {
    (|| 42)();
}
```
Ideally, there should probably be a more comprehensive strategy for checking lang items for well-formedness, but for the time being, I have added some rudimentary well-formedness checks that prevent #83471 and similar issues.
Diffstat (limited to 'compiler/rustc_interface/src/interface.rs')
0 files changed, 0 insertions, 0 deletions