From 1ffb410aa278f48fb8b571701aeb96ab8b4b1da9 Mon Sep 17 00:00:00 2001 From: Tony Li Date: Thu, 4 Apr 2024 19:08:54 +1300 Subject: [PATCH 1/9] Fix incorrect 'llvm_target' value used on watchOS target The expected value is "-apple-watchos..0", i.e. "arm64_32-apple-watchos8.0.0". compiler/rustc_target/src/spec/base/apple/mod.rs contains functions that construct such string. There is an existing function `watchos_sim_llvm_target` which returns llvm target value for watchOS simulator. But there is none for watchOS device. This commit adds that missing function to align watchOS with other Apple platform targets. --- compiler/rustc_target/src/spec/base/apple/mod.rs | 5 +++++ .../src/spec/targets/arm64_32_apple_watchos.rs | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_target/src/spec/base/apple/mod.rs b/compiler/rustc_target/src/spec/base/apple/mod.rs index dd75377ead2a7..752196eef1fae 100644 --- a/compiler/rustc_target/src/spec/base/apple/mod.rs +++ b/compiler/rustc_target/src/spec/base/apple/mod.rs @@ -359,6 +359,11 @@ fn watchos_deployment_target() -> (u32, u32) { from_set_deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0)) } +pub fn watchos_llvm_target(arch: Arch) -> String { + let (major, minor) = watchos_deployment_target(); + format!("{}-apple-watchos{}.{}.0", arch.target_name(), major, minor) +} + pub fn watchos_sim_llvm_target(arch: Arch) -> String { let (major, minor) = watchos_deployment_target(); format!("{}-apple-watchos{}.{}.0-simulator", arch.target_name(), major, minor) diff --git a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs index 9bf09b4376d1c..f842a834c05bf 100644 --- a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs @@ -1,10 +1,11 @@ -use crate::spec::base::apple::{opts, Arch}; +use crate::spec::base::apple::{opts, watchos_llvm_target, Arch}; use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { - let base = opts("watchos", Arch::Arm64_32); + let arch = Arch::Arm64_32; + let base = opts("watchos", arch); Target { - llvm_target: "arm64_32-apple-watchos".into(), + llvm_target: watchos_llvm_target(arch).into(), metadata: crate::spec::TargetMetadata { description: None, tier: None, From de212963f8543d6c86e554716218fd67b84d64a2 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Wed, 3 Apr 2024 15:07:53 +0200 Subject: [PATCH 2/9] Relax framework linking test This test was introduced in #118644, but was over-specified in that it assumed the path of the linker was always `cc`. --- tests/ui/linkage-attr/framework.omit.stderr | 2 +- tests/ui/linkage-attr/framework.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/ui/linkage-attr/framework.omit.stderr b/tests/ui/linkage-attr/framework.omit.stderr index 5cb4d3914371c..23e017cb0122c 100644 --- a/tests/ui/linkage-attr/framework.omit.stderr +++ b/tests/ui/linkage-attr/framework.omit.stderr @@ -1,4 +1,4 @@ -error: linking with `cc` failed: exit status: 1 +error: linking with `LINKER` failed: exit status: 1 | ld: Undefined symbols: _CFRunLoopGetTypeID, referenced from: diff --git a/tests/ui/linkage-attr/framework.rs b/tests/ui/linkage-attr/framework.rs index 662ef4c429ddd..824adf62206da 100644 --- a/tests/ui/linkage-attr/framework.rs +++ b/tests/ui/linkage-attr/framework.rs @@ -6,8 +6,10 @@ //@ [weak]run-pass //@ [both]run-pass -// The linker's exact error output changes between Xcode versions. +// The linker's exact error output changes between Xcode versions, depends on +// linker invocation details, and the linker sometimes outputs more warnings. //@ compare-output-lines-by-subset +//@ normalize-stderr-test: "linking with `.*` failed" -> "linking with `LINKER` failed" //@ normalize-stderr-test: "Undefined symbols for architecture .*" -> "ld: Undefined symbols:" //@ normalize-stderr-test: "._CFRunLoopGetTypeID.," -> "_CFRunLoopGetTypeID," From 5dc7fe473be6ece4d91de87def58accd9bf168fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sat, 6 Apr 2024 23:30:51 +0200 Subject: [PATCH 3/9] add test for ICE: !base.layout().is_sized() #123078 Fixes https://github.com/rust-lang/rust/issues/123078 --- .../layout/base-layout-is-sized-ice-123078.rs | 17 ++++++++++ .../base-layout-is-sized-ice-123078.stderr | 31 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 tests/ui/layout/base-layout-is-sized-ice-123078.rs create mode 100644 tests/ui/layout/base-layout-is-sized-ice-123078.stderr diff --git a/tests/ui/layout/base-layout-is-sized-ice-123078.rs b/tests/ui/layout/base-layout-is-sized-ice-123078.rs new file mode 100644 index 0000000000000..b1c33e1507551 --- /dev/null +++ b/tests/ui/layout/base-layout-is-sized-ice-123078.rs @@ -0,0 +1,17 @@ +// ICE !base.layout().is_sized() +// issue: rust-lang/rust#123078 + +struct S { + a: [u8], + //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time + b: (), +} + +const C: S = unsafe { std::mem::transmute(()) }; +//~^ ERROR cannot transmute between types of different sizes, or dependently-sized types +const _: [(); { + C; + 0 +}] = []; + +pub fn main() {} diff --git a/tests/ui/layout/base-layout-is-sized-ice-123078.stderr b/tests/ui/layout/base-layout-is-sized-ice-123078.stderr new file mode 100644 index 0000000000000..7e0a41a4367d6 --- /dev/null +++ b/tests/ui/layout/base-layout-is-sized-ice-123078.stderr @@ -0,0 +1,31 @@ +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/base-layout-is-sized-ice-123078.rs:5:8 + | +LL | a: [u8], + | ^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` + = note: only the last field of a struct may have a dynamically sized type + = help: change the field's type to have a statically known size +help: borrowed types always have a statically known size + | +LL | a: &[u8], + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | a: Box<[u8]>, + | ++++ + + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/base-layout-is-sized-ice-123078.rs:10:23 + | +LL | const C: S = unsafe { std::mem::transmute(()) }; + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `()` (0 bits) + = note: target type: `S` (this type does not have a fixed size) + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0277, E0512. +For more information about an error, try `rustc --explain E0277`. From 7d9e1067fdbd200729440044ae91037e644a9f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sat, 6 Apr 2024 23:34:46 +0200 Subject: [PATCH 4/9] add test for ICE: Unexpected unsized type tail: &ReStatic [u8] #122488 Fixes https://github.com/rust-lang/rust/issues/122488 --- .../issue-unsized-tail-restatic-ice-122488.rs | 10 +++++++ ...ue-unsized-tail-restatic-ice-122488.stderr | 27 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/ui/layout/issue-unsized-tail-restatic-ice-122488.rs create mode 100644 tests/ui/layout/issue-unsized-tail-restatic-ice-122488.stderr diff --git a/tests/ui/layout/issue-unsized-tail-restatic-ice-122488.rs b/tests/ui/layout/issue-unsized-tail-restatic-ice-122488.rs new file mode 100644 index 0000000000000..96c993035ef18 --- /dev/null +++ b/tests/ui/layout/issue-unsized-tail-restatic-ice-122488.rs @@ -0,0 +1,10 @@ +// ICE Unexpected unsized type tail: &ReStatic [u8] +// issue: rust-lang/rust#122488 +use std::ops::Deref; + +struct ArenaSet::Target>(V, U); +//~^ ERROR the size for values of type `V` cannot be known at compilation time + +const DATA: *const ArenaSet> = std::ptr::null_mut(); + +pub fn main() {} diff --git a/tests/ui/layout/issue-unsized-tail-restatic-ice-122488.stderr b/tests/ui/layout/issue-unsized-tail-restatic-ice-122488.stderr new file mode 100644 index 0000000000000..f39cb29868af5 --- /dev/null +++ b/tests/ui/layout/issue-unsized-tail-restatic-ice-122488.stderr @@ -0,0 +1,27 @@ +error[E0277]: the size for values of type `V` cannot be known at compilation time + --> $DIR/issue-unsized-tail-restatic-ice-122488.rs:5:61 + | +LL | struct ArenaSet::Target>(V, U); + | -------------------------------- ^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `Sized` + | + = note: only the last field of a struct may have a dynamically sized type + = help: change the field's type to have a statically known size +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - struct ArenaSet::Target>(V, U); +LL + struct ArenaSet::Target>(V, U); + | +help: borrowed types always have a statically known size + | +LL | struct ArenaSet::Target>(&V, U); + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | struct ArenaSet::Target>(Box, U); + | ++++ + + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. From 7836909402928c2e2655b9ddf08f825dfe074cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 7 Apr 2024 00:25:56 +0200 Subject: [PATCH 5/9] add test for ice called Option::unwrap() on a None value in collector.rs:934:13 #105488 Fixes https://github.com/rust-lang/rust/issues/105488 --- .../failed-to-resolve-instance-ice-105488.rs | 42 +++++++++++++++++++ ...iled-to-resolve-instance-ice-105488.stderr | 16 +++++++ 2 files changed, 58 insertions(+) create mode 100644 tests/ui/impl-trait/failed-to-resolve-instance-ice-105488.rs create mode 100644 tests/ui/impl-trait/failed-to-resolve-instance-ice-105488.stderr diff --git a/tests/ui/impl-trait/failed-to-resolve-instance-ice-105488.rs b/tests/ui/impl-trait/failed-to-resolve-instance-ice-105488.rs new file mode 100644 index 0000000000000..994a507394707 --- /dev/null +++ b/tests/ui/impl-trait/failed-to-resolve-instance-ice-105488.rs @@ -0,0 +1,42 @@ +// ICE failed to resolve instance for impl MyFnOnce ... +// issue: rust-lang/rust#105488 +//@ build-fail +//~^^^ ERROR overflow evaluating the requirement `fn() -> impl MyFnOnce + +pub trait MyFnOnce { + type Output; + + fn call_my_fn_once(self) -> Self::Output; +} + +pub struct WrapFnOnce(F); + +impl D, D: MyFnOnce> MyFnOnce for WrapFnOnce { + type Output = D::Output; + + fn call_my_fn_once(self) -> Self::Output { + D::call_my_fn_once(self.0()) + } +} + +impl D, D: MyFnOnce> MyFnOnce for F { + type Output = D::Output; + + fn call_my_fn_once(self) -> Self::Output { + D::call_my_fn_once(self()) + } +} + +pub fn my_fn_1() -> impl MyFnOnce { + my_fn_2 +} + +pub fn my_fn_2() -> impl MyFnOnce { + WrapFnOnce(my_fn_1) +} + +fn main() { + let v = my_fn_1(); + + let _ = v.call_my_fn_once(); +} diff --git a/tests/ui/impl-trait/failed-to-resolve-instance-ice-105488.stderr b/tests/ui/impl-trait/failed-to-resolve-instance-ice-105488.stderr new file mode 100644 index 0000000000000..c2782b79d9021 --- /dev/null +++ b/tests/ui/impl-trait/failed-to-resolve-instance-ice-105488.stderr @@ -0,0 +1,16 @@ +error[E0275]: overflow evaluating the requirement `fn() -> impl MyFnOnce {my_fn_2}: MyFnOnce` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`failed_to_resolve_instance_ice_105488`) +note: required for `WrapFnOnce impl MyFnOnce {my_fn_1}>` to implement `MyFnOnce` + --> $DIR/failed-to-resolve-instance-ice-105488.rs:14:37 + | +LL | impl D, D: MyFnOnce> MyFnOnce for WrapFnOnce { + | -------- ^^^^^^^^ ^^^^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here + = note: 126 redundant requirements hidden + = note: required for `WrapFnOnce impl MyFnOnce {my_fn_1}>` to implement `MyFnOnce` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0275`. From 7c43bc037894a0356ebce914d05674e3180611f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 7 Apr 2024 00:48:47 +0200 Subject: [PATCH 6/9] add test for ICE: failed to resolve instance for impl ...> #123145 Fixes https://github.com/rust-lang/rust/issues/123145 --- .../failed-to-resolve-instance-ice-123145.rs | 20 +++++++++++++++++++ ...iled-to-resolve-instance-ice-123145.stderr | 15 ++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/ui/impl-trait/failed-to-resolve-instance-ice-123145.rs create mode 100644 tests/ui/impl-trait/failed-to-resolve-instance-ice-123145.stderr diff --git a/tests/ui/impl-trait/failed-to-resolve-instance-ice-123145.rs b/tests/ui/impl-trait/failed-to-resolve-instance-ice-123145.rs new file mode 100644 index 0000000000000..977827f3b5587 --- /dev/null +++ b/tests/ui/impl-trait/failed-to-resolve-instance-ice-123145.rs @@ -0,0 +1,20 @@ +// ICE failed to resolve instance for ... +// issue: rust-lang/rust#123145 +//@ build-fail +//~^^^ ERROR overflow evaluating the requirement `(fn() -> impl Handler + +trait Handler { + fn handle(&self) {} +} + +impl H> Handler for F {} + +impl Handler for (L,) {} + +fn one() -> impl Handler { + (one,) +} + +fn main() { + one.handle(); +} diff --git a/tests/ui/impl-trait/failed-to-resolve-instance-ice-123145.stderr b/tests/ui/impl-trait/failed-to-resolve-instance-ice-123145.stderr new file mode 100644 index 0000000000000..f61e8c2f8dfea --- /dev/null +++ b/tests/ui/impl-trait/failed-to-resolve-instance-ice-123145.stderr @@ -0,0 +1,15 @@ +error[E0275]: overflow evaluating the requirement `(fn() -> impl Handler {one},): Handler` + | +note: required for `fn() -> impl Handler {one}` to implement `Handler` + --> $DIR/failed-to-resolve-instance-ice-123145.rs:10:32 + | +LL | impl H> Handler for F {} + | ------- ^^^^^^^ ^ + | | + | unsatisfied trait bound introduced here + = note: 2 redundant requirements hidden + = note: required for `fn() -> impl Handler {one}` to implement `Handler` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0275`. From b9761424395436cfca935e32e8cb323b284e24de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 7 Apr 2024 01:20:56 +0200 Subject: [PATCH 7/9] add test for ice: unknown alias DefKind: AnonConst #116710 Fixes https://github.com/rust-lang/rust/issues/116710 --- ...nown-alias-defkind-anonconst-ice-116710.rs | 15 +++++++++++++++ ...-alias-defkind-anonconst-ice-116710.stderr | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.stderr diff --git a/tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.rs b/tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.rs new file mode 100644 index 0000000000000..dd0b1e8c9f71d --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.rs @@ -0,0 +1,15 @@ +// ICE unknown alias DefKind: AnonConst +// issue: rust-lang/rust#116710 +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +struct A; +//~^ ERROR expected value, found builtin type `u8` + +trait Trait {} +impl Trait for A {} + +impl Trait for A {} +//~^ ERROR conflicting implementations of trait `Trait` for type `A<_>` + +pub fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.stderr b/tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.stderr new file mode 100644 index 0000000000000..80ac96d487000 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.stderr @@ -0,0 +1,19 @@ +error[E0423]: expected value, found builtin type `u8` + --> $DIR/unknown-alias-defkind-anonconst-ice-116710.rs:6:43 + | +LL | struct A; + | ^^ not a value + +error[E0119]: conflicting implementations of trait `Trait` for type `A<_>` + --> $DIR/unknown-alias-defkind-anonconst-ice-116710.rs:12:1 + | +LL | impl Trait for A {} + | --------------------------------- first implementation here +LL | +LL | impl Trait for A {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A<_>` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0119, E0423. +For more information about an error, try `rustc --explain E0119`. From 88aa71f1084cae330345f5c904112cad1686e003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 7 Apr 2024 01:45:31 +0200 Subject: [PATCH 8/9] add test for assertion failed: !value.has_infer() #115806 Fixes https://github.com/rust-lang/rust/issues/115806 --- .../assoc-const-no-infer-ice-115806.rs | 19 +++++++++++++++++++ .../assoc-const-no-infer-ice-115806.stderr | 14 ++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.rs create mode 100644 tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.stderr diff --git a/tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.rs b/tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.rs new file mode 100644 index 0000000000000..2607013ec6335 --- /dev/null +++ b/tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.rs @@ -0,0 +1,19 @@ +// ICE: assertion failed: !value.has_infer() +// issue: rust-lang/rust#115806 +#![feature(associated_const_equality)] +#![allow(incomplete_features)] + +pub struct NoPin; + +impl Pins for NoPin {} + +pub trait PinA { + const A: &'static () = &(); +} + +pub trait Pins {} + +impl Pins for T where T: PinA {} +//~^ ERROR conflicting implementations of trait `Pins<_>` for type `NoPin` + +pub fn main() {} diff --git a/tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.stderr b/tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.stderr new file mode 100644 index 0000000000000..9a9baaddcba3a --- /dev/null +++ b/tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `Pins<_>` for type `NoPin` + --> $DIR/assoc-const-no-infer-ice-115806.rs:16:1 + | +LL | impl Pins for NoPin {} + | --------------------------- first implementation here +... +LL | impl Pins for T where T: PinA {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `NoPin` + | + = note: downstream crates may implement trait `PinA<_>` for type `NoPin` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0119`. From ebc86e6f5846c4e8995e20416dd25cd1bf137b7e Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sat, 6 Apr 2024 22:38:20 -0400 Subject: [PATCH 9/9] Add `f16` and `f128` to rustdoc's `PrimitiveType` Fix a few places where these primitives were missing from librustdoc. --- src/librustdoc/clean/types.rs | 4 ++++ src/librustdoc/passes/collect_intra_doc_links.rs | 4 ++++ tests/rustdoc/primitive/primitive.rs | 14 +++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 6793ea9f485f3..b34d54fd9c82c 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1797,8 +1797,10 @@ impl PrimitiveType { sym::bool => Some(PrimitiveType::Bool), sym::char => Some(PrimitiveType::Char), sym::str => Some(PrimitiveType::Str), + sym::f16 => Some(PrimitiveType::F16), sym::f32 => Some(PrimitiveType::F32), sym::f64 => Some(PrimitiveType::F64), + sym::f128 => Some(PrimitiveType::F128), sym::array => Some(PrimitiveType::Array), sym::slice => Some(PrimitiveType::Slice), sym::tuple => Some(PrimitiveType::Tuple), @@ -1831,8 +1833,10 @@ impl PrimitiveType { U32 => single(SimplifiedType::Uint(UintTy::U32)), U64 => single(SimplifiedType::Uint(UintTy::U64)), U128 => single(SimplifiedType::Uint(UintTy::U128)), + F16 => single(SimplifiedType::Float(FloatTy::F16)), F32 => single(SimplifiedType::Float(FloatTy::F32)), F64 => single(SimplifiedType::Float(FloatTy::F64)), + F128 => single(SimplifiedType::Float(FloatTy::F128)), Str => single(SimplifiedType::Str), Bool => single(SimplifiedType::Bool), Char => single(SimplifiedType::Char), diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index a5c264290138a..a9fb0b56df917 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -536,8 +536,10 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> { I64 => tcx.types.i64, I128 => tcx.types.i128, Isize => tcx.types.isize, + F16 => tcx.types.f16, F32 => tcx.types.f32, F64 => tcx.types.f64, + F128 => tcx.types.f128, U8 => tcx.types.u8, U16 => tcx.types.u16, U32 => tcx.types.u32, @@ -2196,8 +2198,10 @@ fn resolve_primitive(path_str: &str, ns: Namespace) -> Option { "u32" => U32, "u64" => U64, "u128" => U128, + "f16" => F16, "f32" => F32, "f64" => F64, + "f128" => F128, "char" => Char, "bool" | "true" | "false" => Bool, "str" | "&str" => Str, diff --git a/tests/rustdoc/primitive/primitive.rs b/tests/rustdoc/primitive/primitive.rs index 32af2636c18b0..4b89fd9dfb731 100644 --- a/tests/rustdoc/primitive/primitive.rs +++ b/tests/rustdoc/primitive/primitive.rs @@ -1,6 +1,8 @@ #![crate_name = "foo"] #![feature(rustc_attrs)] +#![feature(f16)] +#![feature(f128)] // @has foo/index.html '//h2[@id="primitives"]' 'Primitive Types' // @has foo/index.html '//a[@href="primitive.i32.html"]' 'i32' @@ -13,9 +15,19 @@ // @!has foo/index.html '//span' '🔒' #[rustc_doc_primitive = "i32"] /// this is a test! -mod i32{} +mod i32 {} // @has foo/primitive.bool.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello' #[rustc_doc_primitive = "bool"] /// hello mod bool {} + +// @has foo/primitive.f16.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello' +#[rustc_doc_primitive = "f16"] +/// hello +mod f16 {} + +// @has foo/primitive.f128.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello' +#[rustc_doc_primitive = "f128"] +/// hello +mod f128 {}