Skip to content
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
Actually use placeholder regions for trait method late bound regions …
…in collect_return_position_impl_trait_in_trait_tys
  • Loading branch information
compiler-errors committed Nov 24, 2024
commit 15dff274d07621283b38e4ca0008f7e6145c2519
12 changes: 6 additions & 6 deletions compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,9 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
let impl_sig = ocx.normalize(
&misc_cause,
param_env,
tcx.liberate_late_bound_regions(
impl_m.def_id,
infcx.instantiate_binder_with_fresh_vars(
return_span,
infer::HigherRankedType,
tcx.fn_sig(impl_m.def_id).instantiate_identity(),
),
);
Expand All @@ -536,10 +537,9 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
// them with inference variables.
// We will use these inference variables to collect the hidden types of RPITITs.
let mut collector = ImplTraitInTraitCollector::new(&ocx, return_span, param_env, impl_m_def_id);
let unnormalized_trait_sig = infcx
.instantiate_binder_with_fresh_vars(
return_span,
infer::HigherRankedType,
let unnormalized_trait_sig = tcx
.liberate_late_bound_regions(
impl_m.def_id,
tcx.fn_sig(trait_m.def_id).instantiate(tcx, trait_to_impl_args),
)
.fold_with(&mut collector);
Expand Down
30 changes: 30 additions & 0 deletions tests/ui/impl-trait/in-trait/do-not-imply-from-trait-impl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Make sure that we don't accidentally collect an RPITIT hidden type that does not
// hold for all instantiations of the trait signature.

trait MkStatic {
fn mk_static(self) -> &'static str;
}

impl MkStatic for &'static str {
fn mk_static(self) -> &'static str { self }
}

trait Foo {
fn foo<'a: 'static, 'late>(&'late self) -> impl MkStatic;
}

impl Foo for str {
fn foo<'a: 'static>(&'a self) -> impl MkStatic + 'static {
//~^ ERROR method not compatible with trait
self
}
}

fn call_foo<T: Foo + ?Sized>(t: &T) -> &'static str {
t.foo().mk_static()
}

fn main() {
let s = call_foo(String::from("hello, world").as_str());
println!("> {s}");
}
22 changes: 22 additions & 0 deletions tests/ui/impl-trait/in-trait/do-not-imply-from-trait-impl.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
error[E0308]: method not compatible with trait
--> $DIR/do-not-imply-from-trait-impl.rs:17:38
|
LL | fn foo<'a: 'static>(&'a self) -> impl MkStatic + 'static {
| ^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected signature `fn(&'late _) -> _`
found signature `fn(&'a _) -> _`
note: the lifetime `'late` as defined here...
--> $DIR/do-not-imply-from-trait-impl.rs:13:25
|
LL | fn foo<'a: 'static, 'late>(&'late self) -> impl MkStatic;
| ^^^^^
note: ...does not necessarily outlive the lifetime `'a` as defined here
--> $DIR/do-not-imply-from-trait-impl.rs:17:12
|
LL | fn foo<'a: 'static>(&'a self) -> impl MkStatic + 'static {
| ^^

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0308`.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ note: type in trait
|
LL | fn early<'early, T>(x: &'early T) -> impl Sized;
| ^^^^^^^^^
= note: expected signature `fn(&T)`
found signature `fn(&'late ())`
= note: expected signature `fn(&'early T)`
found signature `fn(&())`
help: change the parameter type to match the trait
|
LL | fn early<'late, T>(_: &T) {}
| ~~
LL | fn early<'late, T>(_: &'early T) {}
| ~~~~~~~~~

error: aborting due to 1 previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) {
|
= note: the pointer is valid for the static lifetime
note: but the referenced data is only valid for the anonymous lifetime defined here
--> $DIR/rpitit-hidden-types-self-implied-wf.rs:6:18
--> $DIR/rpitit-hidden-types-self-implied-wf.rs:2:18
|
LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) {
LL | fn extend(_: &str) -> (impl Sized + '_, &'static str);
| ^^^^

error: aborting due to 1 previous error
Expand Down
15 changes: 8 additions & 7 deletions tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
error[E0623]: lifetime mismatch
error[E0477]: the type `impl Future<Output = Vec<u8>>` does not fulfill the required lifetime
--> $DIR/signature-mismatch.rs:77:10
|
LL | &'a self,
| -------- this parameter and the return type are declared with different lifetimes...
...
LL | ) -> impl Future<Output = Vec<u8>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| ...but data from `buff` is returned here
|
note: type must outlive the lifetime `'a` as defined here as required by this binding
--> $DIR/signature-mismatch.rs:73:32
|
LL | fn async_fn_reduce_outlive<'a, 'b, T>(
| ^^

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0623`.
For more information about this error, try `rustc --explain E0477`.
2 changes: 1 addition & 1 deletion tests/ui/impl-trait/in-trait/signature-mismatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl AsyncTrait for Struct {
buff: &'b [u8],
t: T,
) -> impl Future<Output = Vec<u8>> {
//[failure]~^ ERROR lifetime mismatch
//[failure]~^ ERROR the type `impl Future<Output = Vec<u8>>` does not fulfill the required lifetime
async move {
let _t = t;
vec![]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
error: return type captures more lifetimes than trait definition
--> $DIR/rpitit-impl-captures-too-much.rs:10:39
|
LL | fn hello(self_: Invariant<'_>) -> impl Sized + use<Self>;
| -- this lifetime was captured
...
LL | fn hello(self_: Invariant<'_>) -> impl Sized + use<'_> {}
| -- ^^^^^^^^^^^^^^^^^^^^
| |
| this lifetime was captured
| ^^^^^^^^^^^^^^^^^^^^
|
note: hidden type must only reference lifetimes captured by this impl trait
--> $DIR/rpitit-impl-captures-too-much.rs:6:39
Expand Down