Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
44933b5
Print env var in --print=deployment-target
madsmtm Nov 14, 2024
0a619dd
Rename `parse_no_flag` to `parse_no_value`
Zalathar Nov 18, 2024
660246b
Don't allow `-Zunstable-options` to take a value
Zalathar Nov 18, 2024
030ddee
don't require const stability for const impls
fee1-dead Nov 20, 2024
3722481
re-export `is_loongarch_feature_detected`
heiher Nov 20, 2024
2487765
Detect const in pattern with typo
estebank Nov 5, 2024
666bcbd
aarch64 softfloat target: always pass floats in int registers
RalfJung Nov 16, 2024
0465f71
Stop being so bail-y in candidate assembly
compiler-errors Nov 21, 2024
5d30436
Re-delay a resolve `bug`
jieyouxu Nov 21, 2024
514ef18
constify `Add`
fee1-dead Nov 20, 2024
f74fdd2
Add code example for `wrapping_neg` method for signed integers
GuillaumeGomez Nov 21, 2024
9a30362
Update TRPL to latest, including new Chapter 17: Async and Await
chriskrycho Oct 17, 2024
34b4518
Update messages which reference book chs. 17-20
chriskrycho Oct 17, 2024
85c582c
Add support for `--library-path` to `rustbook test`
chriskrycho Oct 18, 2024
e0d7cf0
Update bootstrap tests to support book dependencies
chriskrycho Oct 18, 2024
99832cb
rustbook: fix two small typos
chriskrycho Oct 18, 2024
02f51ec
Change to pass "strip" options in an array of string slices and add o…
xingxue-ibm Nov 19, 2024
21dd59f
Update tests for new TRPL chapter order
chriskrycho Oct 30, 2024
30f9f60
Vendor `trpl` crate so The Book tests work offline
chriskrycho Nov 20, 2024
a4a06b3
Use arc4random of libc for RTEMS target
thesummer Nov 21, 2024
de741d2
distinguish overflow and unimplemented in Step::steps_between
michirakara Sep 26, 2024
6ddc947
Rollup merge of #130867 - michirakara:steps_between, r=dtolnay
jhpratt Nov 22, 2024
0e940f9
Rollup merge of #131859 - chriskrycho:update-trpl, r=onur-ozkan
jhpratt Nov 22, 2024
72cd074
Rollup merge of #132090 - compiler-errors:baily, r=lcnr
jhpratt Nov 22, 2024
f2d0388
Rollup merge of #132658 - estebank:const-in-pattern-typo, r=Nadrieril
jhpratt Nov 22, 2024
b0420b3
Rollup merge of #133041 - madsmtm:print-deployment-target-env-var, r=…
jhpratt Nov 22, 2024
8b6b85c
Rollup merge of #133102 - RalfJung:aarch64-softfloat, r=davidtwco,wes…
jhpratt Nov 22, 2024
b65035f
Rollup merge of #133159 - Zalathar:unstable-options-no-value, r=jieyouxu
jhpratt Nov 22, 2024
0c989b2
Rollup merge of #133217 - xingxue-ibm:fix-strip, r=compiler-errors
jhpratt Nov 22, 2024
17a440e
Rollup merge of #133237 - fee1-dead-contrib:constadd, r=compiler-errors
jhpratt Nov 22, 2024
9cf34d6
Rollup merge of #133238 - heiher:loong-stdarch-rexport, r=Amanieu
jhpratt Nov 22, 2024
7058646
Rollup merge of #133286 - jieyouxu:bug-ourselves, r=compiler-errors
jhpratt Nov 22, 2024
36dd052
Rollup merge of #133301 - GuillaumeGomez:add-example-wrapping-neg, r=…
jhpratt Nov 22, 2024
aac0327
Rollup merge of #133313 - thesummer:fix-arc4random, r=cuviper
jhpratt Nov 22, 2024
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
Prev Previous commit
Next Next commit
Stop being so bail-y in candidate assembly
  • Loading branch information
