Skip to content

Rollup of 11 pull requests #135519

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 26 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3c31861
Don't allow transmuting ZSTs in dispatch_from_dyn impl
compiler-errors Jan 8, 2025
11bc805
Don't allow DispatchFromDyn impls that transmute ZST to non-ZST
compiler-errors Jan 8, 2025
d4057e8
re-add --disable-minification to rustdoc
lolbinarycat Jan 10, 2025
7f743c7
bootstrap: do not rely on LIBRARY_PATH env variable
rhelmot Dec 30, 2024
ebd5ce1
for purely return-type based searches, deprioritize clone-like functions
lolbinarycat Jan 9, 2025
244316f
add disclaimer to --disable-minification
lolbinarycat Jan 14, 2025
f5e23d5
fix typo and unit test
lolbinarycat Jan 14, 2025
516a933
Make sure we can produce ConstArgHasWrongType errors for valtree consts
compiler-errors Jan 11, 2025
3cd7581
Normalize field before checking PhantomData in coerce/dispatch impl v…
compiler-errors Jan 8, 2025
2669f2a
Do not consider traits that have unsatisfied const conditions to be c…
compiler-errors Jan 13, 2025
b89a6e4
Consider more erroneous layouts as LayoutError::ReferencesError to su…
compiler-errors Jan 8, 2025
2743df8
Enforce syntactical stability of const traits in HIR
compiler-errors Jan 12, 2025
5775190
Make sure to scrape region constraints from deeply normalizing type o…
compiler-errors Dec 30, 2024
4f6902d
fix underlining of hovered intra-doc links.
lolbinarycat Jan 14, 2025
62d5562
Fix clippy lints
GuillaumeGomez Jan 14, 2025
8f7e622
Rollup merge of #134913 - rhelmot:master, r=jieyouxu
workingjubilee Jan 15, 2025
aa8bc25
Rollup merge of #134940 - compiler-errors:scrape, r=lcnr
workingjubilee Jan 15, 2025
f256f9e
Rollup merge of #135228 - compiler-errors:normalizes-ur-dispatch, r=B…
workingjubilee Jan 15, 2025
55247be
Rollup merge of #135264 - compiler-errors:layout-propagate-errors, r=…
workingjubilee Jan 15, 2025
0a5a8c4
Rollup merge of #135302 - lolbinarycat:rustdoc-search-return-sort-134…
workingjubilee Jan 15, 2025
b998c29
Rollup merge of #135353 - lolbinarycat:rustdoc-disable-minification, …
workingjubilee Jan 15, 2025
7c85da9
Rollup merge of #135380 - compiler-errors:mismatch-valtree, r=lcnr
workingjubilee Jan 15, 2025
11ac57a
Rollup merge of #135423 - compiler-errors:enforce-const-trait-syntact…
workingjubilee Jan 15, 2025
0a1b9db
Rollup merge of #135425 - compiler-errors:not-conditionally-const, r=…
workingjubilee Jan 15, 2025
b52f2fa
Rollup merge of #135499 - lolbinarycat:rustdoc-link-underline-133484,…
workingjubilee Jan 15, 2025
4f25a31
Rollup merge of #135505 - GuillaumeGomez:clippy, r=notriddle
workingjubilee Jan 15, 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
5 changes: 3 additions & 2 deletions compiler/rustc_trait_selection/src/solve/fulfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,10 @@ fn fulfillment_error_for_no_solution<'tcx>(
infcx.tcx.type_of(uv.def).instantiate(infcx.tcx, uv.args)
}
ty::ConstKind::Param(param_ct) => param_ct.find_ty_from_env(obligation.param_env),
_ => span_bug!(
ty::ConstKind::Value(ty, _) => ty,
kind => span_bug!(
obligation.cause.span,
"ConstArgHasWrongType failed but we don't know how to compute type"
"ConstArgHasWrongType failed but we don't know how to compute type for {kind:?}"
),
};
FulfillmentErrorCode::Select(SelectionError::ConstArgHasWrongType {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
error: the constant `N` is not of type `bool`
--> $DIR/type-mismatch-in-nested-goal.rs:9:50
|
LL | fn needs_a<const N: usize>(_: [u8; N]) where (): A<N> {}
| ^^^^ expected `bool`, found `usize`
|
note: required by a const generic parameter in `A`
--> $DIR/type-mismatch-in-nested-goal.rs:5:9
|
LL | trait A<const B: bool> {}
| ^^^^^^^^^^^^^ required by this const generic parameter in `A`

error: the constant `true` is not of type `usize`
--> $DIR/type-mismatch-in-nested-goal.rs:13:13
|
LL | needs_a([]);
| ------- ^^ expected `usize`, found `bool`
| |
| required by a bound introduced by this call
|
note: required by a const generic parameter in `needs_a`
--> $DIR/type-mismatch-in-nested-goal.rs:9:12
|
LL | fn needs_a<const N: usize>(_: [u8; N]) where (): A<N> {}
| ^^^^^^^^^^^^^^ required by this const generic parameter in `needs_a`

error[E0308]: mismatched types
--> $DIR/type-mismatch-in-nested-goal.rs:13:13
|
LL | needs_a([]);
| ------- ^^ expected an array with a size of true, found one with a size of 0
| |
| arguments to this function are incorrect
|
= note: expected array `[u8; true]`
found array `[_; 0]`
note: function defined here
--> $DIR/type-mismatch-in-nested-goal.rs:9:4
|
LL | fn needs_a<const N: usize>(_: [u8; N]) where (): A<N> {}
| ^^^^^^^ ----------

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0308`.
45 changes: 45 additions & 0 deletions tests/ui/const-generics/type-mismatch-in-nested-goal.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
error: the constant `N` is not of type `bool`
--> $DIR/type-mismatch-in-nested-goal.rs:9:50
|
LL | fn needs_a<const N: usize>(_: [u8; N]) where (): A<N> {}
| ^^^^ expected `bool`, found `usize`
|
note: required by a const generic parameter in `A`
--> $DIR/type-mismatch-in-nested-goal.rs:5:9
|
LL | trait A<const B: bool> {}
| ^^^^^^^^^^^^^ required by this const generic parameter in `A`

error: the constant `true` is not of type `usize`
--> $DIR/type-mismatch-in-nested-goal.rs:13:13
|
LL | needs_a([]);
| ------- ^^ expected `usize`, found `bool`
| |
| required by a bound introduced by this call
|
note: required by a const generic parameter in `needs_a`
--> $DIR/type-mismatch-in-nested-goal.rs:9:12
|
LL | fn needs_a<const N: usize>(_: [u8; N]) where (): A<N> {}
| ^^^^^^^^^^^^^^ required by this const generic parameter in `needs_a`

error[E0308]: mismatched types
--> $DIR/type-mismatch-in-nested-goal.rs:13:13
|
LL | needs_a([]);
| ------- ^^ expected an array with a size of true, found one with a size of 0
| |
| arguments to this function are incorrect
|
= note: expected array `[u8; true]`
found array `[_; 0]`
note: function defined here
--> $DIR/type-mismatch-in-nested-goal.rs:9:4
|
LL | fn needs_a<const N: usize>(_: [u8; N]) where (): A<N> {}
| ^^^^^^^ ----------

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0308`.
17 changes: 17 additions & 0 deletions tests/ui/const-generics/type-mismatch-in-nested-goal.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)

trait A<const B: bool> {}

impl A<true> for () {}

fn needs_a<const N: usize>(_: [u8; N]) where (): A<N> {}
//~^ ERROR the constant `N` is not of type `bool`

pub fn main() {
needs_a([]);
//~^ ERROR the constant `true` is not of type `usize`
//~| ERROR mismatched types
// FIXME(const_generics): we should hide this error as we've already errored above
}