Auto merge of #145719 - cuviper:beta-next, r=cuviper

[beta] backports

- Gate const trait syntax rust-lang/rust#144956
- Demote x86_64-apple-darwin to Tier 2 with host tools rust-lang/rust#145252
- Do not use effective_visibilities query for Adt types of a local trait while proving a where-clause rust-lang/rust#145642

r? cuviper
This commit is contained in:
bors
2025-08-21 19:50:47 +00:00
11 changed files with 83 additions and 38 deletions
+3
View File
@@ -885,6 +885,9 @@ fn check_trait_front_matter(&mut self) -> bool {
/// Parses `unsafe? auto? trait Foo { ... }` or `trait Foo = Bar;`.
fn parse_item_trait(&mut self, attrs: &mut AttrVec, lo: Span) -> PResult<'a, ItemKind> {
let constness = self.parse_constness(Case::Sensitive);
if let Const::Yes(span) = constness {
self.psess.gated_spans.gate(sym::const_trait_impl, span);
}
let safety = self.parse_safety(Case::Sensitive);
// Parse optional `auto` prefix.
let is_auto = if self.eat_keyword(exp!(Auto)) {
@@ -7,7 +7,7 @@ pub(crate) fn target() -> Target {
llvm_target,
metadata: TargetMetadata {
description: Some("x86_64 Apple macOS (10.12+, Sierra+)".into()),
tier: Some(1),
tier: Some(2),
host_tools: Some(true),
std: Some(true),
},
@@ -2876,7 +2876,7 @@ pub(super) fn note_obligation_cause_code<G: EmissionGuarantee, T>(
// we check if `TraitB` can be reachable from `S`
// to determine whether to note `TraitA` is sealed trait.
if let ty::Adt(adt, _) = ty.kind() {
let visibilities = tcx.effective_visibilities(());
let visibilities = &tcx.resolutions(()).effective_visibilities;
visibilities.effective_vis(local).is_none_or(|v| {
v.at_level(Level::Reexported)
.is_accessible_from(adt.did(), tcx)
+15 -30
View File
@@ -23,10 +23,6 @@ runners:
<<: *base-job
- &job-macos
os: macos-13
<<: *base-job
- &job-macos-m1
os: macos-14
<<: *base-job
@@ -68,17 +64,6 @@ runners:
<<: *base-job
envs:
env-x86_64-apple-tests: &env-x86_64-apple-tests
SCRIPT: ./x.py check compiletest --set build.compiletest-use-stage0-libtest=true && ./x.py --stage 2 test --skip tests/ui --skip tests/rustdoc -- --exact
RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
# Ensure that host tooling is tested on our minimum supported macOS version.
MACOSX_DEPLOYMENT_TARGET: 10.12
MACOSX_STD_DEPLOYMENT_TARGET: 10.12
SELECT_XCODE: /Applications/Xcode_15.2.app
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
production:
&production
DEPLOY_BUCKET: rust-lang-ci2
@@ -449,8 +434,19 @@ auto:
- name: dist-x86_64-apple
env:
SCRIPT: ./x.py dist bootstrap --include-default-paths --host=x86_64-apple-darwin --target=x86_64-apple-darwin
RUST_CONFIGURE_ARGS: --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set rust.lto=thin --set rust.codegen-units=1
SCRIPT: >-
./x.py dist bootstrap
--include-default-paths
--host=x86_64-apple-darwin
--target=x86_64-apple-darwin
RUST_CONFIGURE_ARGS: >-
--enable-full-tools
--enable-sanitizers
--enable-profiler
--disable-docs
--set rust.jemalloc
--set rust.lto=thin
--set rust.codegen-units=1
# Ensure that host tooling is built to support our minimum support macOS version.
MACOSX_DEPLOYMENT_TARGET: 10.12
MACOSX_STD_DEPLOYMENT_TARGET: 10.12
@@ -476,17 +472,6 @@ auto:
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
<<: *job-macos-m1
- name: x86_64-apple-1
env:
<<: *env-x86_64-apple-tests
<<: *job-macos
- name: x86_64-apple-2
env:
SCRIPT: ./x.py --stage 2 test tests/ui tests/rustdoc
<<: *env-x86_64-apple-tests
<<: *job-macos
- name: dist-aarch64-apple
@@ -511,7 +496,7 @@ auto:
NO_OVERFLOW_CHECKS: 1
DIST_REQUIRE_ALL_TOOLS: 1
CODEGEN_BACKENDS: llvm,cranelift
<<: *job-macos-m1
<<: *job-macos
- name: aarch64-apple
env:
@@ -531,7 +516,7 @@ auto:
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
<<: *job-macos-m1
<<: *job-macos
######################
# Windows Builders #
+1 -1
View File
@@ -36,7 +36,6 @@ target | notes
`aarch64-unknown-linux-gnu` | ARM64 Linux (kernel 4.1+, glibc 2.17+)
[`i686-pc-windows-msvc`](platform-support/windows-msvc.md) | 32-bit MSVC (Windows 10+, Windows Server 2016+, Pentium 4) [^x86_32-floats-return-ABI] [^win32-msvc-alignment]
`i686-unknown-linux-gnu` | 32-bit Linux (kernel 3.2+, glibc 2.17+, Pentium 4) [^x86_32-floats-return-ABI]
[`x86_64-apple-darwin`](platform-support/apple-darwin.md) | 64-bit macOS (10.12+, Sierra+)
[`x86_64-pc-windows-gnu`](platform-support/windows-gnu.md) | 64-bit MinGW (Windows 10+, Windows Server 2016+)
[`x86_64-pc-windows-msvc`](platform-support/windows-msvc.md) | 64-bit MSVC (Windows 10+, Windows Server 2016+)
`x86_64-unknown-linux-gnu` | 64-bit Linux (kernel 3.2+, glibc 2.17+)
@@ -105,6 +104,7 @@ target | notes
[`riscv64gc-unknown-linux-gnu`](platform-support/riscv64gc-unknown-linux-gnu.md) | RISC-V Linux (kernel 4.20+, glibc 2.29)
[`riscv64gc-unknown-linux-musl`](platform-support/riscv64gc-unknown-linux-musl.md) | RISC-V Linux (kernel 4.20+, musl 1.2.3)
[`s390x-unknown-linux-gnu`](platform-support/s390x-unknown-linux-gnu.md) | S390x Linux (kernel 3.2+, glibc 2.17)
[`x86_64-apple-darwin`](platform-support/apple-darwin.md) | 64-bit macOS (10.12+, Sierra+)
[`x86_64-unknown-freebsd`](platform-support/freebsd.md) | 64-bit x86 FreeBSD
[`x86_64-unknown-illumos`](platform-support/illumos.md) | illumos
`x86_64-unknown-linux-musl` | 64-bit Linux with musl 1.2.3
@@ -4,9 +4,12 @@ Apple macOS targets.
**Tier: 1**
- `x86_64-apple-darwin`: macOS on 64-bit x86.
- `aarch64-apple-darwin`: macOS on ARM64 (M1-family or later Apple Silicon CPUs).
**Tier: 2**
- `x86_64-apple-darwin`: macOS on 64-bit x86.
## Target maintainers
[@thomcc](https://github.com/thomcc)
+1 -1
View File
@@ -203,7 +203,7 @@
///
/// The order here matters, more specific entries should be first.
static DOCS_FALLBACK: &[(&str, &str)] = &[
("-apple-", "x86_64-apple-darwin"),
("-apple-", "aarch64-apple-darwin"),
("aarch64", "aarch64-unknown-linux-gnu"),
("arm-", "aarch64-unknown-linux-gnu"),
("", "x86_64-unknown-linux-gnu"),
@@ -0,0 +1,11 @@
// This test is for regression of issue #145611
// There should not be cycle error in effective_visibilities query.
trait LocalTrait {}
struct SomeType;
fn impls_trait<T: LocalTrait>() {}
fn foo() -> impl Sized {
impls_trait::<SomeType>(); //~ ERROR the trait bound `SomeType: LocalTrait` is not satisfied [E0277]
}
fn main() {}
@@ -0,0 +1,20 @@
error[E0277]: the trait bound `SomeType: LocalTrait` is not satisfied
--> $DIR/trait-bound-adt-issue-145611.rs:8:19
|
LL | impls_trait::<SomeType>();
| ^^^^^^^^ the trait `LocalTrait` is not implemented for `SomeType`
|
help: this trait has no implementations, consider adding one
--> $DIR/trait-bound-adt-issue-145611.rs:4:1
|
LL | trait LocalTrait {}
| ^^^^^^^^^^^^^^^^
note: required by a bound in `impls_trait`
--> $DIR/trait-bound-adt-issue-145611.rs:6:19
|
LL | fn impls_trait<T: LocalTrait>() {}
| ^^^^^^^^^^ required by this bound in `impls_trait`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.
@@ -13,6 +13,9 @@ impl const T for S {}
const fn f<A: [const] T>() {} //[stock]~ ERROR const trait impls are experimental
fn g<A: const T>() {} //[stock]~ ERROR const trait impls are experimental
const trait Trait {} //[stock]~ ERROR const trait impls are experimental
#[cfg(false)] const trait Trait {} //[stock]~ ERROR const trait impls are experimental
macro_rules! discard { ($ty:ty) => {} }
discard! { impl [const] T } //[stock]~ ERROR const trait impls are experimental
@@ -29,7 +29,27 @@ LL | fn g<A: const T>() {}
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: const trait impls are experimental
--> $DIR/feature-gate.rs:18:17
--> $DIR/feature-gate.rs:16:1
|
LL | const trait Trait {}
| ^^^^^
|
= note: see issue #143874 <https://github.com/rust-lang/rust/issues/143874> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: const trait impls are experimental
--> $DIR/feature-gate.rs:17:15
|
LL | #[cfg(false)] const trait Trait {}
| ^^^^^
|
= note: see issue #143874 <https://github.com/rust-lang/rust/issues/143874> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: const trait impls are experimental
--> $DIR/feature-gate.rs:21:17
|
LL | discard! { impl [const] T }
| ^^^^^^^
@@ -39,7 +59,7 @@ LL | discard! { impl [const] T }
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: const trait impls are experimental
--> $DIR/feature-gate.rs:19:17
--> $DIR/feature-gate.rs:22:17
|
LL | discard! { impl const T }
| ^^^^^
@@ -58,6 +78,6 @@ LL | #[const_trait]
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 6 previous errors
error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0658`.