Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6e00231
opt-dist: rebuild rustc when doing static LLVM builds
ognevny Jul 19, 2025
a6f2666
std/sys/fd: remove `- 1` from `READ_LIMIT` on Darwin
morinmorin Jul 25, 2025
9449b78
show a trailing comma on singleton tuple constructors in witness pats
dianne Aug 10, 2025
8f649a7
clean up witness printing for tuple-like constructors
dianne Aug 10, 2025
c9ce45c
Optimize `char::encode_utf8`
Kmeakin Aug 16, 2025
e8ae1da
next-solver fix const_trait_impl bootstrap
lcnr Aug 21, 2025
df3d797
Remove `dirs-sys-0.4.1` dependency.
nnethercote Aug 21, 2025
c54db96
Remove `toml-0.5.11` dependency.
nnethercote Aug 21, 2025
78bdd86
miri: also detect aliasing of in-place argument and return place
RalfJung Aug 22, 2025
7046ce8
interpret/allocation: get_range on ProvenanceMap
nia-e Jul 16, 2025
b244f29
remove default opts from config
Shourya742 Aug 23, 2025
32b193c
Remove profile section from Clippy
Kobzol Aug 23, 2025
3ac32ca
rustdoc: make attributes render consistently
karolzwolak Aug 22, 2025
90aa25a
rustdoc: update attribute tests
karolzwolak Aug 22, 2025
1c03ae1
port attribute to the new parsing infrastructure
jdonszelmann Aug 20, 2025
d8b40bd
citool: cleanup `mismatched_lifetime_syntaxes` warnings
samueltardieu Aug 23, 2025
323e230
Fix ICE when validating transmuting ZST to inhabited enum
samueltardieu Aug 23, 2025
f5210f2
Rollup merge of #143898 - ognevny:opt-dist-rustc-rebuild, r=Kobzol
samueltardieu Aug 23, 2025
982b022
Rollup merge of #144452 - morinmorin:apple/update_read_limit, r=Chris…
samueltardieu Aug 23, 2025
5a14685
Rollup merge of #145234 - dianne:1-tuple-witnesses, r=jackh726
samueltardieu Aug 23, 2025
1b9ae8f
Rollup merge of #145515 - Kmeakin:km/optimize-char-encode-utf8, r=Mar…
samueltardieu Aug 23, 2025
95f8b91
Rollup merge of #145540 - nia-e:prov-map-range, r=RalfJung
samueltardieu Aug 23, 2025
e7dc14e
Rollup merge of #145670 - jdonszelmann:port-sanitize, r=lcnr
samueltardieu Aug 23, 2025
9847cb2
Rollup merge of #145713 - lcnr:const-trait-bootstrap, r=compiler-errors
samueltardieu Aug 23, 2025
9088d7a
Rollup merge of #145729 - nnethercote:dup-packages, r=calebcartwright
samueltardieu Aug 23, 2025
0b8d7b1
Rollup merge of #145744 - RalfJung:miri-inplace-aliasing, r=compiler-…
samueltardieu Aug 23, 2025
608271f
Rollup merge of #145774 - Shourya742:2025-08-23-remove-default-opts-m…
samueltardieu Aug 23, 2025
ec52c9c
Rollup merge of #145781 - Kobzol:clippy-remove-profile, r=lqd
samueltardieu Aug 23, 2025
cc90b4f
Rollup merge of #145782 - karolzwolak:rustdoc-consistent-attributes-r…
samueltardieu Aug 23, 2025
a1cdd14
Rollup merge of #145787 - samueltardieu:push-vovspkkxsxtn, r=Kobzol
samueltardieu Aug 23, 2025
4d38062
Rollup merge of #145791 - samueltardieu:fix-zst-to-enum-mir-validatio…
samueltardieu Aug 23, 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
7 changes: 5 additions & 2 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use rustc_errors::{
Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, LintDiagnostic, LintEmitter, MultiSpan,
};
use rustc_hir::attrs::AttributeKind;
use rustc_hir::def::{CtorKind, DefKind};
use rustc_hir::def::{CtorKind, CtorOf, DefKind};
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId};
use rustc_hir::definitions::{DefPathData, Definitions, DisambiguatorState};
use rustc_hir::intravisit::VisitorExt;
Expand Down Expand Up @@ -445,7 +445,10 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
}

