update outdated doc with new example

This commit is contained in:
Mu001999 2025-03-02 23:21:43 +08:00
parent 1c3b035542
commit 4508f5f862

View file

@ -218,10 +218,10 @@ fn check_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGua
/// definition itself. For example, this definition would be illegal: /// definition itself. For example, this definition would be illegal:
/// ///
/// ```rust /// ```rust
/// struct Ref<'a, T> { x: &'a T } /// struct StaticRef<T> { x: &'static T }
/// ``` /// ```
/// ///
/// because the type did not declare that `T:'a`. /// because the type did not declare that `T: 'static`.
/// ///
/// We do this check as a pre-pass before checking fn bodies because if these constraints are /// We do this check as a pre-pass before checking fn bodies because if these constraints are
/// not included it frequently leads to confusing errors in fn bodies. So it's better to check /// not included it frequently leads to confusing errors in fn bodies. So it's better to check