Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #117308

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
e960d0e
Remove -Zdep-tasks.
cjgillot Oct 8, 2023
8531ebf
Remove useless debugging.
cjgillot Oct 8, 2023
89f9da2
Bump stdarch submodule
eduardosm Oct 10, 2023
b57a157
Remove from cranelift codegen LLVM intrinsics that are no longer needed
eduardosm Oct 10, 2023
337af7c
Remove from miri LLVM intrinsics that are no longer needed
eduardosm Oct 10, 2023
35e2f4e
Fix identation of a `rustfmt::skip`ed statement
eduardosm Oct 10, 2023
991bf75
make E0277 use short paths
Milo123459 Oct 14, 2023
62fe807
FileCheck asm_unwind
rmehri01 Oct 20, 2023
2d0a34b
FileCheck caller_with_trivial_bound
rmehri01 Oct 20, 2023
2f9aa7d
FileCheck cycle
rmehri01 Oct 20, 2023
9b3f5e1
FileCheck dont_ice_on_generic_rust_call
rmehri01 Oct 20, 2023
76faae9
FileCheck dyn_trait
rmehri01 Oct 20, 2023
f005d23
FileCheck exponential_runtime
rmehri01 Oct 20, 2023
22679cd
FileCheck inline_any_operand
rmehri01 Oct 20, 2023
de56d2d
FileCheck inline_box_fn
rmehri01 Oct 20, 2023
9d61e6a
FileCheck inline_closure_borrows_arg
rmehri01 Oct 20, 2023
5caee41
FileCheck inline_closure_captures
rmehri01 Oct 20, 2023
7ee05d2
FileCheck inline_closure
rmehri01 Oct 20, 2023
d8f33ef
FileCheck inline_diverging
rmehri01 Oct 21, 2023
20e7caa
FileCheck inline_coroutine
rmehri01 Oct 21, 2023
19c36a9
FileCheck inline_instruction_set
rmehri01 Oct 21, 2023
de82551
FileCheck inline_into_box_place
rmehri01 Oct 21, 2023
3202d4e
FileCheck inline_options
rmehri01 Oct 21, 2023
21a4c39
FileCheck inline_retag
rmehri01 Oct 21, 2023
2532566
FileCheck inline_specialization
rmehri01 Oct 21, 2023
f7acf17
FileCheck inline_trait_method_2
rmehri01 Oct 21, 2023
1b9cb5d
FileCheck inline_trait_method
rmehri01 Oct 21, 2023
773dc62
FileCheck inline_as_ref_as_mut
rmehri01 Oct 21, 2023
bb69597
FileCheck inline_scopes_parenting
rmehri01 Oct 21, 2023
5cf65eb
FileCheck issue_78442
rmehri01 Oct 21, 2023
6e047c0
FileCheck unchecked_shifts
rmehri01 Oct 21, 2023
3faf05b
FileCheck unsized_argument
rmehri01 Oct 21, 2023
6ab66c3
FileCheck unwrap_unchecked
rmehri01 Oct 21, 2023
1ec10ec
address review comments
rmehri01 Oct 22, 2023
828f069
Remove most indentation in check-cfg impl
Urgau Oct 20, 2023
1ef96a9
Fix residual (never merged) check-cfg syntax in doc
Urgau Oct 20, 2023
b7debe3
Parse rustc version at compile time
dtolnay Oct 27, 2023
84a1a68
Better guard against wrong input with check-cfg any()
Urgau Oct 21, 2023
2ef5897
fix failure to detect a too-big-type after adding padding
RalfJung Oct 27, 2023
6dbad23
When encountering sealed traits, point types that implement it
estebank Oct 19, 2023
a65d99d
Update type_err_ctxt_ext.rs
Milo123459 Oct 27, 2023
d265b2a
Rollup merge of #116534 - cjgillot:no-dep-tasks, r=davidtwco
matthiaskrgr Oct 28, 2023
d9ce918
Rollup merge of #116609 - eduardosm:bump-stdarch, r=workingjubilee
matthiaskrgr Oct 28, 2023
d03d191
Rollup merge of #116739 - Milo123459:milo/short-paths, r=estebank
matthiaskrgr Oct 28, 2023
b9b21c1
Rollup merge of #116945 - estebank:sealed-trait-impls, r=petrochenkov
matthiaskrgr Oct 28, 2023
d1379a4
Rollup merge of #117025 - Urgau:cleanup-improve-check-cfg-impl, r=pet…
matthiaskrgr Oct 28, 2023
5666aaf
Rollup merge of #117029 - rmehri01:mir_opt_filecheck_inline_tests, r=…
matthiaskrgr Oct 28, 2023
7e3f63e
Rollup merge of #117256 - dtolnay:currentversion, r=compiler-errors
matthiaskrgr Oct 28, 2023
b0c996a
Rollup merge of #117277 - RalfJung:too-big-with-padding, r=oli-obk
matthiaskrgr Oct 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions compiler/rustc_abi/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ pub trait LayoutCalculator {
// Align the maximum variant size to the largest alignment.
size = size.align_to(align.abi);

// FIXME(oli-obk): deduplicate and harden these checks
if size.bytes() >= dl.obj_size_bound() {
return None;
}
Expand Down Expand Up @@ -1103,6 +1104,10 @@ fn univariant<
inverse_memory_index.into_iter().map(|it| it.index() as u32).collect()
};
let size = min_size.align_to(align.abi);
// FIXME(oli-obk): deduplicate and harden these checks
if size.bytes() >= dl.obj_size_bound() {
return None;
}
let mut layout_of_single_non_zst_field = None;
let mut abi = Abi::Aggregate { sized };
// Try to make this a Scalar/ScalarPair.
Expand Down
41 changes: 13 additions & 28 deletions compiler/rustc_attr/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ use rustc_session::config::ExpectedValues;
use rustc_session::lint::builtin::UNEXPECTED_CFGS;
use rustc_session::lint::BuiltinLintDiagnostics;
use rustc_session::parse::{feature_err, ParseSess};
use rustc_session::Session;
use rustc_session::{RustcVersion, Session};
use rustc_span::hygiene::Transparency;
use rustc_span::{symbol::sym, symbol::Symbol, Span};
use std::fmt::{self, Display};
use std::num::NonZeroU32;

