File tree Expand file tree Collapse file tree 6 files changed +12
-12
lines changed Expand file tree Collapse file tree 6 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -73,9 +73,9 @@ impl<T: ?Sized> !Send for *mut T { }
7373/// impl Foo for Impl { }
7474/// impl Bar for Impl { }
7575///
76- /// let x: &Foo = &Impl; // OK
77- /// // let y: &Bar = &Impl; // error: the trait `Bar` cannot
78- /// // be made into an object
76+ /// let x: &dyn Foo = &Impl; // OK
77+ /// // let y: &dyn Bar = &Impl; // error: the trait `Bar` cannot
78+ /// // be made into an object
7979/// ```
8080///
8181/// [trait object]: ../../book/ch17-02-trait-objects.html
Original file line number Diff line number Diff line change @@ -1071,7 +1071,7 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
10711071/// optimizations, potentially resulting in a larger size:
10721072///
10731073/// ```rust
1074- /// # use std::mem::{MaybeUninit, size_of, align_of };
1074+ /// # use std::mem::{MaybeUninit, size_of};
10751075/// assert_eq!(size_of::<Option<bool>>(), 1);
10761076/// assert_eq!(size_of::<Option<MaybeUninit<bool>>>(), 2);
10771077/// ```
Original file line number Diff line number Diff line change 5353/// let value: i32 = 123;
5454///
5555/// // let the compiler make a trait object
56- /// let object: &Foo = &value;
56+ /// let object: &dyn Foo = &value;
5757///
5858/// // look at the raw representation
5959/// let raw_object: raw::TraitObject = unsafe { mem::transmute(object) };
6565///
6666/// // construct a new object, pointing to a different `i32`, being
6767/// // careful to use the `i32` vtable from `object`
68- /// let synthesized: &Foo = unsafe {
68+ /// let synthesized: &dyn Foo = unsafe {
6969/// mem::transmute(raw::TraitObject {
7070/// data: &other_value as *const _ as *mut (),
7171/// vtable: raw_object.vtable,
Original file line number Diff line number Diff line change @@ -351,9 +351,6 @@ impl Options {
351351 . unwrap_or_else ( || PathBuf :: from ( "doc" ) ) ;
352352 let mut cfgs = matches. opt_strs ( "cfg" ) ;
353353 cfgs. push ( "rustdoc" . to_string ( ) ) ;
354- if should_test {
355- cfgs. push ( "test" . to_string ( ) ) ;
356- }
357354
358355 let extension_css = matches. opt_str ( "e" ) . map ( |s| PathBuf :: from ( & s) ) ;
359356
Original file line number Diff line number Diff line change 22// compile-flags:--test
33// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
44
5+ // Crates like core have doctests gated on `cfg(not(test))` so we need to make
6+ // sure `cfg(test)` is not active when running `rustdoc --test`.
7+
58/// this doctest will be ignored:
69///
710/// ```
811/// assert!(false);
912/// ```
10- #[ cfg( not ( test) ) ]
13+ #[ cfg( test) ]
1114pub struct Foo ;
1215
1316/// this doctest will be tested:
1417///
1518/// ```
1619/// assert!(true);
1720/// ```
18- #[ cfg( test) ]
21+ #[ cfg( not ( test) ) ]
1922pub struct Foo ;
Original file line number Diff line number Diff line change 11
22running 1 test
3- test $DIR/cfg-test.rs - Foo (line 15 ) ... ok
3+ test $DIR/cfg-test.rs - Foo (line 18 ) ... ok
44
55test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
66
You can’t perform that action at this time.
0 commit comments