Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions compiler/rustc_const_eval/src/const_eval/type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,6 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {

variant
}
ty::Bool => {
let (variant, _variant_place) = downcast(sym::Bool)?;
variant
}
ty::Char => {
let (variant, _variant_place) = downcast(sym::Char)?;
variant
}
ty::Int(int_ty) => {
let (variant, variant_place) = downcast(sym::Int)?;
let place = self.project_field(&variant_place, FieldIdx::ZERO)?;
Expand All @@ -108,10 +100,6 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
self.write_float_type_info(place, float_ty.bit_width())?;
variant
}
ty::Str => {
let (variant, _variant_place) = downcast(sym::Str)?;
variant
}
ty::Ref(_, ty, mutability) => {
let (variant, variant_place) = downcast(sym::Reference)?;
let reference_place =
Expand All @@ -136,6 +124,9 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
variant
}
ty::Adt(_, _)
| ty::Bool
| ty::Char
| ty::Str
| ty::Foreign(_)
| ty::Pat(_, _)
| ty::FnDef(..)
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ symbols! {
BTreeMap,
BTreeSet,
BinaryHeap,
Bool,
Borrow,
BorrowMut,
Break,
Expand All @@ -203,7 +202,6 @@ symbols! {
Capture,
Cell,
Center,
Char,
Child,
Cleanup,
Clone,
Expand Down Expand Up @@ -370,7 +368,6 @@ symbols! {
Some,
SpanCtxt,
Stdin,
Str,
String,
StructuralPartialEq,
SubdiagMessage,
Expand Down
30 changes: 0 additions & 30 deletions library/core/src/mem/type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,10 @@ pub enum TypeKind {
Slice(Slice),
/// Dynamic Traits.
DynTrait(DynTrait),
/// Primitive boolean type.
Bool(Bool),
/// Primitive character type.
Char(Char),
/// Primitive signed and unsigned integer type.
Int(Int),
/// Primitive floating-point type.
Float(Float),
/// String slice type.
Str(Str),
/// References.
Reference(Reference),
/// Pointers.
Expand Down Expand Up @@ -137,22 +131,6 @@ pub struct Trait {
pub is_auto: bool,
}

/// Compile-time type information about `bool`.
#[derive(Debug)]
#[non_exhaustive]
#[unstable(feature = "type_info", issue = "146922")]
pub struct Bool {
// No additional information to provide for now.
}

/// Compile-time type information about `char`.
#[derive(Debug)]
#[non_exhaustive]
#[unstable(feature = "type_info", issue = "146922")]
pub struct Char {
// No additional information to provide for now.
}

/// Compile-time type information about signed and unsigned integer types.
#[derive(Debug)]
#[non_exhaustive]
Expand All @@ -173,14 +151,6 @@ pub struct Float {
pub bits: u32,
}

/// Compile-time type information about string slice types.
#[derive(Debug)]
#[non_exhaustive]
#[unstable(feature = "type_info", issue = "146922")]
pub struct Str {
// No additional information to provide for now.
}

/// Compile-time type information about references.
#[derive(Debug)]
#[non_exhaustive]
Expand Down
6 changes: 3 additions & 3 deletions library/coretests/tests/mem/type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ fn test_tuples() {
fn test_primitives() {
use TypeKind::*;

let Type { kind: Bool(_ty), size, .. } = (const { Type::of::<bool>() }) else { panic!() };
let Type { kind: Other, size, .. } = (const { Type::of::<bool>() }) else { panic!() };
assert_eq!(size, Some(1));

let Type { kind: Char(_ty), size, .. } = (const { Type::of::<char>() }) else { panic!() };
let Type { kind: Other, size, .. } = (const { Type::of::<char>() }) else { panic!() };
assert_eq!(size, Some(4));

let Type { kind: Int(ty), size, .. } = (const { Type::of::<i32>() }) else { panic!() };
Expand All @@ -100,7 +100,7 @@ fn test_primitives() {
assert_eq!(size, Some(4));
assert_eq!(ty.bits, 32);

let Type { kind: Str(_ty), size, .. } = (const { Type::of::<str>() }) else { panic!() };
let Type { kind: Other, size, .. } = (const { Type::of::<str>() }) else { panic!() };
assert_eq!(size, None);
}

Expand Down
2 changes: 0 additions & 2 deletions tests/ui/lint/recommend-literal.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//~vv HELP consider importing this struct

type Real = double;
//~^ ERROR cannot find type `double` in this scope
//~| HELP perhaps you intended to use this type
Expand Down
22 changes: 9 additions & 13 deletions tests/ui/lint/recommend-literal.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0425]: cannot find type `double` in this scope
--> $DIR/recommend-literal.rs:3:13
--> $DIR/recommend-literal.rs:1:13
|
LL | type Real = double;
| ^^^^^^
Expand All @@ -8,7 +8,7 @@ LL | type Real = double;
| help: perhaps you intended to use this type: `f64`

error[E0425]: cannot find type `long` in this scope
--> $DIR/recommend-literal.rs:9:12
--> $DIR/recommend-literal.rs:7:12
|
LL | let y: long = 74802374902374923;
| ^^^^
Expand All @@ -17,7 +17,7 @@ LL | let y: long = 74802374902374923;
| help: perhaps you intended to use this type: `i64`

error[E0425]: cannot find type `Boolean` in this scope
--> $DIR/recommend-literal.rs:12:13
--> $DIR/recommend-literal.rs:10:13
|
LL | let v1: Boolean = true;
| ^^^^^^^
Expand All @@ -26,7 +26,7 @@ LL | let v1: Boolean = true;
| help: perhaps you intended to use this type: `bool`

error[E0425]: cannot find type `Bool` in this scope
--> $DIR/recommend-literal.rs:15:13
--> $DIR/recommend-literal.rs:13:13
|
LL | let v2: Bool = true;
| ^^^^
Expand All @@ -41,13 +41,9 @@ help: perhaps you intended to use this type
LL - let v2: Bool = true;
LL + let v2: bool = true;
|
help: consider importing this struct
|
LL + use std::mem::type_info::Bool;
|

error[E0425]: cannot find type `boolean` in this scope
--> $DIR/recommend-literal.rs:21:9
--> $DIR/recommend-literal.rs:19:9
|
LL | fn z(a: boolean) {
| ^^^^^^^
Expand All @@ -56,7 +52,7 @@ LL | fn z(a: boolean) {
| help: perhaps you intended to use this type: `bool`

error[E0425]: cannot find type `byte` in this scope
--> $DIR/recommend-literal.rs:26:11
--> $DIR/recommend-literal.rs:24:11
|
LL | fn a() -> byte {
| ^^^^
Expand All @@ -65,7 +61,7 @@ LL | fn a() -> byte {
| help: perhaps you intended to use this type: `u8`

error[E0425]: cannot find type `float` in this scope
--> $DIR/recommend-literal.rs:33:12
--> $DIR/recommend-literal.rs:31:12
|
LL | width: float,
| ^^^^^
Expand All @@ -74,7 +70,7 @@ LL | width: float,
| help: perhaps you intended to use this type: `f32`

error[E0425]: cannot find type `int` in this scope
--> $DIR/recommend-literal.rs:36:19
--> $DIR/recommend-literal.rs:34:19
|
LL | depth: Option<int>,
| ^^^ not found in this scope
Expand All @@ -90,7 +86,7 @@ LL | struct Data<int> {
| +++++

error[E0425]: cannot find type `short` in this scope
--> $DIR/recommend-literal.rs:42:16
--> $DIR/recommend-literal.rs:40:16
|
LL | impl Stuff for short {}
| ^^^^^
Expand Down
4 changes: 1 addition & 3 deletions tests/ui/reflection/dump.bit32.run.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ Type {
),
}
Type {
kind: Str(
Str,
),
kind: Other,
size: None,
}
Type {
Expand Down
4 changes: 1 addition & 3 deletions tests/ui/reflection/dump.bit64.run.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ Type {
),
}
Type {
kind: Str(
Str,
),
kind: Other,
size: None,
}
Type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ LL | .collect::<String>();
|
= help: the trait `FromIterator<()>` is not implemented for `String`
= help: the following other types implement trait `FromIterator<A>`:
`String` implements `FromIterator<&Char>`
`String` implements `FromIterator<&char>`
`String` implements `FromIterator<&std::ascii::Char>`
`String` implements `FromIterator<&str>`
`String` implements `FromIterator<Box<str, A>>`
`String` implements `FromIterator<Char>`
`String` implements `FromIterator<Cow<'_, str>>`
`String` implements `FromIterator<String>`
`String` implements `FromIterator<char>`
`String` implements `FromIterator<std::ascii::Char>`
note: the method call chain might not have had the expected associated types
--> $DIR/semi-suggestion-when-stmt-and-expr-span-equal.rs:20:10
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/traits/issue-77982.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(
| type must be known at this point
|
= note: multiple `impl`s satisfying `u32: From<_>` found in the `core` crate:
- impl From<Char> for u32;
- impl From<Ipv4Addr> for u32;
- impl From<bool> for u32;
- impl From<char> for u32;
- impl From<std::ascii::Char> for u32;
- impl From<u16> for u32;
- impl From<u8> for u32;
help: try using a fully qualified path to specify the expected types
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/try-trait/bad-interconversion.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ help: the following other types implement trait `From<T>`
= note: in this macro invocation
--> $SRC_DIR/core/src/ascii/ascii_char.rs:LL:COL
|
= note: `u8` implements `From<std::ascii::Char>`
= note: `u8` implements `From<Char>`
::: $SRC_DIR/core/src/ascii/ascii_char.rs:LL:COL
|
= note: in this macro invocation
Expand Down
Loading