use crate::session_diagnostics::{self, IncorrectReprFormatGenericCause};
Expand All @@ -24,8 +23,6 @@ use crate::session_diagnostics::{self, IncorrectReprFormatGenericCause};
/// For more, see [this pull request](https://github.com/rust-lang/rust/pull/100591).
pub const VERSION_PLACEHOLDER: &str = "CURRENT_RUSTC_VERSION";

pub const CURRENT_RUSTC_VERSION: &str = env!("CFG_RELEASE");

pub fn is_builtin_attr(attr: &Attribute) -> bool {
attr.is_doc_comment() || attr.ident().is_some_and(|ident| is_builtin_attr_name(ident.name))
}
Expand Down Expand Up @@ -153,7 +150,7 @@ pub enum StabilityLevel {
#[derive(Encodable, Decodable, PartialEq, Copy, Clone, Debug, Eq, Hash)]
#[derive(HashStable_Generic)]
pub enum Since {
Version(Version),
Version(RustcVersion),
/// Stabilized in the upcoming version, whatever number that is.
Current,
/// Failed to parse a stabilization version.
Expand Down Expand Up @@ -382,7 +379,7 @@ fn parse_stability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabilit
let since = if let Some(since) = since {
if since.as_str() == VERSION_PLACEHOLDER {
Since::Current
} else if let Some(version) = parse_version(since.as_str(), false) {
} else if let Some(version) = parse_version(since) {
Since::Version(version)
} else {
sess.emit_err(session_diagnostics::InvalidSince { span: attr.span });
Expand Down Expand Up @@ -567,31 +564,20 @@ fn gate_cfg(gated_cfg: &GatedCfg, cfg_span: Span, sess: &ParseSess, features: &F
}
}

#[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(HashStable_Generic)]
pub struct Version {
pub major: u16,
pub minor: u16,
pub patch: u16,
}

fn parse_version(s: &str, allow_appendix: bool) -> Option<Version> {
let mut components = s.split('-');
/// Parse a rustc version number written inside string literal in an attribute,
/// like appears in `since = "1.0.0"`. Suffixes like "-dev" and "-nightly" are
/// not accepted in this position, unlike when parsing CFG_RELEASE.
fn parse_version(s: Symbol) -> Option<RustcVersion> {
let mut components = s.as_str().split('-');
let d = components.next()?;
if !allow_appendix && components.next().is_some() {
if components.next().is_some() {
return None;
}
let mut digits = d.splitn(3, '.');
let major = digits.next()?.parse().ok()?;
let minor = digits.next()?.parse().ok()?;
let patch = digits.next().unwrap_or("0").parse().ok()?;
Some(Version { major, minor, patch })
}

impl Display for Version {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(formatter, "{}.{}.{}", self.major, self.minor, self.patch)
}
Some(RustcVersion { major, minor, patch })
}

/// Evaluate a cfg-like condition (with `any` and `all`), using `eval` to
Expand Down Expand Up @@ -623,17 +609,16 @@ pub fn eval_condition(
return false;
}
};
let Some(min_version) = parse_version(min_version.as_str(), false) else {
let Some(min_version) = parse_version(*min_version) else {
sess.emit_warning(session_diagnostics::UnknownVersionLiteral { span: *span });
return false;
};
let rustc_version = parse_version(CURRENT_RUSTC_VERSION, true).unwrap();

// See https://github.com/rust-lang/rust/issues/64796#issuecomment-640851454 for details
if sess.assume_incomplete_release {
rustc_version > min_version
RustcVersion::CURRENT > min_version
} else {
rustc_version >= min_version
RustcVersion::CURRENT >= min_version
}
}
ast::MetaItemKind::List(mis) => {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ pub use StabilityLevel::*;

pub use rustc_ast::attr::*;

pub(crate) use rustc_ast::HashStableContext;
pub(crate) use rustc_session::HashStableContext;

fluent_messages! { "../messages.ftl" }
35 changes: 0 additions & 35 deletions compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,41 +32,6 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
ret.write_cvalue(fx, CValue::by_val(res, fx.layout_of(fx.tcx.types.i64)));
}

// Used by `_mm_movemask_epi8` and `_mm256_movemask_epi8`
"llvm.x86.sse2.pmovmskb.128"
| "llvm.x86.avx2.pmovmskb"
| "llvm.x86.sse.movmsk.ps"
| "llvm.x86.sse2.movmsk.pd" => {
intrinsic_args!(fx, args => (a); intrinsic);

let (lane_count, lane_ty) = a.layout().ty.simd_size_and_type(fx.tcx);
let lane_ty = fx.clif_type(lane_ty).unwrap();
assert!(lane_count <= 32);

let mut res = fx.bcx.ins().iconst(types::I32, 0);

for lane in (0..lane_count).rev() {
let a_lane = a.value_lane(fx, lane).load_scalar(fx);

// cast float to int
let a_lane = match lane_ty {
types::F32 => codegen_bitcast(fx, types::I32, a_lane),
types::F64 => codegen_bitcast(fx, types::I64, a_lane),
_ => a_lane,
};

// extract sign bit of an int
let a_lane_sign = fx.bcx.ins().ushr_imm(a_lane, i64::from(lane_ty.bits() - 1));

// shift sign bit into result
let a_lane_sign = clif_intcast(fx, a_lane_sign, types::I32, false);
res = fx.bcx.ins().ishl_imm(res, 1);
res = fx.bcx.ins().bor(res, a_lane_sign);
}

let res = CValue::by_val(res, fx.layout_of(fx.tcx.types.i32));
ret.write_cvalue(fx, res);
}
"llvm.x86.sse.cmp.ps" | "llvm.x86.sse2.cmp.pd" => {
let (x, y, kind) = match args {
[x, y, kind] => (x, y, kind),
Expand Down
Loading
Loading