Skip to content

Commit 9eff510

Browse files
committed
Auto merge of #123466 - cuviper:beta-next, r=cuviper
[beta] backports - Fix f16 and f128 feature gates in editions other than 2015 #123307 / #123445 - Update to LLVM 18.1.2 #122772 - unix fs: Make hurd using explicit new rather than From #123057 - Don't inherit codegen attrs from parent static #123310 - Make sure to insert Sized bound first into clauses list #123302 r? cuviper
2 parents c119551 + cf44931 commit 9eff510

File tree

16 files changed

+208
-17
lines changed

16 files changed

+208
-17
lines changed

compiler/rustc_const_eval/src/interpret/intern.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use rustc_ast::Mutability;
1818
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
1919
use rustc_errors::ErrorGuaranteed;
2020
use rustc_hir as hir;
21+
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
2122
use rustc_middle::mir::interpret::{ConstAllocation, CtfeProvenance, InterpResult};
2223
use rustc_middle::query::TyCtxtAt;
2324
use rustc_middle::ty::layout::TyAndLayout;
@@ -106,7 +107,12 @@ fn intern_as_new_static<'tcx>(
106107
DefKind::Static { mutability: alloc.0.mutability, nested: true },
107108
);
108109
tcx.set_nested_alloc_id_static(alloc_id, feed.def_id());
109-
feed.codegen_fn_attrs(tcx.codegen_fn_attrs(static_id).clone());
110+
111+
// These do not inherit the codegen attrs of the parent static allocation, since
112+
// it doesn't make sense for them to inherit their `#[no_mangle]` and `#[link_name = ..]`
113+
// and the like.
114+
feed.codegen_fn_attrs(CodegenFnAttrs::new());
115+
110116
feed.eval_static_initializer(Ok(alloc));
111117
feed.generics_of(tcx.generics_of(static_id).clone());
112118
feed.def_ident_span(tcx.def_ident_span(static_id));

compiler/rustc_hir_analysis/src/bounds.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,20 @@ impl<'tcx> Bounds<'tcx> {
5454
span: Span,
5555
polarity: ty::ImplPolarity,
5656
) {
57-
self.clauses.push((
57+
let clause = (
5858
trait_ref
5959
.map_bound(|trait_ref| {
6060
ty::ClauseKind::Trait(ty::TraitPredicate { trait_ref, polarity })
6161
})
6262
.to_predicate(tcx),
6363
span,
64-
));
64+
);
65+
// FIXME(-Znext-solver): We can likely remove this hack once the new trait solver lands.
66+
if tcx.lang_items().sized_trait() == Some(trait_ref.def_id()) {
67+
self.clauses.insert(0, clause);
68+
} else {
69+
self.clauses.push(clause);
70+
}
6571
}
6672

