Skip to content

Rollup of 12 pull requests #133561

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 33 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a9ecd0f
Expand std::os::unix::fs::chown() doc with a warning
grinapo Aug 22, 2024
3408dc1
Update chown help with a link and adding cap warning
grinapo Aug 22, 2024
451c8cd
Remove one stray space.
grinapo Nov 14, 2024
7426066
Add release notes for Rust 1.83.0
cuviper Nov 22, 2024
c14f0a1
Update relnotes from suggestions and issues sync
cuviper Nov 22, 2024
3b8c0cc
Reorder lang relnotes
cuviper Nov 22, 2024
d3d3342
Add an empty line to fix markdown quoting
cuviper Nov 22, 2024
c31a097
aix: create shim for lgammaf_r
mustartt Nov 22, 2024
c7195c4
Change `$float` to `{float}` in relnotes
cuviper Nov 22, 2024
46cd0c5
Also change an older `$integer` to `{integer}`
cuviper Nov 23, 2024
50fb40a
Delay a bug when encountering an impl with unconstrained generics in …
compiler-errors Nov 23, 2024
15dff27
Actually use placeholder regions for trait method late bound regions …
compiler-errors Nov 24, 2024
4b8ca28
Add '<[T]>::as_array', '<[T]>::as_mut_array', '<*const [T]>::as_array…
bjoernager Nov 26, 2024
527b606
fmt
mustartt Nov 27, 2024
e37ac2a
rustc_span: Replace a `HashMap<_, ()>` with `HashSet`
cuviper Nov 27, 2024
e11cfeb
print generated doc paths
onur-ozkan Nov 27, 2024
26c7774
Structurally resolve before applying projection in borrowck
compiler-errors Nov 27, 2024
4120fdb
Check xform_ret_ty for WF in the new solver to improve method winnowing
compiler-errors Nov 27, 2024
37d3c61
extend group-forbid-always-trumps-cli test
RalfJung Nov 27, 2024
871cfc9
Further simplifications
compiler-errors Nov 24, 2024
f0c301f
Fix new clippy lints
GuillaumeGomez Nov 27, 2024
10193a3
Rollup merge of #129409 - grinapo:patch-1, r=Amanieu
GuillaumeGomez Nov 28, 2024
09734ac
Rollup merge of #133320 - cuviper:relnotes-1.83.0, r=cuviper
GuillaumeGomez Nov 28, 2024
acf48fc
Rollup merge of #133368 - compiler-errors:codegen-select-unconstraine…
GuillaumeGomez Nov 28, 2024
3e095e8
Rollup merge of #133428 - compiler-errors:rpitit-unsound, r=lcnr
GuillaumeGomez Nov 28, 2024
b1c33f4
Rollup merge of #133512 - bjoernager:slice-as-array, r=Amanieu
GuillaumeGomez Nov 28, 2024
06815d0
Rollup merge of #133519 - compiler-errors:xform-ret-wf, r=lcnr
GuillaumeGomez Nov 28, 2024
b46ed71
Rollup merge of #133520 - compiler-errors:structurally-resolve-mir-bo…
GuillaumeGomez Nov 28, 2024
7e2f261
Rollup merge of #133534 - RalfJung:cli-lint-flags, r=Nadrieril
GuillaumeGomez Nov 28, 2024
0cad2dc
Rollup merge of #133537 - GuillaumeGomez:fix-clippy-lints, r=Guillaum…
GuillaumeGomez Nov 28, 2024
82d4eae
Rollup merge of #133543 - mustartt:aix-lgammaf_r-shim, r=cuviper
GuillaumeGomez Nov 28, 2024
63a6e9c
Rollup merge of #133547 - cuviper:span-set-entry, r=jieyouxu
GuillaumeGomez Nov 28, 2024
ed913fe
Rollup merge of #133550 - onur-ozkan:doc-log, r=jieyouxu
GuillaumeGomez Nov 28, 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
Delay a bug when encountering an impl with unconstrained generics in …
…codegen_select
  • Loading branch information
compiler-errors committed Nov 23, 2024
commit 50fb40a987746e8847091ce354b649be4a44cde1
21 changes: 15 additions & 6 deletions compiler/rustc_traits/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,21 @@ pub(crate) fn codegen_select_candidate<'tcx>(
}

let impl_source = infcx.resolve_vars_if_possible(impl_source);
let impl_source = infcx.tcx.erase_regions(impl_source);
if impl_source.has_infer() {
// Unused lifetimes on an impl get replaced with inference vars, but never resolved,
// causing the return value of a query to contain inference vars. We do not have a concept
// for this and will in fact ICE in stable hashing of the return value. So bail out instead.
infcx.tcx.dcx().has_errors().unwrap();
let impl_source = tcx.erase_regions(impl_source);
if impl_source.has_non_region_infer() {
// Unused generic types or consts on an impl get replaced with inference vars,
// but never resolved, causing the return value of a query to contain inference
// vars. We do not have a concept for this and will in fact ICE in stable hashing
// of the return value. So bail out instead.
match impl_source {
ImplSource::UserDefined(impl_) => {
tcx.dcx().span_delayed_bug(
tcx.def_span(impl_.impl_def_id),
"this impl has unconstrained generic parameters",
);
}
_ => unreachable!(),
}
return Err(CodegenObligationError::FulfillmentError);
}

Expand Down
18 changes: 0 additions & 18 deletions tests/crashes/126646.rs

This file was deleted.

20 changes: 20 additions & 0 deletions tests/ui/traits/resolve-impl-before-constrain-check.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Need a different module so we try to build the mir for `test`
// before analyzing `mod foo`.

mod foo {
pub trait Callable {
fn call();
}

impl<V: ?Sized> Callable for () {
//~^ ERROR the type parameter `V` is not constrained by the impl trait, self type, or predicates
fn call() {}
}
}
use foo::*;

fn test() -> impl Sized {
<() as Callable>::call()
}

fn main() {}
9 changes: 9 additions & 0 deletions tests/ui/traits/resolve-impl-before-constrain-check.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0207]: the type parameter `V` is not constrained by the impl trait, self type, or predicates
--> $DIR/resolve-impl-before-constrain-check.rs:9:10
|
LL | impl<V: ?Sized> Callable for () {
| ^ unconstrained type parameter

error: aborting due to 1 previous error

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