Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
300901b70509a0af2d971aa6f6104300da24212c
rust/tests/ui/polymorphization/drop_shims/simple.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
314 B
Rust
Raw Normal View History

mir: `unused_generic_params` query This commit implements the `unused_generic_params` query, an initial version of polymorphization which detects when an item does not use generic parameters and is being needlessly monomorphized as a result. Signed-off-by: David Wood <david@davidtw.co>
2020-06-22 13:57:03 +01:00
// check-pass
sess: disable polymorphisation This commit disables polymorphisation to resolve regressions related to closures which inherit unused generic parameters and are then used in casts or reflection. Signed-off-by: David Wood <david@davidtw.co>
2020-07-22 15:03:56 +01:00
// compile-flags:-Zpolymorphize=on
mir: `unused_generic_params` query This commit implements the `unused_generic_params` query, an initial version of polymorphization which detects when an item does not use generic parameters and is being needlessly monomorphized as a result. Signed-off-by: David Wood <david@davidtw.co>
2020-06-22 13:57:03 +01:00
pub struct OnDrop<F: Fn()>(pub F);
impl<F: Fn()> Drop for OnDrop<F> {
fn drop(&mut self) { }
}
fn foo<R, S: FnOnce()>(
_: R,
_: S,
) {
let bar = || {
let _ = OnDrop(|| ());
};
let _ = bar();
}
fn main() {
foo(3u32, || {});
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 1709ms Template: 10ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API