Skip to content

Rollup of 19 pull requests #139508

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

Closed
wants to merge 52 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
fdefffe
compiler: report error when trait object type param reference self
xtexx Mar 30, 2025
6966416
Update to new rinja version (askama)
GuillaumeGomez Apr 3, 2025
f343b9d
Don't construct preds w escaping bound vars in diagnostic_hir_wf_check
compiler-errors Apr 4, 2025
86a7ee6
create new option `build.compiletest-use-stage0-libtest`
onur-ozkan Apr 4, 2025
17fad21
utilize `compiletest_use_stage0_libtest` option
onur-ozkan Apr 4, 2025
afe3834
add change-entry
onur-ozkan Apr 4, 2025
45afefa
Fix trait upcasting to dyn type with no principal when there are proj…
compiler-errors Apr 5, 2025
a6b7a26
Update rinja version in `generate-copyright`
GuillaumeGomez Apr 4, 2025
d37bd4d
Update proc-macro deps list
GuillaumeGomez Apr 3, 2025
1f06a6a
Tell LLVM about impossible niche tags
scottmcm Mar 29, 2025
51e67e2
LLVM18 compatibility fixes in the tests
scottmcm Mar 29, 2025
253da2f
Don't call Span.with_parent on the good path in has_stashed_diagnostic
compiler-errors Apr 7, 2025
c830665
enable in-tree std on some runners
onur-ozkan Apr 5, 2025
1862b31
rm `RegionInferenceContext::var_infos`
lcnr Apr 7, 2025
1a48634
Sort job duration changes by absolute duration
Kobzol Apr 7, 2025
cae28b5
implement `check` step for `compiletest` separately
onur-ozkan Apr 7, 2025
6ece1de
Add job summary links to post-merge report
Kobzol Apr 7, 2025
42048ea
compiletest: Cleanup collection of actual errors
petrochenkov Apr 7, 2025
b86b3fb
compiletest: Always preserve kind for compiler diagnostics
petrochenkov Apr 7, 2025
5c160f5
compiletest: Stricter parsing for diagnostic kinds
petrochenkov Apr 7, 2025
e1a69da
unstable-book/intrinsics: wordsmith MIR-lowering intrinsic docs
RalfJung Apr 7, 2025
fd854a7
compiletest: Avoid ignoring empty diagnostics in one more place
petrochenkov Apr 7, 2025
2fb550b
Update books
rustbot Apr 7, 2025
a7400a8
update intrinsics/mod.rs comment about const intrinsics
RalfJung Apr 7, 2025
bc29123
Revert "remove rust-analyser support for `extern "rust-intrinsic"` b…
Skgland Apr 7, 2025
250b848
Make error message for missing fields with .. and without .. more con…
compiler-errors Mar 27, 2025
268c56e
Implement overflow for infinite implied lifetime bounds
compiler-errors Apr 7, 2025
4aab8e8
document panic behavior of Vec::resize and Vec::resize_with
jogru0 Apr 7, 2025
b08e9c2
Fix stack overflow in exhaustiveness due to recursive HIR opaque type…
compiler-errors Apr 7, 2025
01e44b1
add missing word in doc comment
tshepang Apr 8, 2025
8501dcb
remove unusual indentation
tshepang Apr 8, 2025
502f7f9
Address PR feedback
scottmcm Apr 8, 2025
9bfb203
compiletest: Trim whitespace from environment variable names
Zalathar Apr 8, 2025
2b80521
Rollup merge of #138676 - compiler-errors:overflow-implied-bounds, r=…
Zalathar Apr 8, 2025
8a31cc2
Rollup merge of #139024 - compiler-errors:tweak-default-value-err, r=…
Zalathar Apr 8, 2025
3701847
Rollup merge of #139098 - scottmcm:assert-impossible-tags, r=WaffleLa…
Zalathar Apr 8, 2025
39eecc7
Rollup merge of #139124 - xtexx:gh-139082, r=compiler-errors
Zalathar Apr 8, 2025
a5e7f0e
Rollup merge of #139321 - GuillaumeGomez:update-rinja, r=notriddle,lo…
Zalathar Apr 8, 2025
c8f0356
Rollup merge of #139346 - compiler-errors:non-lifetime-binder-diag-hi…
Zalathar Apr 8, 2025
a1ab3d9
Rollup merge of #139386 - onur-ozkan:configurable-compiletest-libtest…
Zalathar Apr 8, 2025
73bed4f
Rollup merge of #139421 - compiler-errors:upcast-no-principal-with-pr…
Zalathar Apr 8, 2025
4f2734d
Rollup merge of #139468 - compiler-errors:has_stashed_diagnostic, r=o…
Zalathar Apr 8, 2025
8e50682
Rollup merge of #139476 - lcnr:rm-var_infos, r=compiler-errors
Zalathar Apr 8, 2025
e179592
Rollup merge of #139481 - Kobzol:post-merge-links, r=marcoieni
Zalathar Apr 8, 2025
fdb7828
Rollup merge of #139485 - petrochenkov:errkind-light, r=oli-obk,jieyouxu
Zalathar Apr 8, 2025
7ad48aa
Rollup merge of #139490 - RalfJung:unstable-intrinsics-docs, r=oli-obk
Zalathar Apr 8, 2025
1748007
Rollup merge of #139491 - rustbot:docs-update, r=ehuss
Zalathar Apr 8, 2025
d1b8f8e
Rollup merge of #139496 - Skgland:139455-went-too-far, r=Veykril
Zalathar Apr 8, 2025
77666b8
Rollup merge of #139500 - jogru0:117437, r=tgross35
Zalathar Apr 8, 2025
58af9cd
Rollup merge of #139501 - compiler-errors:suppress-stack-overflow, r=…
Zalathar Apr 8, 2025
62721da
Rollup merge of #139504 - tshepang:patch-5, r=jieyouxu
Zalathar Apr 8, 2025
7d32832
Rollup merge of #139507 - Zalathar:trim-env-name, r=jieyouxu
Zalathar Apr 8, 2025
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
59 changes: 54 additions & 5 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,48 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"