fn fn_is_const(self, def_id: DefId) -> bool {
debug_assert_matches!(self.def_kind(def_id), DefKind::Fn | DefKind::AssocFn);
debug_assert_matches!(
self.def_kind(def_id),
DefKind::Fn | DefKind::AssocFn | DefKind::Ctor(CtorOf::Struct, CtorKind::Fn)
);
self.is_conditionally_const(def_id)
}

Expand Down
18 changes: 11 additions & 7 deletions compiler/rustc_next_trait_solver/src/solve/effect_goals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rustc_type_ir::inherent::*;
use rustc_type_ir::lang_items::TraitSolverLangItem;
use rustc_type_ir::solve::SizedTraitKind;
use rustc_type_ir::solve::inspect::ProbeKind;
use rustc_type_ir::{self as ty, Interner, elaborate};
use rustc_type_ir::{self as ty, Interner, TypingMode, elaborate};
use tracing::instrument;

use super::assembly::{Candidate, structural_traits};
Expand Down Expand Up @@ -135,12 +135,16 @@ where
}

let impl_polarity = cx.impl_polarity(impl_def_id);
match impl_polarity {
let certainty = match impl_polarity {
ty::ImplPolarity::Negative => return Err(NoSolution),
ty::ImplPolarity::Reservation => {
unimplemented!("reservation impl for const trait: {:?}", goal)
}
ty::ImplPolarity::Positive => {}
ty::ImplPolarity::Reservation => match ecx.typing_mode() {
TypingMode::Coherence => Certainty::AMBIGUOUS,
TypingMode::Analysis { .. }
| TypingMode::Borrowck { .. }
| TypingMode::PostBorrowckAnalysis { .. }
| TypingMode::PostAnalysis => return Err(NoSolution),
},
ty::ImplPolarity::Positive => Certainty::Yes,
};

if !cx.impl_is_const(impl_def_id) {
Expand Down Expand Up @@ -171,7 +175,7 @@ where
});
ecx.add_goals(GoalSource::ImplWhereBound, const_conditions);

ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
ecx.evaluate_added_goals_and_make_canonical_response(certainty)
})
}

Expand Down
15 changes: 15 additions & 0 deletions tests/ui/traits/const-traits/constructor-const-fn.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//@ check-pass
//@ compile-flags: -Znext-solver
#![feature(const_trait_impl)]
const fn impls_fn<F: ~const Fn(u32) -> Foo>(_: &F) {}

struct Foo(u32);

const fn foo() {
// This previously triggered an incorrect assert
// when checking whether the constructor of `Foo`
// is const.
impls_fn(&Foo)
}

fn main() {}
13 changes: 13 additions & 0 deletions tests/ui/traits/const-traits/reservation-impl-ice.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ compile-flags: -Znext-solver
#![feature(const_from, never_type, const_trait_impl)]

const fn impls_from<T: ~const From<!>>() {}

const fn foo() {
// This previously ICE'd when encountering the reservation impl
// from the standard library.
impls_from::<()>();
//~^ ERROR the trait bound `(): From<!>` is not satisfied
}

fn main() {}
25 changes: 25 additions & 0 deletions tests/ui/traits/const-traits/reservation-impl-ice.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
error[E0277]: the trait bound `(): From<!>` is not satisfied
--> $DIR/reservation-impl-ice.rs:9:18
|
LL | impls_from::<()>();
| ^^ the trait `From<!>` is not implemented for `()`
|
= help: the following other types implement trait `From<T>`:
`(T, T)` implements `From<[T; 2]>`
`(T, T, T)` implements `From<[T; 3]>`
`(T, T, T, T)` implements `From<[T; 4]>`
`(T, T, T, T, T)` implements `From<[T; 5]>`
`(T, T, T, T, T, T)` implements `From<[T; 6]>`
`(T, T, T, T, T, T, T)` implements `From<[T; 7]>`
`(T, T, T, T, T, T, T, T)` implements `From<[T; 8]>`
`(T, T, T, T, T, T, T, T, T)` implements `From<[T; 9]>`
and 4 others
note: required by a bound in `impls_from`
--> $DIR/reservation-impl-ice.rs:4:24
|
LL | const fn impls_from<T: ~const From<!>>() {}
| ^^^^^^^^^^^^^^ required by this bound in `impls_from`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0277`.