Skip to content

Commit 8f2c255

Browse files
committed
Auto merge of #123585 - matthiaskrgr:rollup-dexaj7a, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #123410 (Relax framework linking test) - #123446 (Fix incorrect 'llvm_target' value used on watchOS target) - #123579 (add some more tests) - #123581 (Add `f16` and `f128` to rustdoc's `PrimitiveType`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 0e3235f + 549d85d commit 8f2c255

19 files changed

+279
-6
lines changed

compiler/rustc_target/src/spec/base/apple/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,11 @@ fn watchos_deployment_target() -> (u32, u32) {
368368
from_set_deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0))
369369
}
370370

371+
pub fn watchos_llvm_target(arch: Arch) -> String {
372+
let (major, minor) = watchos_deployment_target();
373+
format!("{}-apple-watchos{}.{}.0", arch.target_name(), major, minor)
374+
}
375+
371376
pub fn watchos_sim_llvm_target(arch: Arch) -> String {
372377
let (major, minor) = watchos_deployment_target();
373378
format!("{}-apple-watchos{}.{}.0-simulator", arch.target_name(), major, minor)

compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
use crate::spec::base::apple::{opts, Arch};
1+
use crate::spec::base::apple::{opts, watchos_llvm_target, Arch};
22
use crate::spec::{Target, TargetOptions};
33

44
pub fn target() -> Target {
5-
let base = opts("watchos", Arch::Arm64_32);
5+
let arch = Arch::Arm64_32;
6+
let base = opts("watchos", arch);
67
Target {
7-
llvm_target: "arm64_32-apple-watchos".into(),
8+
llvm_target: watchos_llvm_target(arch).into(),
89
metadata: crate::spec::TargetMetadata {
910
description: None,
1011
tier: None,

src/librustdoc/clean/types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,8 +1797,10 @@ impl PrimitiveType {
17971797
sym::bool => Some(PrimitiveType::Bool),
17981798
sym::char => Some(PrimitiveType::Char),
17991799
sym::str => Some(PrimitiveType::Str),
1800+
sym::f16 => Some(PrimitiveType::F16),
18001801
sym::f32 => Some(PrimitiveType::F32),
18011802
sym::f64 => Some(PrimitiveType::F64),
1803+
sym::f128 => Some(PrimitiveType::F128),
18021804
sym::array => Some(PrimitiveType::Array),
18031805
sym::slice => Some(PrimitiveType::Slice),
18041806
sym::tuple => Some(PrimitiveType::Tuple),
@@ -1831,8 +1833,10 @@ impl PrimitiveType {
18311833
U32 => single(SimplifiedType::Uint(UintTy::U32)),
18321834
U64 => single(SimplifiedType::Uint(UintTy::U64)),
18331835
U128 => single(SimplifiedType::Uint(UintTy::U128)),
1836+
F16 => single(SimplifiedType::Float(FloatTy::F16)),
18341837
F32 => single(SimplifiedType::Float(FloatTy::F32)),
18351838
F64 => single(SimplifiedType::Float(FloatTy::F64)),
1839+
F128 => single(SimplifiedType::Float(FloatTy::F128)),
18361840
Str => single(SimplifiedType::Str),
18371841
Bool => single(SimplifiedType::Bool),
18381842
Char => single(SimplifiedType::Char),

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,10 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
536536
I64 => tcx.types.i64,
537537
I128 => tcx.types.i128,
538538
Isize => tcx.types.isize,
539+
F16 => tcx.types.f16,
539540
F32 => tcx.types.f32,
540541
F64 => tcx.types.f64,
542+
F128 => tcx.types.f128,
541543
U8 => tcx.types.u8,
542544
U16 => tcx.types.u16,
543545
U32 => tcx.types.u32,
@@ -2196,8 +2198,10 @@ fn resolve_primitive(path_str: &str, ns: Namespace) -> Option<Res> {
21962198
"u32" => U32,
21972199
"u64" => U64,
21982200
"u128" => U128,
2201+
"f16" => F16,
21992202
"f32" => F32,
22002203
"f64" => F64,
2204+
"f128" => F128,
22012205
"char" => Char,
22022206
"bool" | "true" | "false" => Bool,
22032207
"str" | "&str" => Str,

tests/rustdoc/primitive/primitive.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#![crate_name = "foo"]
22

33
#![feature(rustc_attrs)]
4+
#![feature(f16)]
5+
#![feature(f128)]
46

57
// @has foo/index.html '//h2[@id="primitives"]' 'Primitive Types'
68
// @has foo/index.html '//a[@href="primitive.i32.html"]' 'i32'
@@ -13,9 +15,19 @@
1315
// @!has foo/index.html '//span' '🔒'
1416
#[rustc_doc_primitive = "i32"]
1517
/// this is a test!
16-
mod i32{}
18+
mod i32 {}
1719

1820
// @has foo/primitive.bool.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello'
1921
#[rustc_doc_primitive = "bool"]
2022
/// hello
2123
mod bool {}
24+
25+
// @has foo/primitive.f16.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello'
26+
#[rustc_doc_primitive = "f16"]
27+
/// hello
28+
mod f16 {}
29+
30+
// @has foo/primitive.f128.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello'
31+
#[rustc_doc_primitive = "f128"]
32+
/// hello
33+
mod f128 {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// ICE unknown alias DefKind: AnonConst
2+
// issue: rust-lang/rust#116710
3+
#![feature(generic_const_exprs)]
4+
#![allow(incomplete_features)]
5+
6+
struct A<const N: u32 = 1, const M: u32 = u8>;
7+
//~^ ERROR expected value, found builtin type `u8`
8+
9+
trait Trait {}
10+
impl<const N: u32> Trait for A<N> {}
11+
12+
impl<const N: u32> Trait for A<N> {}
13+
//~^ ERROR conflicting implementations of trait `Trait` for type `A<_>`
14+
15+
pub fn main() {}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0423]: expected value, found builtin type `u8`
2+
--> $DIR/unknown-alias-defkind-anonconst-ice-116710.rs:6:43
3+
|
4+
LL | struct A<const N: u32 = 1, const M: u32 = u8>;
5+
| ^^ not a value
6+
7+
error[E0119]: conflicting implementations of trait `Trait` for type `A<_>`
8+
--> $DIR/unknown-alias-defkind-anonconst-ice-116710.rs:12:1
9+
|
10+
LL | impl<const N: u32> Trait for A<N> {}
11+
| --------------------------------- first implementation here
12+
LL |
13+
LL | impl<const N: u32> Trait for A<N> {}
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A<_>`
15+
16+
error: aborting due to 2 previous errors
17+
18+
Some errors have detailed explanations: E0119, E0423.
19+
For more information about an error, try `rustc --explain E0119`.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// ICE: assertion failed: !value.has_infer()
2+
// issue: rust-lang/rust#115806
3+
#![feature(associated_const_equality)]
4+
#![allow(incomplete_features)]
5+
6+
pub struct NoPin;
7+
8+
impl<TA> Pins<TA> for NoPin {}
9+
10+
pub trait PinA<PER> {
11+
const A: &'static () = &();
12+
}
13+
14+
pub trait Pins<USART> {}
15+
16+
impl<USART, T> Pins<USART> for T where T: PinA<USART, A = { &() }> {}
17+
//~^ ERROR conflicting implementations of trait `Pins<_>` for type `NoPin`
18+
19+
pub fn main() {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0119]: conflicting implementations of trait `Pins<_>` for type `NoPin`
2+
--> $DIR/assoc-const-no-infer-ice-115806.rs:16:1
3+
|
4+
LL | impl<TA> Pins<TA> for NoPin {}
5+
| --------------------------- first implementation here
6+
...
7+
LL | impl<USART, T> Pins<USART> for T where T: PinA<USART, A = { &() }> {}
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `NoPin`
9+
|
10+
= note: downstream crates may implement trait `PinA<_>` for type `NoPin`
11+
12+
error: aborting due to 1 previous error
13+
14+
For more information about this error, try `rustc --explain E0119`.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// ICE failed to resolve instance for <fn() -> impl MyFnOnce ...
2+
// issue: rust-lang/rust#105488
3+
//@ build-fail
4+
//~^^^ ERROR overflow evaluating the requirement `fn() -> impl MyFnOnce
5+
6+
pub trait MyFnOnce {
7+
type Output;
8+
9+
fn call_my_fn_once(self) -> Self::Output;
10+
}
11+
12+
pub struct WrapFnOnce<F>(F);
13+
14+
impl<F: FnOnce() -> D, D: MyFnOnce> MyFnOnce for WrapFnOnce<F> {
15+
type Output = D::Output;
16+
17+
fn call_my_fn_once(self) -> Self::Output {
18+
D::call_my_fn_once(self.0())
19+
}
20+
}
21+
22+
impl<F: FnOnce() -> D, D: MyFnOnce> MyFnOnce for F {
23+
type Output = D::Output;
24+
25+
fn call_my_fn_once(self) -> Self::Output {
26+
D::call_my_fn_once(self())
27+
}
28+
}
29+
30+
pub fn my_fn_1() -> impl MyFnOnce {
31+
my_fn_2
32+
}
33+
34+
pub fn my_fn_2() -> impl MyFnOnce {
35+
WrapFnOnce(my_fn_1)
36+
}
37+
38+
fn main() {
39+
let v = my_fn_1();
40+
41+
let _ = v.call_my_fn_once();
42+
}

0 commit comments

Comments
 (0)