Skip to content

Commit

Permalink
Auto merge of rust-lang#119221 - matthiaskrgr:rollup-dh9exqf, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#117601 (Add support for hexagon-unknown-none-elf as target)
 - rust-lang#119169 (Rid the AST & HIR pretty printer of cruft)
 - rust-lang#119194 (Run fuchsia tests only on nightly)
 - rust-lang#119201 (tests: fix overaligned-constant to not over-specify getelementptr instr)
 - rust-lang#119215 (Emits error if has bound regions)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Dec 22, 2023
2 parents 208dd20 + b24e878 commit 398fd92
Show file tree
Hide file tree
Showing 14 changed files with 326 additions and 41 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,9 @@ jobs:
os: ubuntu-20.04-4core-16gb
env: {}
- name: x86_64-gnu-integration
env:
CI_ONLY_WHEN_CHANNEL: nightly
os: ubuntu-20.04-16core-64gb
env: {}
- name: x86_64-gnu-debug
os: ubuntu-20.04-8core-32gb
env: {}
Expand Down
17 changes: 2 additions & 15 deletions compiler/rustc_ast_pretty/src/pprust/state/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::pprust::state::{AnnNode, PrintState, State, INDENT_UNIT};
use ast::StaticItem;
use itertools::{Itertools, Position};
use rustc_ast as ast;
use rustc_ast::GenericBound;
use rustc_ast::ModKind;
use rustc_span::symbol::Ident;

