Skip to content
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

Rollup of 9 pull requests #107318

Merged
merged 21 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
21 commits
Select commit Hold shift click to select a range
9f5a933
Remove backwards compat for LLVM 12 coverage format
Swatinem Jan 9, 2023
6155b9a
Avoid __cxa_thread_atexit_impl on Emscripten
RReverser Jan 12, 2023
ab20f8d
remove optimistic spinning from `mpsc::SyncSender`
ibraheemdev Jan 14, 2023
a41c5f9
Re-add #[allow(unused)] attr
RReverser Jan 14, 2023
25f0147
implement Hash for proc_macro::LineColumn
dtolnay Jan 16, 2023
783caf3
Append .dwp to the binary filename instead of replacing the existing …
khuey Jan 13, 2023
0accf08
remove unnecessary check for opaque types
lcnr Jan 19, 2023
a2d1cb2
impl DispatchFromDyn for Cell and UnsafeCell
dimpolo May 24, 2022
af58854
add feature gate tests for DispatchFromDyn
dimpolo Oct 26, 2022
b222f2e
Move `note_and_explain_type_err` from `rustc_middle` to `rustc_infer`
Noratrieb Jan 25, 2023
943000f
Use `can_eq` to compare types for default assoc type error
Noratrieb Jan 25, 2023
3016f55
improve fn pointer notes
mattjperez Jan 25, 2023
e0d71f5
Rollup merge of #97373 - dimpolo:cell_dispatch_from_dyn, r=dtolnay
matthiaskrgr Jan 26, 2023
b2448f9
Rollup merge of #106625 - Swatinem:ref/cov6, r=nagisa
matthiaskrgr Jan 26, 2023
cc92bdb
Rollup merge of #106779 - RReverser:patch-2, r=Mark-Simulacrum
matthiaskrgr Jan 26, 2023
59fcb7a
Rollup merge of #106811 - khuey:dwp_extension, r=davidtwco
matthiaskrgr Jan 26, 2023
35a8d6f
Rollup merge of #106836 - ibraheemdev:sync-sender-spin, r=Amanieu
matthiaskrgr Jan 26, 2023
d667105
Rollup merge of #106946 - dtolnay:hashlinecolumn, r=m-ou-se
matthiaskrgr Jan 26, 2023
c1d722c
Rollup merge of #107074 - lcnr:validate-dont-skip-opaque, r=compiler-…
matthiaskrgr Jan 26, 2023
f2f1234
Rollup merge of #107287 - mattjperez:improve-fn-pointer-notes, r=comp…
matthiaskrgr Jan 26, 2023
3aeafca
Rollup merge of #107304 - Nilstrieb:ᐸTy as PartialEqᐳ::eq because wha…
matthiaskrgr Jan 26, 2023
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
4 changes: 3 additions & 1 deletion compiler/rustc_infer/src/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 79,7 @@ use std::path::PathBuf;
use std::{cmp, fmt, iter};

mod note;
mod note_and_explain;
mod suggest;

pub(crate) mod need_type_info;
Expand Down Expand Up @@ -1846,7 1847,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
}

self.check_and_note_conflicting_crates(diag, terr);
self.tcx.note_and_explain_type_err(diag, terr, cause, span, cause.body_id.to_def_id());

self.note_and_explain_type_err(diag, terr, cause, span, cause.body_id.to_def_id());

if let Some(ValuePairs::PolyTraitRefs(exp_found)) = values
&& let ty::Closure(def_id, _) = exp_found.expected.skip_binder().self_ty().kind()
Expand Down
654 changes: 654 additions & 0 deletions compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/assoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 130,7 @@ impl std::fmt::Display for AssocKind {
/// done only on items with the same name.
#[derive(Debug, Clone, PartialEq, HashStable)]
pub struct AssocItems<'tcx> {
pub(super) items: SortedIndexMultiMap<u32, Symbol, &'tcx ty::AssocItem>,
items: SortedIndexMultiMap<u32, Symbol, &'tcx ty::AssocItem>,
}

impl<'tcx> AssocItems<'tcx> {
Expand Down
637 changes: 5 additions & 632 deletions compiler/rustc_middle/src/ty/error.rs

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions compiler/rustc_middle/src/ty/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 441,10 @@ impl<'tcx> TyCtxt<'tcx> {
self.opt_def_kind(def_id)
.unwrap_or_else(|| bug!("def_kind: unsupported node: {:?}", def_id))
}

pub fn bound_type_of(self, def_id: impl IntoQueryParam<DefId>) -> ty::EarlyBinder<Ty<'tcx>> {
ty::EarlyBinder(self.type_of(def_id))
}
}

