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 #103375

Merged
merged 20 commits into from
Oct 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a5e116e
`order_dependent_trait_objects` to `ReportNow`
lcnr Oct 3, 2022
cc6ad45
replaced wrong test with the correct mcve
SarthakSingh31 Oct 21, 2022
62a2a1d
fix some typos
Rageking8 Oct 21, 2022
3ff0a33
WinConsole::new is not actually fallible
RalfJung Oct 21, 2022
353ef69
add test for issue 97607
Rageking8 Oct 21, 2022
349ba6b
Remove needless special cases and dead code
oli-obk Oct 21, 2022
d6cf893
Require Drop impls to have the same constness on its bounds as the bo…
oli-obk Oct 21, 2022
e97d295
Remove incorrect comment in `Vec::drain`
WaffleLapkin Oct 21, 2022
0dbf233
rustdoc: merge identical CSS blocks
notriddle Oct 21, 2022
526c1d3
rustdoc: prevent method summary margin from being applied to docblocks
notriddle Oct 21, 2022
1adb4c3
rustdoc: remove unused CSS `.out-of-band { font-weight: normal }`
notriddle Oct 21, 2022
ebfdf73
Rollup merge of #102635 - lcnr:incoherent_auto_trait_objects, r=jackh726
matthiaskrgr Oct 21, 2022
e67f09a
Rollup merge of #103335 - SarthakSingh31:issue-89008, r=jackh726
matthiaskrgr Oct 21, 2022
7ee0aea
Rollup merge of #103339 - Rageking8:fix-some-typos, r=fee1-dead
matthiaskrgr Oct 21, 2022
b21eb5e
Rollup merge of #103340 - RalfJung:winconsole, r=thomcc
matthiaskrgr Oct 21, 2022
db4696a
Rollup merge of #103341 - Rageking8:add-test-for-issue-97607, r=compi…
matthiaskrgr Oct 21, 2022
ed430ca
Rollup merge of #103351 - oli-obk:tilde_const_impls, r=fee1-dead
matthiaskrgr Oct 21, 2022
1b2f594
Rollup merge of #103359 - WaffleLapkin:drain_no_mut_qqq, r=scottmcm
matthiaskrgr Oct 21, 2022
66f33df
Rollup merge of #103364 - notriddle:notriddle/toggles, r=jsha
matthiaskrgr Oct 21, 2022
1d3aa7b
Rollup merge of #103370 - notriddle:notriddle/out-of-band, r=Guillaum…
matthiaskrgr Oct 21, 2022
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
52 changes: 3 additions & 49 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,20 +252,6 @@ impl<'a> AstValidator<'a> {
}
}

fn visit_struct_field_def(&mut self, field: &'a FieldDef) {
if let Some(ident) = field.ident {
if ident.name == kw::Underscore {
self.visit_vis(&field.vis);
self.visit_ident(ident);
self.visit_ty_common(&field.ty);
self.walk_ty(&field.ty);
walk_list!(self, visit_attribute, &field.attrs);
return;
}
}
self.visit_field_def(field);
}

fn err_handler(&self) -> &rustc_errors::Handler {
&self.session.diagnostic()
}
Expand Down Expand Up @@ -1006,8 +992,8 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
visit::walk_lifetime(self, lifetime);
}