Expand Down Expand Up @@ -338,21 +337,9 @@ impl<'a> State<'a> {
self.word_nbsp("trait");
self.print_ident(item.ident);
self.print_generic_params(&generics.params);
let mut real_bounds = Vec::with_capacity(bounds.len());
for bound in bounds.iter() {
if let GenericBound::Trait(ptr, modifiers) = bound
&& let ast::BoundPolarity::Maybe(_) = modifiers.polarity
{
self.space();
self.word_space("for ?");
self.print_trait_ref(&ptr.trait_ref);
} else {
real_bounds.push(bound.clone());
}
}
if !real_bounds.is_empty() {
if !bounds.is_empty() {
self.word_nbsp(":");
self.print_type_bounds(&real_bounds);
self.print_type_bounds(bounds);
}
self.print_where_clause(&generics.where_clause);
self.word(" ");
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_hir_analysis/src/check/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
if let Some(term_did) = tcx.lang_items().termination() {
let return_ty = main_fnsig.output();
let return_ty_span = main_fn_return_type_span(tcx, main_def_id).unwrap_or(main_span);
let return_ty = return_ty.skip_binder();
let Some(return_ty) = return_ty.no_bound_vars() else {
tcx.sess.emit_err(errors::MainFunctionReturnTypeGeneric { span: return_ty_span });
return;
};
let infcx = tcx.infer_ctxt().build();
let cause = traits::ObligationCause::new(
return_ty_span,
Expand Down
24 changes: 2 additions & 22 deletions compiler/rustc_hir_pretty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,17 +553,7 @@ impl<'a> State<'a> {
}
hir::ItemKind::OpaqueTy(opaque_ty) => {
self.print_item_type(item, opaque_ty.generics, |state| {
let mut real_bounds = Vec::with_capacity(opaque_ty.bounds.len());
for b in opaque_ty.bounds {
if let GenericBound::Trait(ptr, hir::TraitBoundModifier::Maybe) = b {
state.space();
state.word_space("for ?");
state.print_trait_ref(&ptr.trait_ref);
} else {
real_bounds.push(b);
}
}
state.print_bounds("= impl", real_bounds);
state.print_bounds("= impl", opaque_ty.bounds)
});
}
hir::ItemKind::Enum(ref enum_definition, params) => {
Expand Down Expand Up @@ -625,17 +615,7 @@ impl<'a> State<'a> {
self.word_nbsp("trait");
self.print_ident(item.ident);
self.print_generic_params(generics.params);
let mut real_bounds = Vec::with_capacity(bounds.len());
for b in bounds {
if let GenericBound::Trait(ptr, hir::TraitBoundModifier::Maybe) = b {
self.space();
self.word_space("for ?");
self.print_trait_ref(&ptr.trait_ref);
} else {
real_bounds.push(b);
}
}
self.print_bounds(":", real_bounds);
self.print_bounds(":", bounds);
self.print_where_clause(generics);
self.word(" ");
self.bopen();
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,7 @@ supported_targets! {
("mips64-unknown-linux-muslabi64", mips64_unknown_linux_muslabi64),
("mips64el-unknown-linux-muslabi64", mips64el_unknown_linux_muslabi64),
("hexagon-unknown-linux-musl", hexagon_unknown_linux_musl),
("hexagon-unknown-none-elf", hexagon_unknown_none_elf),

("mips-unknown-linux-uclibc", mips_unknown_linux_uclibc),
("mipsel-unknown-linux-uclibc", mipsel_unknown_linux_uclibc),
Expand Down
27 changes: 27 additions & 0 deletions compiler/rustc_target/src/spec/targets/hexagon_unknown_none_elf.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use crate::spec::{PanicStrategy, Target, TargetOptions};

pub fn target() -> Target {
Target {
llvm_target: "hexagon-unknown-none-elf".into(),
pointer_width: 32,
data_layout: concat!(
"e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32",
":32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32",
":32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048",
":2048:2048"
)
.into(),
arch: "hexagon".into(),

options: TargetOptions {
cpu: "hexagonv60".into(),
panic_strategy: PanicStrategy::Abort,
dynamic_linking: true,
features: "-small-data,+hvx-length128b".into(),
max_atomic_width: Some(32),
emit_debug_gdb_scripts: false,
c_enum_min_bits: Some(8),
..Default::default()
},
}
}
3 changes: 2 additions & 1 deletion compiler/rustc_target/src/spec/tests/tests_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ impl Target {

// Check dynamic linking stuff
// BPF: when targeting user space vms (like rbpf), those can load dynamic libraries.
if self.os == "none" && self.arch != "bpf" {
// hexagon: when targeting QuRT, that OS can load dynamic libraries.
if self.os == "none" && (self.arch != "bpf" && self.arch != "hexagon") {
assert!(!self.dynamic_linking);
}
if self.only_cdylib
Expand Down
5 changes: 5 additions & 0 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,11 @@ jobs:
<<: *job-linux-4c

- name: x86_64-gnu-integration
env:
# Only run this job on the nightly channel. Fuchsia requires
# nightly features to compile, and this job would fail if
# executed on beta and stable.
CI_ONLY_WHEN_CHANNEL: nightly
<<: *job-linux-16c

- name: x86_64-gnu-debug
Expand Down
1 change: 1 addition & 0 deletions src/doc/rustc/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- [\*-unknown-fuchsia](platform-support/fuchsia.md)
- [\*-kmc-solid_\*](platform-support/kmc-solid.md)
- [csky-unknown-linux-gnuabiv2\*](platform-support/csky-unknown-linux-gnuabiv2.md)
- [hexagon-unknown-none-elf](platform-support/hexagon-unknown-none-elf.md)
- [loongarch\*-unknown-linux-\*](platform-support/loongarch-linux.md)
- [loongarch\*-unknown-none\*](platform-support/loongarch-none.md)
- [m68k-unknown-linux-gnu](platform-support/m68k-unknown-linux-gnu.md)
Expand Down
1 change: 1 addition & 0 deletions src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ target | std | host | notes
`bpfel-unknown-none` | * | | BPF (little endian)
`csky-unknown-linux-gnuabiv2` | ✓ | | C-SKY abiv2 Linux (little endian)
`csky-unknown-linux-gnuabiv2hf` | ✓ | | C-SKY abiv2 Linux, hardfloat (little endian)
[`hexagon-unknown-none-elf`](platform-support/hexagon-unknown-none-elf.md)| * | Bare Hexagon (v60+, HVX)
`hexagon-unknown-linux-musl` | ? | |
`i386-apple-ios` | ✓ | | 32-bit x86 iOS [^x86_32-floats-return-ABI]
[`i586-pc-nto-qnx700`](platform-support/nto-qnx.md) | * | | 32-bit x86 QNX Neutrino 7.0 RTOS [^x86_32-floats-return-ABI]
Expand Down
Loading

0 comments on commit 398fd92

Please sign in to comment.