Skip to content

Commit bc550a5

Browse files
committed
Change warnings from blockquotes to divs
1 parent d9e6a59 commit bc550a5

File tree

3 files changed

+44
-25
lines changed

3 files changed

+44
-25
lines changed

src/expressions/method-call-expr.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,17 @@ generic methods or traits are considered the same, then it is a compiler
8181
error. These cases require a [disambiguating function call syntax] for method
8282
and function invocation.
8383
84-
> Warning: For [trait objects], if there is an inherent method of the same name
85-
> as a trait method, it will give a compiler error when trying to call the
86-
> method in a method call expression. Instead, you can call the method using
87-
> [disambiguating function call syntax], in which case it calls the trait
88-
> method, not the inherent method. There is no way to call the inherent method.
89-
> Just don't define inherent methods on trait objects with the same name a trait
90-
> method and you'll be fine.
84+
<div class="warning">
85+
86+
***Warning:*** For [trait objects], if there is an inherent method of the same
87+
name as a trait method, it will give a compiler error when trying to call the
88+
method in a method call expression. Instead, you can call the method using
89+
[disambiguating function call syntax], in which case it calls the trait
90+
method, not the inherent method. There is no way to call the inherent method.
91+
Just don't define inherent methods on trait objects with the same name a trait
92+
method and you'll be fine.
93+
94+
</div>
9195
9296
[IDENTIFIER]: identifiers.html
9397
[visible]: visibility-and-privacy.html

src/type-layout.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,17 @@ the default `enum` size and alignment for the target platform's C ABI.
233233
> really a "best guess". In particular, this may be incorrect when the C code
234234
> of interest is compiled with certain flags.
235235
236-
> Warning: There are crucial differences between an `enum` in the C language and
237-
> Rust's C-like enumerations with this representation. An `enum` in C is
238-
> mostly a `typedef` plus some named constants; in other words, an object of an
239-
> `enum` type can hold any integer value. For example, this is often used for
240-
> bitflags in `C`. In contrast, Rust’s C-like enumerations can only legally hold
241-
> the discriminant values, everything else is undefined behaviour. Therefore,
242-
> using a C-like enumeration in FFI to model a C `enum` is often wrong.
236+
<div class="warning">
237+
238+
Warning: There are crucial differences between an `enum` in the C language and
239+
Rust's C-like enumerations with this representation. An `enum` in C is
240+
mostly a `typedef` plus some named constants; in other words, an object of an
241+
`enum` type can hold any integer value. For example, this is often used for
242+
bitflags in `C`. In contrast, Rust’s C-like enumerations can only legally hold
243+
the discriminant values, everything else is undefined behaviour. Therefore,
244+
using a C-like enumeration in FFI to model a C `enum` is often wrong.
245+
246+
</div>
243247

244248
It is an error for [zero-variant enumerations] to have the `C` representation.
245249

@@ -290,9 +294,13 @@ padding bytes and forcing the alignment of the type to `1`.
290294
The `align` and `packed` representations cannot be applied on the same type and
291295
a `packed` type cannot transitively contain another `align`ed type.
292296

293-
> Warning: Dereferencing an unaligned pointer is [undefined behaviour] and it is
294-
> possible to [safely create unaligned pointers to `packed` fields][27060].
295-
> Like all ways to create undefined behavior in safe Rust, this is a bug.
297+
<div class="warning">
298+
299+
***Warning:*** Dereferencing an unaligned pointer is [undefined behaviour] and
300+
it is possible to [safely create unaligned pointers to `packed` fields][27060].
301+
Like all ways to create undefined behavior in safe Rust, this is a bug.
302+
303+
</div>
296304

297305
[`align_of_val`]: ../std/mem/fn.align_of_val.html
298306
[`size_of_val`]: ../std/mem/fn.size_of_val.html

src/types.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -580,14 +580,21 @@ if the sets of auto traits are the same and the lifetime bounds are the same.
580580
For example, `dyn Trait + Send + UnwindSafe` is the same as
581581
`dyn Trait + Unwindsafe + Send`.
582582

583-
> Warning: With two trait object types, even when the complete set of traits is
584-
> the same, if the base traits differ, the type is different. For example,
585-
> `dyn Send + Sync` is a different type from `dyn Sync + Send`. See
586-
> [issue 33140].
587-
588-
> Warning: Including the same auto trait multiple times is allowed, and each
589-
> instance is considered a unique type. As such, `dyn Trait + Send` is a
590-
> distinct type to `dyn Trait + Send + Send`. See [issue 47010].
583+
<div class="warning">
584+
585+
***Warning:*** With two trait object types, even when the complete set of traits
586+
is the same, if the base traits differ, the type is different. For example,
587+
`dyn Send + Sync` is a different type from `dyn Sync + Send`. See [issue 33140].
588+
589+
</div>
590+
591+
<div class="warning">
592+
593+
***Warning:*** Including the same auto trait multiple times is allowed, and each
594+
instance is considered a unique type. As such, `dyn Trait + Send` is a
595+
distinct type to `dyn Trait + Send + Send`. See [issue 47010].
596+
597+
</div>
591598

592599
Due to the opaqueness of which concrete type the value is of, trait objects are
593600
[dynamically sized types]. Like all

0 commit comments

Comments
 (0)