compiler-errors committed Nov 21, 2024
commit 0465f71d600dbf9591b27ac569fa428cd5f7c013
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
} else if tcx.is_lang_item(def_id, LangItem::Sized) {
// Sized is never implementable by end-users, it is
// always automatically computed.

// FIXME: Consider moving this check to the top level as it
// may also be useful for predicates other than `Sized`
// Error type cannot possibly implement `Sized` (fixes #123154)
if let Err(e) = obligation.predicate.skip_binder().self_ty().error_reported() {
return Err(SelectionError::Overflow(e.into()));
}

let sized_conditions = self.sized_conditions(obligation);
self.assemble_builtin_bound_candidates(sized_conditions, &mut candidates);
} else if tcx.is_lang_item(def_id, LangItem::Unsize) {
Expand Down Expand Up @@ -230,13 +222,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
) -> Result<(), SelectionError<'tcx>> {
debug!(?stack.obligation);

// An error type will unify with anything. So, avoid
// matching an error type with `ParamCandidate`.
// This helps us avoid spurious errors like issue #121941.
if stack.obligation.predicate.references_error() {
return Ok(());
}

let bounds = stack
.obligation
.param_env
Expand Down Expand Up @@ -563,19 +548,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
obligation: &PolyTraitObligation<'tcx>,
candidates: &mut SelectionCandidateSet<'tcx>,
) {
// Essentially any user-written impl will match with an error type,
// so creating `ImplCandidates` isn't useful. However, we might
// end up finding a candidate elsewhere (e.g. a `BuiltinCandidate` for `Sized`)
// This helps us avoid overflow: see issue #72839
// Since compilation is already guaranteed to fail, this is just
// to try to show the 'nicest' possible errors to the user.
// We don't check for errors in the `ParamEnv` - in practice,
// it seems to cause us to be overly aggressive in deciding
// to give up searching for candidates, leading to spurious errors.
if obligation.predicate.references_error() {
return;
}

let drcx = DeepRejectCtxt::relate_rigid_infer(self.tcx());
let obligation_args = obligation.predicate.skip_binder().trait_ref.args;
self.tcx().for_each_relevant_impl(
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2487,10 +2487,6 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
let impl_args = self.infcx.fresh_args_for_item(obligation.cause.span, impl_def_id);

let trait_ref = impl_trait_header.trait_ref.instantiate(self.tcx(), impl_args);
if trait_ref.references_error() {
return Err(());
}

debug!(?impl_trait_header);

let Normalized { value: impl_trait_ref, obligations: mut nested_obligations } =
Expand Down
6 changes: 1 addition & 5 deletions compiler/rustc_ty_utils/src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use rustc_index::bit_set::BitSet;
use rustc_middle::bug;
use rustc_middle::query::Providers;
use rustc_middle::ty::{
self, EarlyBinder, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt,
TypeVisitor, Upcast,
self, EarlyBinder, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor, Upcast,
};
use rustc_span::DUMMY_SP;
use rustc_span::def_id::{CRATE_DEF_ID, DefId, LocalDefId};
Expand Down Expand Up @@ -95,9 +94,6 @@ fn adt_sized_constraint<'tcx>(
let tail_ty = tcx.type_of(tail_def.did).instantiate_identity();

let constraint_ty = sized_constraint_for_ty(tcx, tail_ty)?;
if let Err(guar) = constraint_ty.error_reported() {
return Some(ty::EarlyBinder::bind(Ty::new_error(tcx, guar)));
}

// perf hack: if there is a `constraint_ty: Sized` bound, then we know
// that the type is sized and do not need to check it on the impl.
Expand Down
17 changes: 0 additions & 17 deletions tests/crashes/124350.rs

This file was deleted.

26 changes: 0 additions & 26 deletions tests/crashes/125758.rs

This file was deleted.

17 changes: 0 additions & 17 deletions tests/crashes/127351.rs

This file was deleted.

18 changes: 0 additions & 18 deletions tests/crashes/127353.rs

This file was deleted.

11 changes: 0 additions & 11 deletions tests/crashes/127742.rs

This file was deleted.

2 changes: 1 addition & 1 deletion tests/crashes/130521.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ struct Vtable(dyn Cap);
trait Cap<'a> {}

union Transmute {
t: u64,
t: u128,
u: &'static Vtable,
}

Expand Down
18 changes: 18 additions & 0 deletions tests/ui/const-generics/generic_const_exprs/bad-multiply.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// regression test for #124350

struct Node<const D: usize> {}

impl<const D: usize> Node<D>
where
SmallVec<{ D * 2 }>:,
//~^ ERROR generic parameters may not be used in const operations
//~| ERROR constant provided when a type was expected
{
fn new() -> Self {
Node::new()
}
}

struct SmallVec<T1>(T1);

fn main() {}
18 changes: 18 additions & 0 deletions tests/ui/const-generics/generic_const_exprs/bad-multiply.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error: generic parameters may not be used in const operations
--> $DIR/bad-multiply.rs:7:16
|
LL | SmallVec<{ D * 2 }>:,
| ^ cannot perform const operation using `D`
|
= help: const parameters may only be used as standalone arguments, i.e. `D`
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions

error[E0747]: constant provided when a type was expected
--> $DIR/bad-multiply.rs:7:14
|
LL | SmallVec<{ D * 2 }>:,
| ^^^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0747`.
1 change: 0 additions & 1 deletion tests/ui/const-generics/kind_mismatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ pub fn remove_key<K, S: SubsetExcept<K>>() -> S {

fn main() {
let map: KeyHolder<0> = remove_key::<_, _>();
//~^ ERROR: the trait bound `KeyHolder<0>: SubsetExcept<_>` is not satisfied
}
24 changes: 2 additions & 22 deletions tests/ui/const-generics/kind_mismatch.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,6 @@ LL | impl<K> ContainsKey<K> for KeyHolder<K> {}
| |
| help: consider changing this type parameter to a const parameter: `const K: u8`

error[E0277]: the trait bound `KeyHolder<0>: SubsetExcept<_>` is not satisfied
--> $DIR/kind_mismatch.rs:22:45
|
LL | let map: KeyHolder<0> = remove_key::<_, _>();
| ^ the trait `ContainsKey<0>` is not implemented for `KeyHolder<0>`
|
note: required for `KeyHolder<0>` to implement `SubsetExcept<_>`
--> $DIR/kind_mismatch.rs:15:28
|
LL | impl<P, T: ContainsKey<0>> SubsetExcept<P> for T {}
| -------------- ^^^^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
note: required by a bound in `remove_key`
--> $DIR/kind_mismatch.rs:17:25
|
LL | pub fn remove_key<K, S: SubsetExcept<K>>() -> S {
| ^^^^^^^^^^^^^^^ required by this bound in `remove_key`

error: aborting due to 3 previous errors
error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0747.
For more information about an error, try `rustc --explain E0277`.
For more information about this error, try `rustc --explain E0747`.
4 changes: 3 additions & 1 deletion tests/ui/generic-associated-types/issue-71176.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ struct Holder<B> {

fn main() {
Holder {
inner: Box::new(()), //~ ERROR: the trait `Provider` cannot be made into an object
inner: Box::new(()),
//~^ ERROR: the trait `Provider` cannot be made into an object
//~| ERROR: the trait `Provider` cannot be made into an object
};
}
19 changes: 18 additions & 1 deletion tests/ui/generic-associated-types/issue-71176.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,24 @@ LL | type A<'a>;
= help: consider moving `A` to another trait
= help: only type `()` implements the trait, consider using it directly instead

error: aborting due to 5 previous errors
error[E0038]: the trait `Provider` cannot be made into an object
--> $DIR/issue-71176.rs:19:16
|
LL | inner: Box::new(()),
| ^^^^^^^^^^^^ `Provider` cannot be made into an object
|
note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-71176.rs:2:10
|
LL | trait Provider {
| -------- this trait cannot be made into an object...
LL | type A<'a>;
| ^ ...because it contains the generic associated type `A`
= help: consider moving `A` to another trait
= help: only type `()` implements the trait, consider using it directly instead
= note: required for the cast from `Box<()>` to `Box<(dyn Provider<A<'_> = _> + 'static), {type error}>`

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0038, E0107.
For more information about an error, try `rustc --explain E0038`.
3 changes: 3 additions & 0 deletions tests/ui/layout/ice-type-error-in-tail-124031.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ normalize-stderr-test: "\d+ bits" -> "$$BITS bits"

// Regression test for issue #124031
// Checks that we don't ICE when the tail
// of an ADT has a type error
Expand All @@ -16,5 +18,6 @@ struct Other {
fn main() {
unsafe {
std::mem::transmute::<Option<()>, Option<&Other>>(None);
//~^ ERROR cannot transmute between types of different sizes
}
}
16 changes: 13 additions & 3 deletions tests/ui/layout/ice-type-error-in-tail-124031.stderr
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
error[E0046]: not all trait items implemented, missing: `RefTarget`
--> $DIR/ice-type-error-in-tail-124031.rs:9:1
--> $DIR/ice-type-error-in-tail-124031.rs:11:1
|
LL | type RefTarget;
| -------------- `RefTarget` from trait
...
LL | impl Trait for () {}
| ^^^^^^^^^^^^^^^^^ missing `RefTarget` in implementation

error: aborting due to 1 previous error
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> $DIR/ice-type-error-in-tail-124031.rs:20:9
|
LL | std::mem::transmute::<Option<()>, Option<&Other>>(None);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: source type: `Option<()>` ($BITS bits)
= note: target type: `Option<&Other>` ($BITS bits)

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0046`.
Some errors have detailed explanations: E0046, E0512.
For more information about an error, try `rustc --explain E0046`.
18 changes: 18 additions & 0 deletions tests/ui/lazy-type-alias/bad-lazy-type-alias.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// regression test for #127351

#![feature(lazy_type_alias)]
//~^ WARN the feature `lazy_type_alias` is incomplete

type ExplicitTypeOutlives<T> = T;

pub struct Warns {
_significant_drop: ExplicitTypeOutlives,
//~^ ERROR missing generics for type alias `ExplicitTypeOutlives`
field: String,
}

pub fn test(w: Warns) {
let _ = || drop(w.field);
}

fn main() {}
28 changes: 28 additions & 0 deletions tests/ui/lazy-type-alias/bad-lazy-type-alias.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-lazy-type-alias.rs:3:12
|
LL | #![feature(lazy_type_alias)]
| ^^^^^^^^^^^^^^^
|
= note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
= note: `#[warn(incomplete_features)]` on by default

error[E0107]: missing generics for type alias `ExplicitTypeOutlives`
--> $DIR/bad-lazy-type-alias.rs:9:24
|
LL | _significant_drop: ExplicitTypeOutlives,
| ^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument
|
note: type alias defined here, with 1 generic parameter: `T`
--> $DIR/bad-lazy-type-alias.rs:6:6
|
LL | type ExplicitTypeOutlives<T> = T;
| ^^^^^^^^^^^^^^^^^^^^ -
help: add missing generic argument
|
LL | _significant_drop: ExplicitTypeOutlives<T>,
| +++

error: aborting due to 1 previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0107`.
1 change: 0 additions & 1 deletion tests/ui/nll/user-annotations/region-error-ice-109072.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ impl Lt<'missing> for () { //~ ERROR undeclared lifetime

fn main() {
let _: <() as Lt<'_>>::T = &();
//~^ ERROR the trait bound `(): Lt<'_>` is not satisfied
}
Loading