forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#136774 - Urgau:rollup-cm061qo, r=Urgau
Rollup of 5 pull requests Successful merges: - rust-lang#134999 (Add cygwin target.) - rust-lang#135488 (Stabilize `vec_pop_if`) - rust-lang#136068 (crashes: more tests) - rust-lang#136694 (Update minifier version to `0.3.4`) - rust-lang#136760 (Fix unwrap error in overflowing int literal) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
30 changed files
with
362 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use std::borrow::Cow; | ||
|
||
use crate::spec::{Cc, DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions, cvs}; | ||
|
||
pub(crate) fn opts() -> TargetOptions { | ||
let mut pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[ | ||
"--disable-dynamicbase", | ||
"--enable-auto-image-base", | ||
]); | ||
crate::spec::add_link_args(&mut pre_link_args, LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[ | ||
"-Wl,--disable-dynamicbase", | ||
"-Wl,--enable-auto-image-base", | ||
]); | ||
let cygwin_libs = &["-lcygwin", "-lgcc", "-lcygwin", "-luser32", "-lkernel32", "-lgcc_s"]; | ||
let mut late_link_args = | ||
TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), cygwin_libs); | ||
crate::spec::add_link_args( | ||
&mut late_link_args, | ||
LinkerFlavor::Gnu(Cc::Yes, Lld::No), | ||
cygwin_libs, | ||
); | ||
TargetOptions { | ||
os: "cygwin".into(), | ||
vendor: "pc".into(), | ||
// FIXME(#13846) this should be enabled for cygwin | ||
function_sections: false, | ||
linker: Some("gcc".into()), | ||
dynamic_linking: true, | ||
dll_prefix: "".into(), | ||
dll_suffix: ".dll".into(), | ||
exe_suffix: ".exe".into(), | ||
families: cvs!["unix"], | ||
is_like_windows: true, | ||
allows_weak_linkage: false, | ||
pre_link_args, | ||
late_link_args, | ||
abi_return_struct_as_int: true, | ||
emit_debug_gdb_scripts: false, | ||
requires_uwtable: true, | ||
eh_frame_header: false, | ||
debuginfo_kind: DebuginfoKind::Dwarf, | ||
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), | ||
..Default::default() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
compiler/rustc_target/src/spec/targets/x86_64_pc_cygwin.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use crate::spec::{Cc, LinkerFlavor, Lld, Target, base}; | ||
|
||
pub(crate) fn target() -> Target { | ||
let mut base = base::cygwin::opts(); | ||
base.cpu = "x86-64".into(); | ||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &["-m", "i386pep"]); | ||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); | ||
base.max_atomic_width = Some(64); | ||
base.linker = Some("x86_64-pc-cygwin-gcc".into()); | ||
Target { | ||
llvm_target: "x86_64-pc-cygwin".into(), | ||
pointer_width: 64, | ||
data_layout: | ||
"e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(), | ||
arch: "x86_64".into(), | ||
options: base, | ||
metadata: crate::spec::TargetMetadata { | ||
description: Some("64-bit x86 Cygwin".into()), | ||
tier: Some(3), | ||
host_tools: Some(false), | ||
std: None, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# `x86_64-pc-cygwin` | ||
|
||
**Tier: 3** | ||
|
||
Windows targets supporting Cygwin. | ||
The `*-cygwin` targets are **not** intended as native target for applications, | ||
a developer writing Windows applications should use the `*-pc-windows-*` targets instead, which are *native* Windows. | ||
|
||
Cygwin is only intended as an emulation layer for Unix-only programs which do not support the native Windows targets. | ||
|
||
## Target maintainers | ||
|
||
- [Berrysoft](https://github.com/Berrysoft) | ||
|
||
## Requirements | ||
|
||
This target is cross compiled. It needs `x86_64-pc-cygwin-gcc` as linker. | ||
|
||
The `target_os` of the target is `cygwin`, and it is `unix`. | ||
|
||
## Building the target | ||
|
||
For cross-compilation you want LLVM with [llvm/llvm-project#121439 (merged)](https://github.com/llvm/llvm-project/pull/121439) applied to fix the LLVM codegen on importing external global variables from DLLs. | ||
No native builds on Cygwin now. It should be possible theoretically though, but might need a lot of patches. | ||
|
||
## Building Rust programs | ||
|
||
Rust does not yet ship pre-compiled artifacts for this target. To compile for | ||
this target, you will either need to build Rust with the target enabled (see | ||
"Building the target" above), or build your own copy of `core` by using | ||
`build-std` or similar. | ||
|
||
## Testing | ||
|
||
Created binaries work fine on Windows with Cygwin. | ||
|
||
## Cross-compilation toolchains and C code | ||
|
||
Compatible C code can be built with GCC shipped with Cygwin. Clang is untested. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//@ known-bug: #135470 | ||
//@ compile-flags: --edition=2021 -Copt-level=0 | ||
|
||
use std::future::Future; | ||
trait Access { | ||
type Lister; | ||
|
||
fn list() -> impl Future<Output = Self::Lister> { | ||
async { todo!() } | ||
} | ||
} | ||
|
||
trait Foo {} | ||
impl Access for dyn Foo { | ||
type Lister = (); | ||
} | ||
|
||
fn main() { | ||
let svc = async { | ||
async { <dyn Foo>::list() }.await; | ||
}; | ||
&svc as &dyn Service; | ||
} | ||
|
||
trait UnaryService { | ||
fn call2() {} | ||
} | ||
trait Unimplemented {} | ||
impl<T: Unimplemented> UnaryService for T {} | ||
struct Wrap<T>(T); | ||
impl<T: Send> UnaryService for Wrap<T> {} | ||
|
||
trait Service { | ||
fn call(&self); | ||
} | ||
impl<T: Send> Service for T { | ||
fn call(&self) { | ||
Wrap::<T>::call2(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//@ known-bug: #135528 | ||
//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes | ||
#![feature(type_alias_impl_trait)] | ||
type Tait = impl Copy; | ||
|
||
fn set(x: &isize) -> isize { | ||
*x | ||
} | ||
|
||
fn d(x: Tait) { | ||
set(x); | ||
} | ||
|
||
fn other_define() -> Tait { | ||
() | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//@ known-bug: #135570 | ||
//@compile-flags: -Zvalidate-mir -Zmir-enable-passes=+Inline -Copt-level=0 -Zmir-enable-passes=+GVN | ||
//@ only-x86_64 | ||
|
||
fn function_with_bytes<const BYTES: &'static [u8; 0xc7b889180b67b07d_bc1a3c88783d35b5_u128]>( | ||
) -> &'static [u8] { | ||
BYTES | ||
} | ||
|
||
fn main() { | ||
function_with_bytes::<b"aa">() == &[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//@ known-bug: #135617 | ||
trait Project { | ||
const ASSOC: usize; | ||
} | ||
|
||
fn foo() | ||
where | ||
for<'a> (): Project, | ||
{ | ||
[(); <() as Project>::ASSOC]; | ||
} | ||
|
||
pub fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//@ known-bug: #135646 | ||
//@ compile-flags: --edition=2024 -Zpolonius=next | ||
fn main() { | ||
&{ [1, 2, 3][4] }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//@ known-bug: #135668 | ||
//@ compile-flags: --edition=2021 | ||
use std::future::Future; | ||
|
||
pub async fn foo() { | ||
let _ = create_task().await; | ||
} | ||
|
||
async fn create_task() -> impl Sized { | ||
bind(documentation) | ||
} | ||
|
||
async fn documentation() { | ||
include_str!("nonexistent"); | ||
} | ||
|
||
fn bind<F>(_filter: F) -> impl Sized | ||
where | ||
F: FilterBase, | ||
{ | ||
|| -> <F as FilterBase>::Assoc { panic!() } | ||
} | ||
|
||
trait FilterBase { | ||
type Assoc; | ||
} | ||
|
||
impl<F, R> FilterBase for F | ||
where | ||
F: Fn() -> R, | ||
// Removing the below line makes it correctly error on both stable and beta | ||
R: Future, | ||
// Removing the below line makes it ICE on both stable and beta | ||
R: Send, | ||
// Removing the above two bounds makes it ICE on stable but correctly error on beta | ||
{ | ||
type Assoc = F; | ||
} |
Oops, something went wrong.