Skip to content

Rollup of 5 pull requests #113098

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

Closed
wants to merge 11 commits into from
Closed
7 changes: 0 additions & 7 deletions compiler/rustc_ast_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ pub struct ForbiddenLifetimeBound {
pub spans: Vec<Span>,
}

#[derive(Diagnostic)]
#[diag(ast_passes_forbidden_non_lifetime_param)]
pub struct ForbiddenNonLifetimeParam {
#[primary_span]
pub spans: Vec<Span>,
}

#[derive(Diagnostic)]
#[diag(ast_passes_fn_param_too_many)]
pub struct FnParamTooMany {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
tcx,
generics,
diag,
&format!("{}", proj.self_ty()),
&proj.self_ty().to_string(),
&path,
None,
matching_span,
Expand All @@ -153,7 +153,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
tcx,
generics,
diag,
&format!("{}", proj.self_ty()),
&proj.self_ty().to_string(),
&path,
None,
matching_span,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_dataflow/src/framework/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub mod graphviz;
pub mod lattice;
mod visitor;

pub use self::cursor::{ResultsClonedCursor, ResultsCursor, ResultsRefCursor};
pub use self::cursor::{AnalysisResults, ResultsClonedCursor, ResultsCursor, ResultsRefCursor};
pub use self::direction::{Backward, Direction, Forward};
pub use self::engine::{Engine, EntrySets, Results, ResultsCloned};
pub use self::lattice::{JoinSemiLattice, MeetSemiLattice};
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_mir_dataflow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ pub use self::drop_flag_effects::{
on_lookup_result_bits,
};
pub use self::framework::{
fmt, graphviz, lattice, visit_results, Analysis, AnalysisDomain, Backward, CallReturnPlaces,
CloneAnalysis, Direction, Engine, Forward, GenKill, GenKillAnalysis, JoinSemiLattice, Results,
ResultsCloned, ResultsClonedCursor, ResultsCursor, ResultsRefCursor, ResultsVisitable,
ResultsVisitor, SwitchIntEdgeEffects,
fmt, graphviz, lattice, visit_results, Analysis, AnalysisDomain, AnalysisResults, Backward,
CallReturnPlaces, CloneAnalysis, Direction, Engine, Forward, GenKill, GenKillAnalysis,
JoinSemiLattice, Results, ResultsCloned, ResultsClonedCursor, ResultsCursor, ResultsRefCursor,
ResultsVisitable, ResultsVisitor, SwitchIntEdgeEffects,
};

use self::move_paths::MoveData;
Expand Down
17 changes: 2 additions & 15 deletions compiler/rustc_mir_transform/src/coverage/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,7 @@ impl DebugCounters {

pub fn add_counter(&mut self, counter_kind: &CoverageKind, some_block_label: Option<String>) {
if let Some(counters) = &mut self.some_counters {
let id: ExpressionOperandId = match *counter_kind {
CoverageKind::Counter { id, .. } => id.into(),
CoverageKind::Expression { id, .. } => id.into(),
_ => bug!(
"the given `CoverageKind` is not an counter or expression: {:?}",
counter_kind
),
};
let id = counter_kind.as_operand_id();
counters
.try_insert(id, DebugCounter::new(counter_kind.clone(), some_block_label))
.expect("attempt to add the same counter_kind to DebugCounters more than once");
Expand Down Expand Up @@ -330,13 +323,7 @@ impl DebugCounters {
}
}

let id: ExpressionOperandId = match *counter_kind {
CoverageKind::Counter { id, .. } => id.into(),
CoverageKind::Expression { id, .. } => id.into(),
_ => {
bug!("the given `CoverageKind` is not an counter or expression: {:?}", counter_kind)
}
};
let id = counter_kind.as_operand_id();
if self.some_counters.is_some() && (counter_format.block || !counter_format.id) {
let counters = self.some_counters.as_ref().unwrap();
if let Some(DebugCounter { some_block_label: Some(block_label), .. }) =
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ pub trait Into<T>: Sized {
#[rustc_diagnostic_item = "From"]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(on(
all(_Self = "&str", T = "std::string::String"),
all(_Self = "&str", any(T = "alloc::string::String", T = "std::string::String")),
note = "to coerce a `{T}` into a `{Self}`, use `&*` as a prefix",
))]
pub trait From<T>: Sized {
Expand Down
8 changes: 4 additions & 4 deletions library/core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(
on(
_Self = "std::ops::RangeTo<Idx>",
any(_Self = "core::ops::RangeTo<Idx>", _Self = "std::ops::RangeTo<Idx>"),
label = "if you meant to iterate until a value, add a starting value",
note = "`..end` is a `RangeTo`, which cannot be iterated on; you might have meant to have a \
bounded `Range`: `0..end`"
),
on(
_Self = "std::ops::RangeToInclusive<Idx>",
any(_Self = "core::ops::RangeToInclusive<Idx>", _Self = "std::ops::RangeToInclusive<Idx>"),
label = "if you meant to iterate until a value (including it), add a starting value",
note = "`..=end` is a `RangeToInclusive`, which cannot be iterated on; you might have meant \
to have a bounded `RangeInclusive`: `0..=end`"
Expand All @@ -43,15 +43,15 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
),
on(_Self = "&[]", label = "`{Self}` is not an iterator; try calling `.iter()`"),
on(
_Self = "std::vec::Vec<T, A>",
any(_Self = "alloc::vec::Vec<T, A>", _Self = "std::vec::Vec<T, A>"),
label = "`{Self}` is not an iterator; try calling `.into_iter()` or `.iter()`"
),
on(
_Self = "&str",
label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
),
on(
_Self = "std::string::String",
any(_Self = "alloc::string::String", _Self = "std::string::String"),
label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
),
on(
Expand Down
28 changes: 14 additions & 14 deletions library/core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,59 +575,59 @@ impl<T: ?Sized> Copy for &T {}
#[lang = "sync"]
#[rustc_on_unimplemented(
on(
_Self = "std::cell::OnceCell<T>",
any(_Self = "core::cell:OnceCell<T>", _Self = "std::cell::OnceCell<T>"),
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::OnceLock` instead"
),
on(
_Self = "std::cell::Cell<u8>",
any(_Self = "core::cell::Cell<u8>", _Self = "std::cell::Cell<u8>"),
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicU8` instead",
),
on(
_Self = "std::cell::Cell<u16>",
any(_Self = "core::cell::Cell<u16>", _Self = "std::cell::Cell<u16>"),
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicU16` instead",
),
on(
_Self = "std::cell::Cell<u32>",
any(_Self = "core::cell::Cell<u32>", _Self = "std::cell::Cell<u32>"),
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicU32` instead",
),
on(
_Self = "std::cell::Cell<u64>",
any(_Self = "core::cell::Cell<u64>", _Self = "std::cell::Cell<u64>"),
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicU64` instead",
),
on(
_Self = "std::cell::Cell<usize>",
any(_Self = "core::cell::Cell<usize>", _Self = "std::cell::Cell<usize>"),
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicUsize` instead",
),
on(
_Self = "std::cell::Cell<i8>",
any(_Self = "core::cell::Cell<i8>", _Self = "std::cell::Cell<i8>"),
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI8` instead",
),
on(
_Self = "std::cell::Cell<i16>",
any(_Self = "core::cell::Cell<i16>", _Self = "std::cell::Cell<i16>"),
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI16` instead",
),
on(
_Self = "std::cell::Cell<i32>",
any(_Self = "core::cell::Cell<i32>", _Self = "std::cell::Cell<i32>"),
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead",
),
on(
_Self = "std::cell::Cell<i64>",
any(_Self = "core::cell::Cell<i64>", _Self = "std::cell::Cell<i64>"),
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI64` instead",
),
on(
_Self = "std::cell::Cell<isize>",
any(_Self = "core::cell::Cell<isize>", _Self = "std::cell::Cell<isize>"),
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicIsize` instead",
),
on(
_Self = "std::cell::Cell<bool>",
any(_Self = "core::cell::Cell<bool>", _Self = "std::cell::Cell<bool>"),
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicBool` instead",
),
on(
_Self = "std::cell::Cell<T>",
any(_Self = "core::cell::Cell<T>", _Self = "std::cell::Cell<T>"),
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock`",
),
on(
_Self = "std::cell::RefCell<T>",
any(_Self = "core::cell::RefCell<T>", _Self = "std::cell::RefCell<T>"),
note = "if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead",
),
message = "`{Self}` cannot be shared between threads safely",
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ops/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#ind
see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>"
),
on(
_Self = "std::string::String",
any(_Self = "alloc::string::String", _Self = "std::string::String"),
note = "you can use `.chars().nth()` or `.bytes().nth()`
see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>"
),
Expand Down
45 changes: 36 additions & 9 deletions library/core/src/ops/try_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,14 @@ pub trait Try: FromResidual {
on(
all(
from_desugaring = "QuestionMark",
_Self = "std::result::Result<T, E>",
R = "std::option::Option<std::convert::Infallible>"
any(
_Self = "core::result::Result<T, E>",
_Self = "std::result::Result<T, E>",
),
any(
R = "core::option::Option<core::convert::Infallible>",
R = "std::option::Option<std::convert::Infallible>",
)
),
message = "the `?` operator can only be used on `Result`s, not `Option`s, \
in {ItemContext} that returns `Result`",
Expand All @@ -237,7 +243,10 @@ pub trait Try: FromResidual {
on(
all(
from_desugaring = "QuestionMark",
_Self = "std::result::Result<T, E>",
any(
_Self = "core::result::Result<T, E>",
_Self = "std::result::Result<T, E>",
)
),
// There's a special error message in the trait selection code for
// `From` in `?`, so this is not shown for result-in-result errors,
Expand All @@ -250,8 +259,14 @@ pub trait Try: FromResidual {
on(
all(
from_desugaring = "QuestionMark",
_Self = "std::option::Option<T>",
R = "std::result::Result<T, E>",
any(
_Self = "core::option::Option<T>",
_Self = "std::option::Option<T>",
),
any(
R = "core::result::Result<T, E>",
R = "std::result::Result<T, E>",
)
),
message = "the `?` operator can only be used on `Option`s, not `Result`s, \
in {ItemContext} that returns `Option`",
Expand All @@ -261,7 +276,10 @@ pub trait Try: FromResidual {
on(
all(
from_desugaring = "QuestionMark",
_Self = "std::option::Option<T>",
any(
_Self = "core::option::Option<T>",
_Self = "std::option::Option<T>",
)
),
// `Option`-in-`Option` always works, as there's only one possible
// residual, so this can also be phrased strongly.
Expand All @@ -273,8 +291,14 @@ pub trait Try: FromResidual {
on(
all(
from_desugaring = "QuestionMark",
_Self = "std::ops::ControlFlow<B, C>",
R = "std::ops::ControlFlow<B, C>",
any(
_Self = "core::ops::ControlFlow<B, C>",
_Self = "std::ops::ControlFlow<B, C>",
),
any(
R = "core::ops::ControlFlow<B, C>",
R = "std::ops::ControlFlow<B, C>",
)
),
message = "the `?` operator in {ItemContext} that returns `ControlFlow<B, _>` \
can only be used on other `ControlFlow<B, _>`s (with the same Break type)",
Expand All @@ -285,7 +309,10 @@ pub trait Try: FromResidual {
on(
all(
from_desugaring = "QuestionMark",
_Self = "std::ops::ControlFlow<B, C>",
any(
_Self = "core::ops::ControlFlow<B, C>",
_Self = "std::ops::ControlFlow<B, C>",
)
// `R` is not a `ControlFlow`, as that case was matched previously
),
message = "the `?` operator can only be used on `ControlFlow`s \
Expand Down
5 changes: 4 additions & 1 deletion library/core/src/slice/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ mod private_slice_index {
#[rustc_on_unimplemented(
on(T = "str", label = "string indices are ranges of `usize`",),
on(
all(any(T = "str", T = "&str", T = "std::string::String"), _Self = "{integer}"),
all(
any(T = "str", T = "&str", T = "alloc::string::String", T = "std::string::String"),
_Self = "{integer}"
),
note = "you can use `.chars().nth()` or `.bytes().nth()`\n\
for more information, see chapter 8 in The Book: \
<https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>"
Expand Down
3 changes: 1 addition & 2 deletions src/librustdoc/html/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{% endfor %}
></script> {# #}
{% endif %}
<div id="rustdoc-vars" {#+ #}
<meta id="rustdoc-vars" {#+ #}
data-root-path="{{page.root_path|safe}}" {#+ #}
data-static-root-path="{{static_root_path|safe}}" {#+ #}
data-current-crate="{{layout.krate}}" {#+ #}
Expand All @@ -39,7 +39,6 @@
data-theme-dark-css="{{files.theme_dark_css}}" {#+ #}
data-theme-ayu-css="{{files.theme_ayu_css}}" {#+ #}
> {# #}
</div> {# #}
<script src="{{static_root_path|safe}}{{files.storage_js}}"></script> {# #}
{% if page.css_class.contains("crate") %}
<script defer src="{{page.root_path|safe}}crates{{page.resource_suffix}}.js"></script> {# #}
Expand Down