diff --git a/compiler/rustc_const_eval/src/const_eval/type_info.rs b/compiler/rustc_const_eval/src/const_eval/type_info.rs index f8881f0968bb4..9ba85c4842aa8 100644 --- a/compiler/rustc_const_eval/src/const_eval/type_info.rs +++ b/compiler/rustc_const_eval/src/const_eval/type_info.rs @@ -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)?; @@ -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 = @@ -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(..) diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 6aa2eae556e25..43fee32ade924 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -190,7 +190,6 @@ symbols! { BTreeMap, BTreeSet, BinaryHeap, - Bool, Borrow, BorrowMut, Break, @@ -203,7 +202,6 @@ symbols! { Capture, Cell, Center, - Char, Child, Cleanup, Clone, @@ -370,7 +368,6 @@ symbols! { Some, SpanCtxt, Stdin, - Str, String, StructuralPartialEq, SubdiagMessage, diff --git a/library/core/src/mem/type_info.rs b/library/core/src/mem/type_info.rs index 8b30803c97c98..e60089998e8a0 100644 --- a/library/core/src/mem/type_info.rs +++ b/library/core/src/mem/type_info.rs @@ -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. @@ -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] @@ -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] diff --git a/library/coretests/tests/mem/type_info.rs b/library/coretests/tests/mem/type_info.rs index 87f2d5dd8289c..8ab8ab88a1b8b 100644 --- a/library/coretests/tests/mem/type_info.rs +++ b/library/coretests/tests/mem/type_info.rs @@ -70,10 +70,10 @@ fn test_tuples() { fn test_primitives() { use TypeKind::*; - let Type { kind: Bool(_ty), size, .. } = (const { Type::of::() }) else { panic!() }; + let Type { kind: Other, size, .. } = (const { Type::of::() }) else { panic!() }; assert_eq!(size, Some(1)); - let Type { kind: Char(_ty), size, .. } = (const { Type::of::() }) else { panic!() }; + let Type { kind: Other, size, .. } = (const { Type::of::() }) else { panic!() }; assert_eq!(size, Some(4)); let Type { kind: Int(ty), size, .. } = (const { Type::of::() }) else { panic!() }; @@ -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::() }) else { panic!() }; + let Type { kind: Other, size, .. } = (const { Type::of::() }) else { panic!() }; assert_eq!(size, None); } diff --git a/tests/ui/lint/recommend-literal.rs b/tests/ui/lint/recommend-literal.rs index be074c1114532..45f9ae0a7bdfb 100644 --- a/tests/ui/lint/recommend-literal.rs +++ b/tests/ui/lint/recommend-literal.rs @@ -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 diff --git a/tests/ui/lint/recommend-literal.stderr b/tests/ui/lint/recommend-literal.stderr index 01e993df17a98..6b6dd134e1d29 100644 --- a/tests/ui/lint/recommend-literal.stderr +++ b/tests/ui/lint/recommend-literal.stderr @@ -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; | ^^^^^^ @@ -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; | ^^^^ @@ -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; | ^^^^^^^ @@ -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; | ^^^^ @@ -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) { | ^^^^^^^ @@ -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 { | ^^^^ @@ -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, | ^^^^^ @@ -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, | ^^^ not found in this scope @@ -90,7 +86,7 @@ LL | struct Data { | +++++ 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 {} | ^^^^^ diff --git a/tests/ui/reflection/dump.bit32.run.stdout b/tests/ui/reflection/dump.bit32.run.stdout index d15b46509ff20..5801a32059cae 100644 --- a/tests/ui/reflection/dump.bit32.run.stdout +++ b/tests/ui/reflection/dump.bit32.run.stdout @@ -188,9 +188,7 @@ Type { ), } Type { - kind: Str( - Str, - ), + kind: Other, size: None, } Type { diff --git a/tests/ui/reflection/dump.bit64.run.stdout b/tests/ui/reflection/dump.bit64.run.stdout index efae226539515..64b92fc02a2a6 100644 --- a/tests/ui/reflection/dump.bit64.run.stdout +++ b/tests/ui/reflection/dump.bit64.run.stdout @@ -188,9 +188,7 @@ Type { ), } Type { - kind: Str( - Str, - ), + kind: Other, size: None, } Type { diff --git a/tests/ui/suggestions/semi-suggestion-when-stmt-and-expr-span-equal.stderr b/tests/ui/suggestions/semi-suggestion-when-stmt-and-expr-span-equal.stderr index 9f34d27478814..aa96159aacf57 100644 --- a/tests/ui/suggestions/semi-suggestion-when-stmt-and-expr-span-equal.stderr +++ b/tests/ui/suggestions/semi-suggestion-when-stmt-and-expr-span-equal.stderr @@ -21,14 +21,14 @@ LL | .collect::(); | = help: the trait `FromIterator<()>` is not implemented for `String` = help: the following other types implement trait `FromIterator`: + `String` implements `FromIterator<&Char>` `String` implements `FromIterator<&char>` - `String` implements `FromIterator<&std::ascii::Char>` `String` implements `FromIterator<&str>` `String` implements `FromIterator>` + `String` implements `FromIterator` `String` implements `FromIterator>` `String` implements `FromIterator` `String` implements `FromIterator` - `String` implements `FromIterator` 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 | diff --git a/tests/ui/traits/issue-77982.stderr b/tests/ui/traits/issue-77982.stderr index b1baabc4394b0..4bc24e81215a0 100644 --- a/tests/ui/traits/issue-77982.stderr +++ b/tests/ui/traits/issue-77982.stderr @@ -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 for u32; - impl From for u32; - impl From for u32; - impl From for u32; - - impl From for u32; - impl From for u32; - impl From for u32; help: try using a fully qualified path to specify the expected types diff --git a/tests/ui/try-trait/bad-interconversion.stderr b/tests/ui/try-trait/bad-interconversion.stderr index a566800da53e4..ebd1a0bf7e00e 100644 --- a/tests/ui/try-trait/bad-interconversion.stderr +++ b/tests/ui/try-trait/bad-interconversion.stderr @@ -18,7 +18,7 @@ help: the following other types implement trait `From` = note: in this macro invocation --> $SRC_DIR/core/src/ascii/ascii_char.rs:LL:COL | - = note: `u8` implements `From` + = note: `u8` implements `From` ::: $SRC_DIR/core/src/ascii/ascii_char.rs:LL:COL | = note: in this macro invocation