6773
pub fn push_projection_bound(

compiler/rustc_resolve/src/ident.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
605605
&& !this.tcx.features().f16
606606
&& !ident.span.allows_unstable(sym::f16)
607607
&& finalize.is_some()
608+
&& innermost_result.is_none()
608609
{
609610
feature_err(
610611
this.tcx.sess,
@@ -618,6 +619,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
618619
&& !this.tcx.features().f128
619620
&& !ident.span.allows_unstable(sym::f128)
620621
&& finalize.is_some()
622+
&& innermost_result.is_none()
621623
{
622624
feature_err(
623625
this.tcx.sess,

library/std/src/sys/pal/unix/fs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ impl FileAttr {
517517

518518
#[cfg(any(target_os = "horizon", target_os = "hurd"))]
519519
pub fn modified(&self) -> io::Result<SystemTime> {
520-
Ok(SystemTime::from(self.stat.st_mtim))
520+
SystemTime::new(self.stat.st_mtim.tv_sec as i64, self.stat.st_mtim.tv_nsec as i64)
521521
}
522522

523523
#[cfg(not(any(
@@ -545,7 +545,7 @@ impl FileAttr {
545545

546546
#[cfg(any(target_os = "horizon", target_os = "hurd"))]
547547
pub fn accessed(&self) -> io::Result<SystemTime> {
548-
Ok(SystemTime::from(self.stat.st_atim))
548+
SystemTime::new(self.stat.st_atim.tv_sec as i64, self.stat.st_atim.tv_nsec as i64)
549549
}
550550

551551
#[cfg(any(

src/llvm-project

Submodule llvm-project updated 67 files

tests/incremental/hashes/function_interfaces.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ pub fn second_trait_bound<T: Eq + Clone>() {}
217217
pub fn second_builtin_bound<T: Send >() {}
218218

219219
#[cfg(not(any(cfail1,cfail4)))]
220-
#[rustc_clean(cfg = "cfail2", except = "opt_hir_owner_nodes, predicates_of")]
220+
#[rustc_clean(cfg = "cfail2", except = "opt_hir_owner_nodes")]
221221
#[rustc_clean(cfg = "cfail3")]
222222
#[rustc_clean(cfg = "cfail5", except = "opt_hir_owner_nodes, predicates_of")]
223223
#[rustc_clean(cfg = "cfail6")]

tests/ui/feature-gates/feature-gate-f128.stderr renamed to tests/ui/feature-gates/feature-gate-f128.e2015.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: the type `f128` is unstable
2-
--> $DIR/feature-gate-f128.rs:3:10
2+
--> $DIR/feature-gate-f128.rs:7:10
33
|
44
LL | const A: f128 = 10.0;
55
| ^^^^
@@ -9,7 +9,7 @@ LL | const A: f128 = 10.0;
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

1111
error[E0658]: the type `f128` is unstable
12-
--> $DIR/feature-gate-f128.rs:6:12
12+
--> $DIR/feature-gate-f128.rs:10:12
1313
|
1414
LL | let a: f128 = 100.0;
1515
| ^^^^
@@ -19,7 +19,7 @@ LL | let a: f128 = 100.0;
1919
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2020

2121
error[E0658]: the type `f128` is unstable
22-
--> $DIR/feature-gate-f128.rs:11:11
22+
--> $DIR/feature-gate-f128.rs:15:11
2323
|
2424
LL | fn foo(a: f128) {}
2525
| ^^^^
@@ -29,7 +29,7 @@ LL | fn foo(a: f128) {}
2929
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3030

3131
error[E0658]: the type `f128` is unstable
32-
--> $DIR/feature-gate-f128.rs:14:8
32+
--> $DIR/feature-gate-f128.rs:18:8
3333
|
3434
LL | a: f128,
3535
| ^^^^
@@ -39,7 +39,7 @@ LL | a: f128,
3939
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4040

4141
error[E0658]: the type `f128` is unstable
42-
--> $DIR/feature-gate-f128.rs:7:13
42+
--> $DIR/feature-gate-f128.rs:11:13
4343
|
4444
LL | let b = 0.0f128;
4545
| ^^^^^^^
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
error[E0658]: the type `f128` is unstable
2+
--> $DIR/feature-gate-f128.rs:7:10
3+
|
4+
LL | const A: f128 = 10.0;
5+
| ^^^^
6+
|
7+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
8+
= help: add `#![feature(f128)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10+
11+
error[E0658]: the type `f128` is unstable
12+
--> $DIR/feature-gate-f128.rs:10:12
13+
|
14+
LL | let a: f128 = 100.0;
15+
| ^^^^
16+
|
17+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
18+
= help: add `#![feature(f128)]` to the crate attributes to enable
19+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
20+
21+
error[E0658]: the type `f128` is unstable
22+
--> $DIR/feature-gate-f128.rs:15:11
23+
|
24+
LL | fn foo(a: f128) {}
25+
| ^^^^
26+
|
27+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
28+
= help: add `#![feature(f128)]` to the crate attributes to enable
29+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
30+
31+
error[E0658]: the type `f128` is unstable
32+
--> $DIR/feature-gate-f128.rs:18:8
33+
|
34+
LL | a: f128,
35+
| ^^^^
36+
|
37+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
38+
= help: add `#![feature(f128)]` to the crate attributes to enable
39+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
40+
41+
error[E0658]: the type `f128` is unstable
42+
--> $DIR/feature-gate-f128.rs:11:13
43+
|
44+
LL | let b = 0.0f128;
45+
| ^^^^^^^
46+
|
47+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
48+
= help: add `#![feature(f128)]` to the crate attributes to enable
49+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
50+
51+
error: aborting due to 5 previous errors
52+
53+
For more information about this error, try `rustc --explain E0658`.

tests/ui/feature-gates/feature-gate-f128.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//@ revisions: e2015 e2018
2+
//
3+
//@[e2018] edition:2018
4+
15
#![allow(unused)]
26

37
const A: f128 = 10.0; //~ ERROR the type `f128` is unstable

tests/ui/feature-gates/feature-gate-f16.stderr renamed to tests/ui/feature-gates/feature-gate-f16.e2015.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: the type `f16` is unstable
2-
--> $DIR/feature-gate-f16.rs:3:10
2+
--> $DIR/feature-gate-f16.rs:7:10
33
|
44
LL | const A: f16 = 10.0;
55
| ^^^
@@ -9,7 +9,7 @@ LL | const A: f16 = 10.0;
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

1111
error[E0658]: the type `f16` is unstable
12-
--> $DIR/feature-gate-f16.rs:6:12
12+
--> $DIR/feature-gate-f16.rs:10:12
1313
|
1414
LL | let a: f16 = 100.0;
1515
| ^^^
@@ -19,7 +19,7 @@ LL | let a: f16 = 100.0;
1919
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2020

2121
error[E0658]: the type `f16` is unstable
22-
--> $DIR/feature-gate-f16.rs:11:11
22+
--> $DIR/feature-gate-f16.rs:15:11
2323
|
2424
LL | fn foo(a: f16) {}
2525
| ^^^
@@ -29,7 +29,7 @@ LL | fn foo(a: f16) {}
2929
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3030

3131
error[E0658]: the type `f16` is unstable
32-
--> $DIR/feature-gate-f16.rs:14:8
32+
--> $DIR/feature-gate-f16.rs:18:8
3333
|
3434
LL | a: f16,
3535
| ^^^
@@ -39,7 +39,7 @@ LL | a: f16,
3939
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4040

4141
error[E0658]: the type `f16` is unstable
42-
--> $DIR/feature-gate-f16.rs:7:13
42+
--> $DIR/feature-gate-f16.rs:11:13
4343
|
4444
LL | let b = 0.0f16;
4545
| ^^^^^^

0 commit comments

Comments
 (0)