Skip to content

Commit 8b97973

Browse files
committed
auto merge of #18064 : luqmana/rust/remove-reflection, r=nick29581
Out goes reflection! This means your code will break if you used the `:?` format specifier, anything else from libdebug, or the `visit_tydesc` intrinsic directly. Closes #18046. [breaking-change]
2 parents b6e0d3a + 7899248 commit 8b97973

File tree

239 files changed

+709
-2926
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

239 files changed

+709
-2926
lines changed

mk/crates.mk

+4-5
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
TARGET_CRATES := libc std green native flate arena glob term semver \
5353
uuid serialize sync getopts collections num test time rand \
54-
url log regex graphviz core rbml rlibc alloc debug rustrt \
54+
url log regex graphviz core rbml rlibc alloc rustrt \
5555
unicode
5656
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat regex_macros fmt_macros \
5757
rustc_llvm rustc_back
@@ -63,20 +63,19 @@ DEPS_libc := core
6363
DEPS_rlibc := core
6464
DEPS_unicode := core
6565
DEPS_alloc := core libc native:jemalloc
66-
DEPS_debug := std
6766
DEPS_rustrt := alloc core libc collections native:rustrt_native
6867
DEPS_std := core libc rand alloc collections rustrt sync unicode \
6968
native:rust_builtin native:backtrace
7069
DEPS_graphviz := std
7170
DEPS_green := std native:context_switch
7271
DEPS_native := std
73-
DEPS_syntax := std term serialize log fmt_macros debug arena libc
72+
DEPS_syntax := std term serialize log fmt_macros arena libc
7473
DEPS_rustc := syntax flate arena serialize getopts rbml \
75-
time log graphviz debug rustc_llvm rustc_back
74+
time log graphviz rustc_llvm rustc_back
7675
DEPS_rustc_llvm := native:rustllvm libc std
7776
DEPS_rustc_back := std syntax rustc_llvm flate log libc
7877
DEPS_rustdoc := rustc native:hoedown serialize getopts \
79-
test time debug
78+
test time
8079
DEPS_flate := std native:miniz
8180
DEPS_arena := std
8281
DEPS_graphviz := std

src/doc/reference.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ This is a list of behaviour not considered *unsafe* in Rust terms, but that may
11771177
be undesired.
11781178

11791179
* Deadlocks
1180-
* Reading data from private fields (`std::repr`, `format!("{:?}", x)`)
1180+
* Reading data from private fields (`std::repr`)
11811181
* Leaks due to reference count cycles, even in the global heap
11821182
* Exiting without calling destructors
11831183
* Sending signals
@@ -2279,8 +2279,6 @@ These types help drive the compiler's analysis
22792279
: The lifetime parameter should be considered invariant
22802280
* `malloc`
22812281
: Allocate memory on the managed heap.
2282-
* `opaque`
2283-
: ___Needs filling in___
22842282
* `owned_box`
22852283
: ___Needs filling in___
22862284
* `stack_exhausted`
@@ -2295,8 +2293,6 @@ These types help drive the compiler's analysis
22952293
: The type parameter should be considered invariant
22962294
* `ty_desc`
22972295
: ___Needs filling in___
2298-
* `ty_visitor`
2299-
: ___Needs filling in___
23002296

23012297
> **Note:** This list is likely to become out of date. We should auto-generate
23022298
> it from `librustc/middle/lang_items.rs`.

src/liballoc/arc.rs

-2
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,6 @@ mod tests {
317317

318318
assert_eq!((*arc_v)[2], 3);
319319
assert_eq!((*arc_v)[4], 5);
320-
321-
info!("{:?}", arc_v);
322320
}
323321

324322
#[test]

src/liballoc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ extern crate libc;
7777

7878
// Allow testing this library
7979

80-
#[cfg(test)] extern crate debug;
8180
#[cfg(test)] extern crate native;
8281
#[cfg(test)] #[phase(plugin, link)] extern crate std;
8382
#[cfg(test)] #[phase(plugin, link)] extern crate log;

