3 ms·
Sure, it’s good to point out the difference between “the behavior of a typical optimizing compiler” and “things actually guaranteed by the language”. The contex
by codeflo 4y ago
Sure, it’s good to point out the difference between “the behavior of a typical optimizing compiler” and “things actually guaranteed by the language”. The context of the discussion was the former, I think. I’m not even that certain that monomorphization is actually required in theory.
- estebank 4y agoYes, monomorphization isn't needed in theory, as long as the user-visible behavior remains the same, and in practice the team is exploring options[1] to identify cases where the currently manual practice of writing pub fn foo<T: AsRef<X>>(x: T) { inner_foo(x.as_ref()); } fn inner_foo(_: &X) { todo!() } can be instead done by the compiler automatically (turning monomorphized code back into polymorphic code, hence the polimorphization hame). [1]: https://rustc-dev-guide.rust-lang.org/backend/monomorph.html#polymorphization https://rustc-dev-guide.rust-lang.org/backend/monomorph.html...