impl<'tcx> TyCtxtAt<'tcx> {
Expand All @@ -449,4 453,8 @@ impl<'tcx> TyCtxtAt<'tcx> {
self.opt_def_kind(def_id)
.unwrap_or_else(|| bug!("def_kind: unsupported node: {:?}", def_id))
}

pub fn bound_type_of(self, def_id: impl IntoQueryParam<DefId>) -> ty::EarlyBinder<Ty<'tcx>> {
ty::EarlyBinder(self.type_of(def_id))
}
}
11 changes: 0 additions & 11 deletions compiler/rustc_middle/src/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 3,6 @@
use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use crate::mir;
use crate::ty::layout::IntegerExt;
use crate::ty::query::TyCtxtAt;
use crate::ty::{
self, DefIdTree, FallibleTypeFolder, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable,
TypeVisitable,
Expand Down Expand Up @@ -637,10 636,6 @@ impl<'tcx> TyCtxt<'tcx> {
if visitor.found_recursion { Err(expanded_type) } else { Ok(expanded_type) }
}

pub fn bound_type_of(self, def_id: DefId) -> ty::EarlyBinder<Ty<'tcx>> {
ty::EarlyBinder(self.type_of(def_id))
}

pub fn bound_return_position_impl_trait_in_trait_tys(
self,
def_id: DefId,
Expand Down Expand Up @@ -738,12 733,6 @@ impl<'tcx> TyCtxt<'tcx> {
}
}

impl<'tcx> TyCtxtAt<'tcx> {
pub fn bound_type_of(self, def_id: DefId) -> ty::EarlyBinder<Ty<'tcx>> {
ty::EarlyBinder(self.type_of(def_id))
}
}

struct OpaqueTypeExpander<'tcx> {
// Contains the DefIds of the opaque types that are currently being
// expanded. When we expand an opaque type we insert the DefId of
Expand Down
14 changes: 14 additions & 0 deletions tests/ui/associated-types/defaults-in-other-trait-items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 44,18 @@ impl AssocConst for () {
const C: Self::Ty = 0u8;
}

pub trait Trait {
type Res = isize; //~ NOTE associated type defaults can't be assumed inside the trait defining them

fn infer_me_correctly() -> Self::Res {
//~^ NOTE expected `<Self as Trait>::Res` because of return type

// {integer} == isize
2
//~^ ERROR mismatched types
//~| NOTE expected associated type, found integer
//~| NOTE expected associated type `<Self as Trait>::Res`
}
}

fn main() {}
17 changes: 16 additions & 1 deletion tests/ui/associated-types/defaults-in-other-trait-items.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 24,21 @@ LL | const C: Self::Ty = 0u8;
= note: expected associated type `<Self as AssocConst>::Ty`
found type `u8`

error: aborting due to 2 previous errors
error[E0308]: mismatched types
--> $DIR/defaults-in-other-trait-items.rs:54:9
|
LL | type Res = isize;
| ----------------- associated type defaults can't be assumed inside the trait defining them
LL |
LL | fn infer_me_correctly() -> Self::Res {
| --------- expected `<Self as Trait>::Res` because of return type
...
LL | 2
| ^ expected associated type, found integer
|
= note: expected associated type `<Self as Trait>::Res`
found type `{integer}`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0308`.
4 changes: 2 additions & 2 deletions tests/ui/associated-types/issue-26681.stderr
Original file line number Diff line number Diff line change
@@ -1,13 1,13 @@
error[E0308]: mismatched types
--> $DIR/issue-26681.rs:17:39
|
LL | type Fv: Foo = u8;
| ------------------ associated type defaults can't be assumed inside the trait defining them
LL | const C: <Self::Fv as Foo>::Bar = 6665;
| ^^^^ expected associated type, found integer
|
= note: expected associated type `<<Self as Baz>::Fv as Foo>::Bar`
found type `{integer}`
= help: consider constraining the associated type `<<Self as Baz>::Fv as Foo>::Bar` to `{integer}`
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html

error: aborting due to previous error

Expand Down