[[package]]
name = "askama"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a4e46abb203e00ef226442d452769233142bbfdd79c3941e84c8e61c4112543"
dependencies = [
"askama_derive",
"itoa",
"percent-encoding",
"serde",
"serde_json",
]

[[package]]
name = "askama_derive"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54398906821fd32c728135f7b351f0c7494ab95ae421d41b6f5a020e158f28a6"
dependencies = [
"askama_parser",
"basic-toml",
"memchr",
"proc-macro2",
"quote",
"rustc-hash 2.1.1",
"serde",
"serde_derive",
"syn 2.0.100",
]

[[package]]
name = "askama_parser"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf315ce6524c857bb129ff794935cf6d42c82a6cff60526fe2a63593de4d0d4f"
dependencies = [
"memchr",
"serde",
"serde_derive",
"winnow 0.7.4",
]

[[package]]
name = "autocfg"
version = "1.4.0"
Expand Down Expand Up @@ -1345,8 +1387,8 @@ name = "generate-copyright"
version = "0.1.0"
dependencies = [
"anyhow",
"askama",
"cargo_metadata 0.18.1",
"rinja",
"serde",
"serde_json",
"thiserror 1.0.69",
Expand Down Expand Up @@ -3069,9 +3111,7 @@ version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dc4940d00595430b3d7d5a01f6222b5e5b51395d1120bdb28d854bb8abb17a5"
dependencies = [
"humansize",
"itoa",
"percent-encoding",
"rinja_derive",
]

Expand Down Expand Up @@ -4628,6 +4668,7 @@ name = "rustdoc"
version = "0.0.0"
dependencies = [
"arrayvec",
"askama",
"base64",
"expect-test",
"indexmap",
Expand All @@ -4636,7 +4677,6 @@ dependencies = [
"pulldown-cmark 0.9.6",
"pulldown-cmark-escape",
"regex",
"rinja",
"rustdoc-json-types",
"serde",
"serde_json",
Expand Down Expand Up @@ -5426,7 +5466,7 @@ dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
"winnow 0.5.40",
]

[[package]]
Expand Down Expand Up @@ -6437,6 +6477,15 @@ dependencies = [
"memchr",
]

[[package]]
name = "winnow"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36"
dependencies = [
"memchr",
]

[[package]]
name = "winsplit"
version = "0.1.0"
Expand Down
5 changes: 4 additions & 1 deletion bootstrap.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# - A new option
# - A change in the default values
#
# If the change-id does not match the version currently in use, x.py will
# If the change-id does not match the version currently in use, x.py will
# display the changes made to the bootstrap.
# To suppress these warnings, you can set change-id = "ignore".
#change-id = <latest change id in src/bootstrap/src/utils/change_tracker.rs>
Expand Down Expand Up @@ -442,6 +442,9 @@
# What custom diff tool to use for displaying compiletest tests.
#compiletest-diff-tool = <none>

# Whether to use the precompiled stage0 libtest with compiletest.
#compiletest-use-stage0-libtest = true

# Indicates whether ccache is used when building certain artifacts (e.g. LLVM).
# Set to `true` to use the first `ccache` in PATH, or set an absolute path to use
# a specific version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@ impl<'tcx> TypeOpInfo<'tcx> for crate::type_check::InstantiateOpaqueType<'tcx> {
// started MIR borrowchecking with, so the region
// constraints have already been taken. Use the data from
// our `mbcx` instead.
|vid| mbcx.regioncx.var_infos[vid].origin,
|vid| mbcx.regioncx.var_infos[vid].universe,
|vid| RegionVariableOrigin::Nll(mbcx.regioncx.definitions[vid].origin),
|vid| mbcx.regioncx.definitions[vid].universe,
)
}
}
Expand Down
9 changes: 3 additions & 6 deletions compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ use rustc_errors::{Applicability, Diag, EmissionGuarantee, MultiSpan, listify};
use rustc_hir::def::{CtorKind, Namespace};
use rustc_hir::{self as hir, CoroutineKind, LangItem};
use rustc_index::IndexSlice;
use rustc_infer::infer::{
BoundRegionConversionTime, NllRegionVariableOrigin, RegionVariableOrigin,
};
use rustc_infer::infer::{BoundRegionConversionTime, NllRegionVariableOrigin};
use rustc_infer::traits::SelectionError;
use rustc_middle::bug;
use rustc_middle::mir::{
Expand Down Expand Up @@ -633,9 +631,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
) {
let predicate_span = path.iter().find_map(|constraint| {
let outlived = constraint.sub;
if let Some(origin) = self.regioncx.var_infos.get(outlived)
&& let RegionVariableOrigin::Nll(NllRegionVariableOrigin::Placeholder(_)) =
origin.origin
if let Some(origin) = self.regioncx.definitions.get(outlived)
&& let NllRegionVariableOrigin::Placeholder(_) = origin.origin
&& let ConstraintCategory::Predicate(span) = constraint.category
{
Some(span)
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/polonius/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ fn emit_mermaid_nll_regions<'tcx>(
writeln!(out, "flowchart TD")?;

// Emit the region nodes.
for region in regioncx.var_infos.indices() {
for region in regioncx.definitions.indices() {
write!(out, "{}[\"", region.as_usize())?;
render_region(region, regioncx, out)?;
writeln!(out, "\"]")?;
Expand Down Expand Up @@ -387,7 +387,7 @@ fn emit_mermaid_nll_sccs<'tcx>(
// Gather and emit the SCC nodes.
let mut nodes_per_scc: IndexVec<_, _> =
regioncx.constraint_sccs().all_sccs().map(|_| Vec::new()).collect();
for region in regioncx.var_infos.indices() {
for region in regioncx.definitions.indices() {
let scc = regioncx.constraint_sccs().scc(region);
nodes_per_scc[scc].push(region);
}
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_borrowck/src/region_infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,11 @@ impl RegionTracker {
}

pub struct RegionInferenceContext<'tcx> {
pub var_infos: VarInfos,

/// Contains the definition for every region variable. Region
/// variables are identified by their index (`RegionVid`). The
/// definition contains information about where the region came
/// from as well as its final inferred value.
definitions: IndexVec<RegionVid, RegionDefinition<'tcx>>,
pub(crate) definitions: IndexVec<RegionVid, RegionDefinition<'tcx>>,

/// The liveness constraints added to each region. For most
/// regions, these start out empty and steadily grow, though for
Expand Down Expand Up @@ -453,7 +451,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
Rc::new(member_constraints.into_mapped(|r| constraint_sccs.scc(r)));

let mut result = Self {
var_infos,
definitions,
liveness_constraints,
constraints,
Expand Down
32 changes: 31 additions & 1 deletion compiler/rustc_codegen_ssa/src/mir/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use rustc_middle::mir::{self, ConstValue};
use rustc_middle::ty::Ty;
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
use rustc_middle::{bug, span_bug};
use rustc_session::config::OptLevel;
use tracing::{debug, instrument};

use super::place::{PlaceRef, PlaceValue};
Expand Down Expand Up @@ -496,6 +497,18 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
_ => (tag_imm, bx.cx().immediate_backend_type(tag_op.layout)),
};

// Layout ensures that we only get here for cases where the discriminant
// value and the variant index match, since that's all `Niche` can encode.
// But for emphasis and debugging, let's double-check one anyway.
debug_assert_eq!(
self.layout
.ty
.discriminant_for_variant(bx.tcx(), untagged_variant)
.unwrap()
.val,
u128::from(untagged_variant.as_u32()),
);

let relative_max = niche_variants.end().as_u32() - niche_variants.start().as_u32();

// We have a subrange `niche_start..=niche_end` inside `range`.
Expand Down Expand Up @@ -537,6 +550,21 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
relative_discr,
bx.cx().const_uint(tag_llty, relative_max as u64),
);

// Thanks to parameter attributes and load metadata, LLVM already knows
// the general valid range of the tag. It's possible, though, for there
// to be an impossible value *in the middle*, which those ranges don't
// communicate, so it's worth an `assume` to let the optimizer know.
if niche_variants.contains(&untagged_variant)
&& bx.cx().sess().opts.optimize != OptLevel::No
{
let impossible =
u64::from(untagged_variant.as_u32() - niche_variants.start().as_u32());
let impossible = bx.cx().const_uint(tag_llty, impossible);
let ne = bx.icmp(IntPredicate::IntNE, relative_discr, impossible);
bx.assume(ne);
}

(is_niche, cast_tag, niche_variants.start().as_u32() as u128)
};

Expand All @@ -553,7 +581,9 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
);

// In principle we could insert assumes on the possible range of `discr`, but
// currently in LLVM this seems to be a pessimization.
// currently in LLVM this isn't worth it because the original `tag` will
// have either a `range` parameter attribute or `!range` metadata,
// or come from a `transmute` that already `assume`d it.

discr
}
Expand Down
Loading
Loading