Skip to content

Rollup of 11 pull requests #137001

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

Merged
merged 27 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a917fd5
Fix diagnostic when using = instead of : in let bindings
chenyukang Feb 11, 2025
d82219a
debuginfo: Set bitwidth appropriately in enum variant tags
maurer Feb 12, 2025
e663819
Move `llvm.ccache` to `build.ccache`
Kobzol Feb 12, 2025
2c4922c
rustdoc: use better, consistent SVG icons for scraped examples
notriddle Feb 12, 2025
ab786d3
coverage: Eliminate more counters by giving them to unreachable nodes
Zalathar Feb 11, 2025
66ebee4
Compiletest should not inherit all host RUSTFLAGS
jyn514 Feb 13, 2025
a1a6fd7
Add warning about using llvm.ccache and add FIXME note
Kobzol Feb 13, 2025
8ff3639
ci: move `x86_64-gnu-debug` job to the free runner
marcoieni Feb 13, 2025
bd4f80c
Remove `llvm.ccache` option from `config.example.toml`
Kobzol Feb 13, 2025
0709ba3
unify LLVM version finding logic
onur-ozkan Feb 13, 2025
f7a03d0
Fix `x test --stage 1 ui-fulldeps` on macOS (until the next beta bump)
jyn514 Feb 13, 2025
de273e4
normalizes-to rework rigid alias handling
lcnr Feb 11, 2025
05bd5ce
rework pointee handling for the new rigid alias approach
lcnr Feb 11, 2025
059288e
adjust derive_error
lcnr Feb 12, 2025
81c6d5e
eagerly prove WF when resolving fully qualified paths
lcnr Feb 12, 2025
83a0261
fallout :skull_emoji:
lcnr Feb 12, 2025
e2ee9f7
Rollup merge of #136863 - lcnr:treat-as-rigid, r=compiler-errors
workingjubilee Feb 14, 2025
d784803
Rollup merge of #136869 - chenyukang:yukang-fix-133713-let-binding, r…
workingjubilee Feb 14, 2025
864eba9
Rollup merge of #136895 - maurer:fix-enum-discr, r=nikic
workingjubilee Feb 14, 2025
1b603f9
Rollup merge of #136928 - lcnr:method-lookup-check-wf, r=compiler-errors
workingjubilee Feb 14, 2025
9f87de6
Rollup merge of #136941 - Kobzol:ccache-build, r=onur-ozkan
workingjubilee Feb 14, 2025
82110ca
Rollup merge of #136950 - notriddle:notriddle/svg-example-buttons, r=…
workingjubilee Feb 14, 2025
d82ec95
Rollup merge of #136957 - Zalathar:counters, r=oli-obk
workingjubilee Feb 14, 2025
bde2091
Rollup merge of #136960 - jyn514:compiletest-args, r=jieyouxu
workingjubilee Feb 14, 2025
0e85960
Rollup merge of #136962 - onur-ozkan:fix-enzyme-note, r=jieyouxu
workingjubilee Feb 14, 2025
0e56579
Rollup merge of #136970 - marcoieni:no-largedisk, r=Kobzol
workingjubilee Feb 14, 2025
6eb3929
Rollup merge of #136973 - jyn514:fulldeps-stage1, r=jieyouxu
workingjubilee Feb 14, 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
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,12 @@ fn build_enum_variant_member_di_node<'ll, 'tcx>(
.source_info
.unwrap_or_else(|| (unknown_file_metadata(cx), UNKNOWN_LINE_NUMBER));

let discr = discr_value.opt_single_val().map(|value| {
let tag_base_type = tag_base_type(cx.tcx, enum_type_and_layout);
let size = cx.size_of(tag_base_type);
cx.const_uint_big(cx.type_ix(size.bits()), value)
});

unsafe {
llvm::LLVMRustDIBuilderCreateVariantMemberType(
DIB(cx),
Expand All @@ -448,7 +454,7 @@ fn build_enum_variant_member_di_node<'ll, 'tcx>(
enum_type_and_layout.size.bits(),
enum_type_and_layout.align.abi.bits() as u32,
Size::ZERO.bits(),
discr_value.opt_single_val().map(|value| cx.const_u128(value)),
discr,
DIFlags::FlagZero,
variant_member_info.variant_struct_type_di_node,
)
Expand Down
33 changes: 8 additions & 25 deletions compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,13 +798,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
bug!("`resolve_ty_and_res_fully_qualified_call` called on `LangItem`")
}
};

self.register_wf_obligation(
ty.raw.into(),
qself.span,
ObligationCauseCode::WellFormed(None),
);
self.select_obligations_where_possible(|_| {});

if let Some(&cached_result) = self.typeck_results.borrow().type_dependent_defs().get(hir_id)
{
self.register_wf_obligation(
ty.raw.into(),
qself.span,
ObligationCauseCode::WellFormed(None),
);
// Return directly on cache hit. This is useful to avoid doubly reporting
// errors with default match binding modes. See #44614.
let def = cached_result.map_or(Res::Err, |(kind, def_id)| Res::Def(kind, def_id));
Expand All @@ -824,18 +827,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

let trait_missing_method =
matches!(error, method::MethodError::NoMatch(_)) && ty.normalized.is_trait();
// If we have a path like `MyTrait::missing_method`, then don't register
// a WF obligation for `dyn MyTrait` when method lookup fails. Otherwise,
// register a WF obligation so that we can detect any additional
// errors in the self type.
if !trait_missing_method {
self.register_wf_obligation(
ty.raw.into(),
qself.span,
ObligationCauseCode::WellFormed(None),
);
}

if item_name.name != kw::Empty {
self.report_method_error(
hir_id,
Expand All @@ -849,14 +840,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
result
});

if result.is_ok() {
self.register_wf_obligation(
ty.raw.into(),
qself.span,
ObligationCauseCode::WellFormed(None),
);
}

// Write back the new resolution.
self.write_resolution(hir_id, result);
(
Expand Down
8 changes: 2 additions & 6 deletions compiler/rustc_mir_transform/src/coverage/counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,8 @@ pub(crate) fn transcribe_counters(
let mut new_counters_for_sites = |sites: Vec<BasicCoverageBlock>| {
sites.into_iter().map(|node| new.ensure_phys_counter(node)).collect::<Vec<_>>()
};
let mut pos = new_counters_for_sites(pos);
let mut neg = new_counters_for_sites(neg);

// These sorts are also not strictly necessary; see above.
pos.sort();
neg.sort();
let pos = new_counters_for_sites(pos);
let neg = new_counters_for_sites(neg);

let pos_counter = new.make_sum(&pos).unwrap_or(CovTerm::Zero);
let new_counter = new.make_subtracted_sum(pos_counter, &neg);
Expand Down
19 changes: 14 additions & 5 deletions compiler/rustc_mir_transform/src/coverage/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,20 @@ fn coverage_ids_info<'tcx>(
}
}

// FIXME(Zalathar): It should be possible to sort `priority_list[1..]` by
// `!bcbs_seen.contains(bcb)` to simplify the mappings even further, at the
// expense of some churn in the tests. When doing so, also consider removing
// the sorts in `transcribe_counters`.
let node_counters = make_node_counters(&fn_cov_info.node_flow_data, &fn_cov_info.priority_list);
// Clone the priority list so that we can re-sort it.
let mut priority_list = fn_cov_info.priority_list.clone();
// The first ID in the priority list represents the synthetic "sink" node,
// and must remain first so that it _never_ gets a physical counter.
debug_assert_eq!(priority_list[0], priority_list.iter().copied().max().unwrap());
assert!(!bcbs_seen.contains(priority_list[0]));
// Partition the priority list, so that unreachable nodes (removed by MIR opts)
// are sorted later and therefore are _more_ likely to get a physical counter.
// This is counter-intuitive, but it means that `transcribe_counters` can
// easily skip those unused physical counters and replace them with zero.
// (The original ordering remains in effect within both partitions.)
priority_list[1..].sort_by_key(|&bcb| !bcbs_seen.contains(bcb));

let node_counters = make_node_counters(&fn_cov_info.node_flow_data, &priority_list);
let coverage_counters = transcribe_counters(&node_counters, &bcb_needs_counter, &bcbs_seen);

let CoverageCounters {
Expand Down
51 changes: 23 additions & 28 deletions compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use derive_where::derive_where;
use rustc_type_ir::fold::TypeFoldable;
use rustc_type_ir::inherent::*;
use rustc_type_ir::lang_items::TraitSolverLangItem;
use rustc_type_ir::solve::inspect;
use rustc_type_ir::visit::TypeVisitableExt as _;
use rustc_type_ir::{self as ty, Interner, TypingMode, Upcast as _, elaborate};
use tracing::{debug, instrument};
Expand Down Expand Up @@ -297,25 +296,6 @@ where
let Ok(normalized_self_ty) =
self.structurally_normalize_ty(goal.param_env, goal.predicate.self_ty())
else {
// FIXME: We register a fake candidate when normalization fails so that
// we can point at the reason for *why*. I'm tempted to say that this
// is the wrong way to do this, though.
let result =
self.probe(|&result| inspect::ProbeKind::RigidAlias { result }).enter(|this| {
let normalized_ty = this.next_ty_infer();
let alias_relate_goal = Goal::new(
this.cx(),
goal.param_env,
ty::PredicateKind::AliasRelate(
goal.predicate.self_ty().into(),
normalized_ty.into(),
ty::AliasRelationDirection::Equate,
),
);
this.add_goal(GoalSource::AliasWellFormed, alias_relate_goal);
this.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
});
assert_eq!(result, Err(NoSolution));
return vec![];
};

Expand Down Expand Up @@ -797,11 +777,12 @@ where
/// treat the alias as rigid.
///
/// See trait-system-refactor-initiative#124 for more details.
#[instrument(level = "debug", skip(self), ret)]
#[instrument(level = "debug", skip(self, inject_normalize_to_rigid_candidate), ret)]
pub(super) fn merge_candidates(
&mut self,
proven_via: Option<TraitGoalProvenVia>,
candidates: Vec<Candidate<I>>,
inject_normalize_to_rigid_candidate: impl FnOnce(&mut EvalCtxt<'_, D>) -> QueryResult<I>,
) -> QueryResult<I> {
let Some(proven_via) = proven_via else {
// We don't care about overflow. If proving the trait goal overflowed, then
Expand All @@ -818,13 +799,27 @@ where
// FIXME(const_trait_impl): should this behavior also be used by
// constness checking. Doing so is *at least theoretically* breaking,
// see github.com/rust-lang/rust/issues/133044#issuecomment-2500709754
TraitGoalProvenVia::ParamEnv | TraitGoalProvenVia::AliasBound => candidates
.iter()
.filter(|c| {
matches!(c.source, CandidateSource::AliasBound | CandidateSource::ParamEnv(_))
})
.map(|c| c.result)
.collect(),
TraitGoalProvenVia::ParamEnv | TraitGoalProvenVia::AliasBound => {
let mut candidates_from_env: Vec<_> = candidates
.iter()
.filter(|c| {
matches!(
c.source,
CandidateSource::AliasBound | CandidateSource::ParamEnv(_)
)
})
.map(|c| c.result)
.collect();

// If the trait goal has been proven by using the environment, we want to treat
// aliases as rigid if there are no applicable projection bounds in the environment.
if candidates_from_env.is_empty() {
if let Ok(response) = inject_normalize_to_rigid_candidate(self) {
candidates_from_env.push(response);
}
}
candidates_from_env
}
TraitGoalProvenVia::Misc => candidates.iter().map(|c| c.result).collect(),
};

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_next_trait_solver/src/solve/effect_goals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,6 @@ where
goal.with(ecx.cx(), goal.predicate.trait_ref);
ecx.compute_trait_goal(trait_goal)
})?;
self.merge_candidates(proven_via, candidates)
self.merge_candidates(proven_via, candidates, |_ecx| Err(NoSolution))
}
}
Loading
Loading