fn visit_field_def(&mut self, s: &'a FieldDef) {
visit::walk_field_def(self, s)
fn visit_field_def(&mut self, field: &'a FieldDef) {
visit::walk_field_def(self, field)
}

fn visit_item(&mut self, item: &'a Item) {
Expand Down Expand Up @@ -1195,42 +1181,10 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
self.check_mod_file_item_asciionly(item.ident);
}
}
ItemKind::Struct(ref vdata, ref generics) => match vdata {
// Duplicating the `Visitor` logic allows catching all cases
// of `Anonymous(Struct, Union)` outside of a field struct or union.
//
// Inside `visit_ty` the validator catches every `Anonymous(Struct, Union)` it
// encounters, and only on `ItemKind::Struct` and `ItemKind::Union`
// it uses `visit_ty_common`, which doesn't contain that specific check.
VariantData::Struct(ref fields, ..) => {
self.visit_vis(&item.vis);
self.visit_ident(item.ident);
self.visit_generics(generics);
self.with_banned_assoc_ty_bound(|this| {
walk_list!(this, visit_struct_field_def, fields);
});
walk_list!(self, visit_attribute, &item.attrs);
return;
}
_ => {}
},
ItemKind::Union(ref vdata, ref generics) => {
ItemKind::Union(ref vdata, ..) => {
if vdata.fields().is_empty() {
self.err_handler().span_err(item.span, "unions cannot have zero fields");
}
match vdata {
VariantData::Struct(ref fields, ..) => {
self.visit_vis(&item.vis);
self.visit_ident(item.ident);
self.visit_generics(generics);
self.with_banned_assoc_ty_bound(|this| {
walk_list!(this, visit_struct_field_def, fields);
});
walk_list!(self, visit_attribute, &item.attrs);
return;
}
_ => {}
}
}
ItemKind::Const(def, .., None) => {
self.check_defaultness(item.span, def);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/src/sso/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct SsoHashSet<T> {
map: SsoHashMap<T, ()>,
}

/// Adapter function used ot return
/// Adapter function used to return
/// result if SsoHashMap functions into
/// result SsoHashSet should return.
#[inline(always)]
Expand Down
8 changes: 1 addition & 7 deletions compiler/rustc_hir_analysis/src/check/dropck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
let p = p.kind();
match (predicate.skip_binder(), p.skip_binder()) {
(ty::PredicateKind::Trait(a), ty::PredicateKind::Trait(b)) => {
// Since struct predicates cannot have ~const, project the impl predicate
// onto one that ignores the constness. This is equivalent to saying that
// we match a `Trait` bound on the struct with a `Trait` or `~const Trait`
// in the impl.
let non_const_a =
ty::TraitPredicate { constness: ty::BoundConstness::NotConst, ..a };
relator.relate(predicate.rebind(non_const_a), p.rebind(b)).is_ok()
relator.relate(predicate.rebind(a), p.rebind(b)).is_ok()
}
(ty::PredicateKind::Projection(a), ty::PredicateKind::Projection(b)) => {
relator.relate(predicate.rebind(a), p.rebind(b)).is_ok()
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,7 @@ declare_lint! {
"trait-object types were treated as different depending on marker-trait order",
@future_incompatible = FutureIncompatibleInfo {
reference: "issue #56484 <https://github.com/rust-lang/rust/issues/56484>",
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
};
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/interpret/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl<'tcx> TyCtxt<'tcx> {

match ty::Instance::resolve_opt_const_arg(
self, param_env,
// FIXME: maybe have a seperate version for resolving mir::UnevaluatedConst?
// FIXME: maybe have a separate version for resolving mir::UnevaluatedConst?
ct.def, ct.substs,
) {
Ok(Some(instance)) => {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ fn project_and_unify_type<'cx, 'tcx>(
};
debug!(?normalized, ?obligations, "project_and_unify_type result");
let actual = obligation.predicate.term;
// For an example where this is neccessary see src/test/ui/impl-trait/nested-return-type2.rs
// For an example where this is necessary see src/test/ui/impl-trait/nested-return-type2.rs
// This allows users to omit re-mentioning all bounds on an associated type and just use an
// `impl Trait` for the assoc type to add more bounds.
let InferOk { value: actual, obligations: new } =
Expand Down
4 changes: 1 addition & 3 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1999,9 +1999,7 @@ impl<T, A: Allocator> Vec<T, A> {
unsafe {
// set self.vec length's to start, to be safe in case Drain is leaked
self.set_len(start);
// Use the borrow in the IterMut to indicate borrowing behavior of the
// whole Drain iterator (like &mut T).
let range_slice = slice::from_raw_parts_mut(self.as_mut_ptr().add(start), end - start);
let range_slice = slice::from_raw_parts(self.as_ptr().add(start), end - start);
Drain {
tail_start: end,
tail_len: len - end,
Expand Down
2 changes: 1 addition & 1 deletion library/test/src/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub(crate) fn stdout() -> Option<Box<StdoutTerminal>> {
pub(crate) fn stdout() -> Option<Box<StdoutTerminal>> {
TerminfoTerminal::new(io::stdout())
.map(|t| Box::new(t) as Box<StdoutTerminal>)
.or_else(|| WinConsole::new(io::stdout()).ok().map(|t| Box::new(t) as Box<StdoutTerminal>))
.or_else(|| Some(Box::new(WinConsole::new(io::stdout())) as Box<StdoutTerminal>))
}

/// Terminal color definitions
Expand Down
7 changes: 3 additions & 4 deletions library/test/src/term/win.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ impl<T: Write + Send + 'static> WinConsole<T> {
}
}

/// Returns `None` whenever the terminal cannot be created for some reason.
pub(crate) fn new(out: T) -> io::Result<WinConsole<T>> {
pub(crate) fn new(out: T) -> WinConsole<T> {
use std::mem::MaybeUninit;

let fg;
Expand All @@ -132,13 +131,13 @@ impl<T: Write + Send + 'static> WinConsole<T> {
bg = color::BLACK;
}
}
Ok(WinConsole {
WinConsole {
buf: out,
def_foreground: fg,
def_background: bg,
foreground: fg,
background: bg,
})
}
}
}

Expand Down
15 changes: 4 additions & 11 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@ pre.example-line-numbers {
.out-of-band {
flex-grow: 0;
font-size: 1.125rem;
font-weight: normal;
}

.docblock code, .docblock-short code,
Expand Down Expand Up @@ -1536,6 +1535,7 @@ details.dir-entry a {
https://developer.mozilla.org/en-US/docs/Web/CSS/contain */
details.rustdoc-toggle {
contain: layout;
position: relative;
}

/* The hideme class is used on summary tags that contain a span with
Expand Down Expand Up @@ -1629,10 +1629,6 @@ details.rustdoc-toggle[open] > summary.hideme {
position: absolute;
}

details.rustdoc-toggle {
position: relative;
}

details.rustdoc-toggle[open] > summary.hideme > span {
display: none;
}
Expand Down Expand Up @@ -1983,8 +1979,8 @@ in storage.js
}
}

.method-toggle summary,
.implementors-toggle summary,
.method-toggle > summary,
.implementors-toggle > summary,
.impl,
#implementors-list > .docblock,
.impl-items > section,
Expand All @@ -1993,10 +1989,7 @@ in storage.js
margin-bottom: 0.75em;
}

.method-toggle[open]:not(:last-child) {
margin-bottom: 2em;
}

.method-toggle[open]:not(:last-child),
.implementors-toggle[open]:not(:last-child) {
margin-bottom: 2em;
}
Expand Down
11 changes: 11 additions & 0 deletions src/test/rustdoc-gui/docblock-details.goml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,14 @@ assert-property: (".top-doc .docblock summary h4", {"offsetHeight": "33"})
assert-css: (".top-doc .docblock summary h4", {"margin-top": "15px", "margin-bottom": "5px"})
// So `33 + 15 + 5` == `53`
assert-property: (".top-doc .docblock summary", {"offsetHeight": "53"})

// We now check the `<summary>` on a method.
assert-css: (
".method-toggle .docblock summary h4",
{"border-bottom-width": "0px"},
)
// This allows to ensure that summary is on one line only!
assert-property: (".method-toggle .docblock summary h4", {"offsetHeight": "30"})
assert-css: (".method-toggle .docblock summary h4", {"margin-top": "15px", "margin-bottom": "5px"})
// So `30 + 15 + 5` == `50`
assert-property: (".method-toggle .docblock summary", {"offsetHeight": "50"})
12 changes: 12 additions & 0 deletions src/test/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,18 @@ pub mod details {
/// <div>I'm the content of the details!</div>
/// </details>
pub struct Details;

impl Details {
/// We check the appearance of the `<details>`/`<summary>` in here.
///
/// ## Hello
///
/// <details>
/// <summary><h4>I'm a summary</h4></summary>
/// <div>I'm the content of the details!</div>
/// </details>
pub fn method() {}
}
}

pub mod doc_block_table {
Expand Down
12 changes: 12 additions & 0 deletions src/test/ui/closures/issue-97607.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// check-pass
#[allow(unused)]

fn test<T, F, U>(f: F) -> Box<dyn Fn(T) -> U + 'static>
where
F: 'static + Fn(T) -> U,
for<'a> U: 'a, // < This is the problematic line, see #97607
{
Box::new(move |t| f(t))
}

fn main() {}
19 changes: 0 additions & 19 deletions src/test/ui/generic-associated-types/bugs/issue-89008.stderr

This file was deleted.

2 changes: 1 addition & 1 deletion src/test/ui/generic-associated-types/bugs/issue-91762.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// check-fail
// known-bug

// We almost certaintly want this to pass, but
// We almost certainly want this to pass, but
// it's particularly difficult currently, because we need a way of specifying
// that `<Self::Base as Functor>::With<T> = Self` without using that when we have
// a `U`. See `https://github.com/rust-lang/rust/pull/92728` for a (hacky)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
// check-fail
// check-pass
// edition:2021
// known-bug: #88908

// This should pass, but seems to run into a TAIT bug.

#![feature(type_alias_impl_trait)]

use std::future::Future;
use std::marker::PhantomData;

trait Stream {
type Item;
}

struct Empty<T>(T);
impl<T> Stream for Empty<T> {
type Item = ();
struct Empty<T> {
_phantom: PhantomData<T>,
}
fn empty<T>() -> Empty<T> {
todo!()

impl<T> Stream for Empty<T> {
type Item = T;
}

trait X {
type LineStream<'a, Repr>: Stream<Item = Repr> where Self: 'a;

type LineStreamFut<'a,Repr>: Future<Output = Self::LineStream<'a, Repr>> where Self: 'a;

fn line_stream<'a,Repr>(&'a self) -> Self::LineStreamFut<'a,Repr>;
type LineStreamFut<'a, Repr>: Future<Output = Self::LineStream<'a, Repr>> where Self: 'a;
fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr>;
}

struct Y;

impl X for Y {
type LineStream<'a, Repr> = impl Stream<Item = Repr>;

type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>> ;

type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>;
fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
async {empty()}
async { Empty { _phantom: PhantomData } }
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/let-else/let-else-non-diverging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn main() {

// Ensure that uninhabited types do not "diverge".
// This might be relaxed in the future, but when it is,
// it should be an explicitly wanted descision.
// it should be an explicitly wanted decision.
let Some(x) = Some(1) else { foo::<Uninhabited>() }; //~ ERROR does not diverge
}

Expand Down
Loading