src/libcollections/hash/sip.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ mod tests {
402402
debug!("siphash test {}: {}", t, buf);
403403
let vec = u8to64_le!(vecs[t], 0);
404404
let out = hash_with_keys(k0, k1, &Bytes(buf.as_slice()));
405-
debug!("got {:?}, expected {:?}", out, vec);
405+
debug!("got {}, expected {}", out, vec);
406406
assert_eq!(vec, out);
407407

408408
state_full.reset();
@@ -412,9 +412,6 @@ mod tests {
412412
let v = to_hex_str(&vecs[t]);
413413
debug!("{}: ({}) => inc={} full={}", t, v, i, f);
414414

415-
debug!("full state {:?}", state_full);
416-
debug!("inc state {:?}", state_inc);
417-
418415
assert_eq!(f, i);
419416
assert_eq!(f, v);
420417

src/libcollections/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ extern crate alloc;
3333

3434
#[cfg(test)] extern crate native;
3535
#[cfg(test)] extern crate test;
36-
#[cfg(test)] extern crate debug;
3736

3837
#[cfg(test)] #[phase(plugin, link)] extern crate std;
3938
#[cfg(test)] #[phase(plugin, link)] extern crate log;

src/libcollections/ringbuf.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -551,21 +551,21 @@ mod tests {
551551
assert_eq!(d.len(), 3u);
552552
d.push(137);
553553
assert_eq!(d.len(), 4u);
554-
debug!("{:?}", d.front());
554+
debug!("{}", d.front());
555555
assert_eq!(*d.front().unwrap(), 42);
556-
debug!("{:?}", d.back());
556+
debug!("{}", d.back());
557557
assert_eq!(*d.back().unwrap(), 137);
558558
let mut i = d.pop_front();
559-
debug!("{:?}", i);
559+
debug!("{}", i);
560560
assert_eq!(i, Some(42));
561561
i = d.pop();
562-
debug!("{:?}", i);
562+
debug!("{}", i);
563563
assert_eq!(i, Some(137));
564564
i = d.pop();
565-
debug!("{:?}", i);
565+
debug!("{}", i);
566566
assert_eq!(i, Some(137));
567567
i = d.pop();
568-
debug!("{:?}", i);
568+
debug!("{}", i);
569569
assert_eq!(i, Some(17));
570570
assert_eq!(d.len(), 0u);
571571
d.push(3);
@@ -576,10 +576,10 @@ mod tests {
576576
assert_eq!(d.len(), 3u);
577577
d.push_front(1);
578578
assert_eq!(d.len(), 4u);
579-
debug!("{:?}", d.get(0));
580-
debug!("{:?}", d.get(1));
581-
debug!("{:?}", d.get(2));
582-
debug!("{:?}", d.get(3));
579+
debug!("{}", d.get(0));
580+
debug!("{}", d.get(1));
581+
debug!("{}", d.get(2));
582+
debug!("{}", d.get(3));
583583
assert_eq!(*d.get(0), 1);
584584
assert_eq!(*d.get(1), 2);
585585
assert_eq!(*d.get(2), 3);

src/libcore/intrinsics.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,21 @@ pub struct TyDesc {
5858
pub drop_glue: GlueFn,
5959

6060
// Called by reflection visitor to visit a value of type `T`
61+
#[cfg(stage0)]
6162
pub visit_glue: GlueFn,
6263

6364
// Name corresponding to the type
6465
pub name: &'static str,
6566
}
6667

68+
#[cfg(stage0)]
6769
#[lang="opaque"]
6870
pub enum Opaque { }
6971

72+
#[cfg(stage0)]
7073
pub type Disr = u64;
7174

75+
#[cfg(stage0)]
7276
#[lang="ty_visitor"]
7377
pub trait TyVisitor {
7478
fn visit_bot(&mut self) -> bool;
@@ -327,8 +331,6 @@ extern "rust-intrinsic" {
327331
/// Returns `true` if a type is managed (will be allocated on the local heap)
328332
pub fn owns_managed<T>() -> bool;
329333

330-
pub fn visit_tydesc(td: *const TyDesc, tv: &mut TyVisitor);
331-
332334
/// Calculates the offset from a pointer. The offset *must* be in-bounds of
333335
/// the object, or one-byte-past-the-end. An arithmetic overflow is also
334336
/// undefined behaviour.

src/libdebug/fmt.rs

-53
This file was deleted.

src/libdebug/lib.rs

-33
This file was deleted.

0 commit comments

Comments
 (0)