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
58e901b6fd1163172149fd422565523b17eed5f0
rust/tests/ui/polymorphization/drop_shims/transitive.rs

28 lines
368 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 bar<F: FnOnce()>(f: F) {
let _ = OnDrop(|| ());
f()
}
fn foo<R, S: FnOnce()>(
_: R,
_: S,
) {
let bar = || {
bar(|| {})
};
let _ = bar();
}
fn main() {
foo(3u32, || {});
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 1430ms Template: 2ms
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