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

+5
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

+4-3
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

+4
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

+4
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

+13-1
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 {}
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() {}
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`.
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() {}
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`.
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0275]: overflow evaluating the requirement `fn() -> impl MyFnOnce {my_fn_2}: MyFnOnce`
2+
|
3+
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`failed_to_resolve_instance_ice_105488`)
4+
note: required for `WrapFnOnce<fn() -> impl MyFnOnce {my_fn_1}>` to implement `MyFnOnce`
5+
--> $DIR/failed-to-resolve-instance-ice-105488.rs:14:37
6+
|
7+
LL | impl<F: FnOnce() -> D, D: MyFnOnce> MyFnOnce for WrapFnOnce<F> {
8+
| -------- ^^^^^^^^ ^^^^^^^^^^^^^
9+
| |
10+
| unsatisfied trait bound introduced here
11+
= note: 126 redundant requirements hidden
12+
= note: required for `WrapFnOnce<fn() -> impl MyFnOnce {my_fn_1}>` to implement `MyFnOnce`
13+
14+
error: aborting due to 1 previous error
15+
16+
For more information about this error, try `rustc --explain E0275`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ICE failed to resolve instance for ...
2+
// issue: rust-lang/rust#123145
3+
//@ build-fail
4+
//~^^^ ERROR overflow evaluating the requirement `(fn() -> impl Handler
5+
6+
trait Handler {
7+
fn handle(&self) {}
8+
}
9+
10+
impl<H: Handler, F: Fn() -> H> Handler for F {}
11+
12+
impl<L: Handler> Handler for (L,) {}
13+
14+
fn one() -> impl Handler {
15+
(one,)
16+
}
17+
18+
fn main() {
19+
one.handle();
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0275]: overflow evaluating the requirement `(fn() -> impl Handler {one},): Handler`
2+
|
3+
note: required for `fn() -> impl Handler {one}` to implement `Handler`
4+
--> $DIR/failed-to-resolve-instance-ice-123145.rs:10:32
5+
|
6+
LL | impl<H: Handler, F: Fn() -> H> Handler for F {}
7+
| ------- ^^^^^^^ ^
8+
| |
9+
| unsatisfied trait bound introduced here
10+
= note: 2 redundant requirements hidden
11+
= note: required for `fn() -> impl Handler {one}` to implement `Handler`
12+
13+
error: aborting due to 1 previous error
14+
15+
For more information about this error, try `rustc --explain E0275`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ICE !base.layout().is_sized()
2+
// issue: rust-lang/rust#123078
3+
4+
struct S {
5+
a: [u8],
6+
//~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
7+
b: (),
8+
}
9+
10+
const C: S = unsafe { std::mem::transmute(()) };
11+
//~^ ERROR cannot transmute between types of different sizes, or dependently-sized types
12+
const _: [(); {
13+
C;
14+
0
15+
}] = [];
16+
17+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
2+
--> $DIR/base-layout-is-sized-ice-123078.rs:5:8
3+
|
4+
LL | a: [u8],
5+
| ^^^^ doesn't have a size known at compile-time
6+
|
7+
= help: the trait `Sized` is not implemented for `[u8]`
8+
= note: only the last field of a struct may have a dynamically sized type
9+
= help: change the field's type to have a statically known size
10+
help: borrowed types always have a statically known size
11+
|
12+
LL | a: &[u8],
13+
| +
14+
help: the `Box` type always has a statically known size and allocates its contents in the heap
15+
|
16+
LL | a: Box<[u8]>,
17+
| ++++ +
18+
19+
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
20+
--> $DIR/base-layout-is-sized-ice-123078.rs:10:23
21+
|
22+
LL | const C: S = unsafe { std::mem::transmute(()) };
23+
| ^^^^^^^^^^^^^^^^^^^
24+
|
25+
= note: source type: `()` (0 bits)
26+
= note: target type: `S` (this type does not have a fixed size)
27+
28+
error: aborting due to 2 previous errors
29+
30+
Some errors have detailed explanations: E0277, E0512.
31+
For more information about an error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// ICE Unexpected unsized type tail: &ReStatic [u8]
2+
// issue: rust-lang/rust#122488
3+
use std::ops::Deref;
4+
5+
struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(V, U);
6+
//~^ ERROR the size for values of type `V` cannot be known at compilation time
7+
8+
const DATA: *const ArenaSet<Vec<u8>> = std::ptr::null_mut();
9+
10+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
error[E0277]: the size for values of type `V` cannot be known at compilation time
2+
--> $DIR/issue-unsized-tail-restatic-ice-122488.rs:5:61
3+
|
4+
LL | struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(V, U);
5+
| -------------------------------- ^ doesn't have a size known at compile-time
6+
| |
7+
| this type parameter needs to be `Sized`
8+
|
9+
= note: only the last field of a struct may have a dynamically sized type
10+
= help: change the field's type to have a statically known size
11+
help: consider removing the `?Sized` bound to make the type parameter `Sized`
12+
|
13+
LL - struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(V, U);
14+
LL + struct ArenaSet<U: Deref, V = <U as Deref>::Target>(V, U);
15+
|
16+
help: borrowed types always have a statically known size
17+
|
18+
LL | struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(&V, U);
19+
| +
20+
help: the `Box` type always has a statically known size and allocates its contents in the heap
21+
|
22+
LL | struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(Box<V>, U);
23+
| ++++ +
24+
25+
error: aborting due to 1 previous error
26+
27+
For more information about this error, try `rustc --explain E0277`.

tests/ui/linkage-attr/framework.omit.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: linking with `cc` failed: exit status: 1
1+
error: linking with `LINKER` failed: exit status: 1
22
|
33
ld: Undefined symbols:
44
_CFRunLoopGetTypeID, referenced from:

tests/ui/linkage-attr/framework.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
//@ [weak]run-pass
77
//@ [both]run-pass
88

9-
// The linker's exact error output changes between Xcode versions.
9+
// The linker's exact error output changes between Xcode versions, depends on
10+
// linker invocation details, and the linker sometimes outputs more warnings.
1011
//@ compare-output-lines-by-subset
12+
//@ normalize-stderr-test: "linking with `.*` failed" -> "linking with `LINKER` failed"
1113
//@ normalize-stderr-test: "Undefined symbols for architecture .*" -> "ld: Undefined symbols:"
1214
//@ normalize-stderr-test: "._CFRunLoopGetTypeID.," -> "_CFRunLoopGetTypeID,"
1315

0 commit comments

Comments
 (0)