Skip to content

Commit 11565c3

Browse files
committed
Sync from rust 6650252
2 parents 4b7bcdb + 43a25a5 commit 11565c3

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

example/issue-72793.rs

+11-13
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,21 @@
22

33
#![feature(type_alias_impl_trait)]
44

5-
mod helper {
6-
pub trait T {
7-
type Item;
8-
}
5+
pub trait T {
6+
type Item;
7+
}
98

10-
pub type Alias<'a> = impl T<Item = &'a ()>;
9+
pub type Alias<'a> = impl T<Item = &'a ()>;
1110

12-
struct S;
13-
impl<'a> T for &'a S {
14-
type Item = &'a ();
15-
}
11+
struct S;
12+
impl<'a> T for &'a S {
13+
type Item = &'a ();
14+
}
1615

17-
pub fn filter_positive<'a>() -> Alias<'a> {
18-
&S
19-
}
16+
#[define_opaque(Alias)]
17+
pub fn filter_positive<'a>() -> Alias<'a> {
18+
&S
2019
}
21-
use helper::*;
2220

2321
fn with_positive(fun: impl Fn(Alias<'_>)) {
2422
fun(filter_positive());

patches/0029-stdlib-Disable-f16-and-f128-in-compiler-builtins.patch

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ index 7165c3e48af..968552ad435 100644
1212
--- a/library/alloc/Cargo.toml
1313
+++ b/library/alloc/Cargo.toml
1414
@@ -11,7 +11,7 @@ test = { path = "../test" }
15-
edition = "2021"
15+
bench = false
1616

1717
[dependencies]
1818
core = { path = "../core", public = true }
19-
-compiler_builtins = { version = "=0.1.150", features = ['rustc-dep-of-std'] }
20-
+compiler_builtins = { version = "=0.1.150", features = ['rustc-dep-of-std', 'no-f16-f128'] }
19+
-compiler_builtins = { version = "=0.1.151", features = ['rustc-dep-of-std'] }
20+
+compiler_builtins = { version = "=0.1.151", features = ['rustc-dep-of-std', 'no-f16-f128'] }
2121

22-
[dev-dependencies]
23-
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
22+
[features]
23+
compiler-builtins-mem = ['compiler_builtins/mem']
2424
--
2525
2.34.1
2626

src/lib.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,9 @@ impl CodegenBackend for CraneliftCodegenBackend {
175175
}
176176
}
177177

178-
fn target_features_cfg(
179-
&self,
180-
sess: &Session,
181-
_allow_unstable: bool,
182-
) -> Vec<rustc_span::Symbol> {
178+
fn target_features_cfg(&self, sess: &Session) -> (Vec<Symbol>, Vec<Symbol>) {
183179
// FIXME return the actually used target features. this is necessary for #[cfg(target_feature)]
184-
if sess.target.arch == "x86_64" && sess.target.os != "none" {
180+
let target_features = if sess.target.arch == "x86_64" && sess.target.os != "none" {
185181
// x86_64 mandates SSE2 support and rustc requires the x87 feature to be enabled
186182
vec![sym::fsxr, sym::sse, sym::sse2, Symbol::intern("x87")]
187183
} else if sess.target.arch == "aarch64" {
@@ -195,7 +191,10 @@ impl CodegenBackend for CraneliftCodegenBackend {
195191
}
196192
} else {
197193
vec![]
198-
}
194+
};
195+
// FIXME do `unstable_target_features` properly
196+
let unstable_target_features = target_features.clone();
197+
(target_features, unstable_target_features)
199198
}
200199

201200
fn print_version(&self) {

0 commit comments

Comments
 (0)