diff options
| author | bors <bors@rust-lang.org> | 2021-01-15 09:27:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-01-15 09:27:21 +0000 |
| commit | 4e208f6a3afb42528878b0f3464e337c4bf3bbc8 (patch) | |
| tree | 21529ff86f6f364980511a8cb4cb7a0001ae29c0 /src | |
| parent | dcf622eb70aebe16d40c5f88fa2a41fa7019541c (diff) | |
| parent | 7286be15fa3f18ea4bd5b6ce481426f7d78e4a57 (diff) | |
| download | rust-4e208f6a3afb42528878b0f3464e337c4bf3bbc8.tar.gz rust-4e208f6a3afb42528878b0f3464e337c4bf3bbc8.zip | |
Auto merge of #81035 - JohnTitor:rollup-9m03awf, r=JohnTitor
Rollup of 5 pull requests
Successful merges:
- #80254 (Don't try to add nested predicate to Rustdoc auto-trait `ParamEnv`)
- #80834 (Remove unreachable panics from VecDeque::{front/back}[_mut])
- #80944 (Use Option::map_or instead of `.map(..).unwrap_or(..)`)
- #81008 (Don't ICE when computing a layout of a generator tainted by errors)
- #81023 (Remove doctree::Variant)
Failed merges:
- #81033 (Remove useless `clean::Variant` struct)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 13 | ||||
| -rw-r--r-- | src/librustdoc/doctree.rs | 6 | ||||
| -rw-r--r-- | src/test/codegen/vecdeque_no_panic.rs | 19 | ||||
| -rw-r--r-- | src/test/rustdoc/issue-80233-normalize-auto-trait.rs | 37 | ||||
| -rw-r--r-- | src/test/ui/generator/layout-error.rs | 28 | ||||
| -rw-r--r-- | src/test/ui/generator/layout-error.stderr | 9 |
6 files changed, 93 insertions, 19 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index c74a5659942..5ec79c586dc 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1837,19 +1837,6 @@ impl Clean<VariantStruct> for rustc_hir::VariantData<'_> { } } -impl Clean<Item> for doctree::Variant<'_> { - fn clean(&self, cx: &DocContext<'_>) -> Item { - let what_rustc_thinks = Item::from_hir_id_and_parts( - self.id, - Some(self.name), - VariantItem(Variant { kind: self.def.clean(cx) }), - cx, - ); - // don't show `pub` for variants, which are always public - Item { visibility: Inherited, ..what_rustc_thinks } - } -} - impl Clean<Item> for ty::VariantDef { fn clean(&self, cx: &DocContext<'_>) -> Item { let kind = match self.ctor_kind { diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index bc9f1cf8806..4710c91f929 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -48,12 +48,6 @@ crate enum StructType { Unit, } -crate struct Variant<'hir> { - crate name: Symbol, - crate id: hir::HirId, - crate def: &'hir hir::VariantData<'hir>, -} - #[derive(Debug)] crate struct Import<'hir> { crate name: Symbol, diff --git a/src/test/codegen/vecdeque_no_panic.rs b/src/test/codegen/vecdeque_no_panic.rs new file mode 100644 index 00000000000..cbf420bada9 --- /dev/null +++ b/src/test/codegen/vecdeque_no_panic.rs @@ -0,0 +1,19 @@ +// This test checks that `VecDeque::front[_mut]()` and `VecDeque::back[_mut]()` can't panic. + +// compile-flags: -O +// ignore-debug: the debug assertions get in the way + +#![crate_type = "lib"] + +use std::collections::VecDeque; + +// CHECK-LABEL: @dont_panic +#[no_mangle] +pub fn dont_panic(v: &mut VecDeque<usize>) { + // CHECK-NOT: expect + // CHECK-NOT: panic + v.front(); + v.front_mut(); + v.back(); + v.back_mut(); +} diff --git a/src/test/rustdoc/issue-80233-normalize-auto-trait.rs b/src/test/rustdoc/issue-80233-normalize-auto-trait.rs new file mode 100644 index 00000000000..585a0864bb2 --- /dev/null +++ b/src/test/rustdoc/issue-80233-normalize-auto-trait.rs @@ -0,0 +1,37 @@ +// Regression test for issue #80233 +// Tests that we don't ICE when processing auto traits + +#![crate_type = "lib"] +pub trait Trait1 {} + +pub trait Trait2 { + type Type2; +} + +pub trait Trait3 { + type Type3; +} + +impl Trait2 for Struct1 { + type Type2 = Struct1; +} + +impl<I: Trait2> Trait2 for Vec<I> { + type Type2 = Vec<I::Type2>; +} + +impl<T: Trait1> Trait3 for T { + type Type3 = Struct1; +} + +impl<T: Trait3> Trait3 for Vec<T> { + type Type3 = Vec<T::Type3>; +} + +pub struct Struct1 {} + +// @has issue_80233_normalize_auto_trait/struct.Question.html +// @has - '//code' 'impl<T> Send for Question<T>' +pub struct Question<T: Trait1> { + pub ins: <<Vec<T> as Trait3>::Type3 as Trait2>::Type2, +} diff --git a/src/test/ui/generator/layout-error.rs b/src/test/ui/generator/layout-error.rs new file mode 100644 index 00000000000..059867277ad --- /dev/null +++ b/src/test/ui/generator/layout-error.rs @@ -0,0 +1,28 @@ +// Verifies that computing a layout of a generator tainted by type errors +// doesn't ICE. Regression test for #80998. +// +// edition:2018 + +#![feature(type_alias_impl_trait)] +use std::future::Future; + +pub struct Task<F: Future>(F); +impl<F: Future> Task<F> { + fn new() -> Self { + todo!() + } + fn spawn(&self, _: impl FnOnce() -> F) { + todo!() + } +} + +fn main() { + async fn cb() { + let a = Foo; //~ ERROR cannot find value `Foo` in this scope + } + + type F = impl Future; + // Check that statics are inhabited computes they layout. + static POOL: Task<F> = Task::new(); + Task::spawn(&POOL, || cb()); +} diff --git a/src/test/ui/generator/layout-error.stderr b/src/test/ui/generator/layout-error.stderr new file mode 100644 index 00000000000..b1a258f4f2c --- /dev/null +++ b/src/test/ui/generator/layout-error.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `Foo` in this scope + --> $DIR/layout-error.rs:21:17 + | +LL | let a = Foo; + | ^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. |
